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,648 @@
1
+ /**
2
+ * blake2b (64-bit) & blake2s (8 to 32-bit) hash functions.
3
+ * b could have been faster, but there is no fast u64 in js, so s is 1.5x faster.
4
+ * @module
5
+ */
6
+ import { BSIGMA, G1s, G2s } from './_blake.ts';
7
+ import { SHA256_IV } from './_md.ts';
8
+ import * as u64 from './_u64.ts';
9
+ // prettier-ignore
10
+ import {
11
+ abytes, aexists, anumber, aoutput,
12
+ checkOpts,
13
+ clean, copyBytes, createHasher,
14
+ swap32IfBE, swap8IfBE,
15
+ u32,
16
+ type CHash,
17
+ type Hash,
18
+ type TArg,
19
+ type TRet
20
+ } from './utils.ts';
21
+
22
+ // Unrealized speed-up: G1b/G2b call the tiny u64.* helpers (rotations, split adds) across
23
+ // the module boundary, which V8 does not inline — u64.add's {h,l} return even allocates
24
+ // per call. File-local copies of the helpers measured ~15-20% faster blake2b on Node 24.
25
+ // Kept deduplicated in _u64 for auditability. Also doesn't matter for bundles
26
+ // which don't do `import`.
27
+
28
+ /**
29
+ * Blake hash options.
30
+ * `dkLen` is output length. `key` is used in MAC mode. `salt` is used in
31
+ * KDF mode.
32
+ */
33
+ export type Blake2Opts = {
34
+ /** Desired digest length in bytes. RFC 7693 uses 1..64 for blake2b and 1..32 for blake2s. */
35
+ dkLen?: number;
36
+ /** Optional MAC key. */
37
+ key?: Uint8Array;
38
+ /** Optional salt mixed into initialization. */
39
+ salt?: Uint8Array;
40
+ /** Optional personalization bytes. */
41
+ personalization?: Uint8Array;
42
+ };
43
+
44
+ // Same IV words as `SHA512_IV`, but endian-swapped into LE u32 low/high halves
45
+ // for the BLAKE2b u64 helpers below.
46
+ const B2B_IV = /* @__PURE__ */ Uint32Array.from([
47
+ 0xf3bcc908, 0x6a09e667, 0x84caa73b, 0xbb67ae85, 0xfe94f82b, 0x3c6ef372, 0x5f1d36f1, 0xa54ff53a,
48
+ 0xade682d1, 0x510e527f, 0x2b3e6c1f, 0x9b05688c, 0xfb41bd6b, 0x1f83d9ab, 0x137e2179, 0x5be0cd19,
49
+ ]);
50
+ // Shared synchronous BLAKE2b work vector as LE u32 low/high halves.
51
+ const BBUF = /* @__PURE__ */ new Uint32Array(32);
52
+
53
+ // BLAKE2b G mix split into two half-rounds over LE u32 low/high limbs.
54
+ function G1b(a: number, b: number, c: number, d: number, msg: TArg<Uint32Array>, x: number) {
55
+ // NOTE: V is LE here
56
+ const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore
57
+ let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1]; // prettier-ignore
58
+ let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1]; // prettier-ignore
59
+ let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1]; // prettier-ignore
60
+ let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1]; // prettier-ignore
61
+ // v[a] = (v[a] + v[b] + x) | 0;
62
+ const ll = u64.add3L(Al, Bl, Xl);
63
+ Ah = u64.add3H(ll, Ah, Bh, Xh);
64
+ Al = ll | 0;
65
+ // v[d] = rotr(v[d] ^ v[a], 32)
66
+ let xh = Dh ^ Ah, xl = Dl ^ Al; // prettier-ignore
67
+ Dh = u64.rotr32H(xh, xl);
68
+ Dl = u64.rotr32L(xh, xl);
69
+ // v[c] = (v[c] + v[d]) | 0;
70
+ ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl));
71
+ // v[b] = rotr(v[b] ^ v[c], 24)
72
+ xh = Bh ^ Ch;
73
+ xl = Bl ^ Cl;
74
+ Bh = u64.rotrSH(xh, xl, 24);
75
+ Bl = u64.rotrSL(xh, xl, 24);
76
+ BBUF[2 * a] = Al;
77
+ BBUF[2 * a + 1] = Ah;
78
+ BBUF[2 * b] = Bl;
79
+ BBUF[2 * b + 1] = Bh;
80
+ BBUF[2 * c] = Cl;
81
+ BBUF[2 * c + 1] = Ch;
82
+ BBUF[2 * d] = Dl;
83
+ BBUF[2 * d + 1] = Dh;
84
+ }
85
+
86
+ // Second half-round of the same LE-limb BLAKE2b G mix; `x` is the message word offset.
87
+ function G2b(a: number, b: number, c: number, d: number, msg: TArg<Uint32Array>, x: number) {
88
+ // NOTE: V is LE here
89
+ const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore
90
+ let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1]; // prettier-ignore
91
+ let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1]; // prettier-ignore
92
+ let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1]; // prettier-ignore
93
+ let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1]; // prettier-ignore
94
+ // v[a] = (v[a] + v[b] + x) | 0;
95
+ const ll = u64.add3L(Al, Bl, Xl);
96
+ Ah = u64.add3H(ll, Ah, Bh, Xh);
97
+ Al = ll | 0;
98
+ // v[d] = rotr(v[d] ^ v[a], 16)
99
+ let xh = Dh ^ Ah, xl = Dl ^ Al; // prettier-ignore
100
+ Dh = u64.rotrSH(xh, xl, 16);
101
+ Dl = u64.rotrSL(xh, xl, 16);
102
+ // v[c] = (v[c] + v[d]) | 0;
103
+ ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl));
104
+ // v[b] = rotr(v[b] ^ v[c], 63)
105
+ xh = Bh ^ Ch;
106
+ xl = Bl ^ Cl;
107
+ Bh = u64.rotrBH(xh, xl, 63);
108
+ Bl = u64.rotrBL(xh, xl, 63);
109
+ BBUF[2 * a] = Al;
110
+ BBUF[2 * a + 1] = Ah;
111
+ BBUF[2 * b] = Bl;
112
+ BBUF[2 * b + 1] = Bh;
113
+ BBUF[2 * c] = Cl;
114
+ BBUF[2 * c + 1] = Ch;
115
+ BBUF[2 * d] = Dl;
116
+ BBUF[2 * d + 1] = Dh;
117
+ }
118
+
119
+ function checkBlake2Opts(
120
+ outputLen: number,
121
+ opts: TArg<Blake2Opts | undefined> = {},
122
+ keyLen: number,
123
+ saltLen: number,
124
+ persLen: number
125
+ ) {
126
+ anumber(keyLen);
127
+ // RFC 7693 §2.1 requires digest length nn in 1..keyLen (keyLen doubles as
128
+ // the per-variant max for both key and digest lengths: 64 for b, 32 for s).
129
+ if (outputLen <= 0 || outputLen > keyLen)
130
+ throw new Error('"dkLen" must be 1..' + keyLen + ', got ' + outputLen);
131
+ const { key, salt, personalization } = opts;
132
+ // This API uses `undefined` for the RFC 7693 `kk = 0` case, so a provided key must be non-empty.
133
+ if (key !== undefined && (key.length < 1 || key.length > keyLen))
134
+ throw new Error('"key" expected to be undefined or of length=1..' + keyLen);
135
+ if (salt !== undefined) abytes(salt, saltLen, 'salt');
136
+ if (personalization !== undefined) abytes(personalization, persLen, 'personalization');
137
+ }
138
+
139
+ /** Internal base class for BLAKE2. */
140
+ export abstract class _BLAKE2<T extends _BLAKE2<T>> implements Hash<T> {
141
+ protected abstract compress(msg: Uint32Array, offset: number, isLast: boolean): void;
142
+ protected abstract get(): number[];
143
+ protected abstract set(...args: number[]): void;
144
+ abstract destroy(): void;
145
+ protected buffer: Uint8Array;
146
+ protected buffer32: Uint32Array;
147
+ protected finished = false;
148
+ protected destroyed = false;
149
+ protected length: number = 0;
150
+ protected pos: number = 0;
151
+ readonly blockLen: number;
152
+ readonly outputLen: number;
153
+ readonly canXOF: boolean = false;
154
+
155
+ constructor(blockLen: number, outputLen: number) {
156
+ anumber(blockLen);
157
+ anumber(outputLen);
158
+ this.blockLen = blockLen;
159
+ this.outputLen = outputLen;
160
+ this.buffer = new Uint8Array(blockLen);
161
+ this.buffer32 = u32(this.buffer);
162
+ }
163
+ update(data: TArg<Uint8Array>): this {
164
+ aexists(this);
165
+ abytes(data);
166
+ // Main difference with other hashes: there is flag for last block,
167
+ // so we cannot process current block before we know that there
168
+ // is the next one. This significantly complicates logic and reduces ability
169
+ // to do zero-copy processing
170
+ const { blockLen, buffer, buffer32 } = this;
171
+ const len = data.length;
172
+ const offset = data.byteOffset;
173
+ const buf = data.buffer;
174
+ for (let pos = 0; pos < len;) {
175
+ // If buffer is full and we still have input (don't process last block, same as blake2s)
176
+ if (this.pos === blockLen) {
177
+ swap32IfBE(buffer32);
178
+ this.compress(buffer32, 0, false);
179
+ swap32IfBE(buffer32);
180
+ this.pos = 0;
181
+ }
182
+ const take = Math.min(blockLen - this.pos, len - pos);
183
+ const dataOffset = offset + pos;
184
+ // Zero-copy only for full, 4-byte-aligned, non-final blocks.
185
+ if (take === blockLen && !(dataOffset % 4) && pos + take < len) {
186
+ const data32 = new Uint32Array(buf, dataOffset, Math.floor((len - pos) / 4));
187
+ swap32IfBE(data32);
188
+ for (let pos32 = 0; pos + blockLen < len; pos32 += buffer32.length, pos += blockLen) {
189
+ this.length += blockLen;
190
+ this.compress(data32, pos32, false);
191
+ }
192
+ swap32IfBE(data32);
193
+ continue;
194
+ }
195
+ // When the whole input is buffered in one go (common for short messages), passing `data`
196
+ // directly avoids allocating a subarray view.
197
+ buffer.set(pos === 0 && take === len ? data : data.subarray(pos, pos + take), this.pos);
198
+ this.pos += take;
199
+ this.length += take;
200
+ pos += take;
201
+ }
202
+ return this;
203
+ }
204
+ digestInto(out: TArg<Uint8Array>): void {
205
+ aexists(this);
206
+ aoutput(out, this);
207
+ // Reject unaligned views explicitly instead of hiding them behind a full scratch copy.
208
+ if (out.byteOffset & 3)
209
+ throw new RangeError('"output" expected 4-byte aligned byteOffset, got ' + out.byteOffset);
210
+ const { pos, buffer32 } = this;
211
+ this.finished = true;
212
+ // Padding
213
+ this.buffer.fill(0, pos);
214
+ swap32IfBE(buffer32);
215
+ this.compress(buffer32, 0, true);
216
+ swap32IfBE(buffer32);
217
+ const state = this.get();
218
+ // digest() passes our own `buffer` as `out`; reuse its cached u32 view instead of allocating.
219
+ const out32 = out === this.buffer ? buffer32 : u32(out);
220
+ const full = Math.floor(this.outputLen / 4);
221
+ for (let i = 0; i < full; i++) out32[i] = swap8IfBE(state[i]);
222
+ const tail = this.outputLen % 4;
223
+ if (!tail) return;
224
+ const off = full * 4;
225
+ const word = state[full];
226
+ for (let i = 0; i < tail; i++) out[off + i] = word >>> (8 * i);
227
+ }
228
+ digest(): TRet<Uint8Array> {
229
+ const { buffer, outputLen } = this;
230
+ this.digestInto(buffer);
231
+ // Return a copy so callers do not alias the instance scratch buffer used during finalization.
232
+ const res = buffer.slice(0, outputLen);
233
+ this.destroy();
234
+ return res as TRet<Uint8Array>;
235
+ }
236
+ _cloneInto(to?: T): T {
237
+ const { buffer, length, finished, destroyed, outputLen, pos } = this;
238
+ // Recreate only `dkLen`; key/salt/personalization are already absorbed into the copied state.
239
+ to ||= new (this.constructor as any)({ dkLen: outputLen }) as T;
240
+ to.set(...this.get());
241
+ // Last-block-aware lazy compression keeps the pending block live even when full.
242
+ to.buffer.set(buffer);
243
+ to.destroyed = destroyed;
244
+ to.finished = finished;
245
+ to.length = length;
246
+ to.pos = pos;
247
+ // @ts-ignore
248
+ to.outputLen = outputLen;
249
+ return to;
250
+ }
251
+ clone(): T {
252
+ return this._cloneInto();
253
+ }
254
+ }
255
+
256
+ /** Internal blake2b hash class with state stored as LE u32 low/high halves. */
257
+ export class _BLAKE2b extends _BLAKE2<_BLAKE2b> {
258
+ // Same IV words as SHA-512 / BLAKE2b, encoded as LE u32 low/high halves.
259
+ private v0l = B2B_IV[0] | 0;
260
+ private v0h = B2B_IV[1] | 0;
261
+ private v1l = B2B_IV[2] | 0;
262
+ private v1h = B2B_IV[3] | 0;
263
+ private v2l = B2B_IV[4] | 0;
264
+ private v2h = B2B_IV[5] | 0;
265
+ private v3l = B2B_IV[6] | 0;
266
+ private v3h = B2B_IV[7] | 0;
267
+ private v4l = B2B_IV[8] | 0;
268
+ private v4h = B2B_IV[9] | 0;
269
+ private v5l = B2B_IV[10] | 0;
270
+ private v5h = B2B_IV[11] | 0;
271
+ private v6l = B2B_IV[12] | 0;
272
+ private v6h = B2B_IV[13] | 0;
273
+ private v7l = B2B_IV[14] | 0;
274
+ private v7h = B2B_IV[15] | 0;
275
+
276
+ constructor(opts: Blake2Opts = {}) {
277
+ opts = checkOpts({}, opts);
278
+ const olen = opts.dkLen === undefined ? 64 : opts.dkLen;
279
+ super(128, olen);
280
+ checkBlake2Opts(olen, opts, 64, 16, 16);
281
+ let { key, personalization, salt } = opts;
282
+ let keyLength = 0;
283
+ if (key !== undefined) {
284
+ abytes(key, undefined, 'key');
285
+ keyLength = key.length;
286
+ }
287
+ // RFC 7693 §2.5: xor `p[0] = 0x0101kknn` into the low 32 bits of `h[0]`;
288
+ // the high 32 bits stay at `IV[0]`.
289
+ this.v0l ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24);
290
+ if (salt !== undefined) {
291
+ abytes(salt, undefined, 'salt');
292
+ // Copy: u32() would throw on views with byteOffset not divisible by 4.
293
+ const slt = u32(copyBytes(salt));
294
+ this.v4l ^= swap8IfBE(slt[0]);
295
+ this.v4h ^= swap8IfBE(slt[1]);
296
+ this.v5l ^= swap8IfBE(slt[2]);
297
+ this.v5h ^= swap8IfBE(slt[3]);
298
+ }
299
+ if (personalization !== undefined) {
300
+ abytes(personalization, undefined, 'personalization');
301
+ // Copy: u32() would throw on views with byteOffset not divisible by 4.
302
+ const pers = u32(copyBytes(personalization));
303
+ this.v6l ^= swap8IfBE(pers[0]);
304
+ this.v6h ^= swap8IfBE(pers[1]);
305
+ this.v7l ^= swap8IfBE(pers[2]);
306
+ this.v7h ^= swap8IfBE(pers[3]);
307
+ }
308
+ if (key !== undefined) {
309
+ // Pad to blockLen and update
310
+ const tmp = new Uint8Array(this.blockLen);
311
+ tmp.set(key);
312
+ this.update(tmp);
313
+ // The padded copy holds key material; buffer/state keep what they need.
314
+ clean(tmp);
315
+ }
316
+ }
317
+ // prettier-ignore
318
+ protected get(): [
319
+ number, number, number, number, number, number, number, number,
320
+ number, number, number, number, number, number, number, number
321
+ ] {
322
+ let { v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h } = this;
323
+ return [v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h];
324
+ }
325
+ // prettier-ignore
326
+ protected set(
327
+ v0l: number, v0h: number, v1l: number, v1h: number,
328
+ v2l: number, v2h: number, v3l: number, v3h: number,
329
+ v4l: number, v4h: number, v5l: number, v5h: number,
330
+ v6l: number, v6h: number, v7l: number, v7h: number
331
+ ): void {
332
+ this.v0l = v0l | 0;
333
+ this.v0h = v0h | 0;
334
+ this.v1l = v1l | 0;
335
+ this.v1h = v1h | 0;
336
+ this.v2l = v2l | 0;
337
+ this.v2h = v2h | 0;
338
+ this.v3l = v3l | 0;
339
+ this.v3h = v3h | 0;
340
+ this.v4l = v4l | 0;
341
+ this.v4h = v4h | 0;
342
+ this.v5l = v5l | 0;
343
+ this.v5h = v5h | 0;
344
+ this.v6l = v6l | 0;
345
+ this.v6h = v6h | 0;
346
+ this.v7l = v7l | 0;
347
+ this.v7h = v7h | 0;
348
+ }
349
+ protected compress(msg: Uint32Array, offset: number, isLast: boolean): void {
350
+ // First half from state. Direct writes: get() would allocate an array +
351
+ // closure per block.
352
+ // prettier-ignore
353
+ const { v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h } = this;
354
+ // prettier-ignore
355
+ { BBUF[0] = v0l; BBUF[1] = v0h; BBUF[2] = v1l; BBUF[3] = v1h;
356
+ BBUF[4] = v2l; BBUF[5] = v2h; BBUF[6] = v3l; BBUF[7] = v3h;
357
+ BBUF[8] = v4l; BBUF[9] = v4h; BBUF[10] = v5l; BBUF[11] = v5h;
358
+ BBUF[12] = v6l; BBUF[13] = v6h; BBUF[14] = v7l; BBUF[15] = v7h; }
359
+ BBUF.set(B2B_IV, 16); // Second half from IV.
360
+ const l = u64.fromNumL(this.length);
361
+ const h = u64.fromNumH(this.length);
362
+ BBUF[24] = B2B_IV[8] ^ l; // Low word of the offset.
363
+ BBUF[25] = B2B_IV[9] ^ h; // High word.
364
+ // Invert all bits for last block
365
+ if (isLast) {
366
+ BBUF[28] = ~BBUF[28];
367
+ BBUF[29] = ~BBUF[29];
368
+ }
369
+ let j = 0;
370
+ const s = BSIGMA;
371
+ // SIGMA selects 64-bit message words; multiply by 2 because `msg` stores
372
+ // each word as [low32, high32].
373
+ for (let i = 0; i < 12; i++) {
374
+ G1b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
375
+ G2b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
376
+ G1b(1, 5, 9, 13, msg, offset + 2 * s[j++]);
377
+ G2b(1, 5, 9, 13, msg, offset + 2 * s[j++]);
378
+ G1b(2, 6, 10, 14, msg, offset + 2 * s[j++]);
379
+ G2b(2, 6, 10, 14, msg, offset + 2 * s[j++]);
380
+ G1b(3, 7, 11, 15, msg, offset + 2 * s[j++]);
381
+ G2b(3, 7, 11, 15, msg, offset + 2 * s[j++]);
382
+
383
+ G1b(0, 5, 10, 15, msg, offset + 2 * s[j++]);
384
+ G2b(0, 5, 10, 15, msg, offset + 2 * s[j++]);
385
+ G1b(1, 6, 11, 12, msg, offset + 2 * s[j++]);
386
+ G2b(1, 6, 11, 12, msg, offset + 2 * s[j++]);
387
+ G1b(2, 7, 8, 13, msg, offset + 2 * s[j++]);
388
+ G2b(2, 7, 8, 13, msg, offset + 2 * s[j++]);
389
+ G1b(3, 4, 9, 14, msg, offset + 2 * s[j++]);
390
+ G2b(3, 4, 9, 14, msg, offset + 2 * s[j++]);
391
+ }
392
+ this.v0l ^= BBUF[0] ^ BBUF[16];
393
+ this.v0h ^= BBUF[1] ^ BBUF[17];
394
+ this.v1l ^= BBUF[2] ^ BBUF[18];
395
+ this.v1h ^= BBUF[3] ^ BBUF[19];
396
+ this.v2l ^= BBUF[4] ^ BBUF[20];
397
+ this.v2h ^= BBUF[5] ^ BBUF[21];
398
+ this.v3l ^= BBUF[6] ^ BBUF[22];
399
+ this.v3h ^= BBUF[7] ^ BBUF[23];
400
+ this.v4l ^= BBUF[8] ^ BBUF[24];
401
+ this.v4h ^= BBUF[9] ^ BBUF[25];
402
+ this.v5l ^= BBUF[10] ^ BBUF[26];
403
+ this.v5h ^= BBUF[11] ^ BBUF[27];
404
+ this.v6l ^= BBUF[12] ^ BBUF[28];
405
+ this.v6h ^= BBUF[13] ^ BBUF[29];
406
+ this.v7l ^= BBUF[14] ^ BBUF[30];
407
+ this.v7h ^= BBUF[15] ^ BBUF[31];
408
+ clean(BBUF);
409
+ }
410
+ destroy(): void {
411
+ this.destroyed = true;
412
+ clean(this.buffer32);
413
+ this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
414
+ }
415
+ }
416
+
417
+ /**
418
+ * Blake2b hash function. 64-bit. 1.5x slower than blake2s in JS.
419
+ * @param msg - message that would be hashed
420
+ * @param opts - Optional output, MAC, salt, and personalization settings.
421
+ * `dkLen` must be 1..64 bytes; `salt` and `personalization`, if present,
422
+ * must be 16 bytes each. See {@link Blake2Opts}.
423
+ * @returns Digest bytes.
424
+ * @example
425
+ * Hash a message with Blake2b.
426
+ * ```ts
427
+ * blake2b(new Uint8Array([97, 98, 99]));
428
+ * ```
429
+ * @example
430
+ * Hash a message with Blake2b while selecting output, MAC, salt, and personalization settings.
431
+ * ```ts
432
+ * blake2b(new Uint8Array([97, 98, 99]), {
433
+ * dkLen: 32,
434
+ * key: new Uint8Array(32),
435
+ * salt: new Uint8Array(16),
436
+ * personalization: new Uint8Array(16),
437
+ * });
438
+ * ```
439
+ */
440
+ export const blake2b: TRet<CHash<_BLAKE2b, Blake2Opts>> = /* @__PURE__ */ createHasher(
441
+ (opts) => new _BLAKE2b(opts)
442
+ );
443
+
444
+ // =================
445
+ // Blake2S
446
+ // =================
447
+
448
+ /** Internal type, 16 numbers. */
449
+ // prettier-ignore
450
+ export type _Num16 = {
451
+ v0: number; v1: number; v2: number; v3: number;
452
+ v4: number; v5: number; v6: number; v7: number;
453
+ v8: number; v9: number; v10: number; v11: number;
454
+ v12: number; v13: number; v14: number; v15: number;
455
+ };
456
+
457
+ /**
458
+ * BLAKE2-compress core method.
459
+ * Runs only the round function over a caller-supplied local vector; callers initialize `v0..v15`
460
+ * and apply the final `h[i] ^= v[i] ^ v[i + 8]` fold themselves.
461
+ * @param s - flattened sigma schedule bytes
462
+ * @param offset - starting word offset inside `msg`, not a byte offset
463
+ * @param msg - message words
464
+ * @param rounds - round count to execute
465
+ * @param v0 - state word 0
466
+ * @param v1 - state word 1
467
+ * @param v2 - state word 2
468
+ * @param v3 - state word 3
469
+ * @param v4 - state word 4
470
+ * @param v5 - state word 5
471
+ * @param v6 - state word 6
472
+ * @param v7 - state word 7
473
+ * @param v8 - state word 8
474
+ * @param v9 - state word 9
475
+ * @param v10 - state word 10
476
+ * @param v11 - state word 11
477
+ * @param v12 - state word 12
478
+ * @param v13 - state word 13
479
+ * @param v14 - state word 14
480
+ * @param v15 - state word 15
481
+ * @returns Updated compression state words.
482
+ * @example
483
+ * Run the BLAKE2 compression core on zeroed state and message words.
484
+ * ```ts
485
+ * import { _compress } from '@noble/hashes/blake2.js';
486
+ * const state = _compress(
487
+ * new Uint8Array(16),
488
+ * 0,
489
+ * new Uint32Array(16),
490
+ * 1,
491
+ * 0, 0, 0, 0, 0, 0, 0, 0,
492
+ * 0, 0, 0, 0, 0, 0, 0, 0
493
+ * );
494
+ * state.v0;
495
+ * ```
496
+ */
497
+ // prettier-ignore
498
+ export function _compress(
499
+ s: TArg<Uint8Array>, offset: number, msg: TArg<Uint32Array>, rounds: number,
500
+ v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number,
501
+ v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number,
502
+ ): _Num16 {
503
+ let j = 0;
504
+ for (let i = 0; i < rounds; i++) {
505
+ ({ a: v0, b: v4, c: v8, d: v12 } = G1s(v0, v4, v8, v12, msg[offset + s[j++]]));
506
+ ({ a: v0, b: v4, c: v8, d: v12 } = G2s(v0, v4, v8, v12, msg[offset + s[j++]]));
507
+ ({ a: v1, b: v5, c: v9, d: v13 } = G1s(v1, v5, v9, v13, msg[offset + s[j++]]));
508
+ ({ a: v1, b: v5, c: v9, d: v13 } = G2s(v1, v5, v9, v13, msg[offset + s[j++]]));
509
+ ({ a: v2, b: v6, c: v10, d: v14 } = G1s(v2, v6, v10, v14, msg[offset + s[j++]]));
510
+ ({ a: v2, b: v6, c: v10, d: v14 } = G2s(v2, v6, v10, v14, msg[offset + s[j++]]));
511
+ ({ a: v3, b: v7, c: v11, d: v15 } = G1s(v3, v7, v11, v15, msg[offset + s[j++]]));
512
+ ({ a: v3, b: v7, c: v11, d: v15 } = G2s(v3, v7, v11, v15, msg[offset + s[j++]]));
513
+
514
+ ({ a: v0, b: v5, c: v10, d: v15 } = G1s(v0, v5, v10, v15, msg[offset + s[j++]]));
515
+ ({ a: v0, b: v5, c: v10, d: v15 } = G2s(v0, v5, v10, v15, msg[offset + s[j++]]));
516
+ ({ a: v1, b: v6, c: v11, d: v12 } = G1s(v1, v6, v11, v12, msg[offset + s[j++]]));
517
+ ({ a: v1, b: v6, c: v11, d: v12 } = G2s(v1, v6, v11, v12, msg[offset + s[j++]]));
518
+ ({ a: v2, b: v7, c: v8, d: v13 } = G1s(v2, v7, v8, v13, msg[offset + s[j++]]));
519
+ ({ a: v2, b: v7, c: v8, d: v13 } = G2s(v2, v7, v8, v13, msg[offset + s[j++]]));
520
+ ({ a: v3, b: v4, c: v9, d: v14 } = G1s(v3, v4, v9, v14, msg[offset + s[j++]]));
521
+ ({ a: v3, b: v4, c: v9, d: v14 } = G2s(v3, v4, v9, v14, msg[offset + s[j++]]));
522
+ }
523
+ return { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 };
524
+ }
525
+
526
+ // Blake2s reuses the SHA-256 IV words as-is.
527
+ const B2S_IV = /* @__PURE__ */ SHA256_IV.slice();
528
+
529
+ /** Internal blake2s hash class. */
530
+ export class _BLAKE2s extends _BLAKE2<_BLAKE2s> {
531
+ // Internal state, same as SHA-256
532
+ private v0 = B2S_IV[0] | 0;
533
+ private v1 = B2S_IV[1] | 0;
534
+ private v2 = B2S_IV[2] | 0;
535
+ private v3 = B2S_IV[3] | 0;
536
+ private v4 = B2S_IV[4] | 0;
537
+ private v5 = B2S_IV[5] | 0;
538
+ private v6 = B2S_IV[6] | 0;
539
+ private v7 = B2S_IV[7] | 0;
540
+
541
+ constructor(opts: Blake2Opts = {}) {
542
+ opts = checkOpts({}, opts);
543
+ const olen = opts.dkLen === undefined ? 32 : opts.dkLen;
544
+ super(64, olen);
545
+ checkBlake2Opts(olen, opts, 32, 8, 8);
546
+ let { key, personalization, salt } = opts;
547
+ let keyLength = 0;
548
+ if (key !== undefined) {
549
+ abytes(key, undefined, 'key');
550
+ keyLength = key.length;
551
+ }
552
+ // RFC 7693 §2.5: xor `p[0] = 0x0101kknn` directly into `h[0]`, since
553
+ // BLAKE2s stores each state word as one `u32`.
554
+ this.v0 ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24);
555
+ if (salt !== undefined) {
556
+ abytes(salt, undefined, 'salt');
557
+ // Copy: u32() would throw on views with byteOffset not divisible by 4.
558
+ const slt = u32(copyBytes(salt as Uint8Array));
559
+ this.v4 ^= swap8IfBE(slt[0]);
560
+ this.v5 ^= swap8IfBE(slt[1]);
561
+ }
562
+ if (personalization !== undefined) {
563
+ abytes(personalization, undefined, 'personalization');
564
+ // Copy: u32() would throw on views with byteOffset not divisible by 4.
565
+ const pers = u32(copyBytes(personalization as Uint8Array));
566
+ this.v6 ^= swap8IfBE(pers[0]);
567
+ this.v7 ^= swap8IfBE(pers[1]);
568
+ }
569
+ if (key !== undefined) {
570
+ // Pad to blockLen and update
571
+ const tmp = new Uint8Array(this.blockLen);
572
+ tmp.set(key);
573
+ this.update(tmp);
574
+ // The padded copy holds key material; buffer/state keep what they need.
575
+ clean(tmp);
576
+ }
577
+ }
578
+ protected get(): [number, number, number, number, number, number, number, number] {
579
+ const { v0, v1, v2, v3, v4, v5, v6, v7 } = this;
580
+ return [v0, v1, v2, v3, v4, v5, v6, v7];
581
+ }
582
+ // prettier-ignore
583
+ protected set(
584
+ v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number
585
+ ): void {
586
+ this.v0 = v0 | 0;
587
+ this.v1 = v1 | 0;
588
+ this.v2 = v2 | 0;
589
+ this.v3 = v3 | 0;
590
+ this.v4 = v4 | 0;
591
+ this.v5 = v5 | 0;
592
+ this.v6 = v6 | 0;
593
+ this.v7 = v7 | 0;
594
+ }
595
+ protected compress(msg: Uint32Array, offset: number, isLast: boolean): void {
596
+ const l = u64.fromNumL(this.length);
597
+ const h = u64.fromNumH(this.length);
598
+ // Seed v8..v15 from the IV, xor the low/high 32-bit byte counter into
599
+ // v12/v13, and invert v14 on the final block.
600
+ // prettier-ignore
601
+ const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } =
602
+ _compress(
603
+ BSIGMA, offset, msg, 10,
604
+ this.v0, this.v1, this.v2, this.v3, this.v4, this.v5, this.v6, this.v7,
605
+ B2S_IV[0], B2S_IV[1], B2S_IV[2], B2S_IV[3], l ^ B2S_IV[4], h ^ B2S_IV[5], isLast ? ~B2S_IV[6] : B2S_IV[6], B2S_IV[7]
606
+ );
607
+ this.v0 ^= v0 ^ v8;
608
+ this.v1 ^= v1 ^ v9;
609
+ this.v2 ^= v2 ^ v10;
610
+ this.v3 ^= v3 ^ v11;
611
+ this.v4 ^= v4 ^ v12;
612
+ this.v5 ^= v5 ^ v13;
613
+ this.v6 ^= v6 ^ v14;
614
+ this.v7 ^= v7 ^ v15;
615
+ }
616
+ destroy(): void {
617
+ this.destroyed = true;
618
+ clean(this.buffer32);
619
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
620
+ }
621
+ }
622
+
623
+ /**
624
+ * Blake2s hash function. Focuses on 8-bit to 32-bit platforms. 1.5x faster than blake2b in JS.
625
+ * @param msg - message that would be hashed
626
+ * @param opts - Optional output, MAC, salt, and personalization settings.
627
+ * `dkLen` must be 1..32 bytes; `salt` and `personalization`, if present,
628
+ * must be 8 bytes each. See {@link Blake2Opts}.
629
+ * @returns Digest bytes.
630
+ * @example
631
+ * Hash a message with Blake2s.
632
+ * ```ts
633
+ * blake2s(new Uint8Array([97, 98, 99]));
634
+ * ```
635
+ * @example
636
+ * Hash a message with Blake2s while selecting output, MAC, salt, and personalization settings.
637
+ * ```ts
638
+ * blake2s(new Uint8Array([97, 98, 99]), {
639
+ * dkLen: 16,
640
+ * key: new Uint8Array(32),
641
+ * salt: new Uint8Array(8),
642
+ * personalization: new Uint8Array(8),
643
+ * });
644
+ * ```
645
+ */
646
+ export const blake2s: TRet<CHash<_BLAKE2s, Blake2Opts>> = /* @__PURE__ */ createHasher(
647
+ (opts) => new _BLAKE2s(opts)
648
+ );