@fnndsc/brasa 0.34.0 → 0.35.0

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 (422) hide show
  1. package/dist/api/models.d.ts +1 -2
  2. package/dist/api/models.js.map +1 -1
  3. package/dist/buildinfo.json +1 -1
  4. package/dist/builtins/debug.d.ts +1 -1
  5. package/dist/builtins/debug.js +12 -8
  6. package/dist/builtins/debug.js.map +1 -1
  7. package/dist/builtins/executable.d.ts +1 -1
  8. package/dist/builtins/executable.js +2 -1
  9. package/dist/builtins/executable.js.map +1 -1
  10. package/dist/builtins/fs/acl.d.ts +1 -16
  11. package/dist/builtins/fs/acl.js +3 -1
  12. package/dist/builtins/fs/acl.js.map +1 -1
  13. package/dist/builtins/fs/archive.js +1 -1
  14. package/dist/builtins/fs/archive.js.map +1 -1
  15. package/dist/builtins/fs/cat.d.ts +1 -1
  16. package/dist/builtins/fs/cat.js +47 -7
  17. package/dist/builtins/fs/cat.js.map +1 -1
  18. package/dist/builtins/fs/cd.d.ts +1 -19
  19. package/dist/builtins/fs/cd.js +45 -94
  20. package/dist/builtins/fs/cd.js.map +1 -1
  21. package/dist/builtins/fs/configWrite.d.ts +1 -1
  22. package/dist/builtins/fs/configWrite.js +1 -1
  23. package/dist/builtins/fs/configWrite.js.map +1 -1
  24. package/dist/builtins/fs/cp.d.ts +1 -1
  25. package/dist/builtins/fs/cp.js +19 -13
  26. package/dist/builtins/fs/cp.js.map +1 -1
  27. package/dist/builtins/fs/download.d.ts +1 -1
  28. package/dist/builtins/fs/download.js +2 -1
  29. package/dist/builtins/fs/download.js.map +1 -1
  30. package/dist/builtins/fs/du.d.ts +10 -1
  31. package/dist/builtins/fs/du.js +36 -2
  32. package/dist/builtins/fs/du.js.map +1 -1
  33. package/dist/builtins/fs/edit.d.ts +1 -1
  34. package/dist/builtins/fs/edit.js +10 -4
  35. package/dist/builtins/fs/edit.js.map +1 -1
  36. package/dist/builtins/fs/entries.d.ts +43 -0
  37. package/dist/builtins/fs/entries.js +81 -0
  38. package/dist/builtins/fs/entries.js.map +1 -0
  39. package/dist/builtins/fs/ls.d.ts +1 -2
  40. package/dist/builtins/fs/ls.js +70 -10
  41. package/dist/builtins/fs/ls.js.map +1 -1
  42. package/dist/builtins/fs/mkdir.d.ts +1 -1
  43. package/dist/builtins/fs/mkdir.js +29 -20
  44. package/dist/builtins/fs/mkdir.js.map +1 -1
  45. package/dist/builtins/fs/mv.d.ts +1 -1
  46. package/dist/builtins/fs/mv.js +40 -23
  47. package/dist/builtins/fs/mv.js.map +1 -1
  48. package/dist/builtins/fs/pull.d.ts +1 -1
  49. package/dist/builtins/fs/pull.js +2 -1
  50. package/dist/builtins/fs/pull.js.map +1 -1
  51. package/dist/builtins/fs/pwd.d.ts +1 -1
  52. package/dist/builtins/fs/pwd.js +9 -45
  53. package/dist/builtins/fs/pwd.js.map +1 -1
  54. package/dist/builtins/fs/rm.d.ts +1 -22
  55. package/dist/builtins/fs/rm.js +33 -58
  56. package/dist/builtins/fs/rm.js.map +1 -1
  57. package/dist/builtins/fs/rmdir.d.ts +1 -1
  58. package/dist/builtins/fs/rmdir.js +21 -40
  59. package/dist/builtins/fs/rmdir.js.map +1 -1
  60. package/dist/builtins/fs/touch.d.ts +1 -1
  61. package/dist/builtins/fs/touch.js +64 -25
  62. package/dist/builtins/fs/touch.js.map +1 -1
  63. package/dist/builtins/fs/tree.d.ts +1 -1
  64. package/dist/builtins/fs/tree.js +26 -3
  65. package/dist/builtins/fs/tree.js.map +1 -1
  66. package/dist/builtins/fs/upload.d.ts +1 -1
  67. package/dist/builtins/fs/upload.js +3 -1
  68. package/dist/builtins/fs/upload.js.map +1 -1
  69. package/dist/builtins/fs/xattr.d.ts +1 -10
  70. package/dist/builtins/fs/xattr.js +3 -1
  71. package/dist/builtins/fs/xattr.js.map +1 -1
  72. package/dist/builtins/games/bytes.d.ts +1 -1
  73. package/dist/builtins/games/bytes.js +2 -1
  74. package/dist/builtins/games/bytes.js.map +1 -1
  75. package/dist/builtins/games/chimes.d.ts +1 -13
  76. package/dist/builtins/games/chimes.js +1 -1
  77. package/dist/builtins/games/chimes.js.map +1 -1
  78. package/dist/builtins/games/chrislab.d.ts +33 -0
  79. package/dist/builtins/games/chrislab.js +117 -0
  80. package/dist/builtins/games/chrislab.js.map +1 -0
  81. package/dist/builtins/games/cowsay.d.ts +1 -11
  82. package/dist/builtins/games/cowsay.js +1 -1
  83. package/dist/builtins/games/cowsay.js.map +1 -1
  84. package/dist/builtins/games/figlet.d.ts +1 -11
  85. package/dist/builtins/games/figlet.js +1 -1
  86. package/dist/builtins/games/figlet.js.map +1 -1
  87. package/dist/builtins/games/lab.d.ts +1 -43
  88. package/dist/builtins/games/lab.js +7 -111
  89. package/dist/builtins/games/lab.js.map +1 -1
  90. package/dist/builtins/games/lolcat.d.ts +1 -11
  91. package/dist/builtins/games/lolcat.js +1 -1
  92. package/dist/builtins/games/lolcat.js.map +1 -1
  93. package/dist/builtins/games/morse.d.ts +1 -10
  94. package/dist/builtins/games/morse.js +1 -1
  95. package/dist/builtins/games/morse.js.map +1 -1
  96. package/dist/builtins/games/numbers.d.ts +1 -10
  97. package/dist/builtins/games/numbers.js +1 -1
  98. package/dist/builtins/games/numbers.js.map +1 -1
  99. package/dist/builtins/games/play.d.ts +1 -11
  100. package/dist/builtins/games/play.js +1 -1
  101. package/dist/builtins/games/play.js.map +1 -1
  102. package/dist/builtins/games/qr.d.ts +1 -12
  103. package/dist/builtins/games/qr.js +1 -1
  104. package/dist/builtins/games/qr.js.map +1 -1
  105. package/dist/builtins/games/show.d.ts +1 -12
  106. package/dist/builtins/games/show.js +1 -1
  107. package/dist/builtins/games/show.js.map +1 -1
  108. package/dist/builtins/games/sky.d.ts +1 -11
  109. package/dist/builtins/games/sky.js +1 -1
  110. package/dist/builtins/games/sky.js.map +1 -1
  111. package/dist/builtins/games/text.d.ts +1 -10
  112. package/dist/builtins/games/text.js +1 -1
  113. package/dist/builtins/games/text.js.map +1 -1
  114. package/dist/builtins/games/wtf.d.ts +1 -9
  115. package/dist/builtins/games/wtf.js +1 -1
  116. package/dist/builtins/games/wtf.js.map +1 -1
  117. package/dist/builtins/help.d.ts +18 -15
  118. package/dist/builtins/help.js +51 -1200
  119. package/dist/builtins/help.js.map +1 -1
  120. package/dist/builtins/net/connect.d.ts +1 -1
  121. package/dist/builtins/net/connect.js +2 -1
  122. package/dist/builtins/net/connect.js.map +1 -1
  123. package/dist/builtins/net/cubepath.d.ts +1 -1
  124. package/dist/builtins/net/cubepath.js +1 -1
  125. package/dist/builtins/net/cubepath.js.map +1 -1
  126. package/dist/builtins/net/logout.d.ts +1 -1
  127. package/dist/builtins/net/logout.js +1 -1
  128. package/dist/builtins/net/logout.js.map +1 -1
  129. package/dist/builtins/net/netstat.d.ts +1 -1
  130. package/dist/builtins/net/netstat.js +1 -2
  131. package/dist/builtins/net/netstat.js.map +1 -1
  132. package/dist/builtins/net/pacs.d.ts +1 -1
  133. package/dist/builtins/net/pacs.js +3 -2
  134. package/dist/builtins/net/pacs.js.map +1 -1
  135. package/dist/builtins/net/pacsUtils.js +2 -1
  136. package/dist/builtins/net/pacsUtils.js.map +1 -1
  137. package/dist/builtins/net/query.csv.js +1 -1
  138. package/dist/builtins/net/query.csv.js.map +1 -1
  139. package/dist/builtins/net/query.d.ts +2 -2
  140. package/dist/builtins/net/query.fanout.d.ts +1 -1
  141. package/dist/builtins/net/query.fanout.js +1 -1
  142. package/dist/builtins/net/query.fanout.js.map +1 -1
  143. package/dist/builtins/net/query.js +3 -2
  144. package/dist/builtins/net/query.js.map +1 -1
  145. package/dist/builtins/net/status.d.ts +1 -1
  146. package/dist/builtins/net/status.js +2 -1
  147. package/dist/builtins/net/status.js.map +1 -1
  148. package/dist/builtins/parametersofplugin.d.ts +1 -1
  149. package/dist/builtins/parametersofplugin.js +1 -1
  150. package/dist/builtins/parametersofplugin.js.map +1 -1
  151. package/dist/builtins/pluginExecute.d.ts +1 -1
  152. package/dist/builtins/pluginExecute.js +3 -1
  153. package/dist/builtins/pluginExecute.js.map +1 -1
  154. package/dist/builtins/proc.d.ts +1 -2
  155. package/dist/builtins/proc.js +4 -3
  156. package/dist/builtins/proc.js.map +1 -1
  157. package/dist/builtins/res/compute.d.ts +1 -1
  158. package/dist/builtins/res/compute.js +2 -1
  159. package/dist/builtins/res/compute.js.map +1 -1
  160. package/dist/builtins/res/dicom.d.ts +2 -2
  161. package/dist/builtins/res/dicom.js +1 -2
  162. package/dist/builtins/res/dicom.js.map +1 -1
  163. package/dist/builtins/res/expect.d.ts +1 -1
  164. package/dist/builtins/res/expect.js +2 -1
  165. package/dist/builtins/res/expect.js.map +1 -1
  166. package/dist/builtins/res/feed.d.ts +1 -1
  167. package/dist/builtins/res/feed.diagram.d.ts +1 -2
  168. package/dist/builtins/res/feed.diagram.js +2 -2
  169. package/dist/builtins/res/feed.diagram.js.map +1 -1
  170. package/dist/builtins/res/feed.js +3 -1
  171. package/dist/builtins/res/feed.js.map +1 -1
  172. package/dist/builtins/res/feed.tree.d.ts +1 -1
  173. package/dist/builtins/res/feed.tree.js +1 -1
  174. package/dist/builtins/res/feed.tree.js.map +1 -1
  175. package/dist/builtins/res/files.d.ts +1 -1
  176. package/dist/builtins/res/files.js +1 -1
  177. package/dist/builtins/res/files.js.map +1 -1
  178. package/dist/builtins/res/gather.d.ts +1 -1
  179. package/dist/builtins/res/gather.js +1 -1
  180. package/dist/builtins/res/gather.js.map +1 -1
  181. package/dist/builtins/res/gather.store.js.map +1 -1
  182. package/dist/builtins/res/group.d.ts +1 -1
  183. package/dist/builtins/res/group.js +1 -1
  184. package/dist/builtins/res/group.js.map +1 -1
  185. package/dist/builtins/res/image.d.ts +1 -20
  186. package/dist/builtins/res/image.js +1 -2
  187. package/dist/builtins/res/image.js.map +1 -1
  188. package/dist/builtins/res/pipeline.d.ts +1 -1
  189. package/dist/builtins/res/pipeline.diagram.d.ts +1 -1
  190. package/dist/builtins/res/pipeline.diagram.js +2 -2
  191. package/dist/builtins/res/pipeline.diagram.js.map +1 -1
  192. package/dist/builtins/res/pipeline.js +3 -1
  193. package/dist/builtins/res/pipeline.js.map +1 -1
  194. package/dist/builtins/res/play.d.ts +1 -1
  195. package/dist/builtins/res/play.js +2 -1
  196. package/dist/builtins/res/play.js.map +1 -1
  197. package/dist/builtins/res/plugin.d.ts +1 -1
  198. package/dist/builtins/res/plugin.info.d.ts +1 -1
  199. package/dist/builtins/res/plugin.info.js +2 -1
  200. package/dist/builtins/res/plugin.info.js.map +1 -1
  201. package/dist/builtins/res/plugin.js +2 -2
  202. package/dist/builtins/res/plugin.js.map +1 -1
  203. package/dist/builtins/res/plugininstance.d.ts +1 -1
  204. package/dist/builtins/res/plugininstance.js +1 -1
  205. package/dist/builtins/res/plugininstance.js.map +1 -1
  206. package/dist/builtins/res/pluginmeta.d.ts +1 -1
  207. package/dist/builtins/res/pluginmeta.js +1 -1
  208. package/dist/builtins/res/pluginmeta.js.map +1 -1
  209. package/dist/builtins/res/record.d.ts +1 -1
  210. package/dist/builtins/res/record.js +1 -1
  211. package/dist/builtins/res/record.js.map +1 -1
  212. package/dist/builtins/res/tag.d.ts +1 -1
  213. package/dist/builtins/res/tag.js +1 -1
  214. package/dist/builtins/res/tag.js.map +1 -1
  215. package/dist/builtins/res/user.d.ts +1 -1
  216. package/dist/builtins/res/user.js +2 -1
  217. package/dist/builtins/res/user.js.map +1 -1
  218. package/dist/builtins/res/workflow.d.ts +1 -1
  219. package/dist/builtins/res/workflow.js +1 -1
  220. package/dist/builtins/res/workflow.js.map +1 -1
  221. package/dist/builtins/store.d.ts +1 -1
  222. package/dist/builtins/store.js +2 -1
  223. package/dist/builtins/store.js.map +1 -1
  224. package/dist/builtins/sys/cal.d.ts +1 -12
  225. package/dist/builtins/sys/cal.js +1 -1
  226. package/dist/builtins/sys/cal.js.map +1 -1
  227. package/dist/builtins/sys/context.d.ts +1 -1
  228. package/dist/builtins/sys/context.js +1 -1
  229. package/dist/builtins/sys/context.js.map +1 -1
  230. package/dist/builtins/sys/date.d.ts +1 -12
  231. package/dist/builtins/sys/date.js +1 -1
  232. package/dist/builtins/sys/date.js.map +1 -1
  233. package/dist/builtins/sys/fortune.d.ts +1 -11
  234. package/dist/builtins/sys/fortune.js +1 -1
  235. package/dist/builtins/sys/fortune.js.map +1 -1
  236. package/dist/builtins/sys/motd.d.ts +1 -18
  237. package/dist/builtins/sys/motd.js +3 -3
  238. package/dist/builtins/sys/motd.js.map +1 -1
  239. package/dist/builtins/sys/notes.d.ts +1 -2
  240. package/dist/builtins/sys/notes.js +1 -2
  241. package/dist/builtins/sys/notes.js.map +1 -1
  242. package/dist/builtins/sys/physicalmode.d.ts +1 -1
  243. package/dist/builtins/sys/physicalmode.js +1 -1
  244. package/dist/builtins/sys/physicalmode.js.map +1 -1
  245. package/dist/builtins/sys/timing.d.ts +1 -1
  246. package/dist/builtins/sys/timing.js +1 -1
  247. package/dist/builtins/sys/timing.js.map +1 -1
  248. package/dist/builtins/sys/version.d.ts +1 -7
  249. package/dist/builtins/sys/version.js +1 -1
  250. package/dist/builtins/sys/version.js.map +1 -1
  251. package/dist/builtins/sys/weather.d.ts +1 -1
  252. package/dist/builtins/sys/weather.js +1 -1
  253. package/dist/builtins/sys/weather.js.map +1 -1
  254. package/dist/builtins/sys/whoami.d.ts +1 -1
  255. package/dist/builtins/sys/whoami.js +2 -1
  256. package/dist/builtins/sys/whoami.js.map +1 -1
  257. package/dist/builtins/utils.d.ts +2 -19
  258. package/dist/builtins/utils.js +5 -55
  259. package/dist/builtins/utils.js.map +1 -1
  260. package/dist/builtins/wildcard.d.ts +4 -53
  261. package/dist/builtins/wildcard.js +3 -177
  262. package/dist/builtins/wildcard.js.map +1 -1
  263. package/dist/chris/backend.d.ts +22 -0
  264. package/dist/chris/backend.js +102 -0
  265. package/dist/chris/backend.js.map +1 -0
  266. package/dist/chris/binEntry.js.map +1 -0
  267. package/dist/chris/binMount.d.ts +60 -0
  268. package/dist/chris/binMount.js +154 -0
  269. package/dist/chris/binMount.js.map +1 -0
  270. package/dist/{core → chris}/chiliDelegate.d.ts +1 -1
  271. package/dist/{core → chris}/chiliDelegate.js +1 -1
  272. package/dist/chris/chiliDelegate.js.map +1 -0
  273. package/dist/chris/chrisCommands.d.ts +14 -0
  274. package/dist/chris/chrisCommands.js +168 -0
  275. package/dist/chris/chrisCommands.js.map +1 -0
  276. package/dist/chris/commandFallback.d.ts +3 -0
  277. package/dist/chris/commandFallback.js +113 -0
  278. package/dist/chris/commandFallback.js.map +1 -0
  279. package/dist/chris/completion.d.ts +3 -0
  280. package/dist/chris/completion.js +100 -0
  281. package/dist/chris/completion.js.map +1 -0
  282. package/dist/chris/connect.js.map +1 -0
  283. package/dist/chris/debug.d.ts +10 -0
  284. package/dist/chris/debug.js +9 -0
  285. package/dist/chris/debug.js.map +1 -0
  286. package/dist/chris/files.d.ts +16 -0
  287. package/dist/chris/files.js +141 -0
  288. package/dist/chris/files.js.map +1 -0
  289. package/dist/chris/filesystem.d.ts +3 -0
  290. package/dist/chris/filesystem.js +57 -0
  291. package/dist/chris/filesystem.js.map +1 -0
  292. package/dist/chris/help.d.ts +16 -0
  293. package/dist/chris/help.js +1193 -0
  294. package/dist/chris/help.js.map +1 -0
  295. package/dist/chris/jobsState.js.map +1 -0
  296. package/dist/chris/mounts.d.ts +7 -0
  297. package/dist/chris/mounts.js +34 -0
  298. package/dist/chris/mounts.js.map +1 -0
  299. package/dist/chris/navigation.d.ts +40 -0
  300. package/dist/chris/navigation.js +160 -0
  301. package/dist/chris/navigation.js.map +1 -0
  302. package/dist/{core → chris}/promptContext.d.ts +2 -2
  303. package/dist/{core → chris}/promptContext.js +3 -3
  304. package/dist/chris/promptContext.js.map +1 -0
  305. package/dist/chris/references.d.ts +14 -0
  306. package/dist/chris/references.js +113 -0
  307. package/dist/chris/references.js.map +1 -0
  308. package/dist/chris/tasks.d.ts +31 -0
  309. package/dist/chris/tasks.js +55 -0
  310. package/dist/chris/tasks.js.map +1 -0
  311. package/dist/chris/universeLayout.js.map +1 -0
  312. package/dist/chris/watch.d.ts +3 -0
  313. package/dist/chris/watch.js +15 -0
  314. package/dist/chris/watch.js.map +1 -0
  315. package/dist/core/answerKinds.d.ts +32 -0
  316. package/dist/core/answerKinds.js +56 -0
  317. package/dist/core/answerKinds.js.map +1 -0
  318. package/dist/core/backend.d.ts +261 -0
  319. package/dist/core/backend.js +32 -0
  320. package/dist/core/backend.js.map +1 -0
  321. package/dist/core/commandOrder.d.ts +16 -0
  322. package/dist/core/commandOrder.js +17 -0
  323. package/dist/core/commandOrder.js.map +1 -0
  324. package/dist/core/commandRegistry.d.ts +120 -0
  325. package/dist/core/commandRegistry.js +124 -0
  326. package/dist/core/commandRegistry.js.map +1 -0
  327. package/dist/core/coreCommands.d.ts +16 -0
  328. package/dist/core/coreCommands.js +156 -0
  329. package/dist/core/coreCommands.js.map +1 -0
  330. package/dist/core/dispatch.d.ts +2 -19
  331. package/dist/core/dispatch.js +86 -447
  332. package/dist/core/dispatch.js.map +1 -1
  333. package/dist/core/elevation.d.ts +5 -5
  334. package/dist/core/elevation.js +12 -7
  335. package/dist/core/elevation.js.map +1 -1
  336. package/dist/core/engine.d.ts +12 -18
  337. package/dist/core/engine.js +40 -117
  338. package/dist/core/engine.js.map +1 -1
  339. package/dist/core/errorText.d.ts +14 -0
  340. package/dist/core/errorText.js +26 -0
  341. package/dist/core/errorText.js.map +1 -0
  342. package/dist/core/expansion.d.ts +0 -2
  343. package/dist/core/expansion.js +43 -101
  344. package/dist/core/expansion.js.map +1 -1
  345. package/dist/core/fileRefusal.d.ts +4 -15
  346. package/dist/core/fileRefusal.js +4 -26
  347. package/dist/core/fileRefusal.js.map +1 -1
  348. package/dist/core/filesystem.d.ts +27 -0
  349. package/dist/core/filesystem.js +45 -0
  350. package/dist/core/filesystem.js.map +1 -0
  351. package/dist/core/handlerRun.d.ts +30 -0
  352. package/dist/core/handlerRun.js +34 -0
  353. package/dist/core/handlerRun.js.map +1 -0
  354. package/dist/core/paths.d.ts +18 -0
  355. package/dist/core/paths.js +49 -0
  356. package/dist/core/paths.js.map +1 -0
  357. package/dist/core/preprocess.d.ts +1 -1
  358. package/dist/core/preprocess.js +1 -1
  359. package/dist/core/preprocess.js.map +1 -1
  360. package/dist/core/sink.d.ts +1 -1
  361. package/dist/core/sink.js +0 -8
  362. package/dist/core/sink.js.map +1 -1
  363. package/dist/core/taskWatch.d.ts +42 -0
  364. package/dist/core/taskWatch.js +142 -0
  365. package/dist/core/taskWatch.js.map +1 -0
  366. package/dist/core/tasks.d.ts +46 -0
  367. package/dist/core/tasks.js +102 -0
  368. package/dist/core/tasks.js.map +1 -0
  369. package/dist/core.d.ts +22 -0
  370. package/dist/core.js +23 -0
  371. package/dist/core.js.map +1 -0
  372. package/dist/index.d.ts +8 -5
  373. package/dist/index.js +17 -5
  374. package/dist/index.js.map +1 -1
  375. package/dist/lib/completer/index.js +41 -99
  376. package/dist/lib/completer/index.js.map +1 -1
  377. package/dist/lib/prefetch.js +2 -2
  378. package/dist/lib/prefetch.js.map +1 -1
  379. package/dist/lib/vfs/listing.d.ts +1 -1
  380. package/dist/lib/vfs/providers/static.d.ts +15 -6
  381. package/dist/lib/vfs/providers/static.js +20 -43
  382. package/dist/lib/vfs/providers/static.js.map +1 -1
  383. package/dist/lib/vfs/providers/static_content.d.ts +4 -4
  384. package/dist/lib/vfs/providers/static_content.js +4 -24
  385. package/dist/lib/vfs/providers/static_content.js.map +1 -1
  386. package/dist/lib/vfs/vfs.d.ts +11 -2
  387. package/dist/lib/vfs/vfs.js +90 -51
  388. package/dist/lib/vfs/vfs.js.map +1 -1
  389. package/dist/lib/wildcard.d.ts +57 -0
  390. package/dist/lib/wildcard.js +183 -0
  391. package/dist/lib/wildcard.js.map +1 -0
  392. package/dist/notes.json +1 -1
  393. package/dist/null/backend.d.ts +29 -0
  394. package/dist/null/backend.js +41 -0
  395. package/dist/null/backend.js.map +1 -0
  396. package/dist/session/answer.d.ts +4 -4
  397. package/dist/session/answer.js +0 -2
  398. package/dist/session/answer.js.map +1 -1
  399. package/dist/session/index.d.ts +12 -10
  400. package/dist/session/index.js +9 -38
  401. package/dist/session/index.js.map +1 -1
  402. package/package.json +12 -6
  403. package/dist/builtins/fs/folderExists.d.ts +0 -8
  404. package/dist/builtins/fs/folderExists.js +0 -67
  405. package/dist/builtins/fs/folderExists.js.map +0 -1
  406. package/dist/command-keys.d.ts +0 -8
  407. package/dist/command-keys.js +0 -37
  408. package/dist/command-keys.js.map +0 -1
  409. package/dist/core/chiliDelegate.js.map +0 -1
  410. package/dist/core/connect.js.map +0 -1
  411. package/dist/core/jobsState.js.map +0 -1
  412. package/dist/core/promptContext.js.map +0 -1
  413. package/dist/lib/vfs/providers/binEntry.js.map +0 -1
  414. package/dist/universe/universeLayout.js.map +0 -1
  415. /package/dist/{lib/vfs/providers → chris}/binEntry.d.ts +0 -0
  416. /package/dist/{lib/vfs/providers → chris}/binEntry.js +0 -0
  417. /package/dist/{core → chris}/connect.d.ts +0 -0
  418. /package/dist/{core → chris}/connect.js +0 -0
  419. /package/dist/{core → chris}/jobsState.d.ts +0 -0
  420. /package/dist/{core → chris}/jobsState.js +0 -0
  421. /package/dist/{universe → chris}/universeLayout.d.ts +0 -0
  422. /package/dist/{universe → chris}/universeLayout.js +0 -0
@@ -12,330 +12,37 @@
12
12
  *
13
13
  * @module
14
14
  */
15
- import { builtin_rev, builtin_tac, builtin_yes, builtin_seq, builtin_shuf, builtin_rot13 } from '../builtins/games/text.js';
16
- import { builtin_factor, builtin_primes, builtin_roll, builtin_calc, builtin_units } from '../builtins/games/numbers.js';
17
- import { builtin_cowsay, builtin_cowthink } from '../builtins/games/cowsay.js';
18
- import { builtin_figlet, builtin_banner } from '../builtins/games/figlet.js';
19
- import { builtin_lolcat } from '../builtins/games/lolcat.js';
20
- import { builtin_morse } from '../builtins/games/morse.js';
21
- import { builtin_who, builtin_uptime, builtin_ping, builtin_chrisfetch, builtin_say } from '../builtins/games/lab.js';
22
- import { builtin_wtf } from '../builtins/games/wtf.js';
23
- import { builtin_file, builtin_xxd, builtin_strings, builtin_sha256sum, builtin_md5sum } from '../builtins/games/bytes.js';
24
- import { builtin_qr } from '../builtins/games/qr.js';
25
- import { builtin_pom, builtin_stardate, builtin_ddate, builtin_sunrise } from '../builtins/games/sky.js';
26
- import { builtin_timer, builtin_leave, builtin_stopwatch } from '../builtins/games/chimes.js';
27
- import { builtin_sl, builtin_cmatrix, builtin_rain, builtin_asciiquarium, builtin_tetris, builtin_snake } from '../builtins/games/show.js';
28
- import { builtin_quiz, builtin_hangman, builtin_2048 } from '../builtins/games/play.js';
29
- import { builtin_notes } from '../builtins/sys/notes.js';
15
+ import { commands_register, commandOrder_set, envelopeHandler_get, plainHandler_get, builtinCommand_has } from './commandRegistry.js';
16
+ import { coreCommands } from './coreCommands.js';
17
+ import { ENVELOPE_ORDER, PLAIN_ORDER, HELP_ORDER } from './commandOrder.js';
30
18
  import { stdin_set } from '../builtins/games/stdin.js';
31
- import { builtin_netstat } from '../builtins/net/netstat.js';
32
19
  import { writeFileSync, appendFileSync } from 'fs';
33
20
  import chalk from 'chalk';
34
- import { builtin_cd, builtin_ls, builtin_pwd, builtin_connect, builtin_logout, builtin_cat, builtin_cp, builtin_mv, builtin_upload, builtin_pacs, builtin_pipeline, builtin_pull, builtin_query, builtin_cubepath, builtin_dcm, builtin_image, builtin_rm, builtin_setfacl, builtin_getfacl, builtin_chmod, builtin_setfattr, builtin_getfattr, builtin_touch, builtin_mkdir, builtin_rmdir, builtin_plugin, builtin_feed, builtin_compute, builtin_tag, builtin_expect, builtin_play, builtin_record, builtin_gather, builtin_group, builtin_user, builtin_pluginmeta, builtin_plugininstance, builtin_workflow, builtin_download, builtin_edit, builtin_config, builtin_files, builtin_links, builtin_dirs, builtin_context, builtin_parametersofplugin, builtin_physicalmode, builtin_timing, builtin_id, builtin_whoami, builtin_whereami, builtin_version, builtin_fortune, builtin_weather, builtin_motd, builtin_date, builtin_cal, builtin_debug, builtin_help, builtin_tree, builtin_du, builtin_store, error_stripDebugPrefix } from '../builtins/index.js';
35
- import { builtin_executePlugin } from '../builtins/pluginExecute.js';
36
- import { builtin_proc } from '../builtins/proc.js';
37
- import { shellWords_expand } from '../builtins/wildcard.js';
38
- import { help_render, commandHelp_get, pipelineExecutableHelp_render, args_checkHasHelpFlag, } from '../builtins/help.js';
39
- import { pluginExecutable_handle } from '../builtins/executable.js';
40
- import { errorStack, Ok, Err, envelope_error } from '@fnndsc/cumin';
41
- import { envelopeHandler_wrap, envelope_deliver, sink_get, PipeCaptureSink, sinkScope_run } from './sink.js';
21
+ import { error_stripDebugPrefix } from './errorText.js';
22
+ import { exitCode_read, handler_runDirect } from './handlerRun.js';
23
+ import { backendInstalled_get } from './backend.js';
24
+ import { shellWords_expand } from '../lib/wildcard.js';
25
+ import { help_render, helpMissing_render, verb_available, commandHelp_get, args_checkHasHelpFlag, } from '../builtins/help.js';
26
+ import { envelope_deliver, sink_get, PipeCaptureSink, sinkScope_run } from './sink.js';
42
27
  import { reference_refusal, reference_resolve, unresolvedStands_get, verbInHand_set } from './expansion.js';
43
28
  import { answer_note, answerConsulted_take } from '../session/answer.js';
44
- import { vfs } from '../lib/vfs/vfs.js';
45
29
  import { shellWords_referencesExpand, shellWords_tokenize, shellWords_values, } from '../lib/parser.js';
46
30
  import { surface_get, capability_require } from './surface.js';
47
31
  import { sudoCommand_run } from './elevation.js';
48
32
  import { redirectTarget_resolve, pathnameExpansion_isEligible, } from './preprocess.js';
49
- import { chiliCommand_run, chiliCommand_exists, chiliDelegationNotice_build } from './chiliDelegate.js';
50
- export { chiliCommand_run };
33
+ import { envelope_error } from '@fnndsc/menu';
34
+ import { errorStack, Ok, Err } from '@fnndsc/fond';
51
35
  /**
52
- * Handles a command chell does not recognize. If chili has no such command
53
- * either, reports `command not found` on the error channel and does not
54
- * delegate — no chili run, no context init. Otherwise emits the hand-off notice
55
- * on the live sink *before* running chili, so the notice appears ahead of
56
- * chili's (possibly slow) output rather than being glued on after it returns.
57
- *
58
- * @param command - The unrecognized command name.
59
- * @param args - The command's arguments.
60
- * @returns The delivered envelope (chili's result, or a not-found error).
61
- */
62
- async function unknownCommand_delegate(command, args) {
63
- if (!(await chiliCommand_exists(command))) {
64
- const envelope = envelope_error('', undefined, `${chalk.red(`chell: command not found: ${command}`)}\n`);
65
- envelope_deliver(envelope);
66
- return envelope;
67
- }
68
- sink_get().data_write(chiliDelegationNotice_build(command));
69
- const chiliEnvelope = await chiliCommand_run(command, ['-s', ...args]);
70
- envelope_deliver(chiliEnvelope);
71
- return chiliEnvelope;
72
- }
73
- /**
74
- * Builtins that have been converted to return envelopes, keyed by command
75
- * name. Entries here are also present in COMMAND_HANDLERS in wrapped form;
76
- * this registry exists so envelope-aware hosts can bypass the wrapper and
77
- * receive the structured result.
36
+ * Shape of a converted builtin: returns its outcome as an envelope instead
37
+ * of printing. The engine layer will consume these directly; the dispatch
38
+ * table below consumes them through {@link envelopeHandler_wrap}.
78
39
  */
79
- export const ENVELOPE_HANDLERS = {
80
- cat: builtin_cat,
81
- cd: builtin_cd,
82
- cp: builtin_cp,
83
- mv: builtin_mv,
84
- rm: builtin_rm,
85
- setfacl: builtin_setfacl,
86
- getfacl: builtin_getfacl,
87
- chmod: builtin_chmod,
88
- setfattr: builtin_setfattr,
89
- getfattr: builtin_getfattr,
90
- mkdir: builtin_mkdir,
91
- rmdir: builtin_rmdir,
92
- touch: builtin_touch,
93
- pwd: builtin_pwd,
94
- netstat: builtin_netstat,
95
- id: builtin_id,
96
- whoami: builtin_whoami,
97
- whereami: builtin_whereami,
98
- timing: builtin_timing,
99
- physicalmode: builtin_physicalmode,
100
- debug: builtin_debug,
101
- version: builtin_version,
102
- fortune: builtin_fortune,
103
- cowsay: builtin_cowsay,
104
- cowthink: builtin_cowthink,
105
- figlet: builtin_figlet,
106
- banner: builtin_banner,
107
- lolcat: builtin_lolcat,
108
- rev: builtin_rev,
109
- tac: builtin_tac,
110
- yes: builtin_yes,
111
- seq: builtin_seq,
112
- factor: builtin_factor,
113
- primes: builtin_primes,
114
- shuf: builtin_shuf,
115
- roll: builtin_roll,
116
- rot13: builtin_rot13,
117
- morse: builtin_morse,
118
- calc: builtin_calc,
119
- units: builtin_units,
120
- who: builtin_who,
121
- uptime: builtin_uptime,
122
- ping: builtin_ping,
123
- chrisfetch: builtin_chrisfetch,
124
- say: builtin_say,
125
- wtf: builtin_wtf,
126
- file: builtin_file,
127
- xxd: builtin_xxd,
128
- strings: builtin_strings,
129
- sha256sum: builtin_sha256sum,
130
- md5sum: builtin_md5sum,
131
- qr: builtin_qr,
132
- pom: builtin_pom,
133
- stardate: builtin_stardate,
134
- ddate: builtin_ddate,
135
- sunrise: builtin_sunrise,
136
- timer: builtin_timer,
137
- leave: builtin_leave,
138
- stopwatch: builtin_stopwatch,
139
- sl: builtin_sl,
140
- cmatrix: builtin_cmatrix,
141
- rain: builtin_rain,
142
- asciiquarium: builtin_asciiquarium,
143
- tetris: builtin_tetris,
144
- snake: builtin_snake,
145
- quiz: builtin_quiz,
146
- hangman: builtin_hangman,
147
- '2048': builtin_2048,
148
- weather: builtin_weather,
149
- motd: builtin_motd,
150
- notes: builtin_notes,
151
- date: builtin_date,
152
- cal: builtin_cal,
153
- ls: builtin_ls,
154
- tree: builtin_tree,
155
- du: builtin_du,
156
- help: builtin_help,
157
- proc: builtin_proc,
158
- logout: builtin_logout,
159
- cubepath: builtin_cubepath,
160
- dcm: builtin_dcm,
161
- image: builtin_image,
162
- query: builtin_query,
163
- feed: builtin_feed,
164
- feeds: builtin_feed,
165
- compute: builtin_compute,
166
- computes: builtin_compute,
167
- tag: builtin_tag,
168
- tags: builtin_tag,
169
- expect: builtin_expect,
170
- play: builtin_play,
171
- record: builtin_record,
172
- gather: builtin_gather,
173
- group: builtin_group,
174
- groups: builtin_group,
175
- user: builtin_user,
176
- users: builtin_user,
177
- pluginmeta: builtin_pluginmeta,
178
- pluginmetas: builtin_pluginmeta,
179
- meta: builtin_pluginmeta,
180
- metas: builtin_pluginmeta,
181
- plugininstance: builtin_plugininstance,
182
- plugininstances: builtin_plugininstance,
183
- instance: builtin_plugininstance,
184
- instances: builtin_plugininstance,
185
- job: builtin_plugininstance,
186
- jobs: builtin_plugininstance,
187
- workflow: builtin_workflow,
188
- workflows: builtin_workflow,
189
- files: builtin_files,
190
- links: builtin_links,
191
- dirs: builtin_dirs,
192
- context: builtin_context,
193
- parametersofplugin: builtin_parametersofplugin,
194
- plugin: builtin_plugin,
195
- plugins: builtin_plugin,
196
- pacsservers: (args) => chiliCommand_run('pacsservers', ['-s', ...args]),
197
- pacsqueries: (args) => chiliCommand_run('pacsqueries', ['-s', ...args]),
198
- pacsretrieve: (args) => chiliCommand_run('pacsretrieve', ['-s', ...args]),
199
- connect: builtin_connect,
200
- upload: builtin_upload,
201
- download: builtin_download,
202
- store: builtin_store,
203
- edit: builtin_edit,
204
- config: builtin_config,
205
- pacs: builtin_pacs,
206
- pull: builtin_pull,
207
- pipeline: builtin_pipeline,
208
- pipelines: builtin_pipeline,
209
- };
210
- export const COMMAND_HANDLERS = {
211
- connect: envelopeHandler_wrap(builtin_connect),
212
- logout: envelopeHandler_wrap(builtin_logout),
213
- cd: envelopeHandler_wrap(builtin_cd),
214
- ls: envelopeHandler_wrap(builtin_ls),
215
- pwd: envelopeHandler_wrap(builtin_pwd),
216
- netstat: envelopeHandler_wrap(builtin_netstat),
217
- cat: envelopeHandler_wrap(builtin_cat),
218
- rm: envelopeHandler_wrap(builtin_rm),
219
- setfacl: envelopeHandler_wrap(builtin_setfacl),
220
- getfacl: envelopeHandler_wrap(builtin_getfacl),
221
- chmod: envelopeHandler_wrap(builtin_chmod),
222
- setfattr: envelopeHandler_wrap(builtin_setfattr),
223
- getfattr: envelopeHandler_wrap(builtin_getfattr),
224
- cp: envelopeHandler_wrap(builtin_cp),
225
- mv: envelopeHandler_wrap(builtin_mv),
226
- touch: envelopeHandler_wrap(builtin_touch),
227
- mkdir: envelopeHandler_wrap(builtin_mkdir),
228
- rmdir: envelopeHandler_wrap(builtin_rmdir),
229
- upload: envelopeHandler_wrap(builtin_upload),
230
- pacs: envelopeHandler_wrap(builtin_pacs),
231
- pipeline: envelopeHandler_wrap(builtin_pipeline),
232
- pipelines: envelopeHandler_wrap(builtin_pipeline),
233
- pull: envelopeHandler_wrap(builtin_pull),
234
- query: envelopeHandler_wrap(builtin_query),
235
- cubepath: envelopeHandler_wrap(builtin_cubepath),
236
- dcm: envelopeHandler_wrap(builtin_dcm),
237
- image: envelopeHandler_wrap(builtin_image),
238
- download: envelopeHandler_wrap(builtin_download),
239
- edit: envelopeHandler_wrap(builtin_edit),
240
- config: envelopeHandler_wrap(builtin_config),
241
- context: envelopeHandler_wrap(builtin_context),
242
- parametersofplugin: envelopeHandler_wrap(builtin_parametersofplugin),
243
- physicalmode: envelopeHandler_wrap(builtin_physicalmode),
244
- timing: envelopeHandler_wrap(builtin_timing),
245
- id: envelopeHandler_wrap(builtin_id),
246
- whoami: envelopeHandler_wrap(builtin_whoami),
247
- whereami: envelopeHandler_wrap(builtin_whereami),
248
- debug: envelopeHandler_wrap(builtin_debug),
249
- fortune: envelopeHandler_wrap(builtin_fortune),
250
- cowsay: envelopeHandler_wrap(builtin_cowsay),
251
- cowthink: envelopeHandler_wrap(builtin_cowthink),
252
- figlet: envelopeHandler_wrap(builtin_figlet),
253
- banner: envelopeHandler_wrap(builtin_banner),
254
- lolcat: envelopeHandler_wrap(builtin_lolcat),
255
- rev: envelopeHandler_wrap(builtin_rev),
256
- tac: envelopeHandler_wrap(builtin_tac),
257
- yes: envelopeHandler_wrap(builtin_yes),
258
- seq: envelopeHandler_wrap(builtin_seq),
259
- factor: envelopeHandler_wrap(builtin_factor),
260
- primes: envelopeHandler_wrap(builtin_primes),
261
- shuf: envelopeHandler_wrap(builtin_shuf),
262
- roll: envelopeHandler_wrap(builtin_roll),
263
- rot13: envelopeHandler_wrap(builtin_rot13),
264
- morse: envelopeHandler_wrap(builtin_morse),
265
- calc: envelopeHandler_wrap(builtin_calc),
266
- units: envelopeHandler_wrap(builtin_units),
267
- who: envelopeHandler_wrap(builtin_who),
268
- uptime: envelopeHandler_wrap(builtin_uptime),
269
- ping: envelopeHandler_wrap(builtin_ping),
270
- chrisfetch: envelopeHandler_wrap(builtin_chrisfetch),
271
- say: envelopeHandler_wrap(builtin_say),
272
- wtf: envelopeHandler_wrap(builtin_wtf),
273
- file: envelopeHandler_wrap(builtin_file),
274
- xxd: envelopeHandler_wrap(builtin_xxd),
275
- strings: envelopeHandler_wrap(builtin_strings),
276
- sha256sum: envelopeHandler_wrap(builtin_sha256sum),
277
- md5sum: envelopeHandler_wrap(builtin_md5sum),
278
- qr: envelopeHandler_wrap(builtin_qr),
279
- pom: envelopeHandler_wrap(builtin_pom),
280
- stardate: envelopeHandler_wrap(builtin_stardate),
281
- ddate: envelopeHandler_wrap(builtin_ddate),
282
- sunrise: envelopeHandler_wrap(builtin_sunrise),
283
- timer: envelopeHandler_wrap(builtin_timer),
284
- leave: envelopeHandler_wrap(builtin_leave),
285
- stopwatch: envelopeHandler_wrap(builtin_stopwatch),
286
- sl: envelopeHandler_wrap(builtin_sl),
287
- cmatrix: envelopeHandler_wrap(builtin_cmatrix),
288
- rain: envelopeHandler_wrap(builtin_rain),
289
- asciiquarium: envelopeHandler_wrap(builtin_asciiquarium),
290
- tetris: envelopeHandler_wrap(builtin_tetris),
291
- snake: envelopeHandler_wrap(builtin_snake),
292
- quiz: envelopeHandler_wrap(builtin_quiz),
293
- hangman: envelopeHandler_wrap(builtin_hangman),
294
- '2048': envelopeHandler_wrap(builtin_2048),
295
- weather: envelopeHandler_wrap(builtin_weather),
296
- motd: envelopeHandler_wrap(builtin_motd),
297
- notes: envelopeHandler_wrap(builtin_notes),
298
- date: envelopeHandler_wrap(builtin_date),
299
- cal: envelopeHandler_wrap(builtin_cal),
300
- help: envelopeHandler_wrap(builtin_help),
301
- proc: envelopeHandler_wrap(builtin_proc),
302
- tree: envelopeHandler_wrap(builtin_tree),
303
- du: envelopeHandler_wrap(builtin_du),
304
- store: envelopeHandler_wrap(builtin_store),
305
- plugin: envelopeHandler_wrap(builtin_plugin),
306
- plugins: envelopeHandler_wrap(builtin_plugin),
307
- feed: envelopeHandler_wrap(builtin_feed),
308
- feeds: envelopeHandler_wrap(builtin_feed),
309
- compute: envelopeHandler_wrap(builtin_compute),
310
- computes: envelopeHandler_wrap(builtin_compute),
311
- tag: envelopeHandler_wrap(builtin_tag),
312
- tags: envelopeHandler_wrap(builtin_tag),
313
- expect: envelopeHandler_wrap(builtin_expect),
314
- play: envelopeHandler_wrap(builtin_play),
315
- record: envelopeHandler_wrap(builtin_record),
316
- gather: envelopeHandler_wrap(builtin_gather),
317
- group: envelopeHandler_wrap(builtin_group),
318
- groups: envelopeHandler_wrap(builtin_group),
319
- pluginmeta: envelopeHandler_wrap(builtin_pluginmeta),
320
- pluginmetas: envelopeHandler_wrap(builtin_pluginmeta),
321
- meta: envelopeHandler_wrap(builtin_pluginmeta),
322
- metas: envelopeHandler_wrap(builtin_pluginmeta),
323
- plugininstance: envelopeHandler_wrap(builtin_plugininstance),
324
- plugininstances: envelopeHandler_wrap(builtin_plugininstance),
325
- instance: envelopeHandler_wrap(builtin_plugininstance),
326
- instances: envelopeHandler_wrap(builtin_plugininstance),
327
- job: envelopeHandler_wrap(builtin_plugininstance),
328
- jobs: envelopeHandler_wrap(builtin_plugininstance),
329
- workflow: envelopeHandler_wrap(builtin_workflow),
330
- workflows: envelopeHandler_wrap(builtin_workflow),
331
- files: envelopeHandler_wrap(builtin_files),
332
- links: envelopeHandler_wrap(builtin_links),
333
- dirs: envelopeHandler_wrap(builtin_dirs),
334
- pacsservers: envelopeHandler_wrap((args) => chiliCommand_run('pacsservers', ['-s', ...args])),
335
- pacsqueries: envelopeHandler_wrap((args) => chiliCommand_run('pacsqueries', ['-s', ...args])),
336
- pacsretrieve: envelopeHandler_wrap((args) => chiliCommand_run('pacsretrieve', ['-s', ...args])),
337
- };
338
- export { COMMAND_HANDLERS_KEYS } from '../command-keys.js';
40
+ // The engine registers its core commands and the order commands list in; a
41
+ // backend registers its own beside them (the ChRIS backend's from brasa's
42
+ // entry). Every lookup below goes through the registry.
43
+ commands_register(coreCommands);
44
+ commandOrder_set({ envelope: ENVELOPE_ORDER, plain: PLAIN_ORDER, help: HELP_ORDER });
45
+ export { ENVELOPE_HANDLERS, COMMAND_HANDLERS } from './commandRegistry.js';
339
46
  /**
340
47
  * Prints elapsed time since startTime if timing is enabled.
341
48
  *
@@ -348,101 +55,6 @@ export function command_timingMaybePrint(startTime, enabled) {
348
55
  const elapsed = performance.now() - startTime;
349
56
  sink_get().data_write(`${chalk.gray(`[${elapsed.toFixed(2)}ms]`)}\n`);
350
57
  }
351
- /**
352
- * Handles a pipeline name invoked directly as an executable from /bin.
353
- * Routes flag combinations to the appropriate pipeline subcommand:
354
- * --diagram → pipeline diagram (preserving renderer flags)
355
- * --signalflow → pipeline diagram --signalflow
356
- * --help / -h → contextual pipeline-executable help
357
- * --nodes / --parameters → pipeline info
358
- * --manifest → pipeline manifest
359
- * --source / --readme → pipeline source
360
- * (bare or --compute) → pipeline run
361
- *
362
- * @param name - The pipeline name as typed.
363
- * @param args - Arguments following the pipeline name.
364
- * @returns The pipeline builtin's envelope, preserving diagram models and text.
365
- */
366
- async function pipelineExecutable_handle(name, args) {
367
- const exitCodeBefore = exitCode_read();
368
- let envelope;
369
- if (args.includes('--help') || args.includes('-h')) {
370
- envelope = { status: 'ok', rendered: pipelineExecutableHelp_render(name) };
371
- }
372
- else if (args.includes('--diagram')) {
373
- const diagramArgs = args.filter((argument) => argument !== '--diagram');
374
- envelope = await builtin_pipeline(['diagram', name, ...diagramArgs]);
375
- }
376
- else if (args.includes('--signalflow')) {
377
- envelope = await builtin_pipeline(['diagram', name, '--signalflow']);
378
- }
379
- else if (args.includes('--manifest')) {
380
- envelope = await builtin_pipeline(['manifest', name]);
381
- }
382
- else if (args.includes('--nodes') || args.includes('--parameters')) {
383
- envelope = await builtin_pipeline(['info', name]);
384
- }
385
- else if (args.includes('--source') || args.includes('--readme')) {
386
- envelope = await builtin_pipeline(['source', name]);
387
- }
388
- else {
389
- envelope = await builtin_pipeline(['run', name, ...args]);
390
- }
391
- const result = envelope ?? { status: 'ok', rendered: '' };
392
- const exitCodeAfter = exitCode_read();
393
- if (exitCodeAfter !== 0 && exitCodeAfter !== exitCodeBefore)
394
- result.status = 'error';
395
- return result;
396
- }
397
- /**
398
- * Finds exact plugin and pipeline executable matches in the virtual `/bin`.
399
- *
400
- * @param command - Executable name as typed.
401
- * @returns Matching dynamic executable entries, if the listing is available.
402
- */
403
- async function binExecutableMatches_get(command) {
404
- const binResult = await vfs.data_get('/bin');
405
- if (!binResult.ok) {
406
- return { plugin: undefined, pipeline: undefined };
407
- }
408
- return {
409
- plugin: binResult.value.find((item) => item.name === command && item.type === 'plugin'),
410
- pipeline: binResult.value.find((item) => item.name === command && item.type === 'pipeline'),
411
- };
412
- }
413
- /**
414
- * Reads the current process exit code as a number.
415
- *
416
- * @returns The exit code, treating an unset code as zero.
417
- */
418
- function exitCode_read() {
419
- return typeof process.exitCode === 'number' ? process.exitCode : 0;
420
- }
421
- /**
422
- * Runs a printing handler uncaptured, preserving an explicit envelope or
423
- * deriving one from the exit-code delta for legacy handlers.
424
- *
425
- * This is the passthrough for commands that cannot be captured yet: the
426
- * interactive holdouts (their prompts must reach the terminal) and the
427
- * progress writers (their live updates must stay live). The handler prints
428
- * exactly as it always has; the placeholder envelope records only the
429
- * outcome, with no rendered text, so envelope consumers never re-print what
430
- * the terminal already showed. Migrated handlers may return that envelope
431
- * directly while retaining the same live-output behavior.
432
- *
433
- * @param handler - A legacy printing command handler.
434
- * @param args - Parsed arguments.
435
- * @returns A placeholder envelope carrying the command's outcome.
436
- */
437
- async function handler_runDirect(handler, args) {
438
- const exitCodeBefore = exitCode_read();
439
- const explicitEnvelope = await handler(args);
440
- if (explicitEnvelope !== undefined)
441
- return explicitEnvelope;
442
- const exitCodeAfter = exitCode_read();
443
- const failed = exitCodeAfter !== 0 && exitCodeAfter !== exitCodeBefore;
444
- return { status: failed ? 'error' : 'ok', rendered: '' };
445
- }
446
58
  /**
447
59
  * Drains the errorStack from a checkpoint into an envelope's structured
448
60
  * `errors` field, and escalates status to `error` when an error-type message
@@ -484,8 +96,8 @@ export async function command_dispatchEnvelope(command, args) {
484
96
  }
485
97
  /**
486
98
  * Runs the dispatch itself (without the error drain). Expands environment
487
- * references in the arguments, then checks ENVELOPE_HANDLERS, then
488
- * unconverted COMMAND_HANDLERS, then /bin plugin/pipeline names, then falls
99
+ * references in the arguments, then checks the registry's envelope handlers,
100
+ * then its plain handlers, then /bin plugin/pipeline names, then falls
489
101
  * back to chili through the capture bridge.
490
102
  *
491
103
  * Envelope-speaking handlers are delivered through the active sink here, so
@@ -501,9 +113,18 @@ async function commandDispatchEnvelope_run(command, args) {
501
113
  process.exit(0);
502
114
  }
503
115
  if (command === 'sudo') {
504
- return await sudoCommand_run(args, commandDispatchEnvelope_run);
116
+ // The nested command delivers its own envelope; sudo's own refusals
117
+ // (usage, nesting, no administrator, credentials) are delivered here.
118
+ let nestedRan = false;
119
+ const envelope = await sudoCommand_run(args, async (nested, nestedArgs) => {
120
+ nestedRan = true;
121
+ return commandDispatchEnvelope_run(nested, nestedArgs);
122
+ });
123
+ if (!nestedRan)
124
+ envelope_deliver(envelope);
125
+ return envelope;
505
126
  }
506
- const envelopeHandler = ENVELOPE_HANDLERS[command];
127
+ const envelopeHandler = envelopeHandler_get(command);
507
128
  if (envelopeHandler) {
508
129
  // A handler that resolves without an envelope (as stubbed handlers in
509
130
  // tests do) is treated as having produced no output.
@@ -514,22 +135,39 @@ async function commandDispatchEnvelope_run(command, args) {
514
135
  envelope_deliver(envelope);
515
136
  return envelope;
516
137
  }
517
- const handler = COMMAND_HANDLERS[command];
138
+ const handler = plainHandler_get(command);
518
139
  if (handler) {
519
140
  return handler_runDirect(handler, args);
520
141
  }
521
- const binMatches = await binExecutableMatches_get(command);
522
- if (binMatches.plugin) {
523
- return handler_runDirect((pluginArgs) => builtin_executePlugin(command, pluginArgs), args);
524
- }
525
- if (binMatches.pipeline) {
526
- const envelope = await pipelineExecutable_handle(command, args);
527
- envelope_deliver(envelope);
528
- return envelope;
529
- }
530
- // Unknown commands are guarded, then delegated to chili — its output is
531
- // captured through its own seam, with no console capture here.
532
- return unknownCommand_delegate(command, args);
142
+ return unknownCommand_handle(command, args, false);
143
+ }
144
+ /**
145
+ * Hands a word nothing registered answers to the backend, and says
146
+ * `command not found` when the backend does not know it either.
147
+ *
148
+ * @param command - The word.
149
+ * @param args - Its arguments.
150
+ * @param captured - Whether the line's output is being captured.
151
+ * @returns The delivered envelope.
152
+ */
153
+ async function unknownCommand_handle(command, args, captured) {
154
+ const answered = (await backendInstalled_get()?.fallback?.unknown?.(command, args, captured)) ?? null;
155
+ if (answered !== null)
156
+ return answered;
157
+ const envelope = envelope_error('', undefined, `${chalk.red(`chell: command not found: ${command}`)}\n`);
158
+ envelope_deliver(envelope);
159
+ return envelope;
160
+ }
161
+ /**
162
+ * A word the backend claims ahead of the registry (ChRIS: a plugin named
163
+ * with its version).
164
+ *
165
+ * @param command - The word.
166
+ * @param args - Its arguments.
167
+ * @returns The backend's envelope, or null when it does not claim the word.
168
+ */
169
+ async function commandClaim_try(command, args) {
170
+ return (await backendInstalled_get()?.fallback?.claim?.(command, args)) ?? null;
533
171
  }
534
172
  /**
535
173
  * Dispatches a parsed command to its handler.
@@ -553,7 +191,12 @@ export async function command_dispatch(command, args) {
553
191
  * because the output went to the file, not the terminal.
554
192
  */
555
193
  export async function redirect_execute(redirectInfo) {
556
- const { buffer } = await chellCommand_executeAndCapture(redirectInfo.command);
194
+ const { buffer, model } = await chellCommand_executeAndCapture(redirectInfo.command);
195
+ // The rows went to a file, but the command still answered with them: an
196
+ // index after `ls > listing.txt` counts them as it would after `ls`.
197
+ if (model !== undefined) {
198
+ answer_note(model.kind, model.data, redirectInfo.command.trim());
199
+ }
557
200
  const targetResult = redirectTarget_resolve(redirectInfo.filePath, redirectInfo.command);
558
201
  if (!targetResult.ok) {
559
202
  const lastError = errorStack.stack_pop();
@@ -583,14 +226,12 @@ async function helpEnvelope_maybe(command, args) {
583
226
  return null;
584
227
  }
585
228
  let rendered;
586
- if (commandHelp_get(command) !== undefined) {
229
+ if (commandHelp_get(command) !== undefined && verb_available(command)) {
587
230
  rendered = help_render(command);
588
231
  }
589
232
  else {
590
- const binMatches = await binExecutableMatches_get(command);
591
- rendered = binMatches.pipeline
592
- ? pipelineExecutableHelp_render(command)
593
- : help_render(command);
233
+ const backendHelp = (await backendInstalled_get()?.fallback?.help?.(command)) ?? null;
234
+ rendered = backendHelp ?? helpMissing_render(command);
594
235
  }
595
236
  const envelope = { status: 'ok', rendered };
596
237
  envelope_deliver(envelope);
@@ -646,7 +287,7 @@ async function commandWords_expand(command, args) {
646
287
  }
647
288
  /**
648
289
  * Executes a chell command and captures its output.
649
- * Consults COMMAND_HANDLERS — the single source of truth — so the pipe path
290
+ * Consults the command registry — the single source of truth — so the pipe path
650
291
  * is always consistent with the direct-execution path.
651
292
  *
652
293
  * @param commandLine - The command line to execute.
@@ -687,38 +328,36 @@ async function chellCommand_executeAndCapture(commandLine) {
687
328
  // streaming commands and binary cat write to the same sink directly (raw
688
329
  // bytes kept byte-for-byte). The err channel passes through to stderr live.
689
330
  const pipeSink = new PipeCaptureSink(sink_get());
331
+ let model;
690
332
  await sinkScope_run(pipeSink, async () => {
691
333
  const helpEnvelope = await helpEnvelope_maybe(command, args);
692
334
  if (helpEnvelope)
693
335
  return;
694
- const envelopeHandler = ENVELOPE_HANDLERS[command];
336
+ const envelopeHandler = envelopeHandler_get(command);
695
337
  if (envelopeHandler) {
696
338
  const envelope = await envelopeHandler(args);
697
339
  if (envelope) {
698
340
  envelope_deliver(envelope);
341
+ model = envelope.model;
699
342
  }
700
343
  return;
701
344
  }
702
- const pluginEnvelope = await pluginExecutable_handle(command, args);
703
- if (pluginEnvelope) {
704
- envelope_deliver(pluginEnvelope);
345
+ const claimed = await commandClaim_try(command, args);
346
+ if (claimed) {
347
+ envelope_deliver(claimed);
348
+ model = claimed.model;
705
349
  return;
706
350
  }
707
- const handler = COMMAND_HANDLERS[command];
351
+ const handler = plainHandler_get(command);
708
352
  if (handler) {
709
353
  await handler(args);
710
354
  return;
711
355
  }
712
- const binMatches = await binExecutableMatches_get(command);
713
- if (binMatches.pipeline) {
714
- const envelope = await pipelineExecutable_handle(command, args);
715
- envelope_deliver(envelope);
716
- return;
717
- }
718
- await unknownCommand_delegate(command, args);
356
+ const answered = await unknownCommand_handle(command, args, true);
357
+ model = answered.model;
719
358
  });
720
359
  const buffer = pipeSink.buffer_get();
721
- return { text: buffer.toString('utf-8'), buffer };
360
+ return { text: buffer.toString('utf-8'), buffer, ...(model !== undefined ? { model } : {}) };
722
361
  }
723
362
  /**
724
363
  * Executes a pipe chain by running the first command in chell and piping
@@ -743,7 +382,7 @@ export async function pipe_execute(segments) {
743
382
  for (let i = 1; i < segments.length; i++) {
744
383
  const segment = segments[i];
745
384
  const word = segment.trim().split(/\s+/)[0] ?? '';
746
- if (word !== '' && (word in ENVELOPE_HANDLERS || word in COMMAND_HANDLERS)) {
385
+ if (word !== '' && builtinCommand_has(word)) {
747
386
  stdin_set(currentInput.toString('utf-8'));
748
387
  try {
749
388
  currentInput = (await chellCommand_executeAndCapture(segment)).buffer;
@@ -816,7 +455,7 @@ export async function command_executeToEnvelope(trimmedLine, startTime, timingEn
816
455
  // command_dispatchEnvelope, so it drains the errorStack itself.
817
456
  const checkpoint = errorStack.checkpoint_mark();
818
457
  const exitCodeBefore = exitCode_read();
819
- const pluginEnvelope = await pluginExecutable_handle(command, args);
458
+ const pluginEnvelope = await commandClaim_try(command, args);
820
459
  if (pluginEnvelope) {
821
460
  envelope_deliver(pluginEnvelope);
822
461
  command_timingMaybePrint(startTime, timingEnabled);