@jerryan/just-bash 3.6.1 → 3.8.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 (328) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/README.md +15 -5
  3. package/dist/AGENTS.md +2 -2
  4. package/dist/Bash.d.ts +4 -2
  5. package/dist/bin/chunks/{awk2-KO7ZE3P7.js → awk2-NTRVFXRA.js} +1 -1
  6. package/dist/bin/chunks/chmod-GX5SYTRL.js +3 -0
  7. package/dist/bin/chunks/chunk-2NJJXU4K.js +27 -0
  8. package/dist/bin/{shell/chunks/chunk-ZMGLTHSU.js → chunks/chunk-3ROYEBJI.js} +1 -1
  9. package/dist/bin/chunks/chunk-6FGMEZZP.js +20 -0
  10. package/dist/bin/chunks/chunk-6JUPBMCR.js +13 -0
  11. package/dist/bin/{shell/chunks/chunk-3DWQCLNP.js → chunks/chunk-7WBCA2BB.js} +1 -1
  12. package/dist/bin/chunks/{chunk-LE2XKKGQ.js → chunk-ABP4OLJV.js} +1 -1
  13. package/dist/bin/{shell/chunks/chunk-7PUOS2OO.js → chunks/chunk-ANX7U57Q.js} +1 -1
  14. package/dist/bin/chunks/{chunk-B2GCIQI2.js → chunk-BB5VTPMQ.js} +1 -1
  15. package/dist/bin/chunks/chunk-CN4JKMTR.js +8 -0
  16. package/dist/bin/chunks/{chunk-WFHYGSLJ.js → chunk-CNVNOT67.js} +1 -1
  17. package/dist/bin/{shell/chunks/chunk-6ESRNSO7.js → chunks/chunk-DRPHNXG7.js} +1 -1
  18. package/dist/bin/chunks/chunk-F2PYTUMR.js +9 -0
  19. package/dist/bin/{shell/chunks/chunk-OXLC2WWX.js → chunks/chunk-H7PD6FLC.js} +10 -10
  20. package/dist/bin/chunks/chunk-HWK7KFGB.js +3 -0
  21. package/dist/bin/{shell/chunks/chunk-QYZN33JA.js → chunks/chunk-IOKQFPM6.js} +1 -1
  22. package/dist/bin/chunks/{chunk-M7SIPZZZ.js → chunk-KMYJMEON.js} +1 -1
  23. package/dist/bin/chunks/chunk-KNTDFP7X.js +12 -0
  24. package/dist/bin/{shell/chunks/chunk-RPUFEP5O.js → chunks/chunk-M3Z5NZXT.js} +1 -1
  25. package/dist/bin/chunks/chunk-MBREBDZQ.js +3 -0
  26. package/dist/bin/{shell/chunks/chunk-L345YZ6R.js → chunks/chunk-MF3GVFLC.js} +1 -1
  27. package/dist/bin/{shell/chunks/chunk-YCOJCFGU.js → chunks/chunk-MPFNZYEA.js} +1 -1
  28. package/dist/bin/chunks/chunk-OHFB3M3X.js +3 -0
  29. package/dist/bin/{shell/chunks/chunk-F3UDTTI7.js → chunks/chunk-ONF4KUYV.js} +1 -1
  30. package/dist/bin/chunks/chunk-PPVF2N6C.js +3 -0
  31. package/dist/bin/chunks/{chunk-V2XF3TTW.js → chunk-PRVPFKTC.js} +1 -1
  32. package/dist/bin/{shell/chunks/chunk-7VWOECJ3.js → chunks/chunk-PTUQEN6I.js} +1 -1
  33. package/dist/bin/chunks/{chunk-R2J5MJOM.js → chunk-QFOXSCOD.js} +1 -1
  34. package/dist/bin/{shell/chunks/chunk-6TUILMPB.js → chunks/chunk-QFTZKD5O.js} +1 -1
  35. package/dist/bin/chunks/{chunk-HQ63MFHG.js → chunk-QJWFCA7P.js} +1 -1
  36. package/dist/bin/chunks/chunk-RTN6X652.js +11 -0
  37. package/dist/bin/chunks/{chunk-67XYNGRV.js → chunk-T6OIISUC.js} +1 -1
  38. package/dist/bin/{shell/chunks/chunk-JELR4642.js → chunks/chunk-U5JLGI56.js} +13 -13
  39. package/dist/bin/chunks/{chunk-7PPAWLUI.js → chunk-V4S4A7M6.js} +1 -1
  40. package/dist/bin/{shell/chunks/chunk-DZAFUADN.js → chunks/chunk-VPSBWWXM.js} +1 -1
  41. package/dist/bin/chunks/{chunk-GA5TPRMF.js → chunk-YXPSX3SI.js} +11 -11
  42. package/dist/bin/chunks/{chunk-472JZJ2D.js → chunk-ZVG47PYA.js} +1 -1
  43. package/dist/bin/chunks/cp-YLP7ULVT.js +3 -0
  44. package/dist/bin/{shell/chunks/diff-YXZZCUSQ.js → chunks/diff-JSJ56EOK.js} +1 -1
  45. package/dist/bin/chunks/du-DH76GZJ3.js +3 -0
  46. package/dist/bin/chunks/{expr-NNMDHOCN.js → expr-PQEPO5TE.js} +1 -1
  47. package/dist/bin/chunks/{file-4T64QNLS.js → file-JA7QI2YT.js} +1 -1
  48. package/dist/bin/chunks/find-MHC4QV6H.js +3 -0
  49. package/dist/bin/chunks/flag-coverage-2H5CPEM6.js +3 -0
  50. package/dist/bin/chunks/{grep-CVU5V66H.js → grep-VXWNMIDD.js} +1 -1
  51. package/dist/bin/chunks/gzip-UQZL4R74.js +3 -0
  52. package/dist/bin/chunks/{jq-V7OTAVU5.js → jq-YS4PR46D.js} +1 -1
  53. package/dist/bin/chunks/js-exec-T3SAB2B6.js +1651 -0
  54. package/dist/bin/chunks/ln-XVC53673.js +3 -0
  55. package/dist/bin/chunks/ls-5Z45FV4U.js +3 -0
  56. package/dist/bin/chunks/mkdir-YJ3SOVRP.js +3 -0
  57. package/dist/bin/chunks/mv-EOOP2TO3.js +3 -0
  58. package/dist/bin/chunks/python3-3ERN3L6S.js +23 -0
  59. package/dist/bin/chunks/readlink-EJ3IKLWW.js +3 -0
  60. package/dist/bin/chunks/rg-WHVR3YDT.js +3 -0
  61. package/dist/bin/chunks/rm-B4LVIG7A.js +3 -0
  62. package/dist/bin/chunks/rmdir-PRNISPBA.js +3 -0
  63. package/dist/bin/{shell/chunks/sed-4LVDFHIJ.js → chunks/sed-SY63U2YX.js} +1 -1
  64. package/dist/bin/{shell/chunks/sleep-MOJQBZMY.js → chunks/sleep-DVFE2GSF.js} +1 -1
  65. package/dist/bin/chunks/split-HIFKSV2A.js +3 -0
  66. package/dist/bin/chunks/sqlite3-KNN6V2W6.js +3 -0
  67. package/dist/bin/{shell/chunks/tar-7HGZIMZD.js → chunks/tar-7XOP7VOX.js} +1 -1
  68. package/dist/bin/chunks/{timeout-RQOWSWYG.js → timeout-YGFHQJKX.js} +1 -1
  69. package/dist/bin/chunks/worker.js +120 -109
  70. package/dist/bin/chunks/{xan-WW53ETXT.js → xan-RMH6JEXM.js} +1 -1
  71. package/dist/bin/chunks/{yq-MYZOS2WN.js → yq-CWBZMGUV.js} +1 -1
  72. package/dist/bin/just-bash.js +355 -350
  73. package/dist/bin/shell/chunks/{awk2-KO7ZE3P7.js → awk2-NTRVFXRA.js} +1 -1
  74. package/dist/bin/shell/chunks/chmod-GX5SYTRL.js +3 -0
  75. package/dist/bin/shell/chunks/chunk-2NJJXU4K.js +27 -0
  76. package/dist/bin/{chunks/chunk-ZMGLTHSU.js → shell/chunks/chunk-3ROYEBJI.js} +1 -1
  77. package/dist/bin/shell/chunks/chunk-6FGMEZZP.js +20 -0
  78. package/dist/bin/shell/chunks/chunk-6JUPBMCR.js +13 -0
  79. package/dist/bin/{chunks/chunk-3DWQCLNP.js → shell/chunks/chunk-7WBCA2BB.js} +1 -1
  80. package/dist/bin/shell/chunks/{chunk-LE2XKKGQ.js → chunk-ABP4OLJV.js} +1 -1
  81. package/dist/bin/{chunks/chunk-7PUOS2OO.js → shell/chunks/chunk-ANX7U57Q.js} +1 -1
  82. package/dist/bin/shell/chunks/{chunk-B2GCIQI2.js → chunk-BB5VTPMQ.js} +1 -1
  83. package/dist/bin/shell/chunks/chunk-CN4JKMTR.js +8 -0
  84. package/dist/bin/shell/chunks/{chunk-WFHYGSLJ.js → chunk-CNVNOT67.js} +1 -1
  85. package/dist/bin/{chunks/chunk-6ESRNSO7.js → shell/chunks/chunk-DRPHNXG7.js} +1 -1
  86. package/dist/bin/shell/chunks/chunk-F2PYTUMR.js +9 -0
  87. package/dist/bin/{chunks/chunk-OXLC2WWX.js → shell/chunks/chunk-H7PD6FLC.js} +10 -10
  88. package/dist/bin/shell/chunks/chunk-HWK7KFGB.js +3 -0
  89. package/dist/bin/{chunks/chunk-QYZN33JA.js → shell/chunks/chunk-IOKQFPM6.js} +1 -1
  90. package/dist/bin/shell/chunks/{chunk-M7SIPZZZ.js → chunk-KMYJMEON.js} +1 -1
  91. package/dist/bin/shell/chunks/chunk-KNTDFP7X.js +12 -0
  92. package/dist/bin/{chunks/chunk-RPUFEP5O.js → shell/chunks/chunk-M3Z5NZXT.js} +1 -1
  93. package/dist/bin/shell/chunks/chunk-MBREBDZQ.js +3 -0
  94. package/dist/bin/{chunks/chunk-L345YZ6R.js → shell/chunks/chunk-MF3GVFLC.js} +1 -1
  95. package/dist/bin/{chunks/chunk-YCOJCFGU.js → shell/chunks/chunk-MPFNZYEA.js} +1 -1
  96. package/dist/bin/shell/chunks/chunk-OHFB3M3X.js +3 -0
  97. package/dist/bin/{chunks/chunk-F3UDTTI7.js → shell/chunks/chunk-ONF4KUYV.js} +1 -1
  98. package/dist/bin/shell/chunks/chunk-PPVF2N6C.js +3 -0
  99. package/dist/bin/shell/chunks/{chunk-V2XF3TTW.js → chunk-PRVPFKTC.js} +1 -1
  100. package/dist/bin/{chunks/chunk-7VWOECJ3.js → shell/chunks/chunk-PTUQEN6I.js} +1 -1
  101. package/dist/bin/shell/chunks/{chunk-R2J5MJOM.js → chunk-QFOXSCOD.js} +1 -1
  102. package/dist/bin/{chunks/chunk-6TUILMPB.js → shell/chunks/chunk-QFTZKD5O.js} +1 -1
  103. package/dist/bin/shell/chunks/{chunk-HQ63MFHG.js → chunk-QJWFCA7P.js} +1 -1
  104. package/dist/bin/shell/chunks/chunk-RTN6X652.js +11 -0
  105. package/dist/bin/shell/chunks/{chunk-67XYNGRV.js → chunk-T6OIISUC.js} +1 -1
  106. package/dist/bin/{chunks/chunk-JELR4642.js → shell/chunks/chunk-U5JLGI56.js} +13 -13
  107. package/dist/bin/shell/chunks/{chunk-7PPAWLUI.js → chunk-V4S4A7M6.js} +1 -1
  108. package/dist/bin/{chunks/chunk-DZAFUADN.js → shell/chunks/chunk-VPSBWWXM.js} +1 -1
  109. package/dist/bin/shell/chunks/{chunk-GA5TPRMF.js → chunk-YXPSX3SI.js} +11 -11
  110. package/dist/bin/shell/chunks/{chunk-472JZJ2D.js → chunk-ZVG47PYA.js} +1 -1
  111. package/dist/bin/shell/chunks/cp-YLP7ULVT.js +3 -0
  112. package/dist/bin/{chunks/diff-YXZZCUSQ.js → shell/chunks/diff-JSJ56EOK.js} +1 -1
  113. package/dist/bin/shell/chunks/du-DH76GZJ3.js +3 -0
  114. package/dist/bin/shell/chunks/{expr-NNMDHOCN.js → expr-PQEPO5TE.js} +1 -1
  115. package/dist/bin/shell/chunks/{file-4T64QNLS.js → file-JA7QI2YT.js} +1 -1
  116. package/dist/bin/shell/chunks/find-MHC4QV6H.js +3 -0
  117. package/dist/bin/shell/chunks/flag-coverage-2H5CPEM6.js +3 -0
  118. package/dist/bin/shell/chunks/{grep-CVU5V66H.js → grep-VXWNMIDD.js} +1 -1
  119. package/dist/bin/shell/chunks/gzip-UQZL4R74.js +3 -0
  120. package/dist/bin/shell/chunks/{jq-V7OTAVU5.js → jq-YS4PR46D.js} +1 -1
  121. package/dist/bin/shell/chunks/js-exec-T3SAB2B6.js +1651 -0
  122. package/dist/bin/shell/chunks/ln-XVC53673.js +3 -0
  123. package/dist/bin/shell/chunks/ls-5Z45FV4U.js +3 -0
  124. package/dist/bin/shell/chunks/mkdir-YJ3SOVRP.js +3 -0
  125. package/dist/bin/shell/chunks/mv-EOOP2TO3.js +3 -0
  126. package/dist/bin/shell/chunks/python3-3ERN3L6S.js +23 -0
  127. package/dist/bin/shell/chunks/readlink-EJ3IKLWW.js +3 -0
  128. package/dist/bin/shell/chunks/rg-WHVR3YDT.js +3 -0
  129. package/dist/bin/shell/chunks/rm-B4LVIG7A.js +3 -0
  130. package/dist/bin/shell/chunks/rmdir-PRNISPBA.js +3 -0
  131. package/dist/bin/{chunks/sed-4LVDFHIJ.js → shell/chunks/sed-SY63U2YX.js} +1 -1
  132. package/dist/bin/{chunks/sleep-MOJQBZMY.js → shell/chunks/sleep-DVFE2GSF.js} +1 -1
  133. package/dist/bin/shell/chunks/split-HIFKSV2A.js +3 -0
  134. package/dist/bin/shell/chunks/sqlite3-KNN6V2W6.js +3 -0
  135. package/dist/bin/{chunks/tar-7HGZIMZD.js → shell/chunks/tar-7XOP7VOX.js} +1 -1
  136. package/dist/bin/shell/chunks/{timeout-RQOWSWYG.js → timeout-YGFHQJKX.js} +1 -1
  137. package/dist/bin/shell/chunks/{xan-WW53ETXT.js → xan-RMH6JEXM.js} +1 -1
  138. package/dist/bin/shell/chunks/{yq-MYZOS2WN.js → yq-CWBZMGUV.js} +1 -1
  139. package/dist/bin/shell/shell.js +397 -392
  140. package/dist/bundle/browser.js +693 -669
  141. package/dist/bundle/chunks/{awk2-W6BNZEJN.js → awk2-VS5QVYHU.js} +1 -1
  142. package/dist/bundle/chunks/chmod-TEY5MD2W.js +2 -0
  143. package/dist/bundle/chunks/{chunk-26GP3ACY.js → chunk-35MBA3VY.js} +1 -1
  144. package/dist/bundle/chunks/chunk-3CIDHL5V.js +11 -0
  145. package/dist/bundle/chunks/chunk-3OBCZP7T.js +12 -0
  146. package/dist/bundle/chunks/{chunk-F6XU52K3.js → chunk-45QZRGYF.js} +1 -1
  147. package/dist/bundle/chunks/chunk-4CC3OZPU.js +2 -0
  148. package/dist/bundle/chunks/{chunk-73JQKNZT.js → chunk-4KZT23KR.js} +11 -11
  149. package/dist/bundle/chunks/{chunk-PJM5C3HZ.js → chunk-5EI7WSRV.js} +10 -10
  150. package/dist/bundle/chunks/{chunk-T6DNSPYO.js → chunk-6BSOPPZH.js} +1 -1
  151. package/dist/bundle/chunks/{chunk-DAKEIWT3.js → chunk-6HO6HX7V.js} +1 -1
  152. package/dist/bundle/chunks/{chunk-XVSR5HHH.js → chunk-6QAM55HM.js} +1 -1
  153. package/dist/bundle/chunks/chunk-A257L6QO.js +7 -0
  154. package/dist/bundle/chunks/{chunk-UC76ZOWM.js → chunk-ATGOUOX2.js} +1 -1
  155. package/dist/bundle/chunks/chunk-B6OSJB22.js +26 -0
  156. package/dist/bundle/chunks/{chunk-2TSZPVPI.js → chunk-BLPYR4TN.js} +1 -1
  157. package/dist/bundle/chunks/{chunk-VJ6UXG2R.js → chunk-CH7SUFFO.js} +1 -1
  158. package/dist/bundle/chunks/{chunk-FQUVK4Q5.js → chunk-DDPD7SIB.js} +1 -1
  159. package/dist/bundle/chunks/{chunk-TLPMB3FO.js → chunk-DMWNBCXJ.js} +1 -1
  160. package/dist/bundle/chunks/{chunk-ZXFELXJH.js → chunk-FSKXIFYT.js} +1 -1
  161. package/dist/bundle/chunks/{chunk-KEMO3CBM.js → chunk-GNPLDVBD.js} +1 -1
  162. package/dist/bundle/chunks/{chunk-FZZL53S2.js → chunk-GRUZ4SBY.js} +1 -1
  163. package/dist/bundle/chunks/{chunk-RPKJJFGZ.js → chunk-HCKTU6IR.js} +1 -1
  164. package/dist/bundle/chunks/{chunk-4EDQZIAN.js → chunk-LGIJSCWH.js} +1 -1
  165. package/dist/bundle/chunks/chunk-LRFR25IP.js +8 -0
  166. package/dist/bundle/chunks/chunk-MWL2I5BV.js +19 -0
  167. package/dist/bundle/chunks/{chunk-6IA4DXG2.js → chunk-N3A4JVFJ.js} +1 -1
  168. package/dist/bundle/chunks/{chunk-PPEXVPHR.js → chunk-O452S4KX.js} +1 -1
  169. package/dist/bundle/chunks/chunk-RWQWFXMH.js +10 -0
  170. package/dist/bundle/chunks/chunk-S6DNKKUL.js +2 -0
  171. package/dist/bundle/chunks/{chunk-NBNI7G66.js → chunk-SE23TEGG.js} +1 -1
  172. package/dist/bundle/chunks/chunk-T5ZEIOJ3.js +2 -0
  173. package/dist/bundle/chunks/{chunk-ULXTDFQC.js → chunk-U57DSHID.js} +1 -1
  174. package/dist/bundle/chunks/{chunk-6DDRR56B.js → chunk-WE7BJ7YU.js} +1 -1
  175. package/dist/bundle/chunks/chunk-WXPNKIIH.js +2 -0
  176. package/dist/bundle/chunks/{chunk-5I5U6IYI.js → chunk-XQ2ZZFO6.js} +1 -1
  177. package/dist/bundle/chunks/{chunk-YFFU74KY.js → chunk-XV2V56NQ.js} +1 -1
  178. package/dist/bundle/chunks/{chunk-FIMF2TLE.js → chunk-Y6JBSHCM.js} +13 -13
  179. package/dist/bundle/chunks/cp-UR762VVT.js +2 -0
  180. package/dist/bundle/chunks/{diff-CSARC7WF.js → diff-VDB6RXHO.js} +1 -1
  181. package/dist/bundle/chunks/du-EQKH3UNA.js +2 -0
  182. package/dist/bundle/chunks/{expr-XSBELPAC.js → expr-A5XITHQD.js} +1 -1
  183. package/dist/bundle/chunks/{file-URNAD6FQ.js → file-6AYYTULJ.js} +1 -1
  184. package/dist/bundle/chunks/find-RLKBCGJR.js +2 -0
  185. package/dist/bundle/chunks/flag-coverage-UMQ3BWDP.js +2 -0
  186. package/dist/bundle/chunks/{grep-4AYF3A5J.js → grep-Q2O5EIXQ.js} +1 -1
  187. package/dist/bundle/chunks/gzip-KC5ENBD2.js +2 -0
  188. package/dist/bundle/chunks/{jq-NY7PCVMH.js → jq-UKAA3QWU.js} +1 -1
  189. package/dist/bundle/chunks/js-exec-ZQMIYQTH.js +1650 -0
  190. package/dist/bundle/chunks/ln-CEM7GDB5.js +2 -0
  191. package/dist/bundle/chunks/ls-WH5S4PPL.js +2 -0
  192. package/dist/bundle/chunks/mkdir-Z6MMWH3D.js +2 -0
  193. package/dist/bundle/chunks/mv-WE7DBLEK.js +2 -0
  194. package/dist/bundle/chunks/python3-QB7OE256.js +22 -0
  195. package/dist/bundle/chunks/readlink-JSRKXLLQ.js +2 -0
  196. package/dist/bundle/chunks/rg-JKB7DR66.js +2 -0
  197. package/dist/bundle/chunks/rm-IGPLE632.js +2 -0
  198. package/dist/bundle/chunks/rmdir-3WTXMVKI.js +2 -0
  199. package/dist/bundle/chunks/{sed-LIRH26EA.js → sed-6G32B25J.js} +1 -1
  200. package/dist/bundle/chunks/{sleep-25QUPVDK.js → sleep-PPRBTSVR.js} +1 -1
  201. package/dist/bundle/chunks/split-HUKVGJTW.js +2 -0
  202. package/dist/bundle/chunks/sqlite3-KB3MXTTM.js +2 -0
  203. package/dist/bundle/chunks/{tar-B72KU357.js → tar-LE7LAAIX.js} +1 -1
  204. package/dist/bundle/chunks/{timeout-37GM7IIL.js → timeout-C6WDYPLV.js} +1 -1
  205. package/dist/bundle/chunks/worker.js +120 -109
  206. package/dist/bundle/chunks/{xan-UIGVJCMA.js → xan-UIL24CGT.js} +1 -1
  207. package/dist/bundle/chunks/{yq-FGNXZCGX.js → yq-ZRNZKDLE.js} +1 -1
  208. package/dist/bundle/index.cjs +2677 -1101
  209. package/dist/bundle/index.js +346 -341
  210. package/dist/commands/diff/format.d.ts +46 -0
  211. package/dist/commands/js-exec/js-exec.d.ts +1 -14
  212. package/dist/commands/js-exec/run-runtime.d.ts +10 -0
  213. package/dist/commands/worker-bridge/bridge-handler.d.ts +0 -3
  214. package/dist/commands/worker-bridge/protocol.d.ts +57 -23
  215. package/dist/fs/fs-error.d.ts +43 -0
  216. package/dist/fs/interface.d.ts +13 -0
  217. package/dist/fs/mountable-fs/mountable-fs.d.ts +20 -0
  218. package/dist/fs/overlay-fs/apply.d.ts +2 -1
  219. package/dist/fs/overlay-fs/index.d.ts +0 -1
  220. package/dist/fs/overlay-fs/overlay-fs.d.ts +14 -0
  221. package/dist/fs/path-utils.d.ts +5 -0
  222. package/dist/fs/traversal.d.ts +9 -0
  223. package/dist/fs/vfs-template.d.ts +38 -15
  224. package/dist/index.d.cts +2 -1
  225. package/dist/index.d.ts +2 -1
  226. package/dist/interpreter/builtin-dispatch.d.ts +10 -0
  227. package/dist/interpreter/builtin-manifest.d.ts +273 -0
  228. package/dist/interpreter/builtins/help.d.ts +6 -0
  229. package/dist/interpreter/builtins/shopt.d.ts +3 -0
  230. package/dist/interpreter/helpers/shell-constants.d.ts +0 -20
  231. package/dist/interpreter/helpers/substitution-status.d.ts +34 -0
  232. package/dist/interpreter/interpreter.d.ts +1 -1
  233. package/dist/interpreter/types.d.ts +8 -1
  234. package/dist/limits.d.ts +2 -0
  235. package/dist/timers.d.ts +0 -9
  236. package/dist/types.d.ts +4 -3
  237. package/package.json +8 -8
  238. package/dist/bin/chunks/chmod-WYYTXGVB.js +0 -3
  239. package/dist/bin/chunks/chunk-23OI2XDJ.js +0 -20
  240. package/dist/bin/chunks/chunk-43E7AR6A.js +0 -3
  241. package/dist/bin/chunks/chunk-AI7JUA46.js +0 -13
  242. package/dist/bin/chunks/chunk-CL7IYCGG.js +0 -20
  243. package/dist/bin/chunks/chunk-GQKQEK5N.js +0 -11
  244. package/dist/bin/chunks/chunk-JHEAT7AR.js +0 -12
  245. package/dist/bin/chunks/chunk-OLEQNRKX.js +0 -8
  246. package/dist/bin/chunks/chunk-QKJAAJ7J.js +0 -3
  247. package/dist/bin/chunks/chunk-SE7JHGP3.js +0 -9
  248. package/dist/bin/chunks/chunk-WEHA3JFD.js +0 -3
  249. package/dist/bin/chunks/chunk-YQEKKZTU.js +0 -12
  250. package/dist/bin/chunks/cp-OMVKM35F.js +0 -3
  251. package/dist/bin/chunks/du-LUFPVLNW.js +0 -3
  252. package/dist/bin/chunks/find-AWH2KOY7.js +0 -3
  253. package/dist/bin/chunks/flag-coverage-FYJ2V7J4.js +0 -3
  254. package/dist/bin/chunks/gzip-FDPA6EKG.js +0 -3
  255. package/dist/bin/chunks/js-exec-5QZZCOR7.js +0 -99
  256. package/dist/bin/chunks/js-exec-worker.js +0 -4931
  257. package/dist/bin/chunks/ln-B35EKC2Q.js +0 -3
  258. package/dist/bin/chunks/ls-Q6ZZ6SQ2.js +0 -3
  259. package/dist/bin/chunks/mkdir-74BP5NTG.js +0 -3
  260. package/dist/bin/chunks/mv-76LAHXFR.js +0 -3
  261. package/dist/bin/chunks/python3-TMFYDQAP.js +0 -14
  262. package/dist/bin/chunks/readlink-EHXJNW62.js +0 -3
  263. package/dist/bin/chunks/rg-PXNKNIMY.js +0 -3
  264. package/dist/bin/chunks/rm-NLG5344W.js +0 -3
  265. package/dist/bin/chunks/rmdir-7ZIVFZJX.js +0 -3
  266. package/dist/bin/chunks/split-ZNNNHKSP.js +0 -3
  267. package/dist/bin/chunks/sqlite3-3EUPHVEZ.js +0 -3
  268. package/dist/bin/shell/chunks/chmod-WYYTXGVB.js +0 -3
  269. package/dist/bin/shell/chunks/chunk-23OI2XDJ.js +0 -20
  270. package/dist/bin/shell/chunks/chunk-43E7AR6A.js +0 -3
  271. package/dist/bin/shell/chunks/chunk-AI7JUA46.js +0 -13
  272. package/dist/bin/shell/chunks/chunk-CL7IYCGG.js +0 -20
  273. package/dist/bin/shell/chunks/chunk-GQKQEK5N.js +0 -11
  274. package/dist/bin/shell/chunks/chunk-JHEAT7AR.js +0 -12
  275. package/dist/bin/shell/chunks/chunk-OLEQNRKX.js +0 -8
  276. package/dist/bin/shell/chunks/chunk-QKJAAJ7J.js +0 -3
  277. package/dist/bin/shell/chunks/chunk-SE7JHGP3.js +0 -9
  278. package/dist/bin/shell/chunks/chunk-WEHA3JFD.js +0 -3
  279. package/dist/bin/shell/chunks/chunk-YQEKKZTU.js +0 -12
  280. package/dist/bin/shell/chunks/cp-OMVKM35F.js +0 -3
  281. package/dist/bin/shell/chunks/du-LUFPVLNW.js +0 -3
  282. package/dist/bin/shell/chunks/find-AWH2KOY7.js +0 -3
  283. package/dist/bin/shell/chunks/flag-coverage-FYJ2V7J4.js +0 -3
  284. package/dist/bin/shell/chunks/gzip-FDPA6EKG.js +0 -3
  285. package/dist/bin/shell/chunks/js-exec-5QZZCOR7.js +0 -99
  286. package/dist/bin/shell/chunks/ln-B35EKC2Q.js +0 -3
  287. package/dist/bin/shell/chunks/ls-Q6ZZ6SQ2.js +0 -3
  288. package/dist/bin/shell/chunks/mkdir-74BP5NTG.js +0 -3
  289. package/dist/bin/shell/chunks/mv-76LAHXFR.js +0 -3
  290. package/dist/bin/shell/chunks/python3-TMFYDQAP.js +0 -14
  291. package/dist/bin/shell/chunks/readlink-EHXJNW62.js +0 -3
  292. package/dist/bin/shell/chunks/rg-PXNKNIMY.js +0 -3
  293. package/dist/bin/shell/chunks/rm-NLG5344W.js +0 -3
  294. package/dist/bin/shell/chunks/rmdir-7ZIVFZJX.js +0 -3
  295. package/dist/bin/shell/chunks/split-ZNNNHKSP.js +0 -3
  296. package/dist/bin/shell/chunks/sqlite3-3EUPHVEZ.js +0 -3
  297. package/dist/bundle/chunks/chmod-WM2JFFQC.js +0 -2
  298. package/dist/bundle/chunks/chunk-7IJWBG4I.js +0 -2
  299. package/dist/bundle/chunks/chunk-FSJ6TTCC.js +0 -19
  300. package/dist/bundle/chunks/chunk-G3IRZ4FN.js +0 -8
  301. package/dist/bundle/chunks/chunk-MLIO3BK2.js +0 -7
  302. package/dist/bundle/chunks/chunk-PS2RJNZZ.js +0 -2
  303. package/dist/bundle/chunks/chunk-TBVD66LC.js +0 -10
  304. package/dist/bundle/chunks/chunk-ULXGGWAD.js +0 -11
  305. package/dist/bundle/chunks/chunk-UTKGYVUZ.js +0 -7
  306. package/dist/bundle/chunks/chunk-W2Z6LYL6.js +0 -11
  307. package/dist/bundle/chunks/chunk-WN54B5NQ.js +0 -12
  308. package/dist/bundle/chunks/chunk-YUSFCOM7.js +0 -2
  309. package/dist/bundle/chunks/cp-2KZIPZJS.js +0 -2
  310. package/dist/bundle/chunks/du-7AZCLKR6.js +0 -2
  311. package/dist/bundle/chunks/find-END3EAHV.js +0 -2
  312. package/dist/bundle/chunks/flag-coverage-XSPWRCVG.js +0 -2
  313. package/dist/bundle/chunks/gzip-RQOBR22H.js +0 -2
  314. package/dist/bundle/chunks/js-exec-57QMXJG5.js +0 -98
  315. package/dist/bundle/chunks/js-exec-worker.js +0 -4931
  316. package/dist/bundle/chunks/ln-OPY2ZVGQ.js +0 -2
  317. package/dist/bundle/chunks/ls-ZPXGZX63.js +0 -2
  318. package/dist/bundle/chunks/mkdir-WDDKK2P3.js +0 -2
  319. package/dist/bundle/chunks/mv-ZF6UBVRB.js +0 -2
  320. package/dist/bundle/chunks/python3-NNONJINM.js +0 -13
  321. package/dist/bundle/chunks/readlink-U5OM5A3M.js +0 -2
  322. package/dist/bundle/chunks/rg-NAMXBYKS.js +0 -2
  323. package/dist/bundle/chunks/rm-R2ZENNSN.js +0 -2
  324. package/dist/bundle/chunks/rmdir-YJKPQVCK.js +0 -2
  325. package/dist/bundle/chunks/split-JICLAMP6.js +0 -2
  326. package/dist/bundle/chunks/sqlite3-M4UZPXDO.js +0 -2
  327. package/dist/commands/js-exec/js-exec-worker.d.ts +0 -33
  328. package/dist/fs/overlay-fs/merge.d.ts +0 -24
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Output formatters for diff.
3
+ *
4
+ * The three formats GNU diff can produce: POSIX normal format (the default),
5
+ * unified format (-u) and context format (-c). Layout was derived by running
6
+ * GNU diffutils 3.12 and matching the bytes it emits.
7
+ *
8
+ * Two intentional deviations from GNU:
9
+ *
10
+ * - The -u/-c file header carries no timestamp. GNU appends a tab and the
11
+ * file's mtime; inside a virtual filesystem that is often synthetic or
12
+ * absent, and it would make output non-reproducible. Patch consumers ignore
13
+ * the field.
14
+ * - When several minimal edit scripts exist for the same pair of files, which
15
+ * one comes out is arbitrary, and this picks a different one than GNU on
16
+ * some inputs. Hunks are still minimal and the formats are exact; only the
17
+ * grouping of ambiguous changes can differ.
18
+ */
19
+ /** Number of context lines GNU shows around a change for -u and -c. */
20
+ export declare const DEFAULT_CONTEXT = 3;
21
+ export interface FileLines {
22
+ /** Lines with their trailing newline stripped. */
23
+ lines: string[];
24
+ /** True when the last line is not newline-terminated. */
25
+ noEol: boolean;
26
+ }
27
+ /**
28
+ * A run of adjacent deleted and/or inserted lines. Starts are 0-based indices
29
+ * into the corresponding `FileLines.lines`.
30
+ */
31
+ export interface Change {
32
+ oldStart: number;
33
+ oldCount: number;
34
+ newStart: number;
35
+ newCount: number;
36
+ }
37
+ /** Splits file content into lines, remembering a missing final newline. */
38
+ export declare function splitLines(content: string): FileLines;
39
+ /** Computes the runs of deleted and/or inserted lines between two files. */
40
+ export declare function computeChanges(oldFile: FileLines, newFile: FileLines, ignoreCase: boolean): Change[];
41
+ /** POSIX normal format: `2c2` / `< old` / `---` / `> new`. */
42
+ export declare function formatNormal(oldFile: FileLines, newFile: FileLines, changes: Change[]): string;
43
+ /** Unified format (-u): `--- old`, `+++ new`, `@@` hunks. */
44
+ export declare function formatUnified(oldName: string, newName: string, oldFile: FileLines, newFile: FileLines, changes: Change[], context: number): string;
45
+ /** Context format (-c): `*** old`, `--- new`, `***************` hunks. */
46
+ export declare function formatContext(oldName: string, newName: string, oldFile: FileLines, newFile: FileLines, changes: Change[], context: number): string;
@@ -1,17 +1,4 @@
1
- /**
2
- * js-exec - Execute JavaScript code via QuickJS (WASM)
3
- *
4
- * Runs JavaScript code in an isolated worker thread with access to the
5
- * virtual filesystem, HTTP, and sub-shell execution via SharedArrayBuffer bridge.
6
- *
7
- * This command is Node.js only (uses worker_threads).
8
- */
1
+ /** js-exec - Execute JavaScript code via the run package. */
9
2
  import type { RuntimeCommand } from "../../types.js";
10
- /** @internal Set the idle-teardown delay — for focused lifecycle tests only. */
11
- export declare function _setJsExecWorkerIdleTimeoutMsForTests(ms: number): void;
12
- /** @internal Whether the shared worker is currently alive — for tests only. */
13
- export declare function _hasSharedJsExecWorkerForTests(): boolean;
14
- /** @internal Reset singleton worker state — for focused protocol tests only. */
15
- export declare function _resetJsExecWorkerForTests(): void;
16
3
  export declare const jsExecCommand: RuntimeCommand;
17
4
  export declare const nodeStubCommand: RuntimeCommand;
@@ -0,0 +1,10 @@
1
+ import type { ExecResult, RuntimeCommandContext } from "../../types.js";
2
+ interface RunJsOptions {
3
+ source: string;
4
+ scriptPath: string;
5
+ scriptArgs: string[];
6
+ bootstrapCode?: string;
7
+ isModule: boolean;
8
+ }
9
+ export declare function executeWithRun(options: RunJsOptions, ctx: RuntimeCommandContext): Promise<ExecResult>;
10
+ export {};
@@ -12,9 +12,6 @@ export interface BridgeOutput {
12
12
  stderr: string;
13
13
  exitCode: number;
14
14
  }
15
- /**
16
- * Handles requests from a worker thread.
17
- */
18
15
  export declare class BridgeHandler {
19
16
  private fs;
20
17
  private cwd;
@@ -43,14 +43,34 @@ export declare const OpCode: {
43
43
  readonly INVOKE_TOOL: 400;
44
44
  };
45
45
  export type OpCodeType = (typeof OpCode)[keyof typeof OpCode];
46
- /** Status codes for synchronization */
47
- export declare const Status: {
48
- readonly PENDING: 0;
49
- readonly READY: 1;
50
- readonly SUCCESS: 2;
51
- readonly ERROR: 3;
46
+ /**
47
+ * Two-word request/result state. The previous single STATUS word was
48
+ * written by THREE actors with TWO meanings (worker READY = "request
49
+ * published", host SUCCESS/ERROR = "result published", stop() READY =
50
+ * "wake for cancel") — a worker waiting for a result could observe a
51
+ * request-channel value and read a torn buffer (the CI flake class).
52
+ * Splitting the channels makes the torn state unrepresentable: a
53
+ * result wait is only ever woken by a result write. A state outside
54
+ * the tables on wake is a genuine protocol bug and fails loudly.
55
+ */
56
+ /** Worker + stop() write; the host waits on this word. */
57
+ export declare const RequestState: {
58
+ readonly IDLE: 0;
59
+ /** Worker has published an op. */
60
+ readonly REQUEST: 1;
61
+ /** stop() cancellation wake. The host treats any non-REQUEST wake as
62
+ * loop-abort (stop() also flips its `running` flag). */
63
+ readonly CANCELLED: 2;
64
+ };
65
+ type RequestStateType = (typeof RequestState)[keyof typeof RequestState];
66
+ /** Host writes; the worker waits on this word. stop() never touches
67
+ * it, so a result wait cannot be torn by cancellation. */
68
+ export declare const ResultState: {
69
+ readonly NONE: 0;
70
+ readonly SUCCESS: 1;
71
+ readonly ERROR: 2;
52
72
  };
53
- export type StatusType = (typeof Status)[keyof typeof Status];
73
+ type ResultStateType = (typeof ResultState)[keyof typeof ResultState];
54
74
  /** Error codes */
55
75
  export declare const ErrorCode: {
56
76
  readonly NONE: 0;
@@ -61,18 +81,34 @@ export declare const ErrorCode: {
61
81
  readonly PERMISSION_DENIED: 5;
62
82
  readonly INVALID_PATH: 6;
63
83
  readonly IO_ERROR: 7;
64
- readonly TIMEOUT: 8;
65
84
  readonly NETWORK_ERROR: 9;
66
85
  readonly NETWORK_NOT_CONFIGURED: 10;
67
86
  readonly NOT_EMPTY: 11;
87
+ readonly LOOP: 12;
88
+ readonly FILE_TOO_LARGE: 13;
89
+ readonly NO_SPACE: 14;
90
+ readonly BUSY: 15;
91
+ readonly READ_ONLY: 16;
92
+ readonly CROSS_DEVICE: 17;
68
93
  };
69
94
  export type ErrorCodeType = (typeof ErrorCode)[keyof typeof ErrorCode];
95
+ /**
96
+ * The canonical errno-name <-> wire-code table. Both bridge sides ship
97
+ * together, so the table lives here (not per-side copies): the host
98
+ * maps thrown errnos to wire codes with it, and workers derive guest-
99
+ * facing codes from its inverse via wireToErrnoName(). EPERM precedes
100
+ * EACCES so the inverse prefers the common node spelling.
101
+ */
102
+ export declare const ERRNO_TO_WIRE: Record<string, ErrorCodeType>;
103
+ /** Errno name for a wire code, or undefined for non-errno wire codes
104
+ * (NONE, IO_ERROR, network conditions). PERMISSION_DENIED inverts to
105
+ * EACCES (the more common spelling in node guests). */
106
+ export declare function wireToErrnoName(code: number): string | undefined;
70
107
  /** Buffer sizes */
71
108
  export declare const Size: {
72
- readonly CONTROL_REGION: 32;
73
109
  readonly PATH_BUFFER: 4096;
74
110
  readonly DATA_BUFFER: 8388608;
75
- readonly TOTAL: 8392736;
111
+ readonly TOTAL: 8392740;
76
112
  };
77
113
  /** Flags for operations */
78
114
  export declare const Flags: {
@@ -92,8 +128,10 @@ export declare class ProtocolBuffer {
92
128
  constructor(buffer: SharedArrayBuffer);
93
129
  getOpCode(): OpCodeType;
94
130
  setOpCode(code: OpCodeType): void;
95
- getStatus(): StatusType;
96
- setStatus(status: StatusType): void;
131
+ getRequest(): RequestStateType;
132
+ setRequest(request: RequestStateType): void;
133
+ getResultState(): ResultStateType;
134
+ setResultState(state: ResultStateType): void;
97
135
  getPathLength(): number;
98
136
  setPathLength(length: number): void;
99
137
  getDataLength(): number;
@@ -139,20 +177,16 @@ export declare class ProtocolBuffer {
139
177
  size: number;
140
178
  mtime: Date;
141
179
  };
142
- waitForReady(timeout?: number): "ok" | "timed-out" | "not-equal";
143
- waitForReadyAsync(timeout?: number): {
144
- async: false;
145
- value: "not-equal" | "timed-out";
146
- } | {
147
- async: true;
148
- value: Promise<"ok" | "timed-out">;
149
- };
150
180
  /**
151
- * Wait for status to become READY.
152
- * Returns immediately if status is already READY, or waits until it changes.
181
+ * Wait for the request word to become REQUEST.
182
+ * Returns immediately if already REQUEST; CANCELLED or any unexpected
183
+ * state returns false (the caller's running-flag check aborts the loop).
153
184
  */
154
185
  waitUntilReady(timeout: number): Promise<boolean>;
186
+ /** Worker-side blocking wait on the RESULT word (host writes). */
155
187
  waitForResult(timeout?: number): "ok" | "timed-out" | "not-equal";
156
- notify(): number;
188
+ notifyRequest(): number;
189
+ notifyResult(): number;
157
190
  reset(): void;
158
191
  }
192
+ export {};
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Filesystem error carrying its errno as a STRUCTURED field.
3
+ *
4
+ * The contract: the errno is chosen at the throw site and carried on
5
+ * `.code`; consumers read `.code` and never re-derive it from message
6
+ * prose. There is deliberately NO message-parsing fallback here —
7
+ * parsing "CODE:" prefixes back out of strings is the legacy path this
8
+ * module replaces, and keeping it would leave two sources of truth
9
+ * (the field and the phrasing) with an illusion of robustness.
10
+ *
11
+ * Message format is preserved as a DISPLAY convention only: FsError
12
+ * renders `${code}: ${message}` so existing user-facing text and
13
+ * message-asserting tests are unchanged. The prefix is produced FROM
14
+ * the code, never parsed back INTO one.
15
+ *
16
+ * Contract for IFileSystem implementations (documented on the
17
+ * interface): throw FsError, or any node-style error with a string
18
+ * `.code`. Errors without a structured code are coerced to EIO at
19
+ * classification boundaries (toFsError) — an honest unknown, never a
20
+ * fabricated specific errno.
21
+ */
22
+ export declare class FsError extends Error {
23
+ readonly code: string;
24
+ /** The message WITHOUT the "CODE: " transport prefix — what
25
+ * user-facing display paths should render. */
26
+ readonly bareMessage: string;
27
+ constructor(code: string, message: string);
28
+ }
29
+ /** Extract a structured errno from any thrown value, or undefined when
30
+ * the value carries none (bare Errors, strings, foreign objects). */
31
+ export declare function fsErrorCode(err: unknown): string | undefined;
32
+ /** True when the error carries the given structured errno. */
33
+ export declare function isFsErrorCode(err: unknown, code: string): boolean;
34
+ /**
35
+ * Classify any thrown value at a boundary: structured codes pass
36
+ * through unchanged; everything else becomes the fallback (EIO by
37
+ * default) with the original message preserved. Provided as PUBLIC API
38
+ * for custom IFileSystem implementations and host-side adapters that
39
+ * need to normalize third-party errors before handing them to
40
+ * just-bash internals. Internally, boundaries that only need the code
41
+ * (e.g. the worker bridge) read fsErrorCode directly instead.
42
+ */
43
+ export declare function toFsError(err: unknown, fallbackCode?: string): FsError;
@@ -96,6 +96,19 @@ export interface CpOptions {
96
96
  * - InMemoryFs (in-memory, default)
97
97
  * - Real filesystem (via node:fs)
98
98
  * - Custom implementations (e.g., remote storage, browser IndexedDB)
99
+ *
100
+ * ERROR CONTRACT: implementations signal failure kind by throwing
101
+ * {@link FsError} (or any node-style error with a string `.code`
102
+ * property) using POSIX errno names — `"ENOENT"`, `"EACCES"`,
103
+ * `"EEXIST"`, `"ENOTDIR"`, `"EISDIR"`, `"ENOTEMPTY"`, `"EPERM"`,
104
+ * `"EINVAL"`, `"EBUSY"`, `"ELOOP"`, `"EFBIG"`, `"EXDEV"`, `"ENOSPC"`,
105
+ * `"EROFS"`, `"EIO"`. Consumers
106
+ * (commands, bridged runtimes like python3, and error mappings) read
107
+ * the code from `.code`; they never parse it out of message prose.
108
+ * Errors with no structured code are classified at the boundary as
109
+ * EIO — an honest unknown, never a fabricated specific errno.
110
+ * Message text is free-form; by convention FsError renders
111
+ * `"ECODE: message"` for display.
99
112
  */
100
113
  export interface IFileSystem {
101
114
  /**
@@ -1,5 +1,6 @@
1
1
  import { type ByteString } from "../../encoding.js";
2
2
  import type { BufferEncoding, CpOptions, FileContent, FsStat, IFileSystem, MkdirOptions, ReadFileOptions, RmOptions, WriteFileOptions } from "../interface.js";
3
+ import type { OverlayDiff } from "../overlay-fs/overlay-fs.js";
3
4
  /**
4
5
  * Configuration for a mount point
5
6
  */
@@ -58,6 +59,25 @@ export declare class MountableFs implements IFileSystem {
58
59
  mountPoint: string;
59
60
  filesystem: IFileSystem;
60
61
  }>;
62
+ /**
63
+ * Combined change set across all diff-capable mounts. `space` selects
64
+ * the path form: "vfs" (default) keeps full virtual paths (mount
65
+ * prefix retained — directly replayable by a template merge);
66
+ * "host" maps each entry to its real-absolute host path (for
67
+ * template.apply / applyDiffToRealFs). The base fs is shared scratch
68
+ * and is not diffed. Mounts without a diff() method fail loudly —
69
+ * a merged view cannot silently omit a mount's changes.
70
+ */
71
+ diff(options?: {
72
+ space?: "vfs" | "host";
73
+ }): OverlayDiff;
74
+ /**
75
+ * Reconciliation support (template merge replay): set the changedAt
76
+ * ordering stamp of the node at `path` and its ancestors, routing to
77
+ * the owning mount. Paths outside every mount (shared scratch) have
78
+ * no stampable overlay and are ignored.
79
+ */
80
+ restamp(path: string, changedAt: number, scope?: "full" | "ancestors"): void;
61
81
  /**
62
82
  * Check if a path is exactly a mount point.
63
83
  */
@@ -17,7 +17,8 @@ export declare function removeFromRealFs(path: string): void;
17
17
  * symlinks are recreated with the recorded target; files get the recorded
18
18
  * content (unless metadataOnly — a chmod/utimes copy-up), the recorded
19
19
  * mode (POSIX only — mode bits are advisory on Windows), and the recorded
20
- * mtime restored after the content write.
20
+ * mtime restored after the content write. A type-conflicting on-disk
21
+ * target is replaced (the change-set supersedes the base).
21
22
  */
22
23
  export declare function applyWriteToRealFs(path: string, write: Omit<OverlayWrite, "path">): void;
23
24
  /**
@@ -1,3 +1,2 @@
1
1
  export { applyDiffToRealFs } from "./apply.js";
2
- export { mergeDiffs } from "./merge.js";
3
2
  export { type OverlayDiff, OverlayFs, type OverlayFsOptions, type OverlayNodeType, type OverlayWrite, } from "./overlay-fs.js";
@@ -130,6 +130,20 @@ export declare class OverlayFs implements IFileSystem {
130
130
  private readonly allowSymlinks;
131
131
  private readonly tree;
132
132
  private nextMemoryIdentity;
133
+ /** The real directory this overlay reads through and diffs against. */
134
+ get rootDir(): string;
135
+ /**
136
+ * Reconciliation support (template merge replay, host-side change-set
137
+ * application): stamp the node at `path` with `changedAt` (the
138
+ * replayed entry's own stamp), and correct any NEWER stamps among its
139
+ * ancestors and descendants. Post-sort, a newer stamp can only be a
140
+ * fresh wall-clock stamp minted by the replay op itself (ensured
141
+ * parents, resurrection whiteouts) — those belong to the replayed
142
+ * entry and take its stamp; earlier replayed entries (older stamps)
143
+ * are never touched. This is a host-side reconciliation API, not a
144
+ * guest operation: changedAt is the ordering key merges rely on.
145
+ */
146
+ restamp(path: string, changedAt: number, scope?: "full" | "ancestors"): void;
133
147
  private identityFor;
134
148
  constructor(options: OverlayFsOptions);
135
149
  /**
@@ -39,6 +39,11 @@ export declare function resolvePath(base: string, path: string): string;
39
39
  * Join a parent path with a child name.
40
40
  * Handles the root-path edge case (`"/" + "child"` → `"/child"`).
41
41
  */
42
+ /** Convert an OS-form path fragment to VFS slash form (win32
43
+ * backslashes become slashes; on POSIX this is a no-op). VFS paths are
44
+ * always slash-form — use when reconstructing a virtual path from a
45
+ * real-OS path (e.g. slicing off a real root). */
46
+ export declare function toVirtualSlashes(path: string): string;
42
47
  export declare function joinPath(parent: string, child: string): string;
43
48
  /**
44
49
  * Resolve a symlink target relative to the symlink's location.
@@ -67,6 +67,15 @@ export declare class FileTraversalBudget {
67
67
  constructor(options: TraversalBudgetOptions);
68
68
  checkpoint(work?: number): void;
69
69
  visit(depth: number): void;
70
+ /**
71
+ * Reserve directory children against the entry ceiling without charging for
72
+ * work not yet done. A single readdir can return far more entries than the
73
+ * traversal is allowed to retain, so the collection has to be admitted
74
+ * before it is held, but reading a directory is one filesystem operation
75
+ * however many names come back. Callers that go on to touch each child
76
+ * should use `discover` instead, which also charges the work.
77
+ */
78
+ reserve(count: number): void;
70
79
  /**
71
80
  * Reserve directory children before retaining work items for them. A single
72
81
  * readdir can return far more entries than the traversal is allowed to
@@ -10,41 +10,64 @@ export interface VfsTemplateMount {
10
10
  export interface VfsTemplateOptions {
11
11
  /**
12
12
  * Subtrees privatized per fork. Everything else (/, /tmp, ...) lives
13
- * in the template's shared in-memory scratch fs and behaves like
14
- * shared memory: visible to every fork immediately.
13
+ * in the template's shared scratch memory fs: writes there are
14
+ * visible to every fork immediately and never appear in diffs.
15
15
  */
16
16
  mounts: VfsTemplateMount[];
17
+ /**
18
+ * Per-overlay content-byte budget (OverlayFs maxMemoryBytes),
19
+ * bounding each fork's copy-up memory. Default: the OverlayFs
20
+ * default.
21
+ */
22
+ maxMemoryBytes?: number;
17
23
  }
18
24
  /**
19
- * A process image for parallel agent tool calls (see
25
+ * Template for cheap parallel forks (see
20
26
  * docs/design/vfs-template-fork-model.md). The template owns the shared
21
27
  * scratch fs and the mount configuration; each fork() stamps out a
22
28
  * ready MountableFs with fresh copy-on-write overlays over every
23
- * mounted real root. Forks are single-use: run, diff via merge(),
24
- * discard.
29
+ * mounted real root. Forks are unmanaged: the template keeps no
30
+ * registry, consumes nothing, and never tracks lifecycles.
31
+ *
32
+ * MERGE IS A REPLAY. `merge` combines the given change sets (fork
33
+ * instances are diffed in vfs space; plain diffs pass through), orders
34
+ * every entry by (changedAt, input order), and applies the entries to a
35
+ * fresh fork with the stock filesystem operations — the same codepath
36
+ * the forks themselves used, over the same lower. Anything the
37
+ * filesystem refuses (write under a file, chmod of a deleted path, ...)
38
+ * is skipped, which keeps conflicting (racy) input deterministic and
39
+ * contained to the conflicted path. After each replayed operation the
40
+ * touched node's changedAt is rewritten from the replay position, so
41
+ * merged output is byte-deterministic and wall-clock-free. The merged
42
+ * fork is returned: diff it and discard it, or keep working on it.
25
43
  *
26
44
  * ```ts
27
45
  * const tpl = createVfsTemplate({ mounts: [{ at: "/project", root: projDir }] });
28
46
  * const a = tpl.fork();
29
47
  * const b = tpl.fork();
30
- * await Promise.all([runA(a), runB(b)]);
31
- * const merged = tpl.merge([a, b]); // completion order = tiebreak
32
- * tpl.apply(merged);
48
+ * await Promise.all([runAgent(a), runAgent(b)]);
49
+ * const merged = await tpl.merge([a, b]);
50
+ * tpl.apply(merged.diff({ space: "host" }));
33
51
  * ```
34
52
  */
35
53
  export interface VfsTemplate {
36
54
  /** A fresh per-call filesystem: shared scratch + fresh overlays. */
37
55
  fork(): MountableFs;
38
56
  /**
39
- * Merge the change sets of the given forks (in completion order —
40
- * the tiebreak under changedAt) into one diff with real absolute
41
- * paths. Forks not listed are merged after, in registration order.
57
+ * Replay the given sources' change sets onto a fresh fork and return
58
+ * it. Sources may be fork instances (diffed in vfs space) or plain
59
+ * diffs (e.g. serialized across a process boundary). Array order is
60
+ * the tie-break for equal changedAt stamps. Entries outside every
61
+ * mount point replay into the shared scratch (ordinary fork
62
+ * semantics, never reported in diff()) — merge expects diffs in
63
+ * this template's vfs space.
42
64
  */
43
- merge(forksInCompletionOrder?: MountableFs[]): OverlayDiff;
65
+ merge(sources: Array<MountableFs | OverlayDiff>): Promise<MountableFs>;
44
66
  /**
45
- * Validate a merged diff against the mount map (an entry outside
46
- * every registered root fails loudly) and apply it to the real
47
- * roots. Consumes all registered forks.
67
+ * Validate a merged host-space diff against the mount map (every
68
+ * entry inside a registered root, no symlink writes, no root-self
69
+ * deletion) and apply it to the real filesystem. Type-conflicting
70
+ * on-disk targets are replaced (the change-set supersedes the base).
48
71
  */
49
72
  apply(merged: OverlayDiff): void;
50
73
  }
package/dist/index.d.cts CHANGED
@@ -8,10 +8,11 @@ export type { CommandContextOptions, CustomCommand, LazyCommand, } from "./custo
8
8
  export { createCommandContext, defineCommand, } from "./custom-commands.js";
9
9
  export type { ByteString, OutputKind } from "./encoding.js";
10
10
  export { bytesOutput, decodeBytesToUtf8, EMPTY_BYTES, encodeUtf8ToBytes, latin1FromBytes, stdoutAsBytes, stdoutKind, textOutput, unsafeBytesFromLatin1, } from "./encoding.js";
11
+ export { FsError, fsErrorCode, isFsErrorCode, toFsError, } from "./fs/fs-error.js";
11
12
  export { InMemoryFs } from "./fs/in-memory-fs/index.js";
12
13
  export type { BufferEncoding, CpOptions, DirectoryEntry, FileContent, FileEntry, FileInit, FileSystemFactory, FsEntry, FsStat, InitialFiles, LazyFileEntry, LazyFileProvider, MkdirOptions, RmOptions, SymlinkEntry, } from "./fs/interface.js";
13
14
  export { MountableFs, type MountableFsOptions, type MountConfig, } from "./fs/mountable-fs/index.js";
14
- export { applyDiffToRealFs, mergeDiffs, type OverlayDiff, OverlayFs, type OverlayFsOptions, type OverlayNodeType, type OverlayWrite, } from "./fs/overlay-fs/index.js";
15
+ export { applyDiffToRealFs, type OverlayDiff, OverlayFs, type OverlayFsOptions, type OverlayNodeType, type OverlayWrite, } from "./fs/overlay-fs/index.js";
15
16
  export { ReadWriteFs, type ReadWriteFsOptions, } from "./fs/read-write-fs/index.js";
16
17
  export { createVfsTemplate, type VfsTemplate, type VfsTemplateMount, type VfsTemplateOptions, } from "./fs/vfs-template.js";
17
18
  export type { AllowedUrl, AllowedUrlEntry, NetworkConfig, RequestTransform, SecureFetch, } from "./network/index.js";
package/dist/index.d.ts CHANGED
@@ -8,10 +8,11 @@ export type { CommandContextOptions, CustomCommand, LazyCommand, } from "./custo
8
8
  export { createCommandContext, defineCommand, } from "./custom-commands.js";
9
9
  export type { ByteString, OutputKind } from "./encoding.js";
10
10
  export { bytesOutput, decodeBytesToUtf8, EMPTY_BYTES, encodeUtf8ToBytes, latin1FromBytes, stdoutAsBytes, stdoutKind, textOutput, unsafeBytesFromLatin1, } from "./encoding.js";
11
+ export { FsError, fsErrorCode, isFsErrorCode, toFsError, } from "./fs/fs-error.js";
11
12
  export { InMemoryFs } from "./fs/in-memory-fs/index.js";
12
13
  export type { BufferEncoding, CpOptions, DirectoryEntry, FileContent, FileEntry, FileInit, FileSystemFactory, FsEntry, FsStat, InitialFiles, LazyFileEntry, LazyFileProvider, MkdirOptions, RmOptions, SymlinkEntry, } from "./fs/interface.js";
13
14
  export { MountableFs, type MountableFsOptions, type MountConfig, } from "./fs/mountable-fs/index.js";
14
- export { applyDiffToRealFs, mergeDiffs, type OverlayDiff, OverlayFs, type OverlayFsOptions, type OverlayNodeType, type OverlayWrite, } from "./fs/overlay-fs/index.js";
15
+ export { applyDiffToRealFs, type OverlayDiff, OverlayFs, type OverlayFsOptions, type OverlayNodeType, type OverlayWrite, } from "./fs/overlay-fs/index.js";
15
16
  export { ReadWriteFs, type ReadWriteFsOptions, } from "./fs/read-write-fs/index.js";
16
17
  export { createVfsTemplate, type VfsTemplate, type VfsTemplateMount, type VfsTemplateOptions, } from "./fs/vfs-template.js";
17
18
  export type { AllowedUrl, AllowedUrlEntry, NetworkConfig, RequestTransform, SecureFetch, } from "./network/index.js";
@@ -21,6 +21,16 @@ export type ExecuteUserScriptFn = (scriptPath: string, args: string[], stdin?: s
21
21
  /**
22
22
  * Dispatch context containing dependencies needed for builtin dispatch
23
23
  */
24
+ /** Stdio contract passed to builtin handlers. */
25
+ export interface BuiltinIo {
26
+ stdin: string;
27
+ /** True when a redirection gave this command its own fd 0. `stdin`
28
+ * alone cannot express it: `cmd < empty-file` and an unredirected
29
+ * command both arrive as `""`, but only the first means EOF rather
30
+ * than "inherit the shell's stdin". */
31
+ stdinRedirected: boolean;
32
+ stdinSourceFd: number;
33
+ }
24
34
  export interface BuiltinDispatchContext {
25
35
  ctx: InterpreterContext;
26
36
  runCommand: RunCommandFn;