@north-light/crouter 0.3.349 → 0.3.351

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 (629) hide show
  1. package/bin/crtr-launcher +4 -0
  2. package/bin/runtime-generation-manifest.mjs +12 -2
  3. package/dist/api/client.d.ts +50 -7
  4. package/dist/api/client.js +2 -2
  5. package/dist/api/dto/analytics.d.ts +184 -0
  6. package/dist/api/dto/analytics.js +0 -0
  7. package/dist/api/dto/broker-ops.d.ts +43 -1
  8. package/dist/api/dto/config.d.ts +11 -0
  9. package/dist/api/dto/grants.d.ts +14 -0
  10. package/dist/api/dto/grants.js +0 -0
  11. package/dist/api/dto/human-requests.d.ts +14 -0
  12. package/dist/api/dto/memory.d.ts +6 -0
  13. package/dist/api/dto/modelauth.d.ts +35 -0
  14. package/dist/api/dto/node-records.d.ts +35 -0
  15. package/dist/api/dto/node-records.js +0 -0
  16. package/dist/api/dto/nodes.d.ts +5 -0
  17. package/dist/api/dto/profiles.d.ts +38 -3
  18. package/dist/api/dto/worktree.d.ts +11 -0
  19. package/dist/api/errors.d.ts +23 -1
  20. package/dist/api/errors.js +1 -1
  21. package/dist/api/index.d.ts +2 -0
  22. package/dist/api/index.js +1 -1
  23. package/dist/api/node-transport.js +1 -1
  24. package/dist/api/routes.d.ts +22 -0
  25. package/dist/api/routes.js +1 -1
  26. package/dist/build-root.d.ts +6 -1
  27. package/dist/build-root.js +1 -1
  28. package/dist/builtin-memory/crouter-sdk/client.md +34 -0
  29. package/dist/builtin-memory/crouter-sdk/errors.md +2 -0
  30. package/dist/builtin-memory/crouter-sdk/memory.md +2 -2
  31. package/dist/builtin-memory/crouter-sdk/streaming.md +21 -0
  32. package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/claude-plugin-commands.ts +8 -4
  33. package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/memory-slash-commands.ts +39 -118
  34. package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/provider-rotation.d.ts +6 -1
  35. package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/provider-rotation.js +41 -27
  36. package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/provider-rotation.ts +52 -29
  37. package/dist/cli.js +9 -8
  38. package/dist/clients/attach/chrome/inbox-strip.js +1 -1
  39. package/dist/clients/attach/chrome/roster.js +1 -1
  40. package/dist/clients/attach/config.js +1 -1
  41. package/dist/clients/attach/overlays/auth.js +2 -2
  42. package/dist/clients/attach/overlays/graph.js +1 -1
  43. package/dist/clients/attach/render/tool-calls.js +3 -3
  44. package/dist/clients/attach/session/connection.js +1 -1
  45. package/dist/clients/attach/session/profile-files.js +1 -1
  46. package/dist/clients/attach/viewer.js +1569 -816
  47. package/dist/commands/api-client.js +3 -3
  48. package/dist/commands/broker-permissions.d.ts +2 -0
  49. package/dist/commands/broker-permissions.js +1 -0
  50. package/dist/commands/canvas-analytics/chart.d.ts +52 -0
  51. package/dist/commands/canvas-analytics/chart.js +1 -0
  52. package/dist/commands/canvas-analytics/drilldown.d.ts +34 -0
  53. package/dist/commands/canvas-analytics/drilldown.js +1 -0
  54. package/dist/commands/canvas-analytics/format.d.ts +29 -0
  55. package/dist/commands/canvas-analytics/format.js +1 -0
  56. package/dist/commands/canvas-analytics/graph-detail.d.ts +2 -0
  57. package/dist/commands/canvas-analytics/graph-detail.js +2 -0
  58. package/dist/commands/canvas-analytics/graphs.d.ts +9 -0
  59. package/dist/commands/canvas-analytics/graphs.js +1 -0
  60. package/dist/commands/canvas-analytics/memory.d.ts +2 -0
  61. package/dist/commands/canvas-analytics/memory.js +1 -0
  62. package/dist/commands/canvas-analytics/overview.d.ts +2 -0
  63. package/dist/commands/canvas-analytics/overview.js +1 -0
  64. package/dist/commands/canvas-analytics/shell.d.ts +60 -0
  65. package/dist/commands/canvas-analytics/shell.js +2 -0
  66. package/dist/commands/canvas-analytics/time.d.ts +2 -0
  67. package/dist/commands/canvas-analytics/time.js +1 -0
  68. package/dist/commands/canvas-analytics/usage.d.ts +2 -0
  69. package/dist/commands/canvas-analytics/usage.js +1 -0
  70. package/dist/commands/canvas-analytics/view.d.ts +85 -0
  71. package/dist/commands/canvas-analytics/view.js +1 -0
  72. package/dist/commands/canvas-analytics.d.ts +2 -0
  73. package/dist/commands/canvas-analytics.js +1 -0
  74. package/dist/commands/canvas-prune.js +1 -1
  75. package/dist/commands/canvas.js +1 -1
  76. package/dist/commands/cron.js +5 -5
  77. package/dist/commands/human/components.d.ts +2 -0
  78. package/dist/commands/human/components.js +2 -2
  79. package/dist/commands/human/prompts.js +1 -1
  80. package/dist/commands/human/queue.js +1 -1
  81. package/dist/commands/memory/client.d.ts +11 -0
  82. package/dist/commands/memory/client.js +1 -0
  83. package/dist/commands/memory/delete.js +1 -1
  84. package/dist/commands/memory/edit.js +3 -3
  85. package/dist/commands/memory/find.js +1 -1
  86. package/dist/commands/memory/history.js +4 -4
  87. package/dist/commands/memory/lint.js +1 -1
  88. package/dist/commands/memory/list.d.ts +0 -2
  89. package/dist/commands/memory/list.js +1 -1
  90. package/dist/commands/memory/move.js +1 -1
  91. package/dist/commands/memory/origin.js +1 -1
  92. package/dist/commands/memory/read.d.ts +0 -5
  93. package/dist/commands/memory/read.js +3 -3
  94. package/dist/commands/memory/shared.d.ts +0 -178
  95. package/dist/commands/memory/shared.js +1 -12
  96. package/dist/commands/memory/write.js +5 -5
  97. package/dist/commands/node/bash.js +5 -5
  98. package/dist/commands/node/create.d.ts +0 -17
  99. package/dist/commands/node/create.js +2 -3
  100. package/dist/commands/node/inspect.js +6 -6
  101. package/dist/commands/node/lifecycle.js +2 -2
  102. package/dist/commands/node-context.js +2 -2
  103. package/dist/commands/node-inspect-artifacts.js +6 -6
  104. package/dist/commands/pkg/browse/catalog.js +1 -1
  105. package/dist/commands/pkg/browse/model.d.ts +1 -1
  106. package/dist/commands/pkg/market-manage.js +1 -1
  107. package/dist/commands/pkg/plugin-manage.js +10 -10
  108. package/dist/commands/profile/daemon-profiles.d.ts +13 -0
  109. package/dist/commands/profile/daemon-profiles.js +4 -0
  110. package/dist/commands/profile/delete.js +1 -1
  111. package/dist/commands/profile/env.d.ts +6 -0
  112. package/dist/commands/profile/env.js +2 -2
  113. package/dist/commands/profile/kind.js +1 -2
  114. package/dist/commands/profile/list.js +1 -1
  115. package/dist/commands/profile/meta.js +1 -1
  116. package/dist/commands/profile/new.js +1 -1
  117. package/dist/commands/profile/pause.js +1 -1
  118. package/dist/commands/profile/project.js +1 -1
  119. package/dist/commands/profile/rename.js +1 -1
  120. package/dist/commands/profile/show.js +1 -1
  121. package/dist/commands/profile.js +1 -1
  122. package/dist/commands/push.js +3 -3
  123. package/dist/commands/surface-inspect.js +1 -1
  124. package/dist/commands/sys/branch.js +1 -1
  125. package/dist/commands/sys/config.js +1 -1
  126. package/dist/commands/sys/connect.js +3 -3
  127. package/dist/commands/sys/context/admin/actions.js +1 -1
  128. package/dist/commands/sys/context/admin/model.d.ts +1 -0
  129. package/dist/commands/sys/context/admin/model.js +1 -1
  130. package/dist/commands/sys/context/admin.js +1 -1
  131. package/dist/commands/sys/context/expose.js +2 -1
  132. package/dist/commands/sys/context/prompt-review.js +2 -2
  133. package/dist/commands/sys/context/resolve.js +7 -7
  134. package/dist/commands/sys/context/sysprompt.js +1 -1
  135. package/dist/commands/sys/join.d.ts +1 -0
  136. package/dist/commands/sys/join.js +1 -0
  137. package/dist/commands/sys/migrate.js +1 -1
  138. package/dist/commands/sys/panels/models-panel.js +1 -1
  139. package/dist/commands/sys/panels/profiles-panel.d.ts +0 -1
  140. package/dist/commands/sys/panels/profiles-panel.js +1 -1
  141. package/dist/commands/sys/provider-login.js +6 -6
  142. package/dist/commands/sys/setup-core.d.ts +1 -1
  143. package/dist/commands/sys/setup-core.js +6 -6
  144. package/dist/commands/sys/setup-settings-runner.js +1 -1
  145. package/dist/commands/sys/setup.js +1 -1
  146. package/dist/commands/sys/spaces.d.ts +1 -0
  147. package/dist/commands/sys/spaces.js +2 -0
  148. package/dist/commands/sys/sync-deps.js +2 -2
  149. package/dist/commands/sys/sync-project-guidance.js +4 -4
  150. package/dist/commands/sys/sync-skills.js +2 -2
  151. package/dist/commands/sys/worktrees.d.ts +1 -0
  152. package/dist/commands/sys/worktrees.js +1 -1
  153. package/dist/commands/sys.js +1 -1
  154. package/dist/core/auth-file.js +2 -2
  155. package/dist/core/bash-job-supervisor.d.ts +6 -0
  156. package/dist/core/bash-job-supervisor.js +4 -0
  157. package/dist/core/bash-jobs.d.ts +13 -6
  158. package/dist/core/bash-jobs.js +8 -7
  159. package/dist/core/broker-client/transport-relay.d.ts +6 -3
  160. package/dist/core/broker-client/transport-relay.js +1 -1
  161. package/dist/core/broker-client/transport-socket.d.ts +6 -1
  162. package/dist/core/broker-client/transport-socket.js +1 -1
  163. package/dist/core/canvas/canvas.d.ts +39 -18
  164. package/dist/core/canvas/canvas.js +21 -20
  165. package/dist/core/canvas/context-strip.d.ts +20 -0
  166. package/dist/core/canvas/context-strip.js +5 -0
  167. package/dist/core/canvas/crons.d.ts +12 -20
  168. package/dist/core/canvas/crons.js +15 -13
  169. package/dist/core/canvas/db.js +2 -2
  170. package/dist/core/canvas/deliveries.d.ts +4 -1
  171. package/dist/core/canvas/deliveries.js +1 -1
  172. package/dist/core/canvas/executions.js +1 -1
  173. package/dist/core/canvas/history.d.ts +2 -1
  174. package/dist/core/canvas/history.js +17 -18
  175. package/dist/core/canvas/memory-reads.d.ts +19 -0
  176. package/dist/core/canvas/memory-reads.js +1 -0
  177. package/dist/core/canvas/migrations.d.ts +0 -4
  178. package/dist/core/canvas/migrations.js +99 -32
  179. package/dist/core/canvas/nav-render.js +1 -1
  180. package/dist/core/canvas/node-agent-paths.d.ts +8 -0
  181. package/dist/core/canvas/node-agent-paths.js +1 -0
  182. package/dist/core/canvas/node-recap.d.ts +2 -2
  183. package/dist/core/canvas/node-recap.js +2 -2
  184. package/dist/core/canvas/node-tokens.d.ts +24 -0
  185. package/dist/core/canvas/node-tokens.js +5 -0
  186. package/dist/core/canvas/paths.d.ts +16 -19
  187. package/dist/core/canvas/paths.js +1 -1
  188. package/dist/core/canvas/render-source.d.ts +2 -2
  189. package/dist/core/canvas/render-source.js +6 -9
  190. package/dist/core/canvas/sessions.d.ts +18 -0
  191. package/dist/core/canvas/sessions.js +4 -1
  192. package/dist/core/canvas/types.d.ts +22 -6
  193. package/dist/core/command-hooks/compose.js +1 -1
  194. package/dist/core/command-hooks/discovery.d.ts +15 -1
  195. package/dist/core/command-hooks/discovery.js +1 -1
  196. package/dist/core/command-hooks/help.d.ts +2 -2
  197. package/dist/core/command-hooks/lifecycle-create.d.ts +1 -1
  198. package/dist/core/command-hooks/lifecycle-create.js +1 -1
  199. package/dist/core/command-hooks/transport/exec-invoke.d.ts +2 -0
  200. package/dist/core/command-hooks/transport/exec-invoke.js +1 -1
  201. package/dist/core/command-hooks/transport/exec-lifecycle.d.ts +1 -0
  202. package/dist/core/command-hooks/transport/exec-lifecycle.js +1 -1
  203. package/dist/core/command-hooks/transport/plan.d.ts +3 -0
  204. package/dist/core/command-hooks/transport/plan.js +1 -0
  205. package/dist/core/command-plugins/discovery.js +1 -1
  206. package/dist/core/command.d.ts +6 -2
  207. package/dist/core/command.js +6 -6
  208. package/dist/core/config.d.ts +8 -5
  209. package/dist/core/config.js +1 -1
  210. package/dist/core/conversation-store/client-worker.d.ts +1 -0
  211. package/dist/core/conversation-store/client-worker.js +1 -0
  212. package/dist/core/conversation-store/client.d.ts +2 -0
  213. package/dist/core/conversation-store/client.js +2 -0
  214. package/dist/core/conversation-store/file-store.d.ts +37 -0
  215. package/dist/core/conversation-store/file-store.js +9 -0
  216. package/dist/core/conversation-store/index.d.ts +50 -0
  217. package/dist/core/conversation-store/index.js +1 -0
  218. package/dist/core/conversation-store/listener.d.ts +4 -0
  219. package/dist/core/conversation-store/listener.js +3 -0
  220. package/dist/core/conversation-store/patch.d.ts +1 -0
  221. package/dist/core/conversation-store/patch.js +1 -0
  222. package/dist/core/directory/join.d.ts +27 -0
  223. package/dist/core/directory/join.js +1 -0
  224. package/dist/core/disk-usage.d.ts +4 -0
  225. package/dist/core/disk-usage.js +1 -0
  226. package/dist/core/events/emit.d.ts +2 -0
  227. package/dist/core/events/emit.js +3 -1
  228. package/dist/core/feed/feed.js +4 -4
  229. package/dist/core/feed/messages.d.ts +3 -0
  230. package/dist/core/feed/messages.js +6 -6
  231. package/dist/core/fs-utils.d.ts +2 -0
  232. package/dist/core/fs-utils.js +3 -3
  233. package/dist/core/grants/local.d.ts +4 -0
  234. package/dist/core/grants/local.js +1 -0
  235. package/dist/core/grants/mirror.d.ts +44 -0
  236. package/dist/core/grants/mirror.js +4 -0
  237. package/dist/core/grants/on-sync.d.ts +22 -0
  238. package/dist/core/grants/on-sync.js +1 -0
  239. package/dist/core/grants/remove.d.ts +7 -0
  240. package/dist/core/grants/remove.js +1 -0
  241. package/dist/core/grants/sandboxes.d.ts +7 -0
  242. package/dist/core/grants/sandboxes.js +1 -0
  243. package/dist/core/grants/sync.d.ts +12 -0
  244. package/dist/core/grants/sync.js +1 -0
  245. package/dist/core/help/memory-extensions.d.ts +3 -0
  246. package/dist/core/help/memory-extensions.js +2 -0
  247. package/dist/core/help.d.ts +14 -0
  248. package/dist/core/help.js +7 -7
  249. package/dist/core/host-exports/builtins.js +3 -3
  250. package/dist/core/host-exports/export.js +3 -3
  251. package/dist/core/human/action-binding.d.ts +2 -0
  252. package/dist/core/human/action-binding.js +1 -1
  253. package/dist/core/human/feedback-companion.d.ts +0 -1
  254. package/dist/core/human/feedback-companion.js +1 -1
  255. package/dist/core/human/page-schema.d.ts +1 -1
  256. package/dist/core/inspector/core.d.ts +2 -0
  257. package/dist/core/inspector/core.js +1 -1
  258. package/dist/core/inspector/tui.js +2 -2
  259. package/dist/core/installed-plugins.js +1 -1
  260. package/dist/core/io.js +6 -6
  261. package/dist/core/keybindings/catalog.d.ts +1 -1
  262. package/dist/core/keybindings/catalog.js +1 -1
  263. package/dist/core/layout-migrate/index.d.ts +15 -0
  264. package/dist/core/layout-migrate/index.js +4 -0
  265. package/dist/core/layout-migrate/paths.d.ts +26 -0
  266. package/dist/core/layout-migrate/paths.js +1 -0
  267. package/dist/core/layout-migrate/stored-paths.d.ts +2 -0
  268. package/dist/core/layout-migrate/stored-paths.js +11 -0
  269. package/dist/core/layout-migrate/stores.d.ts +17 -0
  270. package/dist/core/layout-migrate/stores.js +4 -0
  271. package/dist/core/layout.d.ts +26 -0
  272. package/dist/core/layout.js +2 -0
  273. package/dist/core/llm/run.d.ts +60 -0
  274. package/dist/core/llm/run.js +4 -0
  275. package/dist/core/memory/cli-selector.d.ts +13 -0
  276. package/dist/core/memory/cli-selector.js +1 -0
  277. package/dist/core/memory/history.d.ts +5 -4
  278. package/dist/core/memory/history.js +6 -6
  279. package/dist/core/memory/inline-ref-inventory.d.ts +2 -1
  280. package/dist/core/memory/inline-ref-inventory.js +1 -1
  281. package/dist/core/memory/lint.js +2 -2
  282. package/dist/core/memory/mutation-domain.d.ts +2 -2
  283. package/dist/core/memory/mutation-domain.js +8 -7
  284. package/dist/core/memory/mutations.js +1 -1
  285. package/dist/core/memory/service.d.ts +5 -0
  286. package/dist/core/memory/service.js +2 -2
  287. package/dist/core/memory-resolver.d.ts +11 -7
  288. package/dist/core/memory-resolver.js +2 -2
  289. package/dist/core/model-auth/daemon-login.d.ts +13 -0
  290. package/dist/core/model-auth/daemon-login.js +1 -0
  291. package/dist/core/model-auth/flows.d.ts +45 -0
  292. package/dist/core/model-auth/flows.js +1 -0
  293. package/dist/core/model-auth/handoff-jti.d.ts +4 -0
  294. package/dist/core/model-auth/handoff-jti.js +1 -0
  295. package/dist/core/model-routes.js +1 -1
  296. package/dist/core/nested-stores.d.ts +2 -1
  297. package/dist/core/nested-stores.js +1 -2
  298. package/dist/core/preview-registry.js +2 -2
  299. package/dist/core/profiles/env-store.js +2 -2
  300. package/dist/core/profiles/manifest.d.ts +16 -5
  301. package/dist/core/profiles/manifest.js +1 -1
  302. package/dist/core/provider-management.js +1 -1
  303. package/dist/core/review/birth.js +1 -1
  304. package/dist/core/review/companion.d.ts +0 -2
  305. package/dist/core/review/companion.js +1 -1
  306. package/dist/core/review/fork.js +2 -2
  307. package/dist/core/review/realize.js +1 -1
  308. package/dist/core/review/stage.d.ts +1 -1
  309. package/dist/core/review/stage.js +1 -1
  310. package/dist/core/review/types.d.ts +1 -1
  311. package/dist/core/runs/events.d.ts +34 -0
  312. package/dist/core/runs/events.js +1 -0
  313. package/dist/core/runs/operations.d.ts +43 -0
  314. package/dist/core/runs/operations.js +12 -0
  315. package/dist/core/runtime/bearings-render.d.ts +2 -2
  316. package/dist/core/runtime/bearings-render.js +11 -11
  317. package/dist/core/runtime/bearings.js +2 -2
  318. package/dist/core/runtime/broker/cli-relay.d.ts +5 -0
  319. package/dist/core/runtime/broker/cli-relay.js +1 -0
  320. package/dist/core/runtime/broker/client-registry.d.ts +0 -5
  321. package/dist/core/runtime/broker/client-registry.js +1 -1
  322. package/dist/core/runtime/broker/daemon-ops.d.ts +28 -1
  323. package/dist/core/runtime/broker/daemon-ops.js +1 -1
  324. package/dist/core/runtime/broker/engine-drive.d.ts +0 -2
  325. package/dist/core/runtime/broker/engine-drive.js +1 -1
  326. package/dist/core/runtime/broker/fault-retry.d.ts +9 -0
  327. package/dist/core/runtime/broker/fault-retry.js +1 -1
  328. package/dist/core/runtime/broker/frame-dispatch.d.ts +5 -9
  329. package/dist/core/runtime/broker/frame-dispatch.js +1 -1
  330. package/dist/core/runtime/broker/frame-engine-control.d.ts +3 -2
  331. package/dist/core/runtime/broker/frame-engine-control.js +1 -1
  332. package/dist/core/runtime/broker/frame-memory-refs.d.ts +4 -3
  333. package/dist/core/runtime/broker/frame-memory-refs.js +1 -1
  334. package/dist/core/runtime/broker/frame-read.js +1 -1
  335. package/dist/core/runtime/broker/frame-session.js +1 -1
  336. package/dist/core/runtime/broker/held-deferred-inbox.d.ts +3 -1
  337. package/dist/core/runtime/broker/held-deferred-inbox.js +1 -1
  338. package/dist/core/runtime/broker/inbox.d.ts +1 -2
  339. package/dist/core/runtime/broker/inbox.js +7 -10
  340. package/dist/core/runtime/broker/model-adapter.d.ts +9 -0
  341. package/dist/core/runtime/broker/model-adapter.js +2 -0
  342. package/dist/core/runtime/broker/node-token.d.ts +3 -0
  343. package/dist/core/runtime/broker/node-token.js +1 -0
  344. package/dist/core/runtime/broker/read-ops.js +1 -1
  345. package/dist/core/runtime/broker/rebind.d.ts +2 -0
  346. package/dist/core/runtime/broker/rebind.js +1 -1
  347. package/dist/core/runtime/broker/tool-groups.js +1 -1
  348. package/dist/core/runtime/broker/turn-ignition.d.ts +3 -3
  349. package/dist/core/runtime/broker/turn-ignition.js +1 -1
  350. package/dist/core/runtime/broker-cli.js +3 -3
  351. package/dist/core/runtime/broker-extension-render.d.ts +2 -5
  352. package/dist/core/runtime/broker-extension-render.js +4 -4
  353. package/dist/core/runtime/broker-persona-guidance.js +3 -3
  354. package/dist/core/runtime/broker-protocol.d.ts +7 -8
  355. package/dist/core/runtime/broker.js +1 -1
  356. package/dist/core/runtime/canvas-extensions.d.ts +1 -0
  357. package/dist/core/runtime/canvas-extensions.js +1 -1
  358. package/dist/core/runtime/close.d.ts +9 -0
  359. package/dist/core/runtime/close.js +1 -1
  360. package/dist/core/runtime/deliver-live.js +1 -1
  361. package/dist/core/runtime/fleet.d.ts +1 -1
  362. package/dist/core/runtime/front-door-login.js +1 -1
  363. package/dist/core/runtime/front-door.js +2 -2
  364. package/dist/core/runtime/headless-pi.d.ts +1 -1
  365. package/dist/core/runtime/headless-pi.js +1 -1
  366. package/dist/core/runtime/host.d.ts +1 -1
  367. package/dist/core/runtime/host.js +3 -1
  368. package/dist/core/runtime/invocation.d.ts +3 -0
  369. package/dist/core/runtime/kickoff.d.ts +1 -0
  370. package/dist/core/runtime/kickoff.js +16 -16
  371. package/dist/core/runtime/launch-target.d.ts +1 -1
  372. package/dist/core/runtime/launch-target.js +1 -1
  373. package/dist/core/runtime/launch.d.ts +10 -35
  374. package/dist/core/runtime/launch.js +1 -1
  375. package/dist/core/runtime/lifecycle.js +2 -2
  376. package/dist/core/runtime/memory.d.ts +1 -1
  377. package/dist/core/runtime/memory.js +1 -1
  378. package/dist/core/runtime/model-registry.js +1 -1
  379. package/dist/core/runtime/model-swap.d.ts +17 -19
  380. package/dist/core/runtime/model-swap.js +1 -1
  381. package/dist/core/runtime/node-read.js +3 -2
  382. package/dist/core/runtime/nodes.d.ts +7 -0
  383. package/dist/core/runtime/nodes.js +1 -1
  384. package/dist/core/runtime/outcome-document.js +1 -1
  385. package/dist/core/runtime/package-health.js +2 -2
  386. package/dist/core/runtime/persona.js +2 -2
  387. package/dist/core/runtime/pi-vendored.js +1 -1
  388. package/dist/core/runtime/placement-tmux.d.ts +1 -1
  389. package/dist/core/runtime/placement-tmux.js +1 -1
  390. package/dist/core/runtime/placement.js +1 -1
  391. package/dist/core/runtime/promote.js +1 -1
  392. package/dist/core/runtime/provider-credential-gate.js +2 -2
  393. package/dist/core/runtime/recovery-hold.d.ts +2 -0
  394. package/dist/core/runtime/recovery-hold.js +1 -0
  395. package/dist/core/runtime/recycle.js +1 -1
  396. package/dist/core/runtime/reopen.js +1 -1
  397. package/dist/core/runtime/reset.js +1 -1
  398. package/dist/core/runtime/revive.d.ts +1 -1
  399. package/dist/core/runtime/revive.js +2 -3
  400. package/dist/core/runtime/roadmap.js +4 -4
  401. package/dist/core/runtime/run-command.d.ts +6 -0
  402. package/dist/core/runtime/run-command.js +1 -1
  403. package/dist/core/runtime/session-branch.d.ts +2 -8
  404. package/dist/core/runtime/session-branch.js +1 -1
  405. package/dist/core/runtime/session-list-cache.d.ts +6 -22
  406. package/dist/core/runtime/session-list-cache.js +1 -1
  407. package/dist/core/runtime/situational-context.js +2 -2
  408. package/dist/core/runtime/spawn-env.d.ts +6 -6
  409. package/dist/core/runtime/spawn-env.js +1 -1
  410. package/dist/core/runtime/spawn.d.ts +5 -0
  411. package/dist/core/runtime/spawn.js +2 -2
  412. package/dist/core/runtime/stop-guard.js +2 -2
  413. package/dist/core/runtime/stop-signals.d.ts +2 -2
  414. package/dist/core/runtime/stop-signals.js +1 -1
  415. package/dist/core/runtime/structured-output.d.ts +10 -4
  416. package/dist/core/runtime/structured-output.js +4 -4
  417. package/dist/core/runtime/tmux-bindings.js +3 -3
  418. package/dist/core/runtime/tmux-driver.d.ts +4 -0
  419. package/dist/core/runtime/tmux-driver.js +7 -7
  420. package/dist/core/runtime/view-socket.d.ts +9 -2
  421. package/dist/core/runtime/view-socket.js +1 -1
  422. package/dist/core/runtime/warm-pool.js +1 -1
  423. package/dist/core/scope.d.ts +3 -2
  424. package/dist/core/scope.js +1 -1
  425. package/dist/core/scoped-state/db.js +1 -1
  426. package/dist/core/scoped-state/migrate.js +3 -3
  427. package/dist/core/scoped-state/profiles.d.ts +2 -1
  428. package/dist/core/scoped-state/profiles.js +1 -1
  429. package/dist/core/scoped-state/schema.d.ts +2 -1
  430. package/dist/core/scoped-state/schema.js +4 -4
  431. package/dist/core/scopes.d.ts +2 -2
  432. package/dist/core/scopes.js +1 -1
  433. package/dist/core/secrets.d.ts +1 -0
  434. package/dist/core/secrets.js +2 -2
  435. package/dist/core/spaces/mounts.d.ts +32 -0
  436. package/dist/core/spaces/mounts.js +1 -0
  437. package/dist/core/spaces/open-beneath.d.ts +71 -0
  438. package/dist/core/spaces/open-beneath.js +1 -0
  439. package/dist/core/spaces/permissions.d.ts +46 -0
  440. package/dist/core/spaces/permissions.js +1 -0
  441. package/dist/core/spaces/process.d.ts +27 -0
  442. package/dist/core/spaces/process.js +1 -0
  443. package/dist/core/spaces/space.d.ts +8 -0
  444. package/dist/core/spaces/space.js +2 -0
  445. package/dist/core/spaces/stop.d.ts +8 -0
  446. package/dist/core/spaces/stop.js +2 -0
  447. package/dist/core/spaces/users.d.ts +19 -0
  448. package/dist/core/spaces/users.js +1 -0
  449. package/dist/core/subscription-state.d.ts +2 -0
  450. package/dist/core/subscription-state.js +3 -3
  451. package/dist/core/substrate/frontmatter-validation.js +1 -1
  452. package/dist/core/substrate/injected-store.d.ts +28 -3
  453. package/dist/core/substrate/injected-store.js +2 -1
  454. package/dist/core/substrate/listings.js +1 -1
  455. package/dist/core/substrate/memory-events.d.ts +6 -0
  456. package/dist/core/substrate/memory-events.js +1 -0
  457. package/dist/core/substrate/on-read-node.js +1 -1
  458. package/dist/core/substrate/on-read.d.ts +6 -6
  459. package/dist/core/substrate/on-read.js +5 -5
  460. package/dist/core/substrate/plan.js +1 -1
  461. package/dist/core/substrate/render-node.js +1 -1
  462. package/dist/core/substrate/render.d.ts +4 -3
  463. package/dist/core/substrate/render.js +38 -38
  464. package/dist/core/substrate/schema.d.ts +6 -0
  465. package/dist/core/substrate/schema.js +1 -1
  466. package/dist/core/tui/panel.js +1 -1
  467. package/dist/core/user-settings.d.ts +12 -0
  468. package/dist/core/user-settings.js +1 -1
  469. package/dist/core/worktree-mutation-async.js +5 -5
  470. package/dist/core/worktree-quarantine.js +1 -1
  471. package/dist/core/worktree-remove.d.ts +15 -0
  472. package/dist/core/worktree-remove.js +1 -0
  473. package/dist/core/worktree-sweep.js +6 -6
  474. package/dist/daemon/analytics/compute.d.ts +37 -0
  475. package/dist/daemon/analytics/compute.js +1 -0
  476. package/dist/daemon/analytics/scan-worker.d.ts +1 -0
  477. package/dist/daemon/analytics/scan-worker.js +2 -0
  478. package/dist/daemon/analytics/scan.d.ts +37 -0
  479. package/dist/daemon/analytics/scan.js +1 -0
  480. package/dist/daemon/api/app-listener.d.ts +11 -0
  481. package/dist/daemon/api/app-listener.js +21 -0
  482. package/dist/daemon/api/bridge.js +5 -5
  483. package/dist/daemon/api/handlers/analytics.d.ts +2 -0
  484. package/dist/daemon/api/handlers/analytics.js +1 -0
  485. package/dist/daemon/api/handlers/attach.js +1 -1
  486. package/dist/daemon/api/handlers/bash-jobs.js +2 -2
  487. package/dist/daemon/api/handlers/bash.js +1 -1
  488. package/dist/daemon/api/handlers/broker-ops.js +1 -1
  489. package/dist/daemon/api/handlers/canvas.d.ts +1 -1
  490. package/dist/daemon/api/handlers/canvas.js +6 -6
  491. package/dist/daemon/api/handlers/crons.js +1 -1
  492. package/dist/daemon/api/handlers/files.d.ts +1 -1
  493. package/dist/daemon/api/handlers/files.js +1 -1
  494. package/dist/daemon/api/handlers/health.js +2 -2
  495. package/dist/daemon/api/handlers/hook-exec.d.ts +2 -0
  496. package/dist/daemon/api/handlers/hook-exec.js +1 -0
  497. package/dist/daemon/api/handlers/human-requests.js +1 -1
  498. package/dist/daemon/api/handlers/inbox.js +1 -1
  499. package/dist/daemon/api/handlers/llm.d.ts +2 -0
  500. package/dist/daemon/api/handlers/llm.js +3 -0
  501. package/dist/daemon/api/handlers/memory-reads.d.ts +4 -0
  502. package/dist/daemon/api/handlers/memory-reads.js +1 -0
  503. package/dist/daemon/api/handlers/memory.js +5 -1
  504. package/dist/daemon/api/handlers/messages.js +2 -2
  505. package/dist/daemon/api/handlers/modelauth.js +1 -1
  506. package/dist/daemon/api/handlers/node-outcomes.js +1 -1
  507. package/dist/daemon/api/handlers/node-records.d.ts +2 -0
  508. package/dist/daemon/api/handlers/node-records.js +3 -0
  509. package/dist/daemon/api/handlers/nodes.d.ts +1 -1
  510. package/dist/daemon/api/handlers/nodes.js +1 -1
  511. package/dist/daemon/api/handlers/profiles.d.ts +4 -1
  512. package/dist/daemon/api/handlers/profiles.js +1 -1
  513. package/dist/daemon/api/handlers/reports.js +5 -3
  514. package/dist/daemon/api/handlers/reviews.d.ts +1 -1
  515. package/dist/daemon/api/handlers/reviews.js +1 -1
  516. package/dist/daemon/api/handlers/run-routes.d.ts +2 -0
  517. package/dist/daemon/api/handlers/run-routes.js +1 -0
  518. package/dist/daemon/api/handlers/runs.d.ts +9 -0
  519. package/dist/daemon/api/handlers/runs.js +1 -0
  520. package/dist/daemon/api/handlers/subscriptions.js +1 -1
  521. package/dist/daemon/api/handlers/worktree.js +1 -1
  522. package/dist/daemon/api/map.d.ts +10 -4
  523. package/dist/daemon/api/map.js +2 -2
  524. package/dist/daemon/api/operations.d.ts +18 -0
  525. package/dist/daemon/api/operations.js +1 -0
  526. package/dist/daemon/api/principal.d.ts +42 -0
  527. package/dist/daemon/api/principal.js +1 -0
  528. package/dist/daemon/api/router.d.ts +27 -3
  529. package/dist/daemon/api/router.js +1 -1
  530. package/dist/daemon/api/server.d.ts +4 -0
  531. package/dist/daemon/api/server.js +1 -1
  532. package/dist/daemon/api/vendor-signin.d.ts +7 -0
  533. package/dist/daemon/api/vendor-signin.js +77 -0
  534. package/dist/daemon/api/viewer-presence.d.ts +3 -0
  535. package/dist/daemon/api/viewer-presence.js +1 -0
  536. package/dist/daemon/cron/armed-context.d.ts +4 -0
  537. package/dist/daemon/cron/armed-context.js +1 -1
  538. package/dist/daemon/cron/escalation.js +3 -3
  539. package/dist/daemon/cron/lease-recovery.js +1 -1
  540. package/dist/daemon/cron/sinks.js +2 -2
  541. package/dist/daemon/cron-run.d.ts +5 -5
  542. package/dist/daemon/cron-run.js +1 -1
  543. package/dist/daemon/crtrd.js +8 -7
  544. package/dist/daemon/delivery/run-delivery.d.ts +4 -0
  545. package/dist/daemon/delivery/run-delivery.js +1 -1
  546. package/dist/daemon/fleet.d.ts +1 -1
  547. package/dist/daemon/fleet.js +6 -6
  548. package/dist/daemon/human/finish.js +7 -7
  549. package/dist/daemon/joined-owner.d.ts +5 -0
  550. package/dist/daemon/joined-owner.js +1 -0
  551. package/dist/daemon/manage.js +2 -2
  552. package/dist/daemon/messaging/node-message.js +1 -1
  553. package/dist/daemon/park-activity.js +1 -1
  554. package/dist/daemon/reconcilers/bash-deadline.js +1 -1
  555. package/dist/daemon/reconcilers/broker-supervision.d.ts +1 -1
  556. package/dist/daemon/reconcilers/broker-supervision.js +4 -4
  557. package/dist/daemon/reconcilers/delivery-lane.js +1 -1
  558. package/dist/daemon/reconcilers/live-obligation.d.ts +7 -0
  559. package/dist/daemon/reconcilers/live-obligation.js +1 -1
  560. package/dist/daemon/reconcilers/node-lifecycle/tick.js +1 -1
  561. package/dist/daemon/reconcilers/storage-maintenance.d.ts +20 -1
  562. package/dist/daemon/reconcilers/storage-maintenance.js +1 -1
  563. package/dist/daemon/runs/append-section.d.ts +6 -0
  564. package/dist/daemon/runs/append-section.js +2 -0
  565. package/dist/daemon/runs/observer.d.ts +5 -0
  566. package/dist/daemon/runs/observer.js +4 -0
  567. package/dist/launcher/bwrap.d.ts +4 -0
  568. package/dist/launcher/bwrap.js +2 -0
  569. package/dist/launcher/client.d.ts +2 -0
  570. package/dist/launcher/client.js +3 -0
  571. package/dist/launcher/main.d.ts +1 -0
  572. package/dist/launcher/main.js +3 -0
  573. package/dist/launcher/netrule.d.ts +1 -0
  574. package/dist/launcher/netrule.js +1 -0
  575. package/dist/launcher/seccomp.d.ts +1 -0
  576. package/dist/launcher/seccomp.js +1 -0
  577. package/dist/launcher/spec.d.ts +88 -0
  578. package/dist/launcher/spec.js +1 -0
  579. package/dist/launcher/users.d.ts +18 -0
  580. package/dist/launcher/users.js +7 -0
  581. package/dist/launcher/validate.d.ts +22 -0
  582. package/dist/launcher/validate.js +1 -0
  583. package/dist/migrations/corpus.js +3 -3
  584. package/dist/migrations/runner.js +1 -1
  585. package/dist/native/linux/addon.node +0 -0
  586. package/dist/native/linux.d.ts +29 -0
  587. package/dist/native/linux.js +1 -0
  588. package/dist/pi-extensions/broker-local.js +2 -2
  589. package/dist/pi-extensions/canvas-bash-valve.d.ts +1 -3
  590. package/dist/pi-extensions/canvas-bash-valve.js +4 -7
  591. package/dist/pi-extensions/canvas-context-intro.d.ts +1 -2
  592. package/dist/pi-extensions/canvas-context-intro.js +2 -2
  593. package/dist/pi-extensions/canvas-doc-substrate.js +6 -6
  594. package/dist/pi-extensions/canvas-inbox-watcher.d.ts +2 -1
  595. package/dist/pi-extensions/canvas-inbox-watcher.js +2 -1
  596. package/dist/pi-extensions/canvas-passive-context.d.ts +1 -1
  597. package/dist/pi-extensions/canvas-passive-context.js +11 -11
  598. package/dist/pi-extensions/canvas-recap.js +6 -6
  599. package/dist/pi-extensions/canvas-stophook.js +1 -1
  600. package/dist/pi-extensions/canvas-structured-output.js +4 -4
  601. package/dist/pi-extensions/canvas-tool-guide.js +1 -1
  602. package/dist/pi-extensions/system-prompt-entry.d.ts +15 -0
  603. package/dist/pi-extensions/system-prompt-entry.js +1 -0
  604. package/dist/shared/env.d.ts +5 -1
  605. package/dist/shared/env.js +1 -1
  606. package/dist/shared/strip-cd-prefix.d.ts +1 -0
  607. package/dist/shared/strip-cd-prefix.js +1 -0
  608. package/dist/types.d.ts +31 -15
  609. package/docs/cli/memory-and-preferences.md +3 -1
  610. package/docs/sdk/client.md +34 -0
  611. package/docs/sdk/errors.md +2 -0
  612. package/docs/sdk/memory.md +2 -2
  613. package/docs/sdk/streaming.md +21 -0
  614. package/package.json +18 -4
  615. package/packages/crouter-identity/dist/index.d.ts +54 -0
  616. package/packages/crouter-identity/dist/index.js +166 -0
  617. package/packages/crouter-identity/package.json +33 -0
  618. package/runtime.lock.json +34 -8
  619. package/scripts/build-native-linux.mjs +16 -0
  620. package/scripts/install-runtime.mjs +9 -7
  621. package/scripts/lib/isolation-env.mjs +42 -0
  622. package/scripts/runtime-smoke.mjs +49 -0
  623. package/src/native/linux/addon.c +249 -0
  624. package/dist/core/profiles/state-block.d.ts +0 -4
  625. package/dist/core/profiles/state-block.js +0 -3
  626. package/dist/core/runtime/broker/auth-reload.d.ts +0 -41
  627. package/dist/core/runtime/broker/auth-reload.js +0 -1
  628. package/dist/core/substrate/cli-context-delivery.d.ts +0 -22
  629. package/dist/core/substrate/cli-context-delivery.js +0 -1
@@ -86,3 +86,38 @@ export interface CredentialRemovalResultDTO {
86
86
  provider: string;
87
87
  removed_accounts: number;
88
88
  }
89
+ /** `POST /v1/model-auth/flows` (`model_auth.start`) — begin a daemon-run vendor
90
+ * sign-in. `openai` is accepted as `openai-codex`. `redirect: "loopback"` makes
91
+ * the daemon listen on the vendor's registered localhost port (self-host only). */
92
+ export interface StartModelAuthFlowRequest {
93
+ provider: 'anthropic' | 'openai-codex' | 'openai';
94
+ redirect?: 'loopback';
95
+ /** Name for the signed-in account; omitted, a newly seen account is auto-labeled. */
96
+ label?: string;
97
+ }
98
+ /** The started flow: open `url`; for Anthropic's code page paste the code back
99
+ * through `complete`; for OpenAI's device flow enter `user_code` at `url`. */
100
+ export interface ModelAuthFlowStartedDTO {
101
+ flow_id: string;
102
+ provider: 'anthropic' | 'openai-codex';
103
+ url: string;
104
+ instructions: string;
105
+ user_code?: string;
106
+ expires_at: string;
107
+ }
108
+ /** `POST /v1/model-auth/flows/{flow_id}/complete` (`model_auth.complete`). */
109
+ export interface CompleteModelAuthFlowRequest {
110
+ input: string;
111
+ }
112
+ export interface ModelAuthFlowCompletedDTO {
113
+ flow_id: string;
114
+ provider: 'anthropic' | 'openai-codex';
115
+ status: 'connected';
116
+ }
117
+ /** `GET /v1/model-auth/flows/{flow_id}` — a flow's state. */
118
+ export interface ModelAuthFlowDTO {
119
+ flow_id: string;
120
+ provider: 'anthropic' | 'openai-codex';
121
+ status: 'pending' | 'connected' | 'failed' | 'expired';
122
+ message?: string;
123
+ }
@@ -0,0 +1,35 @@
1
+ /** `POST /v1/nodes/{id}/records/log` body: one serialized event record, no newline. */
2
+ export interface NodeLogAppendRequest {
3
+ record: string;
4
+ expected_execution_id: string;
5
+ }
6
+ export interface NodeLogAppendResultDTO {
7
+ appended: boolean;
8
+ }
9
+ /** `PUT /v1/nodes/{id}/records/telemetry` body. A null gauge or activity keeps the recorded value. */
10
+ export interface NodeTelemetryRecordRequest {
11
+ tokens_in: number;
12
+ tokens_out: number;
13
+ model: string;
14
+ context_tokens: number | null;
15
+ last_activity: string | null;
16
+ updated_at: string;
17
+ expected_execution_id: string;
18
+ }
19
+ /** `PUT /v1/nodes/{id}/records/recap` body. */
20
+ export interface NodeRecapRecordRequest {
21
+ briefing: string;
22
+ expected_execution_id: string;
23
+ }
24
+ /** `GET /v1/nodes/{id}/records/passive?ref=` result: a spilled direct-message body. */
25
+ export interface NodeMessageBodyDTO {
26
+ content: string;
27
+ }
28
+ /** `POST /v1/nodes/{id}/records/pushed-final` body. */
29
+ export interface NodePushedFinalRequest {
30
+ action: 'mark' | 'clear' | 'consume';
31
+ expected_execution_id: string;
32
+ }
33
+ export interface NodePushedFinalResultDTO {
34
+ pushedFinal: boolean;
35
+ }
File without changes
@@ -92,6 +92,8 @@ export interface NodeSummaryDTO {
92
92
  profile_id: string | null;
93
93
  /** Per-run allow-list; null inherits everything. */
94
94
  scopes: string[] | null;
95
+ /** App that owns this node's agent folder. */
96
+ grantee: string;
95
97
  /** Whether the node's profile is currently paused. */
96
98
  profile_paused: boolean;
97
99
  parent: NodeIdDTO | null;
@@ -352,6 +354,8 @@ export interface ArtifactDTO {
352
354
  source: string;
353
355
  ts: IsoTime;
354
356
  title: string;
357
+ /** Byte size of the file behind the ref; 0 for a synthetic or unreadable one. */
358
+ size: number;
355
359
  }
356
360
  /** `GET /v1/nodes/{id}/artifacts` query. Narrow to one corpus; absent is the
357
361
  * default report/doc/roadmap set (`inbox` is opt-in only). */
@@ -369,6 +373,7 @@ export interface ContextRootDTO {
369
373
  node_id: NodeIdDTO;
370
374
  label: string;
371
375
  dir: string;
376
+ reports_dir: string;
372
377
  /** True for the node's own context root. */
373
378
  self: boolean;
374
379
  /** Count of context + report files under the root. */
@@ -23,6 +23,36 @@ export interface EnsureProfileRequest {
23
23
  * launched under the profile as `CRTR_PROFILE_META_<KEY>` env. */
24
24
  metadata?: Record<string, string>;
25
25
  }
26
+ /** `POST /v1/profiles` body — create a profile of the caller's app. A name the
27
+ * caller's app already holds is refused. */
28
+ export interface CreateProfileRequest extends EnsureProfileRequest {
29
+ name: string;
30
+ }
31
+ /** `PATCH /v1/profiles/{name}` body — each present field changes one fact of a
32
+ * profile the caller's app holds. */
33
+ export interface UpdateProfileRequest {
34
+ name?: string;
35
+ default_kind?: string;
36
+ /** Append a project, or change the memory cap of the one at this path. */
37
+ add_project?: ProfileProject;
38
+ /** Remove the project at this path; the directory need not still exist. */
39
+ remove_project?: string;
40
+ }
41
+ /** `GET /v1/profiles/{name}/env` — stored env var names, never values. */
42
+ export interface ProfileEnvNamesDTO {
43
+ profile_id: string;
44
+ names: string[];
45
+ }
46
+ /** `PUT /v1/profiles/{name}/env/{var}` body. */
47
+ export interface SetProfileEnvRequest {
48
+ value: string;
49
+ }
50
+ /** `PUT` / `DELETE /v1/profiles/{name}/env/{var}` result. */
51
+ export interface ProfileEnvChangeDTO {
52
+ profile_id: string;
53
+ /** PUT: the name was newly added. DELETE: a stored value was removed. */
54
+ changed: boolean;
55
+ }
26
56
  /** `PATCH /v1/profiles/{name}/metadata` body. Merges `set` and removes `unset`. */
27
57
  export interface UpdateProfileMetadataRequest {
28
58
  set?: Record<string, string>;
@@ -60,11 +90,10 @@ export interface DeleteProfileResultDTO {
60
90
  export interface ProfileDTO {
61
91
  /** Stable profile-directory id (`<slug>-<id>`). */
62
92
  id: string;
93
+ /** Owning app, including for profiles shared with the caller. */
94
+ app: string;
63
95
  name: string;
64
96
  projects: ProfileProject[];
65
- /** Where nodes under this profile run — one of `projects[].path` (the first
66
- * unless re-pointed), or null when the profile owns none. */
67
- home: string | null;
68
97
  /** ISO timestamp when the profile was paused, or null while active. */
69
98
  paused_at: string | null;
70
99
  /** Default node kind when a create omits kind; `general` when absent on the manifest. */
@@ -73,4 +102,10 @@ export interface ProfileDTO {
73
102
  metadata: Record<string, string>;
74
103
  /** The directory this profile is pinned as default for, if any. */
75
104
  default_dir?: string | null;
105
+ /** ISO timestamp the profile was created. */
106
+ created_at: string;
107
+ /** ISO timestamp of the most recent selection, or null if never selected. */
108
+ last_used_at: string | null;
109
+ /** Absolute path of the profile's memory store. */
110
+ memory_path: string;
76
111
  }
@@ -42,3 +42,14 @@ export interface QuarantinedWorktreeDTO {
42
42
  /** Bytes occupied by the checkout, or null when it is gone or unmeasurable. */
43
43
  size_bytes: number | null;
44
44
  }
45
+ /** One space on the runtime: the person's (`user`) or an app's (`app:<id>`). */
46
+ export interface SpaceDTO {
47
+ space: string;
48
+ path: string;
49
+ /** Bytes the space occupies, or null when it cannot be measured. */
50
+ size_bytes: number | null;
51
+ }
52
+ /** `GET /v1/spaces` — person only. */
53
+ export interface SpaceListDTO {
54
+ spaces: SpaceDTO[];
55
+ }
@@ -4,6 +4,17 @@ export interface ErrorBody {
4
4
  code: string;
5
5
  message: string;
6
6
  details?: unknown;
7
+ type?: string;
8
+ param?: string;
9
+ origin?: string;
10
+ retryable?: boolean;
11
+ retry_after_s?: number;
12
+ reset_at?: string;
13
+ request_id?: string;
14
+ run_id?: string;
15
+ question_id?: string;
16
+ scope?: string;
17
+ user_action?: string;
7
18
  };
8
19
  }
9
20
  /** Thrown by `CrtrClient` on a non-2xx response (or a synthesized transport
@@ -14,7 +25,18 @@ export declare class APIError extends Error {
14
25
  readonly code: string;
15
26
  readonly details?: unknown;
16
27
  readonly headers: Headers;
17
- constructor(status: number, code: string, message: string, details?: unknown, headers?: HeadersInit);
28
+ readonly type?: string;
29
+ readonly param?: string;
30
+ readonly origin?: string;
31
+ readonly retryable?: boolean;
32
+ readonly retryAfterS?: number;
33
+ readonly resetAt?: string;
34
+ readonly requestId?: string;
35
+ readonly runId?: string;
36
+ readonly questionId?: string;
37
+ readonly scope?: string;
38
+ readonly userAction?: string;
39
+ constructor(status: number, code: string, message: string, details?: unknown, headers?: HeadersInit, envelope?: Partial<ErrorBody['error']>);
18
40
  }
19
41
  /** @deprecated Use APIError. Kept as the in-repo compatibility alias. */
20
42
  export { APIError as ApiError };
@@ -1 +1 @@
1
- var u=Object.defineProperty;var s=(t,e)=>u(t,"name",{value:e,configurable:!0});class a extends Error{static{s(this,"APIError")}status;code;details;headers;constructor(e,o,n,r,i){super(n),this.name="APIError",this.status=e,this.code=o,this.headers=new Headers(i),r!==void 0&&(this.details=r)}}function c(t){return t instanceof a?t.status===503&&(t.code==="daemon_unavailable"||t.code==="transport_error"||t.code==="daemon_request_interrupted")||t.status===504&&t.code==="request_timeout"||t.status>=500&&t.code==="daemon_health_unavailable":!1}s(c,"isDaemonTransportApiError");function f(t){if(typeof t!="object"||t===null)return!1;const e=t.error;if(typeof e!="object"||e===null)return!1;const{code:o,message:n}=e;return typeof o=="string"&&typeof n=="string"}s(f,"isErrorBody");export{a as APIError,a as ApiError,c as isDaemonTransportApiError,f as isErrorBody};
1
+ var d=Object.defineProperty;var e=(t,r)=>d(t,"name",{value:r,configurable:!0});class o extends Error{static{e(this,"APIError")}status;code;details;headers;type;param;origin;retryable;retryAfterS;resetAt;requestId;runId;questionId;scope;userAction;constructor(r,i,a,n,u,s){super(a),this.name="APIError",this.status=r,this.code=i,this.headers=new Headers(u),n!==void 0&&(this.details=n),this.type=s?.type,this.param=s?.param,this.origin=s?.origin,this.retryable=s?.retryable,this.retryAfterS=s?.retry_after_s,this.resetAt=s?.reset_at,this.requestId=s?.request_id??this.headers.get("Request-Id")??void 0,this.runId=s?.run_id,this.questionId=s?.question_id,this.scope=s?.scope,this.userAction=s?.user_action}}function h(t){return t instanceof o?t.status===503&&(t.code==="daemon_unavailable"||t.code==="transport_error"||t.code==="daemon_request_interrupted")||t.status===504&&t.code==="request_timeout"||t.status>=500&&t.code==="daemon_health_unavailable":!1}e(h,"isDaemonTransportApiError");function f(t){if(typeof t!="object"||t===null)return!1;const r=t.error;if(typeof r!="object"||r===null)return!1;const{code:i,message:a}=r;return typeof i=="string"&&typeof a=="string"}e(f,"isErrorBody");export{o as APIError,o as ApiError,h as isDaemonTransportApiError,f as isErrorBody};
@@ -6,6 +6,7 @@ export { API_VERSION, routes } from './routes.js';
6
6
  export * from '../shared/generated-context.js';
7
7
  export * from './dto/common.js';
8
8
  export * from './dto/health.js';
9
+ export * from './dto/grants.js';
9
10
  export * from './dto/nodes.js';
10
11
  export * from './dto/node-outcomes.js';
11
12
  export * from './dto/node-events.js';
@@ -33,3 +34,4 @@ export * from './dto/human-requests.js';
33
34
  export * from './dto/reviews.js';
34
35
  export * from './dto/review-comments.js';
35
36
  export * from './dto/chat-inventory.js';
37
+ export * from './dto/analytics.js';
package/dist/api/index.js CHANGED
@@ -1 +1 @@
1
- import{CrtrClient as t,waitForDaemonAvailability as e}from"./client.js";import{APIError as p,ApiError as f,isErrorBody as x}from"./errors.js";import{API_VERSION as a,routes as A}from"./routes.js";export*from"../shared/generated-context.js";export*from"./dto/common.js";export*from"./dto/health.js";export*from"./dto/nodes.js";export*from"./dto/node-outcomes.js";export*from"./dto/node-events.js";export*from"./dto/bash-jobs.js";export*from"./dto/messages.js";export*from"./dto/reports.js";export*from"./dto/lifecycle.js";export*from"./dto/subscriptions.js";export*from"./dto/focus.js";export*from"./dto/crons.js";export*from"./dto/config.js";export*from"./dto/attach.js";export*from"./dto/broker.js";export*from"./dto/profiles.js";export*from"./dto/modelauth.js";export*from"./dto/model-config.js";export*from"./dto/canvas.js";export*from"./dto/worktree.js";export*from"./dto/human.js";export*from"./dto/files.js";export*from"./dto/bash.js";export*from"./dto/memory.js";export*from"./dto/inbox.js";export*from"./dto/human-requests.js";export*from"./dto/reviews.js";export*from"./dto/review-comments.js";export*from"./dto/chat-inventory.js";export{p as APIError,a as API_VERSION,f as ApiError,t as CrtrClient,x as isErrorBody,A as routes,e as waitForDaemonAvailability};
1
+ import{CrtrClient as t,waitForDaemonAvailability as e}from"./client.js";import{APIError as p,ApiError as f,isErrorBody as x}from"./errors.js";import{API_VERSION as a,routes as A}from"./routes.js";export*from"../shared/generated-context.js";export*from"./dto/common.js";export*from"./dto/health.js";export*from"./dto/grants.js";export*from"./dto/nodes.js";export*from"./dto/node-outcomes.js";export*from"./dto/node-events.js";export*from"./dto/bash-jobs.js";export*from"./dto/messages.js";export*from"./dto/reports.js";export*from"./dto/lifecycle.js";export*from"./dto/subscriptions.js";export*from"./dto/focus.js";export*from"./dto/crons.js";export*from"./dto/config.js";export*from"./dto/attach.js";export*from"./dto/broker.js";export*from"./dto/profiles.js";export*from"./dto/modelauth.js";export*from"./dto/model-config.js";export*from"./dto/canvas.js";export*from"./dto/worktree.js";export*from"./dto/human.js";export*from"./dto/files.js";export*from"./dto/bash.js";export*from"./dto/memory.js";export*from"./dto/inbox.js";export*from"./dto/human-requests.js";export*from"./dto/reviews.js";export*from"./dto/review-comments.js";export*from"./dto/chat-inventory.js";export*from"./dto/analytics.js";export{p as APIError,a as API_VERSION,f as ApiError,t as CrtrClient,x as isErrorBody,A as routes,e as waitForDaemonAvailability};
@@ -1 +1 @@
1
- var v=Object.defineProperty;var a=(e,o)=>v(e,"name",{value:o,configurable:!0});import{request as A}from"node:http";import{homedir as R}from"node:os";import{join as w}from"node:path";import{CrtrClient as S}from"./client.js";import{envHomeOverride as T}from"../shared/env.js";const O=".crouter",k="crtrd.sock",L=Symbol.for("@north-light/crouter-api/local-socket-fetch");function x(){const e=T(),o=e!==void 0&&e!==""?e:w(R(),O,"canvas");return w(o,k)}a(x,"defaultSocketPath");function H(e){const o=a(function(n,s={}){const m=n instanceof URL?n:new URL(typeof n=="string"?n:n.url),E=s.method??"GET",h={};if(s.headers!==void 0)for(const[l,u]of new Headers(s.headers).entries())h[l]=u;const f=typeof s.body=="string"?s.body:void 0;return f!==void 0&&(h["content-length"]=String(Buffer.byteLength(f))),new Promise((l,u)=>{const i=A({socketPath:e,path:m.pathname+m.search,method:E,headers:h},t=>{const g=new ReadableStream({start(d){t.on("data",r=>d.enqueue(new Uint8Array(r))),t.on("end",()=>d.close()),t.on("error",r=>d.error(r))},cancel(){t.destroy()}}),y=new Headers;for(const[d,r]of Object.entries(t.headers))if(r!==void 0)for(const C of Array.isArray(r)?r:[r])y.append(d,C);const b=t.statusCode??0;l(new Response(b===204?null:g,{status:b,statusText:t.statusMessage,headers:y}))});i.on("error",t=>u(new TypeError("fetch failed",{cause:t})));const c=s.signal,p=a(()=>{i.destroy(),u(c?.reason??new DOMException("The operation was aborted.","AbortError"))},"abort");if(c!=null){if(c.aborted){p();return}c.addEventListener("abort",p,{once:!0})}f!==void 0&&i.write(f),i.end()})},"fetchOverSocket");return o[L]=!0,o}a(H,"socketFetch");function D(e={}){const{socketPath:o,...n}=e;return new S({baseUrl:"http://localhost",fetch:H(o??x()),autostart:!0,...n})}a(D,"localClient");export{x as defaultSocketPath,D as localClient,H as socketFetch};
1
+ var T=Object.defineProperty;var a=(r,e)=>T(r,"name",{value:e,configurable:!0});import{request as g}from"node:http";import{homedir as A}from"node:os";import{join as p}from"node:path";import{CrtrClient as S}from"./client.js";const O=".crouter",_="api.sock",v=Symbol.for("@north-light/crouter-api/local-socket-fetch");function k(){const r=process.env.CRTR_API_SOCKET;if(r)return r;const e=process.env.CRTR_HOME,t=e!==void 0&&e!==""?e:p(A(),O);return p(process.platform==="linux"?"/run/crtr":p(t,"runtime"),_)}a(k,"defaultSocketPath");function x(r){const e=a(function(t,s={}){const m=t instanceof URL?t:new URL(typeof t=="string"?t:t.url),w=s.method??"GET",l={};if(s.headers!==void 0)for(const[h,u]of new Headers(s.headers).entries())l[h]=u;const f=typeof s.body=="string"?s.body:void 0;return f!==void 0&&(l["content-length"]=String(Buffer.byteLength(f))),new Promise((h,u)=>{const i=g({socketPath:r,path:m.pathname+m.search,method:w,headers:l},o=>{const C=new ReadableStream({start(d){o.on("data",n=>d.enqueue(new Uint8Array(n))),o.on("end",()=>d.close()),o.on("error",n=>d.error(n))},cancel(){o.destroy()}}),b=new Headers;for(const[d,n]of Object.entries(o.headers))if(n!==void 0)for(const R of Array.isArray(n)?n:[n])b.append(d,R);const E=o.statusCode??0;h(new Response(E===204?null:C,{status:E,statusText:o.statusMessage,headers:b}))});i.on("error",o=>u(new TypeError("fetch failed",{cause:o})));const c=s.signal,y=a(()=>{i.destroy(),u(c?.reason??new DOMException("The operation was aborted.","AbortError"))},"abort");if(c!=null){if(c.aborted){y();return}c.addEventListener("abort",y,{once:!0})}f!==void 0&&i.write(f),i.end()})},"fetchOverSocket");return e[v]=!0,e}a(x,"socketFetch");function U(r={}){const{socketPath:e,...t}=r;return new S({baseUrl:"http://localhost",fetch:x(e??k()),autostart:!0,...t})}a(U,"localClient");export{k as defaultSocketPath,U as localClient,x as socketFetch};
@@ -10,6 +10,7 @@ export declare const routes: {
10
10
  readonly nodes: () => string;
11
11
  readonly reviveAll: () => string;
12
12
  readonly node: (id: string) => string;
13
+ readonly nodeMemoryReads: (id: string) => string;
13
14
  readonly nodeOutcome: (id: string) => string;
14
15
  readonly nodeOutcomeDelivery: (id: string) => string;
15
16
  readonly nodeEvents: (id: string) => string;
@@ -35,10 +36,20 @@ export declare const routes: {
35
36
  readonly nodeBrokerParkComplete: (id: string) => string;
36
37
  readonly nodeBrokerParkActivity: (id: string) => string;
37
38
  readonly nodeBrokerTelemetry: (id: string) => string;
39
+ readonly nodeLog: (id: string) => string;
40
+ readonly nodeTelemetry: (id: string) => string;
41
+ readonly nodeRecap: (id: string) => string;
42
+ readonly nodeInboxReport: (id: string) => string;
43
+ readonly nodePassiveMessage: (id: string) => string;
44
+ readonly nodePushedFinal: (id: string) => string;
38
45
  readonly nodeMailClaim: (id: string) => string;
39
46
  readonly nodeMailAcknowledge: (id: string) => string;
40
47
  readonly nodeBrokerModel: (id: string) => string;
41
48
  readonly nodeBrokerExtensionState: (id: string) => string;
49
+ readonly nodeBrokerContext: (id: string) => string;
50
+ readonly nodeBrokerMemoryRefs: (id: string) => string;
51
+ readonly nodeBrokerContextCommit: (id: string) => string;
52
+ readonly nodeBrokerContextEvent: (id: string) => string;
42
53
  readonly nodeBrokerGeneratedName: (id: string) => string;
43
54
  readonly nodeBrokerPersonaAck: (id: string) => string;
44
55
  readonly brokerTurn: (id: string) => string;
@@ -53,9 +64,11 @@ export declare const routes: {
53
64
  readonly nodeYield: (id: string) => string;
54
65
  readonly nodeWait: (id: string) => string;
55
66
  readonly nodeConfig: (id: string) => string;
67
+ readonly kinds: () => string;
56
68
  readonly nodeWorktreeClose: (id: string) => string;
57
69
  readonly nodeWorktreeAbandon: (id: string) => string;
58
70
  readonly quarantinedWorktrees: () => string;
71
+ readonly spaces: () => string;
59
72
  readonly nodeAttach: (id: string) => string;
60
73
  readonly focuses: () => string;
61
74
  readonly focusByNode: () => string;
@@ -77,6 +90,7 @@ export declare const routes: {
77
90
  readonly canvasHistoryStats: () => string;
78
91
  readonly canvasSnapshot: () => string;
79
92
  readonly canvasRoster: () => string;
93
+ readonly canvasAnalytics: () => string;
80
94
  readonly canvasGraph: () => string;
81
95
  readonly canvasPrune: () => string;
82
96
  readonly humanReviews: () => string;
@@ -101,6 +115,7 @@ export declare const routes: {
101
115
  readonly humanInboxCancel: (ticketId: string) => string;
102
116
  readonly humanInboxFeedbackResolve: (ticketId: string, commentId: string) => string;
103
117
  readonly humanRequests: () => string;
118
+ readonly humanComponents: () => string;
104
119
  readonly humanRequest: (requestId: string) => string;
105
120
  readonly humanRequestReplace: (requestId: string) => string;
106
121
  readonly humanRequestRespond: (requestId: string) => string;
@@ -111,9 +126,15 @@ export declare const routes: {
111
126
  readonly profilePause: (name: string) => string;
112
127
  readonly profileResume: (name: string) => string;
113
128
  readonly profileMetadata: (name: string) => string;
129
+ readonly profileEnv: (name: string) => string;
130
+ readonly profileEnvVar: (name: string, variable: string) => string;
114
131
  readonly modelAuths: () => string;
115
132
  readonly modelAuthReadiness: () => string;
116
133
  readonly modelAuth: (provider: string) => string;
134
+ readonly modelAuthFlows: () => string;
135
+ readonly modelAuthFlow: (flowId: string) => string;
136
+ readonly modelAuthFlowComplete: (flowId: string) => string;
137
+ readonly modelAuthFlowCancel: (flowId: string) => string;
117
138
  readonly filePeek: () => string;
118
139
  readonly fileWrite: () => string;
119
140
  readonly fileList: () => string;
@@ -124,4 +145,5 @@ export declare const routes: {
124
145
  readonly memoryDocHistory: (name: string) => string;
125
146
  readonly memorySearch: () => string;
126
147
  readonly memoryResolve: () => string;
148
+ readonly memoryOrigin: () => string;
127
149
  };
@@ -1 +1 @@
1
- var s=Object.defineProperty;var o=(e,n)=>s(e,"name",{value:n,configurable:!0});const $="v1",a="/v1",t={healthz:o(()=>"/healthz","healthz"),status:o(()=>"/v1/status","status"),daemonRestart:o(()=>"/v1/daemon/restart","daemonRestart"),daemonMigrate:o(()=>"/v1/daemon/migrate","daemonMigrate"),daemonAdmit:o(()=>"/v1/daemon/admit","daemonAdmit"),nodes:o(()=>"/v1/nodes","nodes"),reviveAll:o(()=>"/v1/nodes/revive-all","reviveAll"),node:o(e=>`/v1/nodes/${e}`,"node"),nodeOutcome:o(e=>`/v1/nodes/${e}/outcome`,"nodeOutcome"),nodeOutcomeDelivery:o(e=>`/v1/nodes/${e}/outcome-delivery`,"nodeOutcomeDelivery"),nodeEvents:o(e=>`/v1/nodes/${e}/events`,"nodeEvents"),nodeSnapshot:o(e=>`/v1/nodes/${e}/snapshot`,"nodeSnapshot"),nodeSubject:o(e=>`/v1/nodes/${e}/subject`,"nodeSubject"),nodeSession:o(e=>`/v1/nodes/${e}/session`,"nodeSession"),nodeChatInventory:o(e=>`/v1/nodes/${e}/chat-inventory`,"nodeChatInventory"),prospectiveChatInventory:o(()=>"/v1/prospective-chat-inventory","prospectiveChatInventory"),nodeTranscript:o(e=>`/v1/nodes/${e}/transcript`,"nodeTranscript"),nodeContext:o(e=>`/v1/nodes/${e}/context`,"nodeContext"),nodeArtifacts:o(e=>`/v1/nodes/${e}/artifacts`,"nodeArtifacts"),nodeReports:o(e=>`/v1/nodes/${e}/reports`,"nodeReports"),nodeResult:o(e=>`/v1/nodes/${e}/result`,"nodeResult"),nodeJobs:o(e=>`/v1/nodes/${e}/jobs`,"nodeJobs"),nodeJob:o((e,n)=>`/v1/nodes/${e}/jobs/${n}`,"nodeJob"),nodeMessages:o(e=>`/v1/nodes/${e}/messages`,"nodeMessages"),nodeInterrupt:o(e=>`/v1/nodes/${e}/interrupt`,"nodeInterrupt"),nodeFork:o(e=>`/v1/nodes/${e}/fork`,"nodeFork"),nodeRevive:o(e=>`/v1/nodes/${e}/revive`,"nodeRevive"),nodeRelaunchRoot:o(e=>`/v1/nodes/${e}/relaunch-root`,"nodeRelaunchRoot"),nodeBrokerSessionBound:o(e=>`/v1/nodes/${e}/broker/session-bound`,"nodeBrokerSessionBound"),nodeBrokerSettle:o(e=>`/v1/nodes/${e}/broker/settle`,"nodeBrokerSettle"),nodeBrokerParkComplete:o(e=>`/v1/nodes/${e}/broker/park-complete`,"nodeBrokerParkComplete"),nodeBrokerParkActivity:o(e=>`/v1/nodes/${e}/broker/park-activity`,"nodeBrokerParkActivity"),nodeBrokerTelemetry:o(e=>`/v1/nodes/${e}/broker/telemetry`,"nodeBrokerTelemetry"),nodeMailClaim:o(e=>`/v1/nodes/${e}/mail/claim`,"nodeMailClaim"),nodeMailAcknowledge:o(e=>`/v1/nodes/${e}/mail/acknowledge`,"nodeMailAcknowledge"),nodeBrokerModel:o(e=>`/v1/nodes/${e}/broker/model`,"nodeBrokerModel"),nodeBrokerExtensionState:o(e=>`/v1/nodes/${e}/broker/extension-state`,"nodeBrokerExtensionState"),nodeBrokerGeneratedName:o(e=>`/v1/nodes/${e}/broker/generated-name`,"nodeBrokerGeneratedName"),nodeBrokerPersonaAck:o(e=>`/v1/nodes/${e}/broker/persona-ack`,"nodeBrokerPersonaAck"),brokerTurn:o(e=>`/v1/broker/${e}/turn`,"brokerTurn"),brokerProviderRetry:o(e=>`/v1/broker/${e}/provider-retry`,"brokerProviderRetry"),brokerFault:o(e=>`/v1/broker/${e}/fault`,"brokerFault"),brokerRecovery:o(e=>`/v1/broker/${e}/recovery`,"brokerRecovery"),nodeFault:o(e=>`/v1/nodes/${e}/fault`,"nodeFault"),nodeClose:o(e=>`/v1/nodes/${e}/close`,"nodeClose"),nodeRecycle:o(e=>`/v1/nodes/${e}/recycle`,"nodeRecycle"),nodeDemote:o(e=>`/v1/nodes/${e}/demote`,"nodeDemote"),nodePromote:o(e=>`/v1/nodes/${e}/promote`,"nodePromote"),nodeYield:o(e=>`/v1/nodes/${e}/yield`,"nodeYield"),nodeWait:o(e=>`/v1/nodes/${e}/wait`,"nodeWait"),nodeConfig:o(e=>`/v1/nodes/${e}/config`,"nodeConfig"),nodeWorktreeClose:o(e=>`/v1/nodes/${e}/worktree/close`,"nodeWorktreeClose"),nodeWorktreeAbandon:o(e=>`/v1/nodes/${e}/worktree/abandon`,"nodeWorktreeAbandon"),quarantinedWorktrees:o(()=>"/v1/worktrees/quarantined","quarantinedWorktrees"),nodeAttach:o(e=>`/v1/nodes/${e}/attach`,"nodeAttach"),focuses:o(()=>"/v1/focuses","focuses"),focusByNode:o(()=>"/v1/focuses/by-node","focusByNode"),focusByPane:o(()=>"/v1/focuses/by-pane","focusByPane"),focus:o(e=>`/v1/focuses/${e}`,"focus"),nodeSubscriptions:o(e=>`/v1/nodes/${e}/subscriptions`,"nodeSubscriptions"),nodeSubscription:o((e,n)=>`/v1/nodes/${e}/subscriptions/${n}`,"nodeSubscription"),crons:o(()=>"/v1/crons","crons"),cron:o(e=>`/v1/crons/${e}`,"cron"),cronPause:o(e=>`/v1/crons/${e}/pause`,"cronPause"),cronResume:o(e=>`/v1/crons/${e}/resume`,"cronResume"),cronRun:o(e=>`/v1/crons/${e}/run`,"cronRun"),cronsPoke:o(()=>"/v1/crons/poke","cronsPoke"),canvasAttention:o(()=>"/v1/canvas/attention","canvasAttention"),canvasAttentionCounts:o(()=>"/v1/canvas/attention/counts","canvasAttentionCounts"),canvasHistorySearch:o(()=>"/v1/canvas/history/search","canvasHistorySearch"),canvasHistoryGrep:o(()=>"/v1/canvas/history/grep","canvasHistoryGrep"),canvasHistoryRead:o(()=>"/v1/canvas/history/read","canvasHistoryRead"),canvasHistoryStats:o(()=>"/v1/canvas/history/stats","canvasHistoryStats"),canvasSnapshot:o(()=>"/v1/canvas/snapshot","canvasSnapshot"),canvasRoster:o(()=>"/v1/canvas/roster","canvasRoster"),canvasGraph:o(()=>"/v1/canvas/graph","canvasGraph"),canvasPrune:o(()=>"/v1/canvas/prune","canvasPrune"),humanReviews:o(()=>"/v1/human/reviews","humanReviews"),humanReview:o(e=>`/v1/human/reviews/${e}`,"humanReview"),humanReviewSubmit:o(e=>`/v1/human/reviews/${e}/submit`,"humanReviewSubmit"),humanReviewCancel:o(e=>`/v1/human/reviews/${e}/cancel`,"humanReviewCancel"),humanReviewDocument:o(e=>`/v1/human/reviews/${e}/document`,"humanReviewDocument"),humanReviewComments:o(e=>`/v1/human/reviews/${e}/comments`,"humanReviewComments"),humanReviewCommentEvents:o(e=>`/v1/human/reviews/${e}/comment-events`,"humanReviewCommentEvents"),humanReviewCommentRanges:o(e=>`/v1/human/reviews/${e}/comment-ranges`,"humanReviewCommentRanges"),humanComment:o(e=>`/v1/human/comments/${e}`,"humanComment"),humanCommentEdit:o(e=>`/v1/human/comments/${e}/edit`,"humanCommentEdit"),humanCommentResolve:o(e=>`/v1/human/comments/${e}/resolve`,"humanCommentResolve"),humanCommentReopen:o(e=>`/v1/human/comments/${e}/reopen`,"humanCommentReopen"),humanCommentDelete:o(e=>`/v1/human/comments/${e}/delete`,"humanCommentDelete"),humanCommentFork:o(e=>`/v1/human/comments/${e}/fork`,"humanCommentFork"),humanInbox:o(()=>"/v1/human/inbox","humanInbox"),humanInboxTicket:o(e=>`/v1/human/inbox/${e}`,"humanInboxTicket"),humanInboxRespond:o(e=>`/v1/human/inbox/${e}/respond`,"humanInboxRespond"),humanInboxProgress:o(e=>`/v1/human/inbox/${e}/progress`,"humanInboxProgress"),humanInboxResponse:o(e=>`/v1/human/inbox/${e}/response`,"humanInboxResponse"),humanInboxCancel:o(e=>`/v1/human/inbox/${e}/cancel`,"humanInboxCancel"),humanInboxFeedbackResolve:o((e,n)=>`/v1/human/inbox/${e}/feedback-comments/${n}/resolve`,"humanInboxFeedbackResolve"),humanRequests:o(()=>"/v1/human/requests","humanRequests"),humanRequest:o(e=>`/v1/human/requests/${e}`,"humanRequest"),humanRequestReplace:o(e=>`/v1/human/requests/${e}/replace`,"humanRequestReplace"),humanRequestRespond:o(e=>`/v1/human/requests/${e}/respond`,"humanRequestRespond"),humanRequestDismiss:o(e=>`/v1/human/requests/${e}/dismiss`,"humanRequestDismiss"),humanRequestCancel:o(e=>`/v1/human/requests/${e}/cancel`,"humanRequestCancel"),profiles:o(()=>"/v1/profiles","profiles"),profile:o(e=>`/v1/profiles/${e}`,"profile"),profilePause:o(e=>`/v1/profiles/${e}/pause`,"profilePause"),profileResume:o(e=>`/v1/profiles/${e}/resume`,"profileResume"),profileMetadata:o(e=>`/v1/profiles/${e}/metadata`,"profileMetadata"),modelAuths:o(()=>"/v1/model-auth","modelAuths"),modelAuthReadiness:o(()=>"/v1/model-auth/readiness","modelAuthReadiness"),modelAuth:o(e=>`/v1/model-auth/${e}`,"modelAuth"),filePeek:o(()=>"/v1/files/peek","filePeek"),fileWrite:o(()=>"/v1/files/write","fileWrite"),fileList:o(()=>"/v1/files/list","fileList"),bash:o(()=>"/v1/bash","bash"),memoryDocs:o(()=>"/v1/memory/docs","memoryDocs"),memoryDoc:o(e=>`/v1/memory/docs/${encodeURIComponent(e)}`,"memoryDoc"),memoryDocMove:o(e=>`/v1/memory/docs/${encodeURIComponent(e)}/move`,"memoryDocMove"),memoryDocHistory:o(e=>`/v1/memory/docs/${encodeURIComponent(e)}/history`,"memoryDocHistory"),memorySearch:o(()=>"/v1/memory/search","memorySearch"),memoryResolve:o(()=>"/v1/memory/resolve","memoryResolve")};export{$ as API_VERSION,t as routes};
1
+ var s=Object.defineProperty;var o=(e,n)=>s(e,"name",{value:n,configurable:!0});const $="v1",t="/v1",a={healthz:o(()=>"/healthz","healthz"),status:o(()=>"/v1/status","status"),daemonRestart:o(()=>"/v1/daemon/restart","daemonRestart"),daemonMigrate:o(()=>"/v1/daemon/migrate","daemonMigrate"),daemonAdmit:o(()=>"/v1/daemon/admit","daemonAdmit"),nodes:o(()=>"/v1/nodes","nodes"),reviveAll:o(()=>"/v1/nodes/revive-all","reviveAll"),node:o(e=>`/v1/nodes/${e}`,"node"),nodeMemoryReads:o(e=>`/v1/nodes/${e}/memory-reads`,"nodeMemoryReads"),nodeOutcome:o(e=>`/v1/nodes/${e}/outcome`,"nodeOutcome"),nodeOutcomeDelivery:o(e=>`/v1/nodes/${e}/outcome-delivery`,"nodeOutcomeDelivery"),nodeEvents:o(e=>`/v1/nodes/${e}/events`,"nodeEvents"),nodeSnapshot:o(e=>`/v1/nodes/${e}/snapshot`,"nodeSnapshot"),nodeSubject:o(e=>`/v1/nodes/${e}/subject`,"nodeSubject"),nodeSession:o(e=>`/v1/nodes/${e}/session`,"nodeSession"),nodeChatInventory:o(e=>`/v1/nodes/${e}/chat-inventory`,"nodeChatInventory"),prospectiveChatInventory:o(()=>"/v1/prospective-chat-inventory","prospectiveChatInventory"),nodeTranscript:o(e=>`/v1/nodes/${e}/transcript`,"nodeTranscript"),nodeContext:o(e=>`/v1/nodes/${e}/context`,"nodeContext"),nodeArtifacts:o(e=>`/v1/nodes/${e}/artifacts`,"nodeArtifacts"),nodeReports:o(e=>`/v1/nodes/${e}/reports`,"nodeReports"),nodeResult:o(e=>`/v1/nodes/${e}/result`,"nodeResult"),nodeJobs:o(e=>`/v1/nodes/${e}/jobs`,"nodeJobs"),nodeJob:o((e,n)=>`/v1/nodes/${e}/jobs/${n}`,"nodeJob"),nodeMessages:o(e=>`/v1/nodes/${e}/messages`,"nodeMessages"),nodeInterrupt:o(e=>`/v1/nodes/${e}/interrupt`,"nodeInterrupt"),nodeFork:o(e=>`/v1/nodes/${e}/fork`,"nodeFork"),nodeRevive:o(e=>`/v1/nodes/${e}/revive`,"nodeRevive"),nodeRelaunchRoot:o(e=>`/v1/nodes/${e}/relaunch-root`,"nodeRelaunchRoot"),nodeBrokerSessionBound:o(e=>`/v1/nodes/${e}/broker/session-bound`,"nodeBrokerSessionBound"),nodeBrokerSettle:o(e=>`/v1/nodes/${e}/broker/settle`,"nodeBrokerSettle"),nodeBrokerParkComplete:o(e=>`/v1/nodes/${e}/broker/park-complete`,"nodeBrokerParkComplete"),nodeBrokerParkActivity:o(e=>`/v1/nodes/${e}/broker/park-activity`,"nodeBrokerParkActivity"),nodeBrokerTelemetry:o(e=>`/v1/nodes/${e}/broker/telemetry`,"nodeBrokerTelemetry"),nodeLog:o(e=>`/v1/nodes/${e}/records/log`,"nodeLog"),nodeTelemetry:o(e=>`/v1/nodes/${e}/records/telemetry`,"nodeTelemetry"),nodeRecap:o(e=>`/v1/nodes/${e}/records/recap`,"nodeRecap"),nodeInboxReport:o(e=>`/v1/nodes/${e}/records/inbox`,"nodeInboxReport"),nodePassiveMessage:o(e=>`/v1/nodes/${e}/records/passive`,"nodePassiveMessage"),nodePushedFinal:o(e=>`/v1/nodes/${e}/records/pushed-final`,"nodePushedFinal"),nodeMailClaim:o(e=>`/v1/nodes/${e}/mail/claim`,"nodeMailClaim"),nodeMailAcknowledge:o(e=>`/v1/nodes/${e}/mail/acknowledge`,"nodeMailAcknowledge"),nodeBrokerModel:o(e=>`/v1/nodes/${e}/broker/model`,"nodeBrokerModel"),nodeBrokerExtensionState:o(e=>`/v1/nodes/${e}/broker/extension-state`,"nodeBrokerExtensionState"),nodeBrokerContext:o(e=>`/v1/nodes/${e}/broker/context`,"nodeBrokerContext"),nodeBrokerMemoryRefs:o(e=>`/v1/nodes/${e}/broker/memory-refs`,"nodeBrokerMemoryRefs"),nodeBrokerContextCommit:o(e=>`/v1/nodes/${e}/broker/context/commit`,"nodeBrokerContextCommit"),nodeBrokerContextEvent:o(e=>`/v1/nodes/${e}/broker/context/event`,"nodeBrokerContextEvent"),nodeBrokerGeneratedName:o(e=>`/v1/nodes/${e}/broker/generated-name`,"nodeBrokerGeneratedName"),nodeBrokerPersonaAck:o(e=>`/v1/nodes/${e}/broker/persona-ack`,"nodeBrokerPersonaAck"),brokerTurn:o(e=>`/v1/broker/${e}/turn`,"brokerTurn"),brokerProviderRetry:o(e=>`/v1/broker/${e}/provider-retry`,"brokerProviderRetry"),brokerFault:o(e=>`/v1/broker/${e}/fault`,"brokerFault"),brokerRecovery:o(e=>`/v1/broker/${e}/recovery`,"brokerRecovery"),nodeFault:o(e=>`/v1/nodes/${e}/fault`,"nodeFault"),nodeClose:o(e=>`/v1/nodes/${e}/close`,"nodeClose"),nodeRecycle:o(e=>`/v1/nodes/${e}/recycle`,"nodeRecycle"),nodeDemote:o(e=>`/v1/nodes/${e}/demote`,"nodeDemote"),nodePromote:o(e=>`/v1/nodes/${e}/promote`,"nodePromote"),nodeYield:o(e=>`/v1/nodes/${e}/yield`,"nodeYield"),nodeWait:o(e=>`/v1/nodes/${e}/wait`,"nodeWait"),nodeConfig:o(e=>`/v1/nodes/${e}/config`,"nodeConfig"),kinds:o(()=>"/v1/kinds","kinds"),nodeWorktreeClose:o(e=>`/v1/nodes/${e}/worktree/close`,"nodeWorktreeClose"),nodeWorktreeAbandon:o(e=>`/v1/nodes/${e}/worktree/abandon`,"nodeWorktreeAbandon"),quarantinedWorktrees:o(()=>"/v1/worktrees/quarantined","quarantinedWorktrees"),spaces:o(()=>"/v1/spaces","spaces"),nodeAttach:o(e=>`/v1/nodes/${e}/attach`,"nodeAttach"),focuses:o(()=>"/v1/focuses","focuses"),focusByNode:o(()=>"/v1/focuses/by-node","focusByNode"),focusByPane:o(()=>"/v1/focuses/by-pane","focusByPane"),focus:o(e=>`/v1/focuses/${e}`,"focus"),nodeSubscriptions:o(e=>`/v1/nodes/${e}/subscriptions`,"nodeSubscriptions"),nodeSubscription:o((e,n)=>`/v1/nodes/${e}/subscriptions/${n}`,"nodeSubscription"),crons:o(()=>"/v1/crons","crons"),cron:o(e=>`/v1/crons/${e}`,"cron"),cronPause:o(e=>`/v1/crons/${e}/pause`,"cronPause"),cronResume:o(e=>`/v1/crons/${e}/resume`,"cronResume"),cronRun:o(e=>`/v1/crons/${e}/run`,"cronRun"),cronsPoke:o(()=>"/v1/crons/poke","cronsPoke"),canvasAttention:o(()=>"/v1/canvas/attention","canvasAttention"),canvasAttentionCounts:o(()=>"/v1/canvas/attention/counts","canvasAttentionCounts"),canvasHistorySearch:o(()=>"/v1/canvas/history/search","canvasHistorySearch"),canvasHistoryGrep:o(()=>"/v1/canvas/history/grep","canvasHistoryGrep"),canvasHistoryRead:o(()=>"/v1/canvas/history/read","canvasHistoryRead"),canvasHistoryStats:o(()=>"/v1/canvas/history/stats","canvasHistoryStats"),canvasSnapshot:o(()=>"/v1/canvas/snapshot","canvasSnapshot"),canvasRoster:o(()=>"/v1/canvas/roster","canvasRoster"),canvasAnalytics:o(()=>"/v1/canvas/analytics","canvasAnalytics"),canvasGraph:o(()=>"/v1/canvas/graph","canvasGraph"),canvasPrune:o(()=>"/v1/canvas/prune","canvasPrune"),humanReviews:o(()=>"/v1/human/reviews","humanReviews"),humanReview:o(e=>`/v1/human/reviews/${e}`,"humanReview"),humanReviewSubmit:o(e=>`/v1/human/reviews/${e}/submit`,"humanReviewSubmit"),humanReviewCancel:o(e=>`/v1/human/reviews/${e}/cancel`,"humanReviewCancel"),humanReviewDocument:o(e=>`/v1/human/reviews/${e}/document`,"humanReviewDocument"),humanReviewComments:o(e=>`/v1/human/reviews/${e}/comments`,"humanReviewComments"),humanReviewCommentEvents:o(e=>`/v1/human/reviews/${e}/comment-events`,"humanReviewCommentEvents"),humanReviewCommentRanges:o(e=>`/v1/human/reviews/${e}/comment-ranges`,"humanReviewCommentRanges"),humanComment:o(e=>`/v1/human/comments/${e}`,"humanComment"),humanCommentEdit:o(e=>`/v1/human/comments/${e}/edit`,"humanCommentEdit"),humanCommentResolve:o(e=>`/v1/human/comments/${e}/resolve`,"humanCommentResolve"),humanCommentReopen:o(e=>`/v1/human/comments/${e}/reopen`,"humanCommentReopen"),humanCommentDelete:o(e=>`/v1/human/comments/${e}/delete`,"humanCommentDelete"),humanCommentFork:o(e=>`/v1/human/comments/${e}/fork`,"humanCommentFork"),humanInbox:o(()=>"/v1/human/inbox","humanInbox"),humanInboxTicket:o(e=>`/v1/human/inbox/${e}`,"humanInboxTicket"),humanInboxRespond:o(e=>`/v1/human/inbox/${e}/respond`,"humanInboxRespond"),humanInboxProgress:o(e=>`/v1/human/inbox/${e}/progress`,"humanInboxProgress"),humanInboxResponse:o(e=>`/v1/human/inbox/${e}/response`,"humanInboxResponse"),humanInboxCancel:o(e=>`/v1/human/inbox/${e}/cancel`,"humanInboxCancel"),humanInboxFeedbackResolve:o((e,n)=>`/v1/human/inbox/${e}/feedback-comments/${n}/resolve`,"humanInboxFeedbackResolve"),humanRequests:o(()=>"/v1/human/requests","humanRequests"),humanComponents:o(()=>"/v1/human/components","humanComponents"),humanRequest:o(e=>`/v1/human/requests/${e}`,"humanRequest"),humanRequestReplace:o(e=>`/v1/human/requests/${e}/replace`,"humanRequestReplace"),humanRequestRespond:o(e=>`/v1/human/requests/${e}/respond`,"humanRequestRespond"),humanRequestDismiss:o(e=>`/v1/human/requests/${e}/dismiss`,"humanRequestDismiss"),humanRequestCancel:o(e=>`/v1/human/requests/${e}/cancel`,"humanRequestCancel"),profiles:o(()=>"/v1/profiles","profiles"),profile:o(e=>`/v1/profiles/${e}`,"profile"),profilePause:o(e=>`/v1/profiles/${e}/pause`,"profilePause"),profileResume:o(e=>`/v1/profiles/${e}/resume`,"profileResume"),profileMetadata:o(e=>`/v1/profiles/${e}/metadata`,"profileMetadata"),profileEnv:o(e=>`/v1/profiles/${e}/env`,"profileEnv"),profileEnvVar:o((e,n)=>`/v1/profiles/${e}/env/${n}`,"profileEnvVar"),modelAuths:o(()=>"/v1/model-auth","modelAuths"),modelAuthReadiness:o(()=>"/v1/model-auth/readiness","modelAuthReadiness"),modelAuth:o(e=>`/v1/model-auth/${e}`,"modelAuth"),modelAuthFlows:o(()=>"/v1/model-auth/flows","modelAuthFlows"),modelAuthFlow:o(e=>`/v1/model-auth/flows/${encodeURIComponent(e)}`,"modelAuthFlow"),modelAuthFlowComplete:o(e=>`/v1/model-auth/flows/${encodeURIComponent(e)}/complete`,"modelAuthFlowComplete"),modelAuthFlowCancel:o(e=>`/v1/model-auth/flows/${encodeURIComponent(e)}/cancel`,"modelAuthFlowCancel"),filePeek:o(()=>"/v1/files/peek","filePeek"),fileWrite:o(()=>"/v1/files/write","fileWrite"),fileList:o(()=>"/v1/files/list","fileList"),bash:o(()=>"/v1/bash","bash"),memoryDocs:o(()=>"/v1/memory/docs","memoryDocs"),memoryDoc:o(e=>`/v1/memory/docs/${encodeURIComponent(e)}`,"memoryDoc"),memoryDocMove:o(e=>`/v1/memory/docs/${encodeURIComponent(e)}/move`,"memoryDocMove"),memoryDocHistory:o(e=>`/v1/memory/docs/${encodeURIComponent(e)}/history`,"memoryDocHistory"),memorySearch:o(()=>"/v1/memory/search","memorySearch"),memoryResolve:o(()=>"/v1/memory/resolve","memoryResolve"),memoryOrigin:o(()=>"/v1/memory/origin","memoryOrigin")};export{$ as API_VERSION,a as routes};
@@ -6,10 +6,15 @@ export declare const SUBTREE_NAMES: readonly string[];
6
6
  export declare function coreHookCatalog(): Promise<CoreHookCatalog>;
7
7
  export declare function coreCommandPaths(): Promise<ReadonlySet<string>>;
8
8
  export declare function extensibleCoreBranches(): Promise<ReadonlySet<string>>;
9
- /** Whether argv targets the daemon-control subtree after the dispatcher's global-token normalization. This only selects a smaller canonical tree; `runCli` still parses, renders help, and reports errors. */
9
+ /** The person-only command path `argv` dispatches into, or null. */
10
+ export declare function personOnlyInvocation(argv: readonly string[]): string | null;
11
+ /** Select a smaller canonical tree; `runCli` still parses, renders help, and reports errors. */
10
12
  export declare function isDaemonControlInvocation(argv: readonly string[]): boolean;
13
+ export declare function isLayoutMigrationInvocation(argv: readonly string[]): boolean;
11
14
  /** Assemble the canonical daemon-control definitions without loading settings or plugin discovery. This path exists so `crtr sys daemon restart` can start the new generation that converts pre-SQL user state. */
12
15
  export declare function resolveDaemonControlRoot(): Promise<RootDef>;
16
+ /** Migration runs offline before command plugins can read or initialize scoped state. */
17
+ export declare function resolveLayoutMigrationRoot(): Promise<RootDef>;
13
18
  /** Build a root that contains only the subtree `first` dispatches into.
14
19
  * Returns the FULL root when `first` is not a recognized subtree — bare `crtr`,
15
20
  * `-h`/`--help`, `--version`, and any unknown leading token all need the
@@ -1 +1 @@
1
- var L=Object.defineProperty;var t=(e,n)=>L(e,"name",{value:n,configurable:!0});import{defineBranch as T,defineRoot as l,GLOBAL_TOKENS as _}from"./core/command.js";import{createCoreHookCatalog as b}from"./core/command-hooks/catalog.js";import{composeCoreHooks as C}from"./core/command-hooks/compose.js";import{mark as m}from"./core/timing.js";import{envScopes as j,scopeAllowed as A}from"./shared/env.js";const p="crtr: agentic runtime.",f=[{name:"--json",desc:"stdout as the leaf's declared outputs in raw JSON instead of prose \u2014 for scripts (a cron's bash, external tooling) that must branch on canvas state; prose stays the contract for what you read yourself."}],d=Object.assign(Object.create(null),{memory:t(async()=>(await import("./commands/memory.js")).registerMemory(),"memory"),profile:t(async()=>(await import("./commands/profile.js")).registerProfile(),"profile"),pkg:t(async()=>(await import("./commands/pkg.js")).registerPkg(),"pkg"),human:t(async()=>(await import("./commands/human.js")).registerHuman(),"human"),sys:t(async()=>(await import("./commands/sys.js")).registerSys(),"sys"),node:t(async()=>(await import("./commands/node.js")).registerNode(),"node"),push:t(async()=>(await import("./commands/push.js")).registerPush(),"push"),cron:t(async()=>(await import("./commands/cron.js")).registerCron(),"cron"),canvas:t(async()=>(await import("./commands/canvas.js")).registerCanvas(),"canvas"),surface:t(async()=>(await import("./commands/surface.js")).registerSurface(),"surface")}),g=Object.freeze(Object.keys(d)),H={human:["ask"],cron:["schedule"],memory:["memory:read","memory:write"]};function x(e){const n=j();return n===null?e:e.filter(r=>{const o=H[r.name];return o===void 0||o.some(s=>A(n,s))})}t(x,"allowedSubtrees");let E;function u(){return E??=Promise.all(g.map(e=>d[e]())),E}t(u,"loadCoreSubtrees");let P;function M(){return m("cli.hooks.catalog"),P??=u().then(b),P}t(M,"coreHookCatalog");function v(){let e;return()=>(e??=(async()=>{const{compileHookRegistry:n,effectiveHookPlugins:r}=await import("./core/command-hooks/discovery.js"),o=r();return m("cli.hooks.effective_plugins",{count:o.length}),o.length===0?(m("cli.hooks.empty_registry"),n(b([]),[])):n(await M(),o)})(),e)}t(v,"hookRegistryLoader");function h(e){const n=new Set,r=t((o,s)=>{if(!(o.kind==="branch"&&o.passthrough!==void 0)&&(n.add(s),o.kind==="branch"))for(const i of o.children)r(i,`${s} ${i.name}`)},"visit");for(const o of e)r(o,o.name);return n}t(h,"commandPathsFor");async function J(){return h(await u())}t(J,"coreCommandPaths");function N(e){const n=[],r=t((o,s)=>{o.extensible===!0&&n.push(s);for(const i of o.children)i.kind==="branch"&&r(i,[...s,i.name])},"visit");for(const o of e)r(o,[o.name]);return n}t(N,"extensibleBranchPaths");async function B(){return new Set(N(await u()).map(e=>e.join(" ")))}t(B,"extensibleCoreBranches");function U(e,n){const{listing:r,...o}=e.help;return T({name:e.name,description:e.description,whenToUse:e.whenToUse,tier:e.tier,help:o,rootEntry:e.rootEntry,extensible:e.extensible,plugin:e.plugin,slash:e.slash,passthrough:e.passthrough,children:n})}t(U,"rebuildBranch");async function O(e,n){if(n.size===0)return e;const[{buildExternalCommandSnapshot:r},{composeCoreBranchMounts:o}]=await Promise.all([import("./core/command-plugins/discovery.js"),import("./core/command-plugins/compose.js")]),s=r(new Set(g),void 0,void 0,h(await u()),n),i=t((a,y)=>{let w=!1;const R=a.children.map(c=>{if(c.kind!=="branch")return c;const k=i(c,[...y,c.name]);return k!==c&&(w=!0),k}),S=a.extensible===!0?o(s.coreMounts,y):[];return w||S.length>0?U(a,[...R,...S]):a},"composeBranch");return e.map(a=>i(a,[a.name]))}t(O,"composeCorePluginMounts");function K(e){const n=e.slice(2).filter(r=>!_.has(r));return n[0]==="sys"&&n[1]==="daemon"}t(K,"isDaemonControlInvocation");async function Q(){const{registerDaemonControlSys:e}=await import("./commands/sys/daemon.js");return l({tagline:p,globals:f,subtrees:[e()]})}t(Q,"resolveDaemonControlRoot");async function V(e){const n=e!==void 0?d[e]:void 0;if(n!==void 0){const r=x(await O([await n()],await B()));if(r.length>0)return l({tagline:p,globals:f,subtrees:C(r,v())})}return D()}t(V,"resolveRoot");async function D(){const e=await u(),[{buildExternalCommandSnapshot:n},{composeExternalSubtrees:r}]=await Promise.all([import("./core/command-plugins/discovery.js"),import("./core/command-plugins/compose.js")]),o=await B(),s=await O(e,o),i=n(new Set(g),void 0,void 0,h(e),o),a=r(i);return l({tagline:p,globals:f,subtrees:[...C(x(s),v()),...a]})}t(D,"buildRoot");export{g as SUBTREE_NAMES,D as buildRoot,J as coreCommandPaths,M as coreHookCatalog,B as extensibleCoreBranches,K as isDaemonControlInvocation,Q as resolveDaemonControlRoot,V as resolveRoot};
1
+ var L=Object.defineProperty;var o=(e,n)=>L(e,"name",{value:n,configurable:!0});import{defineBranch as j,defineRoot as l,GLOBAL_TOKENS as R}from"./core/command.js";import{createCoreHookCatalog as x}from"./core/command-hooks/catalog.js";import{composeCoreHooks as C}from"./core/command-hooks/compose.js";import{mark as f}from"./core/timing.js";import{envNodeId as k,envScopes as H,scopeAllowed as d}from"./shared/env.js";const m="crtr: agentic runtime.",p=[{name:"--json",desc:"stdout as the leaf's declared outputs in raw JSON instead of prose \u2014 for scripts (a cron's bash, external tooling) that must branch on canvas state; prose stays the contract for what you read yourself."}],g=Object.assign(Object.create(null),{memory:o(async()=>(await import("./commands/memory.js")).registerMemory(),"memory"),profile:o(async()=>(await import("./commands/profile.js")).registerProfile(),"profile"),pkg:o(async()=>(await import("./commands/pkg.js")).registerPkg(),"pkg"),human:o(async()=>(await import("./commands/human.js")).registerHuman(),"human"),sys:o(async()=>(await import("./commands/sys.js")).registerSys(),"sys"),node:o(async()=>(await import("./commands/node.js")).registerNode(),"node"),push:o(async()=>(await import("./commands/push.js")).registerPush(),"push"),cron:o(async()=>(await import("./commands/cron.js")).registerCron(),"cron"),canvas:o(async()=>(await import("./commands/canvas.js")).registerCanvas(),"canvas"),surface:o(async()=>(await import("./commands/surface.js")).registerSurface(),"surface")}),y=Object.freeze(Object.keys(g)),M={human:["crtr:act"],cron:["crtr:schedule"],memory:["crtr:memory:read:user","crtr:memory:rw:user"]};function b(e){const n=H();return n===null?e:e.filter(r=>{const t=M[r.name];return t===void 0||t.some(s=>d(n,s))||r.name==="memory"&&typeof process.env.CRTR_GRANTEE=="string"&&process.env.CRTR_GRANTEE.startsWith("app:")&&(d(n,`crtr:memory:read:${process.env.CRTR_GRANTEE}`)||d(n,`crtr:memory:rw:${process.env.CRTR_GRANTEE}`))})}o(b,"allowedSubtrees");let P;function u(){return P??=Promise.all(y.map(e=>g[e]())),P}o(u,"loadCoreSubtrees");let T;function G(){return f("cli.hooks.catalog"),T??=u().then(x),T}o(G,"coreHookCatalog");function O(){let e;return()=>(e??=(async()=>{const{compileHookRegistry:n,effectiveHookPlugins:r}=await import("./core/command-hooks/discovery.js"),t=r(),s=process.platform==="linux"&&k()?await(await import("./core/command-hooks/transport/plan.js")).remoteHookPlan(process.cwd()):[];return f("cli.hooks.effective_plugins",{count:t.length+s.length}),t.length===0&&s.length===0?(f("cli.hooks.empty_registry"),n(x([]),[])):n(await G(),process.platform==="linux"&&k()?t.filter(a=>a.scope==="project"):t,s)})(),e)}o(O,"hookRegistryLoader");function h(e){const n=new Set,r=o((t,s)=>{if(!(t.kind==="branch"&&t.passthrough!==void 0)&&(n.add(s),t.kind==="branch"))for(const a of t.children)r(a,`${s} ${a.name}`)},"visit");for(const t of e)r(t,t.name);return n}o(h,"commandPathsFor");async function Y(){return h(await u())}o(Y,"coreCommandPaths");function I(e){const n=[],r=o((t,s)=>{t.extensible===!0&&n.push(s);for(const a of t.children)a.kind==="branch"&&r(a,[...s,a.name])},"visit");for(const t of e)r(t,[t.name]);return n}o(I,"extensibleBranchPaths");async function _(){return new Set(I(await u()).map(e=>e.join(" ")))}o(_,"extensibleCoreBranches");function U(e,n){const{listing:r,...t}=e.help;return j({name:e.name,description:e.description,whenToUse:e.whenToUse,tier:e.tier,help:t,rootEntry:e.rootEntry,extensible:e.extensible,plugin:e.plugin,slash:e.slash,passthrough:e.passthrough,children:n})}o(U,"rebuildBranch");async function B(e,n){if(n.size===0)return e;const[{buildExternalCommandSnapshot:r},{composeCoreBranchMounts:t}]=await Promise.all([import("./core/command-plugins/discovery.js"),import("./core/command-plugins/compose.js")]),s=r(new Set(y),void 0,void 0,h(await u()),n),a=o((i,w)=>{let S=!1;const A=i.children.map(c=>{if(c.kind!=="branch")return c;const E=a(c,[...w,c.name]);return E!==c&&(S=!0),E}),v=i.extensible===!0?t(s.coreMounts,w):[];return S||v.length>0?U(i,[...A,...v]):i},"composeBranch");return e.map(i=>a(i,[i.name]))}o(B,"composeCorePluginMounts");function N(e,n){const r=e.slice(2).filter(t=>!R.has(t));return r[0]==="sys"&&r[1]===n}o(N,"isSysInvocation");const D=[["surface"],["sys"],["pkg"],["profile","default"],["canvas","chord"],["canvas","config"],["canvas","use"],["canvas","browse"],["canvas","issue"]];function Q(e){const n=e.slice(2).filter(t=>!R.has(t)),r=D.find(t=>t.every((s,a)=>n[a]===s));return r===void 0?null:r.join(" ")}o(Q,"personOnlyInvocation");function V(e){return N(e,"daemon")}o(V,"isDaemonControlInvocation");function X(e){return N(e,"migrate")}o(X,"isLayoutMigrationInvocation");async function Z(){const{registerDaemonControlSys:e}=await import("./commands/sys/daemon.js");return l({tagline:m,globals:p,subtrees:[e()]})}o(Z,"resolveDaemonControlRoot");async function ee(){const[{defineSysBranch:e},{sysMigrateLeaf:n}]=await Promise.all([import("./commands/sys/branch.js"),import("./commands/sys/migrate.js")]);return l({tagline:m,globals:p,subtrees:[e([n])]})}o(ee,"resolveLayoutMigrationRoot");async function te(e){const n=e!==void 0?g[e]:void 0;if(n!==void 0){const r=b(await B([await n()],await _()));if(r.length>0)return l({tagline:m,globals:p,subtrees:C(r,O())})}return $()}o(te,"resolveRoot");async function $(){const e=await u(),[{buildExternalCommandSnapshot:n},{composeExternalSubtrees:r}]=await Promise.all([import("./core/command-plugins/discovery.js"),import("./core/command-plugins/compose.js")]),t=await _(),s=await B(e,t),a=n(new Set(y),void 0,void 0,h(e),t),i=r(a);return l({tagline:m,globals:p,subtrees:[...C(b(s),O()),...i]})}o($,"buildRoot");export{y as SUBTREE_NAMES,$ as buildRoot,Y as coreCommandPaths,G as coreHookCatalog,_ as extensibleCoreBranches,V as isDaemonControlInvocation,X as isLayoutMigrationInvocation,Q as personOnlyInvocation,Z as resolveDaemonControlRoot,ee as resolveLayoutMigrationRoot,te as resolveRoot};
@@ -17,6 +17,40 @@ const customSocketClient = new Crouter({ socketPath: '/custom/path/crtrd.sock' }
17
17
 
18
18
  `Crouter` is the default export and the only class an application constructs. `CrtrClient` from `@north-light/crouter-api` is an implementation detail and is not re-exported.
19
19
 
20
+ ## An app connection and refresh
21
+
22
+ ```ts
23
+ import { OAuth2Client } from '@north-light/crouter-sdk';
24
+
25
+ const oauth = new OAuth2Client({clientId, privateKey, keyId, redirectUri, issuer});
26
+ const {url, codeVerifier, state, nonce} = await oauth.authorizeUrl({scopes: ['openid', 'crtr:act'], state: sessionState});
27
+ // Save codeVerifier, state, and nonce in the app session; redirect the user to url.
28
+ const connection = await oauth.exchangeCode({code: callbackCode, codeVerifier, state, nonce});
29
+ const client = oauth.client(connection, store);
30
+ ```
31
+
32
+ `ConnectionStore` provides `load(userId)` and `save(connection)`; it may also implement `lock(userId, fn)`. A multi-process app must implement the lock across every process: the SDK reloads the connection, sends the refresh request only if no other process rotated its token, and saves the result while the lock is held. `MemoryConnectionStore` locks only within one process and is for local development.
33
+
34
+ A Postgres store can hold a transaction-scoped advisory lock for the whole callback (all workers must use the same database):
35
+
36
+ ```ts
37
+ async function lock<T>(userId: string, fn: () => Promise<T>): Promise<T> {
38
+ const db = await pool.connect();
39
+ try {
40
+ await db.query('BEGIN');
41
+ await db.query('SELECT pg_advisory_xact_lock(hashtextextended($1, 0))', [userId]);
42
+ const result = await fn(); // load, token request, and save complete before COMMIT
43
+ await db.query('COMMIT');
44
+ return result;
45
+ } catch (error) {
46
+ await db.query('ROLLBACK');
47
+ throw error;
48
+ } finally { db.release(); }
49
+ }
50
+ ```
51
+
52
+ `refresh_token_reused` means the app's processes raced on one refresh token; the directory invalidates the grant's refresh tokens, so the user reconnects (without another consent page). Fix the store's `lock` before reconnecting or the race will recur. `runtime_provisioning` means the user's runtime is still being set up and the SDK retries the token request.
53
+
20
54
  ## Options
21
55
 
22
56
  | Option | Type | Default | Meaning |
@@ -13,6 +13,8 @@ when-and-why-to-read: When you need Errors, this knowledge should be read
13
13
 
14
14
  Exceptions are for the layer underneath: the SDK rejected an invalid local identifier or configuration, the daemon refused the request, the connection failed, the request timed out, or you aborted.
15
15
 
16
+ An error without `origin` was produced by the SDK because the request reached no server (runtime, router, or directory). Show it as a connection failure, never as a refusal. An OAuth ID token with a missing or mismatched nonce raises the SDK-only `id_token_invalid` code.
17
+
16
18
  ## Classes and mappings
17
19
 
18
20
  Every class below extends `APIError`, which carries `status`, `code`, `message`, `details`, and `headers`.
@@ -45,9 +45,9 @@ Every method accepts `RequestOptions` as its final optional argument (`signal`,
45
45
  | `memory.history(name, query?, options?)` | `name`; `MemoryHistoryQuery` | `MemoryHistoryDTO` |
46
46
  | `memory.resolve(name, scope?, options?)` | `name`; `MemoryScope` | `MemoryDocRefDTO` |
47
47
 
48
- `MemoryDocCreateRequest` requires `name`, `kind`, `when_and_why_to_read`, and `body`; it also accepts `frontmatter`, `extensions`, and the scope fields. `MemoryDocUpdateRequest` requires `rationale`, which is stored in revision history rather than document text, and optionally accepts `body`, `frontmatter`, `extensions`, `unset`, and the scope fields. `MemoryDocMoveRequest` requires `to` and accepts the scope fields.
48
+ `MemoryDocCreateRequest` requires `name`, `kind`, `when_and_why_to_read`, and `body`; it also accepts `frontmatter`, `extensions`, and the scope fields. `frontmatter.privacy` accepts `public`, `friends`, or `private`; creation defaults to persisted `public`. `MemoryDocUpdateRequest` requires `rationale`, which is stored in revision history rather than document text, and optionally accepts `body`, `frontmatter`, `extensions`, `unset`, and the scope fields. Set `frontmatter.privacy` to change the level; it cannot be unset. A legacy document without the field reads as `private`. `MemoryDocMoveRequest` requires `to` and accepts the scope fields.
49
49
 
50
- `retrieve` returns the body by default. With `frontmatter: true`, its `body` is the complete document source. `MemoryDocDTO` also contains `frontmatter`, `representation` (`'leaf-file'` or `'directory-index'`), `links`, and any lint `findings`; document DTOs include their canonical name, kind, scope, extensions, path, store root, physical relative path, and any competing candidates. `resolve` returns the winning document's location and optional plugin name without reading its body.
50
+ `retrieve` returns the body by default. With `frontmatter: true`, its `body` is the complete document source with the effective privacy level included for older documents. `MemoryDocDTO` also contains `privacy`, `frontmatter`, `representation` (`'leaf-file'` or `'directory-index'`), `links`, and any lint `findings`; document DTOs include their canonical name, kind, scope, extensions, path, store root, physical relative path, and any competing candidates. `resolve` returns the winning document's location and optional plugin name without reading its body.
51
51
 
52
52
  ```ts
53
53
  await client.memory.create({
@@ -9,6 +9,27 @@ when-and-why-to-read: When you need Streaming, this knowledge should be read
9
9
 
10
10
  Watch a run as it works: assistant text as it is produced, tool calls as they start and finish, reports as they are pushed, and the settled outcome.
11
11
 
12
+ ## Forwarding a run to a browser
13
+
14
+ The app server keeps the runtime token and connection; the browser connects only to the app. The app server calls `forwardRunEvents(client, runId, {after: cursorFromRequest(request), signal: request.signal})` and returns the Fetch `Response`. After a host cuts the browser connection, EventSource sends its last SSE id as `Last-Event-ID`; `cursorFromRequest` prefers it over the URL's `after` query parameter.
15
+
16
+ Every forwarded run event is an unnamed SSE record with its `sequence_number` as `id` and the complete event object as `data`. Receive all event types with one handler:
17
+
18
+ ```ts
19
+ const source = new EventSource(`/api/runs/${runId}/events?after=${cursor}`);
20
+ source.onmessage = ({data}) => {
21
+ const event = JSON.parse(data);
22
+ if (event.type === 'stream.refused') { showRefusal(event.error); source.close(); return; }
23
+ if (event.type === 'stream.reconnecting') { showConnectionFailure(event.error); return; }
24
+ if (event.type === 'stream.reconnected') { clearConnectionFailure(); return; }
25
+ showRunEvent(event);
26
+ };
27
+ ```
28
+
29
+ The three `stream.*` records are forwarded-stream notices, not daemon run events; they have no `sequence_number` or SSE id. A `stream.refused` carries the full error envelope, including `stream_gap`'s `details.latest_sequence` and `details.earliest_sequence`. The helper ends that response after a refusal. The SDK does not recover a gap by skipping missing events.
30
+
31
+ When the page reloads mid-reply or gets `stream_gap`, the app reads `runs.trace(runId)` through its server and shows each node's `in_progress_message` (`{thinking, text}` or `null`) as that node's open message. The trace's `latest_sequence` is read consistently with its conversations and open messages. Resume `runs.events(runId, {after: trace.latest_sequence})` (or forward with that cursor); do not use a separately read `runs.get` cursor. Continue appending new deltas to the open message, but replace its thinking or text with the complete content repeated by `node.thinking.done` or `node.output_text.done`. This shows the message from its beginning without duplicating content. `runs.get` and every `runs.list` entry expose `latest_sequence` and `last_activity_at`; a cursor equal to `latest_sequence` is not a gap even when older events have expired.
32
+
12
33
  ## The SDK surface
13
34
 
14
35
  ```ts
@@ -1,4 +1,4 @@
1
- import { envProfileId } from '../../../shared/env.js';
1
+ import { envProfileId, isSandboxedNode } from '../../../shared/env.js';
2
2
  import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
3
3
  import {
4
4
  readFileSync,
@@ -11,7 +11,7 @@ import {
11
11
  realpathSync,
12
12
  } from 'node:fs';
13
13
  import { homedir } from 'node:os';
14
- import { join, resolve, dirname } from 'node:path';
14
+ import { join, resolve, dirname, sep } from 'node:path';
15
15
  import { loadProfileManifest } from '../../../core/profiles/manifest.js';
16
16
  import { stripMarkdownComments } from '../../../core/runtime/command-expansion.js';
17
17
  import { expandShellBlocks, DEFAULT_SHELL_TIMEOUT_MS } from '../../../core/runtime/shell-expansion.js';
@@ -146,6 +146,7 @@ function canonicalDir(path: string): string {
146
146
  * and its ancestors come first; selected-profile project pointers widen the
147
147
  * search without letting a duplicate profile entry displace the local copy. */
148
148
  export function projectClaudeDirs(cwd: string, profileProjectDirs: readonly string[]): string[] {
149
+ if (isSandboxedNode()) return [];
149
150
  const out: string[] = [];
150
151
  const seen = new Set<string>();
151
152
  for (const pointer of [cwd, ...profileProjectDirs]) {
@@ -160,6 +161,7 @@ export function projectClaudeDirs(cwd: string, profileProjectDirs: readonly stri
160
161
  }
161
162
 
162
163
  function selectedProfileProjects(): string[] {
164
+ if (isSandboxedNode()) return [];
163
165
  const profileId = envProfileId() ?? "";
164
166
  if (profileId === "") return [];
165
167
  try {
@@ -184,7 +186,9 @@ function pluginDirs(): { name: string; installPath: string }[] {
184
186
  const name = key.split("@")[0];
185
187
  for (const rec of records ?? []) {
186
188
  if (!rec.installPath) continue;
187
- out.push({ name, installPath: rec.installPath });
189
+ const installPath = resolve(rec.installPath);
190
+ if (isSandboxedNode() && !installPath.startsWith(resolve(HOME) + sep)) continue;
191
+ out.push({ name, installPath });
188
192
  }
189
193
  }
190
194
  return out;
@@ -330,7 +334,7 @@ const TOKEN_REGEX = /\$(?:\{\d+:-[^}]*\}|\{@:\d+(?::\d+)?\}|\d+|ARGUMENTS|@)/;
330
334
  * handler (such as the command shim path above). */
331
335
  function nativePromptBody(name: string, cwd: string): string | undefined {
332
336
  if (name.includes("/") || name.includes("\\") || name.includes("\0")) return undefined;
333
- for (const dir of [PI_PROMPTS, join(cwd, PROJECT_PI_PROMPTS)]) {
337
+ for (const dir of isSandboxedNode() ? [PI_PROMPTS] : [PI_PROMPTS, join(cwd, PROJECT_PI_PROMPTS)]) {
334
338
  try {
335
339
  const raw = readFileSync(join(dir, `${name}.md`), "utf8");
336
340
  return splitFrontmatter(raw).body;