toolcraft 0.0.749 → 0.0.750

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 (374) hide show
  1. package/composition.json +23 -3
  2. package/dist/composition.json +23 -3
  3. package/dist/human-in-loop/approvals-commands.d.ts +1 -1
  4. package/dist/index.d.ts +1 -262
  5. package/dist/index.js +1 -573
  6. package/dist/runtime-platform.d.ts +2 -0
  7. package/dist/runtime-platform.js +2 -0
  8. package/dist/runtime-platform.workerd.d.ts +3 -0
  9. package/dist/runtime-platform.workerd.js +10 -0
  10. package/dist/runtime.d.ts +262 -0
  11. package/dist/runtime.js +576 -0
  12. package/node_modules/@noble/hashes/LICENSE +21 -0
  13. package/node_modules/@noble/hashes/README.md +478 -0
  14. package/node_modules/@noble/hashes/_blake.d.ts +20 -0
  15. package/node_modules/@noble/hashes/_blake.js +59 -0
  16. package/node_modules/@noble/hashes/_md.d.ts +95 -0
  17. package/node_modules/@noble/hashes/_md.js +209 -0
  18. package/node_modules/@noble/hashes/_u64.d.ts +36 -0
  19. package/node_modules/@noble/hashes/_u64.js +77 -0
  20. package/node_modules/@noble/hashes/argon2.d.ts +148 -0
  21. package/node_modules/@noble/hashes/argon2.js +577 -0
  22. package/node_modules/@noble/hashes/blake1.d.ts +162 -0
  23. package/node_modules/@noble/hashes/blake1.js +630 -0
  24. package/node_modules/@noble/hashes/blake2.d.ts +203 -0
  25. package/node_modules/@noble/hashes/blake2.js +573 -0
  26. package/node_modules/@noble/hashes/blake3.d.ts +68 -0
  27. package/node_modules/@noble/hashes/blake3.js +310 -0
  28. package/node_modules/@noble/hashes/eskdf.d.ts +91 -0
  29. package/node_modules/@noble/hashes/eskdf.js +225 -0
  30. package/node_modules/@noble/hashes/hkdf.d.ts +70 -0
  31. package/node_modules/@noble/hashes/hkdf.js +152 -0
  32. package/node_modules/@noble/hashes/hmac.d.ts +50 -0
  33. package/node_modules/@noble/hashes/hmac.js +93 -0
  34. package/node_modules/@noble/hashes/index.d.ts +1 -0
  35. package/node_modules/@noble/hashes/index.js +34 -0
  36. package/node_modules/@noble/hashes/legacy.d.ts +107 -0
  37. package/node_modules/@noble/hashes/legacy.js +348 -0
  38. package/node_modules/@noble/hashes/package.json +91 -0
  39. package/node_modules/@noble/hashes/pbkdf2.d.ts +66 -0
  40. package/node_modules/@noble/hashes/pbkdf2.js +176 -0
  41. package/node_modules/@noble/hashes/scrypt.d.ts +98 -0
  42. package/node_modules/@noble/hashes/scrypt.js +304 -0
  43. package/node_modules/@noble/hashes/sha2.d.ts +176 -0
  44. package/node_modules/@noble/hashes/sha2.js +446 -0
  45. package/node_modules/@noble/hashes/sha3-addons.d.ts +533 -0
  46. package/node_modules/@noble/hashes/sha3-addons.js +973 -0
  47. package/node_modules/@noble/hashes/sha3.d.ts +208 -0
  48. package/node_modules/@noble/hashes/sha3.js +475 -0
  49. package/node_modules/@noble/hashes/src/_blake.ts +67 -0
  50. package/node_modules/@noble/hashes/src/_md.ts +227 -0
  51. package/node_modules/@noble/hashes/src/_u64.ts +111 -0
  52. package/node_modules/@noble/hashes/src/argon2.ts +693 -0
  53. package/node_modules/@noble/hashes/src/blake1.ts +677 -0
  54. package/node_modules/@noble/hashes/src/blake2.ts +648 -0
  55. package/node_modules/@noble/hashes/src/blake3.ts +344 -0
  56. package/node_modules/@noble/hashes/src/eskdf.ts +265 -0
  57. package/node_modules/@noble/hashes/src/hkdf.ts +161 -0
  58. package/node_modules/@noble/hashes/src/hmac.ts +130 -0
  59. package/node_modules/@noble/hashes/src/index.ts +33 -0
  60. package/node_modules/@noble/hashes/src/legacy.ts +361 -0
  61. package/node_modules/@noble/hashes/src/pbkdf2.ts +219 -0
  62. package/node_modules/@noble/hashes/src/scrypt.ts +375 -0
  63. package/node_modules/@noble/hashes/src/sha2.ts +486 -0
  64. package/node_modules/@noble/hashes/src/sha3-addons.ts +1157 -0
  65. package/node_modules/@noble/hashes/src/sha3.ts +525 -0
  66. package/node_modules/@noble/hashes/src/utils.ts +978 -0
  67. package/node_modules/@noble/hashes/src/webcrypto.ts +283 -0
  68. package/node_modules/@noble/hashes/utils.d.ts +560 -0
  69. package/node_modules/@noble/hashes/utils.js +687 -0
  70. package/node_modules/@noble/hashes/webcrypto.d.ts +121 -0
  71. package/node_modules/@noble/hashes/webcrypto.js +228 -0
  72. package/node_modules/@poe-code/agent-mcp-config/dist/apply.js +23 -9
  73. package/node_modules/@poe-code/config-mutations/README.md +2 -0
  74. package/node_modules/@poe-code/config-mutations/dist/execution/apply-mutation.js +4 -5
  75. package/node_modules/@poe-code/config-mutations/dist/execution/path-utils.d.ts +3 -4
  76. package/node_modules/@poe-code/config-mutations/dist/execution/path-utils.js +3 -3
  77. package/node_modules/@poe-code/config-mutations/dist/template/render.js +1 -1
  78. package/node_modules/@poe-code/config-mutations/dist/testing/mock-fs.d.ts +2 -2
  79. package/node_modules/@poe-code/config-mutations/dist/testing/mock-fs.js +3 -6
  80. package/node_modules/@poe-code/config-mutations/dist/types.d.ts +4 -2
  81. package/node_modules/@poe-code/process-runner/README.md +2 -1
  82. package/node_modules/@poe-code/process-runner/dist/transfer-filesystem.d.ts +1 -0
  83. package/node_modules/@poe-code/process-runner/dist/transfer-filesystem.js +1 -0
  84. package/node_modules/@poe-code/process-runner/dist/transfer-filesystem.workerd.d.ts +2 -0
  85. package/node_modules/@poe-code/process-runner/dist/transfer-filesystem.workerd.js +1 -0
  86. package/node_modules/@poe-code/process-runner/dist/types.d.ts +1 -1
  87. package/node_modules/@poe-code/process-runner/dist/workspace-transfer.d.ts +6 -5
  88. package/node_modules/@poe-code/process-runner/dist/workspace-transfer.js +67 -29
  89. package/node_modules/@poe-code/process-runner/package.json +13 -0
  90. package/node_modules/@poe-code/safe-fs/LICENSE +21 -0
  91. package/node_modules/@poe-code/safe-fs/PROVENANCE.json +428 -0
  92. package/node_modules/@poe-code/safe-fs/README.md +411 -0
  93. package/node_modules/@poe-code/safe-fs/dist/bridge/confinement.d.ts +3 -0
  94. package/node_modules/@poe-code/safe-fs/dist/bridge/confinement.js +171 -0
  95. package/node_modules/@poe-code/safe-fs/dist/bridge/filesystem.d.ts +93 -0
  96. package/node_modules/@poe-code/safe-fs/dist/bridge/filesystem.js +453 -0
  97. package/node_modules/@poe-code/safe-fs/dist/bridge/index.d.ts +7 -0
  98. package/node_modules/@poe-code/safe-fs/dist/bridge/index.js +19 -0
  99. package/node_modules/@poe-code/safe-fs/dist/bridge/stats.d.ts +4 -0
  100. package/node_modules/@poe-code/safe-fs/dist/bridge/stats.js +37 -0
  101. package/node_modules/@poe-code/safe-fs/dist/bridge/types.d.ts +81 -0
  102. package/node_modules/@poe-code/safe-fs/dist/bridge/types.js +1 -0
  103. package/node_modules/@poe-code/safe-fs/dist/bridge/values.d.ts +6 -0
  104. package/node_modules/@poe-code/safe-fs/dist/bridge/values.js +65 -0
  105. package/node_modules/@poe-code/safe-fs/dist/config/memory.d.ts +3 -0
  106. package/node_modules/@poe-code/safe-fs/dist/config/memory.js +7 -0
  107. package/node_modules/@poe-code/safe-fs/dist/config/real.d.ts +5 -0
  108. package/node_modules/@poe-code/safe-fs/dist/config/real.js +16 -0
  109. package/node_modules/@poe-code/safe-fs/dist/config/registry.d.ts +2 -0
  110. package/node_modules/@poe-code/safe-fs/dist/config/registry.js +15 -0
  111. package/node_modules/@poe-code/safe-fs/dist/config.d.ts +15 -0
  112. package/node_modules/@poe-code/safe-fs/dist/config.js +46 -0
  113. package/node_modules/@poe-code/safe-fs/dist/config.node.d.ts +2 -0
  114. package/node_modules/@poe-code/safe-fs/dist/config.node.js +11 -0
  115. package/node_modules/@poe-code/safe-fs/dist/config.portable.d.ts +3 -0
  116. package/node_modules/@poe-code/safe-fs/dist/config.portable.js +9 -0
  117. package/node_modules/@poe-code/safe-fs/dist/contracts/abort.d.ts +5 -0
  118. package/node_modules/@poe-code/safe-fs/dist/contracts/abort.js +34 -0
  119. package/node_modules/@poe-code/safe-fs/dist/contracts/cleanup.d.ts +1 -0
  120. package/node_modules/@poe-code/safe-fs/dist/contracts/cleanup.js +9 -0
  121. package/node_modules/@poe-code/safe-fs/dist/contracts/descriptor.d.ts +38 -0
  122. package/node_modules/@poe-code/safe-fs/dist/contracts/descriptor.js +1 -0
  123. package/node_modules/@poe-code/safe-fs/dist/contracts/errors.d.ts +53 -0
  124. package/node_modules/@poe-code/safe-fs/dist/contracts/errors.js +99 -0
  125. package/node_modules/@poe-code/safe-fs/dist/contracts/filesystem.d.ts +379 -0
  126. package/node_modules/@poe-code/safe-fs/dist/contracts/filesystem.js +1 -0
  127. package/node_modules/@poe-code/safe-fs/dist/contracts/index.d.ts +6 -0
  128. package/node_modules/@poe-code/safe-fs/dist/contracts/index.js +6 -0
  129. package/node_modules/@poe-code/safe-fs/dist/contracts/io.d.ts +12 -0
  130. package/node_modules/@poe-code/safe-fs/dist/contracts/io.js +321 -0
  131. package/node_modules/@poe-code/safe-fs/dist/contracts/object.d.ts +134 -0
  132. package/node_modules/@poe-code/safe-fs/dist/contracts/object.js +97 -0
  133. package/node_modules/@poe-code/safe-fs/dist/contracts/path.d.ts +3 -0
  134. package/node_modules/@poe-code/safe-fs/dist/contracts/path.js +2 -0
  135. package/node_modules/@poe-code/safe-fs/dist/contracts/portable-path.d.ts +21 -0
  136. package/node_modules/@poe-code/safe-fs/dist/contracts/portable-path.js +78 -0
  137. package/node_modules/@poe-code/safe-fs/dist/contracts/virtual-path.d.ts +15 -0
  138. package/node_modules/@poe-code/safe-fs/dist/contracts/virtual-path.js +162 -0
  139. package/node_modules/@poe-code/safe-fs/dist/core.d.ts +19 -0
  140. package/node_modules/@poe-code/safe-fs/dist/core.js +17 -0
  141. package/node_modules/@poe-code/safe-fs/dist/fs/capabilities.d.ts +10 -0
  142. package/node_modules/@poe-code/safe-fs/dist/fs/capabilities.js +216 -0
  143. package/node_modules/@poe-code/safe-fs/dist/fs/conditional-chmod.d.ts +7 -0
  144. package/node_modules/@poe-code/safe-fs/dist/fs/conditional-chmod.js +19 -0
  145. package/node_modules/@poe-code/safe-fs/dist/fs/descriptor.d.ts +21 -0
  146. package/node_modules/@poe-code/safe-fs/dist/fs/descriptor.js +279 -0
  147. package/node_modules/@poe-code/safe-fs/dist/fs/devices/index.d.ts +59 -0
  148. package/node_modules/@poe-code/safe-fs/dist/fs/devices/index.js +875 -0
  149. package/node_modules/@poe-code/safe-fs/dist/fs/devices/path.d.ts +7 -0
  150. package/node_modules/@poe-code/safe-fs/dist/fs/devices/path.js +250 -0
  151. package/node_modules/@poe-code/safe-fs/dist/fs/devices/stream.d.ts +6 -0
  152. package/node_modules/@poe-code/safe-fs/dist/fs/devices/stream.js +136 -0
  153. package/node_modules/@poe-code/safe-fs/dist/fs/directory-admission.d.ts +3 -0
  154. package/node_modules/@poe-code/safe-fs/dist/fs/directory-admission.js +14 -0
  155. package/node_modules/@poe-code/safe-fs/dist/fs/memory/atomic-view.d.ts +11 -0
  156. package/node_modules/@poe-code/safe-fs/dist/fs/memory/atomic-view.js +13 -0
  157. package/node_modules/@poe-code/safe-fs/dist/fs/memory/index.d.ts +186 -0
  158. package/node_modules/@poe-code/safe-fs/dist/fs/memory/index.js +3771 -0
  159. package/node_modules/@poe-code/safe-fs/dist/fs/memory/ledger.d.ts +26 -0
  160. package/node_modules/@poe-code/safe-fs/dist/fs/memory/ledger.js +96 -0
  161. package/node_modules/@poe-code/safe-fs/dist/fs/memory/limits.d.ts +13 -0
  162. package/node_modules/@poe-code/safe-fs/dist/fs/memory/limits.js +26 -0
  163. package/node_modules/@poe-code/safe-fs/dist/fs/memory/missing-target.d.ts +15 -0
  164. package/node_modules/@poe-code/safe-fs/dist/fs/memory/missing-target.js +144 -0
  165. package/node_modules/@poe-code/safe-fs/dist/fs/mount/comparison.d.ts +19 -0
  166. package/node_modules/@poe-code/safe-fs/dist/fs/mount/comparison.js +118 -0
  167. package/node_modules/@poe-code/safe-fs/dist/fs/mount/identity.d.ts +6 -0
  168. package/node_modules/@poe-code/safe-fs/dist/fs/mount/identity.js +29 -0
  169. package/node_modules/@poe-code/safe-fs/dist/fs/mount/index.d.ts +74 -0
  170. package/node_modules/@poe-code/safe-fs/dist/fs/mount/index.js +1291 -0
  171. package/node_modules/@poe-code/safe-fs/dist/fs/object-authority.d.ts +27 -0
  172. package/node_modules/@poe-code/safe-fs/dist/fs/object-authority.js +287 -0
  173. package/node_modules/@poe-code/safe-fs/dist/fs/object-publication/index.d.ts +45 -0
  174. package/node_modules/@poe-code/safe-fs/dist/fs/object-publication/index.js +531 -0
  175. package/node_modules/@poe-code/safe-fs/dist/fs/overlay/index.d.ts +87 -0
  176. package/node_modules/@poe-code/safe-fs/dist/fs/overlay/index.js +1185 -0
  177. package/node_modules/@poe-code/safe-fs/dist/fs/overlay/memory-publication.d.ts +42 -0
  178. package/node_modules/@poe-code/safe-fs/dist/fs/overlay/memory-publication.js +558 -0
  179. package/node_modules/@poe-code/safe-fs/dist/fs/path-namespace.d.ts +4 -0
  180. package/node_modules/@poe-code/safe-fs/dist/fs/path-namespace.js +63 -0
  181. package/node_modules/@poe-code/safe-fs/dist/fs/quota/index.d.ts +12 -0
  182. package/node_modules/@poe-code/safe-fs/dist/fs/quota/index.js +520 -0
  183. package/node_modules/@poe-code/safe-fs/dist/fs/readonly/index.d.ts +37 -0
  184. package/node_modules/@poe-code/safe-fs/dist/fs/readonly/index.js +208 -0
  185. package/node_modules/@poe-code/safe-fs/dist/fs/real/allocation.d.ts +1 -0
  186. package/node_modules/@poe-code/safe-fs/dist/fs/real/allocation.js +8 -0
  187. package/node_modules/@poe-code/safe-fs/dist/fs/real/index.d.ts +105 -0
  188. package/node_modules/@poe-code/safe-fs/dist/fs/real/index.js +1259 -0
  189. package/node_modules/@poe-code/safe-fs/dist/fs/s3/authority.d.ts +7 -0
  190. package/node_modules/@poe-code/safe-fs/dist/fs/s3/authority.js +38 -0
  191. package/node_modules/@poe-code/safe-fs/dist/fs/s3/filesystem.d.ts +130 -0
  192. package/node_modules/@poe-code/safe-fs/dist/fs/s3/filesystem.js +1137 -0
  193. package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/bytes.d.ts +1 -0
  194. package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/bytes.js +9 -0
  195. package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/index.d.ts +2 -0
  196. package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/index.js +1 -0
  197. package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/request-fetch.d.ts +15 -0
  198. package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/request-fetch.js +74 -0
  199. package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/request-node.d.ts +4 -0
  200. package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/request-node.js +111 -0
  201. package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/request.d.ts +17 -0
  202. package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/request.js +89 -0
  203. package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/signature.d.ts +20 -0
  204. package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/signature.js +76 -0
  205. package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/transport.d.ts +3 -0
  206. package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/transport.js +478 -0
  207. package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/types.d.ts +30 -0
  208. package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/types.js +1 -0
  209. package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/xml.d.ts +14 -0
  210. package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/xml.js +192 -0
  211. package/node_modules/@poe-code/safe-fs/dist/fs/s3/index.d.ts +8 -0
  212. package/node_modules/@poe-code/safe-fs/dist/fs/s3/index.js +4 -0
  213. package/node_modules/@poe-code/safe-fs/dist/fs/s3/key-order.d.ts +2 -0
  214. package/node_modules/@poe-code/safe-fs/dist/fs/s3/key-order.js +11 -0
  215. package/node_modules/@poe-code/safe-fs/dist/fs/s3/manifest-admission.d.ts +8 -0
  216. package/node_modules/@poe-code/safe-fs/dist/fs/s3/manifest-admission.js +167 -0
  217. package/node_modules/@poe-code/safe-fs/dist/fs/s3/mock.d.ts +48 -0
  218. package/node_modules/@poe-code/safe-fs/dist/fs/s3/mock.js +249 -0
  219. package/node_modules/@poe-code/safe-fs/dist/fs/s3/namespace.d.ts +13 -0
  220. package/node_modules/@poe-code/safe-fs/dist/fs/s3/namespace.js +400 -0
  221. package/node_modules/@poe-code/safe-fs/dist/fs/s3/registry.d.ts +10 -0
  222. package/node_modules/@poe-code/safe-fs/dist/fs/s3/registry.js +73 -0
  223. package/node_modules/@poe-code/safe-fs/dist/fs/s3/transport.d.ts +103 -0
  224. package/node_modules/@poe-code/safe-fs/dist/fs/s3/transport.js +28 -0
  225. package/node_modules/@poe-code/safe-fs/dist/fs/scoped.d.ts +19 -0
  226. package/node_modules/@poe-code/safe-fs/dist/fs/scoped.js +663 -0
  227. package/node_modules/@poe-code/safe-fs/dist/fs/staging-ancestry.d.ts +8 -0
  228. package/node_modules/@poe-code/safe-fs/dist/fs/staging-ancestry.js +115 -0
  229. package/node_modules/@poe-code/safe-fs/dist/fs/staging-cleanup.d.ts +5 -0
  230. package/node_modules/@poe-code/safe-fs/dist/fs/staging-cleanup.js +63 -0
  231. package/node_modules/@poe-code/safe-fs/dist/fs/webdav/index.d.ts +2 -0
  232. package/node_modules/@poe-code/safe-fs/dist/fs/webdav/index.js +1 -0
  233. package/node_modules/@poe-code/safe-fs/dist/fs/webdav/resource-id.d.ts +18 -0
  234. package/node_modules/@poe-code/safe-fs/dist/fs/webdav/resource-id.js +109 -0
  235. package/node_modules/@poe-code/safe-fs/dist/fs/webdav/webdav.d.ts +141 -0
  236. package/node_modules/@poe-code/safe-fs/dist/fs/webdav/webdav.js +1377 -0
  237. package/node_modules/@poe-code/safe-fs/dist/fs/webdav/xml.d.ts +15 -0
  238. package/node_modules/@poe-code/safe-fs/dist/fs/webdav/xml.js +59 -0
  239. package/node_modules/@poe-code/safe-fs/dist/index.d.ts +25 -0
  240. package/node_modules/@poe-code/safe-fs/dist/index.js +21 -0
  241. package/node_modules/@poe-code/safe-fs/dist/native/fs-seek/linux-x64-glibc.node +0 -0
  242. package/node_modules/@poe-code/safe-fs/dist/native/fs-seek/loader.d.ts +5 -0
  243. package/node_modules/@poe-code/safe-fs/dist/native/fs-seek/loader.mjs +120 -0
  244. package/node_modules/@poe-code/safe-fs/dist/native/fs-seek/manifest.json +46 -0
  245. package/node_modules/@poe-code/safe-fs/dist/node/filesystem.d.ts +19 -0
  246. package/node_modules/@poe-code/safe-fs/dist/node/filesystem.js +30 -0
  247. package/node_modules/@poe-code/safe-fs/dist/node/host.d.ts +3 -0
  248. package/node_modules/@poe-code/safe-fs/dist/node/host.js +78 -0
  249. package/node_modules/@poe-code/safe-fs/dist/node/index.d.ts +3 -0
  250. package/node_modules/@poe-code/safe-fs/dist/node/index.js +2 -0
  251. package/node_modules/@poe-code/safe-fs/dist/node/native-seek-unavailable.d.ts +1 -0
  252. package/node_modules/@poe-code/safe-fs/dist/node/native-seek-unavailable.js +5 -0
  253. package/node_modules/@poe-code/safe-fs/dist/node/native-seek.d.ts +3 -0
  254. package/node_modules/@poe-code/safe-fs/dist/node/native-seek.js +54 -0
  255. package/node_modules/@poe-code/safe-fs/dist/node/stats.d.ts +1 -0
  256. package/node_modules/@poe-code/safe-fs/dist/node/stats.js +1 -0
  257. package/node_modules/@poe-code/safe-fs/dist/node/values.d.ts +1 -0
  258. package/node_modules/@poe-code/safe-fs/dist/node/values.js +1 -0
  259. package/node_modules/@poe-code/safe-fs/dist/node-host.d.ts +1 -0
  260. package/node_modules/@poe-code/safe-fs/dist/node-host.js +1 -0
  261. package/node_modules/@poe-code/safe-fs/dist/node-unavailable.d.ts +1 -0
  262. package/node_modules/@poe-code/safe-fs/dist/node-unavailable.js +1 -0
  263. package/node_modules/@poe-code/safe-fs/dist/package.json +29 -0
  264. package/node_modules/@poe-code/safe-fs/dist/platform/browser-path.d.ts +1 -0
  265. package/node_modules/@poe-code/safe-fs/dist/platform/browser-path.js +1 -0
  266. package/node_modules/@poe-code/safe-fs/dist/platform/browser.d.ts +26 -0
  267. package/node_modules/@poe-code/safe-fs/dist/platform/browser.js +58 -0
  268. package/node_modules/@poe-code/safe-fs/dist/platform/node-path.d.ts +1 -0
  269. package/node_modules/@poe-code/safe-fs/dist/platform/node-path.js +1 -0
  270. package/node_modules/@poe-code/safe-fs/dist/platform/node.d.ts +26 -0
  271. package/node_modules/@poe-code/safe-fs/dist/platform/node.js +64 -0
  272. package/node_modules/@poe-code/safe-fs/dist/platform/transport-budget.d.ts +9 -0
  273. package/node_modules/@poe-code/safe-fs/dist/platform/transport-budget.js +17 -0
  274. package/node_modules/@poe-code/safe-fs/dist/python/emscripten.d.ts +15 -0
  275. package/node_modules/@poe-code/safe-fs/dist/python/emscripten.js +357 -0
  276. package/node_modules/@poe-code/safe-fs/dist/python/filesystem.d.ts +51 -0
  277. package/node_modules/@poe-code/safe-fs/dist/python/filesystem.js +243 -0
  278. package/node_modules/@poe-code/safe-fs/dist/python/flags.d.ts +3 -0
  279. package/node_modules/@poe-code/safe-fs/dist/python/flags.js +14 -0
  280. package/node_modules/@poe-code/safe-fs/dist/python/index.d.ts +9 -0
  281. package/node_modules/@poe-code/safe-fs/dist/python/index.js +5 -0
  282. package/node_modules/@poe-code/safe-fs/dist/python/native.d.ts +18 -0
  283. package/node_modules/@poe-code/safe-fs/dist/python/native.js +446 -0
  284. package/node_modules/@poe-code/safe-fs/dist/python/request.d.ts +2 -0
  285. package/node_modules/@poe-code/safe-fs/dist/python/request.js +61 -0
  286. package/node_modules/@poe-code/safe-fs/dist/python/stat.d.ts +8 -0
  287. package/node_modules/@poe-code/safe-fs/dist/python/stat.js +34 -0
  288. package/node_modules/@poe-code/safe-fs/dist/runtime-core.d.ts +27 -0
  289. package/node_modules/@poe-code/safe-fs/dist/runtime-core.js +57 -0
  290. package/node_modules/@poe-code/safe-fs/dist/testing/atomic-filesystem.d.ts +16 -0
  291. package/node_modules/@poe-code/safe-fs/dist/testing/atomic-filesystem.js +496 -0
  292. package/node_modules/@poe-code/safe-fs/dist/testing/object-io-control.d.ts +23 -0
  293. package/node_modules/@poe-code/safe-fs/dist/testing/object-io-control.js +39 -0
  294. package/node_modules/@poe-code/safe-fs/dist/testing/object-io-metrics.d.ts +31 -0
  295. package/node_modules/@poe-code/safe-fs/dist/testing/object-io-metrics.js +143 -0
  296. package/node_modules/@poe-code/safe-fs/dist/testing/object-publication.d.ts +19 -0
  297. package/node_modules/@poe-code/safe-fs/dist/testing/object-publication.js +209 -0
  298. package/node_modules/@poe-code/safe-fs/dist/xml.d.ts +1 -0
  299. package/node_modules/@poe-code/safe-fs/dist/xml.js +1 -0
  300. package/node_modules/@poe-code/safe-fs/package.json +189 -0
  301. package/node_modules/@poe-code/task-list/README.md +2 -0
  302. package/node_modules/@poe-code/task-list/dist/backends/gh-issues-client.d.ts +1 -1
  303. package/node_modules/@poe-code/task-list/dist/backends/gh-issues-client.js +11 -4
  304. package/node_modules/@poe-code/task-list/dist/backends/markdown-dir.js +2 -2
  305. package/node_modules/@poe-code/task-list/dist/backends/utils.js +5 -7
  306. package/node_modules/@poe-code/task-list/dist/backends/yaml-file.js +1 -1
  307. package/node_modules/@poe-code/task-list/dist/default-host.d.ts +2 -0
  308. package/node_modules/@poe-code/task-list/dist/default-host.js +2 -0
  309. package/node_modules/@poe-code/task-list/dist/default-host.workerd.d.ts +4 -0
  310. package/node_modules/@poe-code/task-list/dist/default-host.workerd.js +6 -0
  311. package/node_modules/@poe-code/task-list/dist/filesystem.d.ts +3 -0
  312. package/node_modules/@poe-code/task-list/dist/filesystem.js +32 -0
  313. package/node_modules/@poe-code/task-list/dist/move.js +3 -3
  314. package/node_modules/@poe-code/task-list/dist/open.js +2 -5
  315. package/node_modules/@poe-code/task-list/dist/paths.d.ts +12 -0
  316. package/node_modules/@poe-code/task-list/dist/paths.js +7 -0
  317. package/node_modules/@poe-code/task-list/dist/types.d.ts +6 -5
  318. package/node_modules/@poe-code/task-list/package.json +9 -0
  319. package/node_modules/@poe-code/terminal-text/LICENSE +21 -0
  320. package/node_modules/@poe-code/terminal-text/README.md +12 -0
  321. package/node_modules/@poe-code/terminal-text/dist/index.d.ts +2 -0
  322. package/node_modules/@poe-code/terminal-text/dist/index.js +20 -0
  323. package/node_modules/@poe-code/terminal-text/package.json +22 -0
  324. package/node_modules/@poe-code/xml-ast/LICENSE +21 -0
  325. package/node_modules/@poe-code/xml-ast/README.md +28 -0
  326. package/node_modules/@poe-code/xml-ast/dist/index.d.ts +47 -0
  327. package/node_modules/@poe-code/xml-ast/dist/index.js +635 -0
  328. package/node_modules/@poe-code/xml-ast/package.json +25 -0
  329. package/node_modules/auth-store/README.md +35 -0
  330. package/node_modules/auth-store/dist/index.browser.d.ts +4 -0
  331. package/node_modules/auth-store/dist/index.browser.js +2 -0
  332. package/node_modules/auth-store/dist/provider-store.d.ts +1 -1
  333. package/node_modules/auth-store/dist/safe-fs-secret-store.d.ts +21 -0
  334. package/node_modules/auth-store/dist/safe-fs-secret-store.js +119 -0
  335. package/node_modules/auth-store/dist/secret-store.d.ts +12 -0
  336. package/node_modules/auth-store/dist/secret-store.js +1 -0
  337. package/node_modules/auth-store/dist/transaction-lock.d.ts +2 -4
  338. package/node_modules/auth-store/dist/types.d.ts +2 -9
  339. package/node_modules/auth-store/package.json +16 -2
  340. package/node_modules/tiny-http-mcp-server/dist/composition.json +16 -1
  341. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/README.md +25 -0
  342. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/authorization-state.js +4 -4
  343. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/default-oauth-client-provider.js +6 -40
  344. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/oauth-form.d.ts +10 -0
  345. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/oauth-form.js +20 -0
  346. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/pkce.js +4 -3
  347. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/register-client.d.ts +14 -0
  348. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/register-client.js +53 -0
  349. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/resumable.d.ts +16 -2
  350. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/resumable.js +29 -9
  351. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/revoke-token.d.ts +12 -0
  352. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/revoke-token.js +23 -0
  353. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/token-endpoint.js +6 -19
  354. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/http-fetch.js +1 -1
  355. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/index.browser.d.ts +6 -2
  356. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/index.browser.js +5 -1
  357. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/index.d.ts +5 -2
  358. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/index.js +4 -1
  359. package/node_modules/tiny-http-mcp-server/package.json +4 -4
  360. package/node_modules/tiny-mcp-client/README.md +2 -0
  361. package/node_modules/tiny-mcp-client/dist/index.browser.d.ts +25 -23
  362. package/node_modules/tiny-mcp-client/dist/index.browser.js +116 -1
  363. package/node_modules/tiny-mcp-client/dist/index.d.ts +25 -23
  364. package/node_modules/tiny-mcp-client/dist/index.js +1034 -561
  365. package/node_modules/tiny-mcp-client/package.json +15 -0
  366. package/node_modules/tiny-stdio-mcp-server/dist/composition.json +1 -1
  367. package/node_modules/toolcraft-design/dist/components/table.js +6 -0
  368. package/node_modules/toolcraft-design/dist/escape-terminal-text.d.ts +1 -2
  369. package/node_modules/toolcraft-design/dist/escape-terminal-text.js +1 -20
  370. package/node_modules/toolcraft-design/dist/terminal-markdown/parser/frontmatter.js +2 -1
  371. package/node_modules/toolcraft-design/dist/terminal-markdown/parser.js +2 -1
  372. package/node_modules/toolcraft-schema/dist/json-schema/utils.js +3 -0
  373. package/node_modules/toolcraft-schema/package.json +1 -1
  374. package/package.json +32 -7
@@ -0,0 +1,93 @@
1
+ import type { FileSystem } from "../contracts/filesystem.js";
2
+ import type { BridgePrimitives, BufferEncodingOption, FsBridgeDirent, FsBridgeEncoding, FsBridgeStats, MakeDirectoryOptions, Mode, ObjectEncodingOptions, StatOptions } from "./types.js";
3
+ type Encoding = FsBridgeEncoding | "buffer";
4
+ type ReadOptions = ObjectEncodingOptions & {
5
+ flag?: string | number | undefined;
6
+ signal?: AbortSignal | undefined;
7
+ };
8
+ type DirectoryOptions = {
9
+ encoding?: Encoding | null | undefined;
10
+ recursive?: boolean | undefined;
11
+ withFileTypes?: boolean | undefined;
12
+ };
13
+ export declare class FileSystemBridge<Binary extends Uint8Array> {
14
+ #private;
15
+ static getProvider(bridge: object): FileSystem | undefined;
16
+ constructor(fs: FileSystem, options: {
17
+ readonly cwd?: string;
18
+ readonly root?: string;
19
+ readonly signal?: AbortSignal;
20
+ readonly readFileMaxBytes?: number;
21
+ readonly reserveReadFile?: () => () => void;
22
+ }, primitives: BridgePrimitives<Binary>);
23
+ readFile(path: unknown, options?: {
24
+ encoding?: null | undefined;
25
+ flag?: string | number | undefined;
26
+ signal?: AbortSignal | undefined;
27
+ } | null): Promise<Binary>;
28
+ readFile(path: unknown, options: FsBridgeEncoding | (ReadOptions & {
29
+ encoding: FsBridgeEncoding;
30
+ })): Promise<string>;
31
+ readFile(path: unknown, options?: ReadOptions | FsBridgeEncoding | null): Promise<string | Binary>;
32
+ writeFile(path: unknown, data: unknown, options?: unknown): Promise<void>;
33
+ appendFile(path: unknown, data: unknown, options?: unknown): Promise<void>;
34
+ stat(path: unknown, options?: StatOptions & {
35
+ bigint?: false | undefined;
36
+ }): Promise<FsBridgeStats>;
37
+ stat(path: unknown, options: StatOptions & {
38
+ bigint: true;
39
+ }): Promise<never>;
40
+ stat(path: unknown, options?: StatOptions): Promise<FsBridgeStats>;
41
+ lstat(path: unknown, options?: StatOptions & {
42
+ bigint?: false | undefined;
43
+ }): Promise<FsBridgeStats>;
44
+ lstat(path: unknown, options: StatOptions & {
45
+ bigint: true;
46
+ }): Promise<never>;
47
+ lstat(path: unknown, options?: StatOptions): Promise<FsBridgeStats>;
48
+ readdir(path: unknown, options?: FsBridgeEncoding | (ObjectEncodingOptions & {
49
+ withFileTypes?: false | undefined;
50
+ recursive?: boolean | undefined;
51
+ }) | null): Promise<string[]>;
52
+ readdir(path: unknown, options: "buffer" | (DirectoryOptions & {
53
+ encoding: "buffer";
54
+ withFileTypes?: false | undefined;
55
+ })): Promise<Binary[]>;
56
+ readdir(path: unknown, options: ObjectEncodingOptions & {
57
+ withFileTypes: true;
58
+ recursive?: boolean | undefined;
59
+ }): Promise<FsBridgeDirent[]>;
60
+ readdir(path: unknown, options: DirectoryOptions & {
61
+ encoding: "buffer";
62
+ withFileTypes: true;
63
+ }): Promise<FsBridgeDirent<Binary>[]>;
64
+ mkdir(path: unknown, options: MakeDirectoryOptions & {
65
+ recursive: true;
66
+ }): Promise<string | undefined>;
67
+ mkdir(path: unknown, options?: Mode | (MakeDirectoryOptions & {
68
+ recursive?: false | undefined;
69
+ }) | null): Promise<void>;
70
+ mkdir(path: unknown, options?: Mode | MakeDirectoryOptions | null): Promise<string | undefined>;
71
+ access(path: unknown, mode?: number): Promise<void>;
72
+ unlink(path: unknown): Promise<void>;
73
+ rm(path: unknown, value?: unknown): Promise<void>;
74
+ rmdir(path: unknown, value?: unknown): Promise<void>;
75
+ rename(source: unknown, destination: unknown): Promise<void>;
76
+ copyFile(source: unknown, destination: unknown, mode?: number): Promise<void>;
77
+ cp(source: unknown, destination: unknown, value?: unknown): Promise<void>;
78
+ readlink(path: unknown, options?: ObjectEncodingOptions | FsBridgeEncoding | null): Promise<string>;
79
+ readlink(path: unknown, options: BufferEncodingOption): Promise<Binary>;
80
+ readlink(path: unknown, options?: ObjectEncodingOptions | BufferEncodingOption | string | null): Promise<string | Binary>;
81
+ realpath(path: unknown, options?: ObjectEncodingOptions | FsBridgeEncoding | null): Promise<string>;
82
+ realpath(path: unknown, options: BufferEncodingOption): Promise<Binary>;
83
+ realpath(path: unknown, options?: ObjectEncodingOptions | BufferEncodingOption | string | null): Promise<string | Binary>;
84
+ mkdtemp(prefix: string, options?: ObjectEncodingOptions | FsBridgeEncoding | null): Promise<string>;
85
+ mkdtemp(prefix: string, options: BufferEncodingOption): Promise<Binary>;
86
+ mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncodingOption | string | null): Promise<string | Binary>;
87
+ symlink(target: unknown, path: unknown, type?: unknown): Promise<void>;
88
+ link(existing: unknown, path: unknown): Promise<void>;
89
+ chmod(path: unknown, value: unknown): Promise<void>;
90
+ utimes(path: unknown, atime: unknown, mtime: unknown): Promise<void>;
91
+ truncate(path: unknown, length?: number): Promise<void>;
92
+ }
93
+ export {};
@@ -0,0 +1,453 @@
1
+ import { composeAbortSignals } from "../contracts/abort.js";
2
+ import { bridgeDirent, bridgeStats } from "./stats.js";
3
+ import { booleanValue, checkSignal, onlyKeys, record, withSignal } from "./values.js";
4
+ import { assertBridgePath, checkedBridgePath } from "./confinement.js";
5
+ function fsError(code, syscall, path) {
6
+ return Object.assign(new Error(`${code}: ${syscall}${path === undefined ? "" : ` '${path}'`}`), {
7
+ code,
8
+ syscall,
9
+ ...(path === undefined ? {} : { path }),
10
+ });
11
+ }
12
+ function unsupported(operation) {
13
+ throw fsError("ENOTSUP", operation);
14
+ }
15
+ function hasCode(error, code) {
16
+ return error instanceof Error && "code" in error && error.code === code;
17
+ }
18
+ function childPath(parent, name) {
19
+ return `${parent.replace(/\/$/u, "")}/${name}`;
20
+ }
21
+ function optionsRecord(value, allowed) {
22
+ const options = value == null ? {} : typeof value === "string" ? { encoding: value } : record(value, "options");
23
+ onlyKeys(options, allowed);
24
+ return options;
25
+ }
26
+ function modeValue(value, fallback) {
27
+ if (value === undefined)
28
+ return fallback;
29
+ const parsed = typeof value === "string" && /^[0-7]+$/u.test(value) ? Number.parseInt(value, 8) : value;
30
+ if (typeof parsed !== "number" || !Number.isInteger(parsed) || parsed < 0 || parsed > 0o7777) {
31
+ throw new TypeError("Invalid file mode");
32
+ }
33
+ return parsed;
34
+ }
35
+ function timeValue(value) {
36
+ const number = value instanceof Date ? value.getTime() : Number(value) * 1000;
37
+ if ((typeof value !== "string" && typeof value !== "number" && !(value instanceof Date)) || !Number.isFinite(number)) {
38
+ throw new TypeError("Invalid timestamp");
39
+ }
40
+ return number;
41
+ }
42
+ export class FileSystemBridge {
43
+ static getProvider(bridge) {
44
+ return #fs in bridge ? bridge.#fs : undefined;
45
+ }
46
+ #fs;
47
+ #cwd;
48
+ #root;
49
+ #signal;
50
+ #readFileMaxBytes;
51
+ #reserveReadFile;
52
+ #primitives;
53
+ #codec;
54
+ constructor(fs, options, primitives) {
55
+ if (fs === undefined)
56
+ throw new TypeError("An explicit filesystem is required");
57
+ const cwd = options.cwd ?? "/";
58
+ if (!primitives.paths.isAbsolute(cwd) || cwd.includes("\0"))
59
+ throw new TypeError("cwd must be an absolute virtual path");
60
+ const codec = primitives.codec;
61
+ if (codec === undefined || codec === null || typeof codec.isEncoding !== "function" || typeof codec.encode !== "function" || typeof codec.decode !== "function") {
62
+ throw new TypeError("An explicit filesystem codec is required");
63
+ }
64
+ this.#primitives = primitives;
65
+ this.#codec = Object.freeze({
66
+ isEncoding: codec.isEncoding.bind(codec),
67
+ encode: codec.encode.bind(codec),
68
+ decode: codec.decode.bind(codec)
69
+ });
70
+ this.#fs = fs;
71
+ this.#cwd = primitives.paths.resolve("/", cwd);
72
+ this.#root = primitives.paths.resolve("/", options.root ?? cwd);
73
+ assertBridgePath(this.#root, this.#cwd);
74
+ this.#signal = options.signal;
75
+ const maximum = options.readFileMaxBytes;
76
+ if (maximum !== undefined && maximum !== Infinity && (!Number.isSafeInteger(maximum) || maximum < 0))
77
+ throw new TypeError("Invalid readFileMaxBytes");
78
+ this.#readFileMaxBytes = maximum;
79
+ if (options.reserveReadFile !== undefined && typeof options.reserveReadFile !== "function")
80
+ throw new TypeError("Invalid reserveReadFile");
81
+ this.#reserveReadFile = options.reserveReadFile;
82
+ }
83
+ #encoding(value, fallback, names = false) {
84
+ const selected = value == null ? fallback : value;
85
+ if (typeof selected !== "string" || (selected !== "buffer" && !this.#codec.isEncoding(selected)) || (names && !this.#codec.isEncoding("utf8"))) {
86
+ throw new TypeError("Invalid encoding");
87
+ }
88
+ return selected;
89
+ }
90
+ #textBytes(value) {
91
+ return this.#primitives.copyBytes(this.#codec.encode(value, "utf8"));
92
+ }
93
+ #path(value) {
94
+ const path = this.#primitives.pathValue === undefined ? value : this.#primitives.pathValue(value);
95
+ if (typeof path !== "string" || path.includes("\0"))
96
+ throw new TypeError("Expected a path without NUL bytes; file handles are unsupported");
97
+ if (path.length === 0)
98
+ throw fsError("ENOENT", "path", path);
99
+ checkSignal(this.#signal);
100
+ const absolute = this.#primitives.paths.isAbsolute(path) ? path : childPath(this.#cwd, path);
101
+ assertBridgePath(this.#root, absolute);
102
+ return absolute;
103
+ }
104
+ async #call(paths, operation, signal, noFollow = []) {
105
+ if (signal !== undefined && !(signal instanceof AbortSignal))
106
+ throw new TypeError("Invalid AbortSignal");
107
+ const signalScope = signal !== undefined && this.#signal !== undefined && signal !== this.#signal
108
+ ? composeAbortSignals([signal, this.#signal]) : undefined;
109
+ const combined = signalScope?.signal ?? signal ?? this.#signal;
110
+ try {
111
+ checkSignal(combined);
112
+ const options = combined === undefined ? {} : { signal: combined };
113
+ return await withSignal(combined, async () => {
114
+ const absolute = paths.map((path) => this.#path(path));
115
+ const resolved = [...absolute];
116
+ if (this.#root !== "/") {
117
+ for (let index = 0; index < absolute.length; index++) {
118
+ resolved[index] = await checkedBridgePath(this.#fs, this.#root, absolute[index], options, !noFollow.includes(index));
119
+ }
120
+ }
121
+ checkSignal(combined);
122
+ return operation(options, resolved);
123
+ });
124
+ }
125
+ finally {
126
+ signalScope?.dispose();
127
+ }
128
+ }
129
+ async readFile(path, value) {
130
+ const options = optionsRecord(value, ["encoding", "flag", "signal"]);
131
+ if (options.flag !== undefined && options.flag !== "r")
132
+ unsupported("readFile flag");
133
+ if (options.encoding === "buffer")
134
+ throw new TypeError("Invalid read encoding");
135
+ const codec = this.#encoding(options.encoding, "buffer");
136
+ const maxBytes = this.#readFileMaxBytes;
137
+ const release = this.#reserveReadFile?.();
138
+ let pending;
139
+ try {
140
+ const bytes = await this.#call([path], (signal, resolved) => {
141
+ pending = this.#fs.readFile(resolved[0], { ...signal, ...(maxBytes === undefined ? {} : { maxBytes }) });
142
+ return pending;
143
+ }, options.signal);
144
+ if (maxBytes !== undefined && bytes.byteLength > maxBytes)
145
+ throw fsError("EFBIG", "readFile");
146
+ const buffer = this.#primitives.copyBytes(bytes);
147
+ return codec === "buffer" ? buffer : this.#codec.decode(buffer, codec);
148
+ }
149
+ finally {
150
+ // Cancellation may reject #call before a backend acknowledges it. Keep
151
+ // its reservation until the actual read settles, as well as through decode.
152
+ if (release !== undefined) {
153
+ if (pending === undefined)
154
+ release();
155
+ else
156
+ void pending.then(release, release);
157
+ }
158
+ }
159
+ }
160
+ async #write(path, data, value, fallback) {
161
+ const options = optionsRecord(value, ["encoding", "flag", "mode", "flush", "signal"]);
162
+ if (booleanValue(options.flush))
163
+ unsupported("writeFile flush");
164
+ const codec = this.#encoding(options.encoding, "utf8");
165
+ if (codec === "buffer")
166
+ throw new TypeError("Invalid write encoding");
167
+ const flag = options.flag ?? fallback;
168
+ if (flag !== "w" && flag !== "wx" && flag !== "a" && flag !== "ax")
169
+ unsupported("writeFile flag");
170
+ const mode = modeValue(options.mode, 0o666);
171
+ let bytes;
172
+ if (typeof data === "string")
173
+ bytes = this.#primitives.copyBytes(this.#codec.encode(data, codec));
174
+ else if (ArrayBuffer.isView(data))
175
+ bytes = this.#primitives.copyBytes(new Uint8Array(data.buffer, data.byteOffset, data.byteLength));
176
+ else
177
+ throw new TypeError("writeFile accepts a string or ArrayBuffer view; streams and file handles are unsupported");
178
+ await this.#call([path], (signal, resolved) => this.#fs.writeFile(resolved[0], bytes, { ...signal, flag, mode }), options.signal);
179
+ }
180
+ async writeFile(path, data, options) {
181
+ await this.#write(path, data, options, "w");
182
+ }
183
+ async appendFile(path, data, options) {
184
+ await this.#write(path, data, options, "a");
185
+ }
186
+ async stat(path, value) {
187
+ const options = optionsRecord(value, ["bigint"]);
188
+ if (booleanValue(options.bigint))
189
+ unsupported("stat bigint");
190
+ return bridgeStats(await this.#call([path], (signal, resolved) => this.#fs.stat(resolved[0], signal)));
191
+ }
192
+ async lstat(path, value) {
193
+ const options = optionsRecord(value, ["bigint"]);
194
+ if (booleanValue(options.bigint))
195
+ unsupported("lstat bigint");
196
+ return bridgeStats(await this.#call([path], (signal, resolved) => this.#fs.lstat(resolved[0], signal), undefined, [0]));
197
+ }
198
+ async readdir(path, value) {
199
+ const options = optionsRecord(value, ["encoding", "withFileTypes", "recursive"]);
200
+ const codec = this.#encoding(options.encoding, "utf8", true);
201
+ const withFileTypes = booleanValue(options.withFileTypes);
202
+ const recursive = booleanValue(options.recursive);
203
+ const root = this.#path(path);
204
+ const entries = [];
205
+ const pending = [root];
206
+ while (pending.length > 0) {
207
+ const directory = pending.shift();
208
+ if (directory === undefined)
209
+ break;
210
+ for (const entry of await this.#call([directory], (signal, resolved) => this.#fs.readdir(resolved[0], signal))) {
211
+ if (entry.name === "" || entry.name === "." || entry.name === ".." || entry.name.includes("/") || entry.name.includes("\0")) {
212
+ throw new TypeError("Invalid directory entry from filesystem");
213
+ }
214
+ const fullPath = childPath(directory, entry.name);
215
+ entries.push({ ...entry, parentPath: directory, relative: this.#primitives.paths.relative(root, fullPath) });
216
+ if (recursive && entry.type === "directory")
217
+ pending.push(fullPath);
218
+ }
219
+ }
220
+ if (withFileTypes) {
221
+ return codec === "buffer"
222
+ ? entries.map((entry) => bridgeDirent(this.#textBytes(entry.name), entry.parentPath, entry.type))
223
+ : entries.map((entry) => bridgeDirent(this.#codec.decode(this.#textBytes(entry.name), codec), entry.parentPath, entry.type));
224
+ }
225
+ return codec === "buffer"
226
+ ? entries.map((entry) => this.#textBytes(entry.relative))
227
+ : entries.map((entry) => this.#codec.decode(this.#textBytes(entry.relative), codec));
228
+ }
229
+ async mkdir(path, value) {
230
+ const options = typeof value === "number" || typeof value === "string" ? { mode: value } : optionsRecord(value, ["mode", "recursive"]);
231
+ const mode = modeValue(options.mode, 0o777);
232
+ const recursive = booleanValue(options.recursive);
233
+ const target = this.#path(path);
234
+ let firstCreated;
235
+ if (recursive) {
236
+ let candidate = target;
237
+ while (true) {
238
+ try {
239
+ await this.#call([candidate], (signal, resolved) => this.#fs.stat(resolved[0], signal));
240
+ break;
241
+ }
242
+ catch (error) {
243
+ if (!hasCode(error, "ENOENT"))
244
+ throw error;
245
+ firstCreated = candidate;
246
+ if (candidate === this.#root)
247
+ break;
248
+ const parent = this.#primitives.paths.dirname(candidate);
249
+ if (parent === candidate)
250
+ break;
251
+ candidate = parent;
252
+ }
253
+ }
254
+ }
255
+ await this.#call([target], (signal, resolved) => this.#fs.mkdir(resolved[0], { ...signal, mode, recursive }));
256
+ return firstCreated;
257
+ }
258
+ async access(path, mode = 0) {
259
+ if (!Number.isInteger(mode) || mode < 0 || mode > 7)
260
+ throw new TypeError("Invalid access mode");
261
+ await this.#call([path], (signal, resolved) => this.#fs.access(resolved[0], mode, signal));
262
+ }
263
+ async unlink(path) {
264
+ await this.#call([path], async (signal, resolved) => {
265
+ if (!this.#fs.unlink)
266
+ unsupported("unlink");
267
+ await this.#fs.unlink(resolved[0], signal);
268
+ }, undefined, [0]);
269
+ }
270
+ async rm(path, value) {
271
+ const options = optionsRecord(value, ["force", "recursive", "maxRetries", "retryDelay"]);
272
+ if (options.maxRetries !== undefined && options.maxRetries !== 0)
273
+ unsupported("rm retries");
274
+ if (options.retryDelay !== undefined)
275
+ unsupported("rm retryDelay");
276
+ const recursive = booleanValue(options.recursive);
277
+ const force = booleanValue(options.force);
278
+ await this.#call([path], (signal, resolved) => this.#fs.rm(resolved[0], { ...signal, recursive, force }), undefined, [0]);
279
+ }
280
+ async rmdir(path, value) {
281
+ const options = optionsRecord(value, ["recursive", "maxRetries", "retryDelay"]);
282
+ const stat = await this.lstat(path);
283
+ if (!stat.isDirectory())
284
+ throw fsError("ENOTDIR", "rmdir", this.#path(path));
285
+ if (!booleanValue(options.recursive)) {
286
+ if ((await this.readdir(path)).length > 0)
287
+ throw fsError("ENOTEMPTY", "rmdir", this.#path(path));
288
+ if (options.maxRetries !== undefined && options.maxRetries !== 0)
289
+ unsupported("rmdir retries");
290
+ if (options.retryDelay !== undefined)
291
+ unsupported("rmdir retryDelay");
292
+ const method = this.#fs.rmdir;
293
+ if (method === undefined)
294
+ unsupported("atomic rmdir");
295
+ await this.#call([path], (signal, resolved) => method.call(this.#fs, resolved[0], signal), undefined, [0]);
296
+ }
297
+ else
298
+ await this.rm(path, options);
299
+ }
300
+ async rename(source, destination) {
301
+ await this.#call([source, destination], (signal, resolved) => this.#fs.rename(resolved[0], resolved[1], signal), undefined, [0, 1]);
302
+ }
303
+ async copyFile(source, destination, mode = 0) {
304
+ if (mode !== 0 && mode !== 1)
305
+ unsupported("copyFile mode");
306
+ await this.#call([source, destination], (signal, resolved) => this.#fs.copyFile(resolved[0], resolved[1], { ...signal, exclusive: mode === 1 }));
307
+ }
308
+ async cp(source, destination, value) {
309
+ const options = optionsRecord(value, ["recursive", "force", "errorOnExist", "mode", "dereference", "preserveTimestamps", "verbatimSymlinks"]);
310
+ if (booleanValue(options.dereference) || booleanValue(options.preserveTimestamps) || booleanValue(options.verbatimSymlinks))
311
+ unsupported("cp options");
312
+ const recursive = booleanValue(options.recursive);
313
+ const force = booleanValue(options.force, true);
314
+ const errorOnExist = booleanValue(options.errorOnExist);
315
+ if (options.mode !== undefined && options.mode !== 0 && options.mode !== 1)
316
+ unsupported("cp mode");
317
+ const from = this.#path(source);
318
+ const to = this.#path(destination);
319
+ const canonicalFrom = await this.realpath(from);
320
+ let ancestor = to === this.#root ? to : this.#primitives.paths.dirname(to);
321
+ let canonicalAncestor;
322
+ while (true) {
323
+ try {
324
+ canonicalAncestor = await this.realpath(ancestor);
325
+ break;
326
+ }
327
+ catch (error) {
328
+ if (!hasCode(error, "ENOENT"))
329
+ throw error;
330
+ const parent = this.#primitives.paths.dirname(ancestor);
331
+ if (parent === ancestor)
332
+ throw error;
333
+ ancestor = parent;
334
+ }
335
+ }
336
+ const canonicalTo = this.#primitives.paths.resolve(canonicalAncestor, this.#primitives.paths.relative(ancestor, to));
337
+ if (canonicalFrom === "/" || canonicalTo === canonicalFrom || canonicalTo.startsWith(`${canonicalFrom}/`))
338
+ throw fsError("EINVAL", "cp", to);
339
+ const copy = async (current, target) => {
340
+ const sourceStat = await this.lstat(current);
341
+ if (sourceStat.isSymbolicLink())
342
+ unsupported("cp symlink");
343
+ let destinationStat;
344
+ try {
345
+ destinationStat = await this.lstat(target);
346
+ }
347
+ catch (error) {
348
+ if (!hasCode(error, "ENOENT"))
349
+ throw error;
350
+ }
351
+ if (destinationStat?.isSymbolicLink())
352
+ unsupported("cp destination symlink");
353
+ if (sourceStat.isDirectory()) {
354
+ if (!recursive)
355
+ throw fsError("EISDIR", "cp", current);
356
+ if (destinationStat !== undefined && !destinationStat.isDirectory())
357
+ throw fsError("ENOTDIR", "cp", target);
358
+ await this.mkdir(target, { recursive: true, mode: sourceStat.mode & 0o7777 });
359
+ for (const entry of await this.readdir(current))
360
+ await copy(childPath(current, entry), childPath(target, entry));
361
+ }
362
+ else {
363
+ if (destinationStat?.isDirectory())
364
+ throw fsError("EISDIR", "cp", target);
365
+ if (destinationStat !== undefined && !force) {
366
+ if (errorOnExist)
367
+ throw fsError("EEXIST", "cp", target);
368
+ return;
369
+ }
370
+ await this.mkdir(this.#primitives.paths.dirname(target), { recursive: true });
371
+ await this.copyFile(current, target, options.mode === 1 || !force ? 1 : 0);
372
+ }
373
+ };
374
+ await copy(from, to);
375
+ }
376
+ async readlink(path, value) {
377
+ const codec = this.#encoding(optionsRecord(value, ["encoding"]).encoding, "utf8", true);
378
+ const method = this.#fs.readlink;
379
+ if (method === undefined)
380
+ unsupported("readlink");
381
+ const target = await this.#call([path], (signal, resolved) => method.call(this.#fs, resolved[0], signal), undefined, [0]);
382
+ return codec === "buffer" ? this.#textBytes(target) : this.#codec.decode(this.#textBytes(target), codec);
383
+ }
384
+ async realpath(path, value) {
385
+ const codec = this.#encoding(optionsRecord(value, ["encoding"]).encoding, "utf8", true);
386
+ const target = await this.#call([path], (signal, resolved) => this.#fs.realpath(resolved[0], signal));
387
+ assertBridgePath(this.#root, target);
388
+ return codec === "buffer" ? this.#textBytes(target) : this.#codec.decode(this.#textBytes(target), codec);
389
+ }
390
+ async mkdtemp(prefix, value) {
391
+ if (typeof prefix !== "string" || prefix.includes("\0"))
392
+ throw new TypeError("Invalid mkdtemp prefix");
393
+ const codec = this.#encoding(optionsRecord(value, ["encoding"]).encoding, "utf8", true);
394
+ for (let attempt = 0; attempt < 10; attempt += 1) {
395
+ const path = prefix + this.#primitives.randomSuffix();
396
+ try {
397
+ await this.mkdir(path, { mode: 0o700 });
398
+ return codec === "buffer" ? this.#textBytes(path) : this.#codec.decode(this.#textBytes(path), codec);
399
+ }
400
+ catch (error) {
401
+ if (!hasCode(error, "EEXIST"))
402
+ throw error;
403
+ }
404
+ }
405
+ throw fsError("EEXIST", "mkdtemp", prefix);
406
+ }
407
+ async symlink(target, path, type) {
408
+ if (type !== undefined && type !== null && type !== "file" && type !== "dir")
409
+ unsupported("symlink type");
410
+ const linkTarget = this.#primitives.pathValue === undefined ? target : this.#primitives.pathValue(target);
411
+ if (typeof linkTarget !== "string" || linkTarget.includes("\0"))
412
+ throw new TypeError("Invalid symlink target");
413
+ const destination = this.#path(path);
414
+ const absoluteTarget = this.#path(this.#primitives.paths.isAbsolute(linkTarget)
415
+ ? linkTarget : childPath(this.#primitives.paths.dirname(destination), linkTarget));
416
+ if (this.#root !== "/" && this.#primitives.paths.isAbsolute(linkTarget)) {
417
+ throw fsError("ENOTSUP", "symlink", destination);
418
+ }
419
+ const method = this.#fs.symlink;
420
+ if (method === undefined)
421
+ unsupported("symlink");
422
+ await this.#call([destination, absoluteTarget], (signal, resolved) => method.call(this.#fs, linkTarget, resolved[0], signal), undefined, [0]);
423
+ }
424
+ async link(existing, path) {
425
+ const method = this.#fs.link;
426
+ if (method === undefined)
427
+ unsupported("link");
428
+ await this.#call([existing, path], (signal, resolved) => method.call(this.#fs, resolved[0], resolved[1], signal), undefined, [1]);
429
+ }
430
+ async chmod(path, value) {
431
+ const mode = modeValue(value, 0);
432
+ const method = this.#fs.chmod;
433
+ if (method === undefined)
434
+ unsupported("chmod");
435
+ await this.#call([path], (signal, resolved) => method.call(this.#fs, resolved[0], mode, signal));
436
+ }
437
+ async utimes(path, atime, mtime) {
438
+ const accessTime = timeValue(atime);
439
+ const modificationTime = timeValue(mtime);
440
+ const method = this.#fs.utimes;
441
+ if (method === undefined)
442
+ unsupported("utimes");
443
+ await this.#call([path], (signal, resolved) => method.call(this.#fs, resolved[0], accessTime, modificationTime, signal));
444
+ }
445
+ async truncate(path, length = 0) {
446
+ if (!Number.isInteger(length))
447
+ throw new TypeError("Invalid truncate length");
448
+ const method = this.#fs.truncate;
449
+ if (method === undefined)
450
+ unsupported("truncate");
451
+ await this.#call([path], (signal, resolved) => method.call(this.#fs, resolved[0], Math.max(0, length), signal));
452
+ }
453
+ }
@@ -0,0 +1,7 @@
1
+ import type { FileSystem } from "../contracts/filesystem.js";
2
+ import { FileSystemBridge } from "./filesystem.js";
3
+ import type { FsBridgeOptions } from "./types.js";
4
+ export type { FsBridgeCodec, FsBridgeDirent, FsBridgeEncoding, FsBridgeFileSystem, FsBridgeOptions, FsBridgeStats } from "./types.js";
5
+ export type FsBridge = FileSystemBridge<Uint8Array<ArrayBuffer>>;
6
+ export declare function createFsBridge(fs: FileSystem, options: FsBridgeOptions): FsBridge;
7
+ export declare const getFsBridgeProvider: typeof FileSystemBridge.getProvider;
@@ -0,0 +1,19 @@
1
+ import { platform } from "#safe-fs-platform";
2
+ import { dirname, relativePath, resolvePath } from "../contracts/virtual-path.js";
3
+ import { FileSystemBridge } from "./filesystem.js";
4
+ export function createFsBridge(fs, options) {
5
+ if (options === undefined || options === null)
6
+ throw new TypeError("An explicit filesystem codec is required");
7
+ return new FileSystemBridge(fs, options, {
8
+ codec: options.codec,
9
+ copyBytes(bytes) { return new Uint8Array(bytes); },
10
+ randomSuffix() { return platform.randomUUID().slice(0, 6); },
11
+ paths: {
12
+ isAbsolute(path) { return typeof path === "string" && path.startsWith("/"); },
13
+ dirname,
14
+ relative: relativePath,
15
+ resolve: resolvePath
16
+ }
17
+ });
18
+ }
19
+ export const getFsBridgeProvider = FileSystemBridge.getProvider;
@@ -0,0 +1,4 @@
1
+ import type { FsBridgeDirent, FsBridgeStats } from "./types.js";
2
+ import type { FileStat, FileType } from "../contracts/filesystem.js";
3
+ export declare function bridgeStats(stat: FileStat): FsBridgeStats;
4
+ export declare function bridgeDirent<Name extends string | Uint8Array>(name: Name, parentPath: string, type: FileType): FsBridgeDirent<Name>;
@@ -0,0 +1,37 @@
1
+ function predicates(type) {
2
+ return {
3
+ isFile: () => type === "file",
4
+ isDirectory: () => type === "directory",
5
+ isSymbolicLink: () => type === "symlink",
6
+ isBlockDevice: () => false,
7
+ isCharacterDevice: () => type === "character",
8
+ isFIFO: () => false,
9
+ isSocket: () => false,
10
+ };
11
+ }
12
+ export function bridgeStats(stat) {
13
+ return {
14
+ dev: stat.dev ?? 0,
15
+ ino: stat.ino ?? 0,
16
+ mode: (stat.mode & 0o7777) | (stat.type === "directory" ? 0o040000 : stat.type === "symlink" ? 0o120000 : stat.type === "character" ? 0o020000 : 0o100000),
17
+ nlink: stat.nlink ?? 1,
18
+ uid: stat.uid ?? 0,
19
+ gid: stat.gid ?? 0,
20
+ rdev: 0,
21
+ size: stat.size,
22
+ blksize: stat.ioBlockSize ?? stat.preferredIoBlockSize ?? 4096,
23
+ blocks: Math.ceil(stat.size / 512),
24
+ atimeMs: stat.atimeMs,
25
+ mtimeMs: stat.mtimeMs,
26
+ ctimeMs: stat.ctimeMs,
27
+ birthtimeMs: stat.birthtimeMs ?? stat.ctimeMs,
28
+ atime: new Date(stat.atimeMs),
29
+ mtime: new Date(stat.mtimeMs),
30
+ ctime: new Date(stat.ctimeMs),
31
+ birthtime: new Date(stat.birthtimeMs ?? stat.ctimeMs),
32
+ ...predicates(stat.type),
33
+ };
34
+ }
35
+ export function bridgeDirent(name, parentPath, type) {
36
+ return { name, parentPath, path: parentPath, ...predicates(type) };
37
+ }