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,525 @@
1
+ /**
2
+ * SHA3 (keccak) hash function, based on a new "Sponge function" design.
3
+ * Different from older hashes, the internal state is bigger than output size.
4
+ *
5
+ * Check out
6
+ * {@link https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf | FIPS-202},
7
+ * {@link https://keccak.team/keccak.html | Website}, and
8
+ * {@link https://crypto.stackexchange.com/q/15727 | the differences between
9
+ * SHA-3 and Keccak}.
10
+ *
11
+ * Check out `sha3-addons` module for cSHAKE, k12, and others.
12
+ * @module
13
+ */
14
+ import { split } from './_u64.ts';
15
+ // prettier-ignore
16
+ import {
17
+ abool, abytes, aexists, anumber, aoutput,
18
+ checkOpts,
19
+ clean, createHasher,
20
+ oidNist,
21
+ swap32IfBE,
22
+ u32,
23
+ type CHash, type CHashXOF,
24
+ type Hash,
25
+ type HashInfo,
26
+ type HashXOF,
27
+ type TArg,
28
+ type TRet
29
+ } from './utils.ts';
30
+
31
+ // No __PURE__ annotations in sha3 header:
32
+ // EVERYTHING is in fact used on every export.
33
+ // Various per round constants calculations
34
+ const _0n = BigInt(0);
35
+ const _1n = BigInt(1);
36
+ const _2n = BigInt(2);
37
+ const _7n = BigInt(7);
38
+ const _256n = BigInt(256);
39
+ // FIPS 202 Algorithm 5 rc(): when the outgoing bit is 1, the 8-bit LFSR xors
40
+ // taps 0, 4, 5, and 6, which compresses to the feedback mask `0x71`.
41
+ const _0x71n = BigInt(0x71);
42
+ const SHA3_PI: number[] = [];
43
+ const SHA3_ROTL: number[] = [];
44
+ const _SHA3_IOTA: bigint[] = []; // no pure annotation: var is always used
45
+ for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
46
+ // Pi
47
+ [x, y] = [y, (2 * x + 3 * y) % 5];
48
+ SHA3_PI.push(2 * (5 * y + x));
49
+ // Rotational
50
+ SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);
51
+ // Iota
52
+ let t = _0n;
53
+ for (let j = 0; j < 7; j++) {
54
+ R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;
55
+ if (R & _2n) t ^= _1n << ((_1n << BigInt(j)) - _1n);
56
+ }
57
+ _SHA3_IOTA.push(t);
58
+ }
59
+ const IOTAS = split(_SHA3_IOTA, true);
60
+ // `split(..., true)` keeps the local little-endian lane-word layout used by
61
+ // `state32`, so these `H` / `L` tables follow the file's first-word /
62
+ // second-word lane slots rather than `_u64.ts`'s usual high/low naming.
63
+ const SHA3_IOTA_H = IOTAS[0];
64
+ const SHA3_IOTA_L = IOTAS[1];
65
+
66
+ // 64-bit left rotates as u32 pairs. Inlined here (not imported from _u64) so V8 can
67
+ // inline them into keccakP — the import path costs ~24% on sha3_256. SHA3 is the only
68
+ // consumer of left-rotates; other hashes use right-rotates from _u64.
69
+ // Valid for s in 1..31 (SH/SL) and 33..63 (BH/BL); keccak never rotates by 0/32/64.
70
+ const rotlSH = (h: number, l: number, s: number): number => (h << s) | (l >>> (32 - s));
71
+ const rotlSL = (h: number, l: number, s: number): number => (l << s) | (h >>> (32 - s));
72
+ const rotlBH = (h: number, l: number, s: number): number => (l << (s - 32)) | (h >>> (64 - s));
73
+ const rotlBL = (h: number, l: number, s: number): number => (h << (s - 32)) | (l >>> (64 - s));
74
+ const rotlH = (h: number, l: number, s: number) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));
75
+ const rotlL = (h: number, l: number, s: number) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));
76
+
77
+ // Reused Theta scratch buffer (column parities), same pattern as SHA256_W in sha2.
78
+ // keccakP never calls user code, so the shared buffer cannot be observed mid-permutation.
79
+ const B = new Uint32Array(5 * 2);
80
+
81
+ /**
82
+ * `keccakf1600` internal permutation, additionally allows adjusting the round count.
83
+ * @param s - 5x5 Keccak state encoded as 25 lanes split into 50 uint32 words
84
+ * in this file's local little-endian lane-word order
85
+ * @param rounds - number of rounds to execute
86
+ * @throws On wrong argument types. {@link TypeError}
87
+ * @throws On wrong argument ranges or values. {@link RangeError}
88
+ * @throws If `rounds` is outside the supported `1..24` range. {@link Error}
89
+ * @example
90
+ * Permute a Keccak state with the default 24 rounds.
91
+ * ```ts
92
+ * keccakP(new Uint32Array(50));
93
+ * ```
94
+ */
95
+ export function keccakP(s: TArg<Uint32Array>, rounds: number = 24): void {
96
+ if (!(s instanceof Uint32Array))
97
+ throw new TypeError('"s" expected Uint32Array(50), got type=' + typeof s);
98
+ if (s.length !== 50) throw new RangeError('"s" expected Uint32Array(50), got length=' + s.length);
99
+ anumber(rounds, 'rounds');
100
+ // This implementation precomputes only the standard Keccak-f[1600] 24-round Iota table.
101
+ if (rounds < 1 || rounds > 24) throw new Error('"rounds" expected integer 1..24');
102
+ // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)
103
+ for (let round = 24 - rounds; round < 24; round++) {
104
+ // Theta θ
105
+ for (let x = 0; x < 10; x++) B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
106
+ for (let x = 0; x < 10; x += 2) {
107
+ const idx1 = (x + 8) % 10;
108
+ const idx0 = (x + 2) % 10;
109
+ const B0 = B[idx0];
110
+ const B1 = B[idx0 + 1];
111
+ const Th = rotlH(B0, B1, 1) ^ B[idx1];
112
+ const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
113
+ for (let y = 0; y < 50; y += 10) {
114
+ s[x + y] ^= Th;
115
+ s[x + y + 1] ^= Tl;
116
+ }
117
+ }
118
+ // Rho (ρ) and Pi (π)
119
+ let curH = s[2];
120
+ let curL = s[3];
121
+ for (let t = 0; t < 24; t++) {
122
+ const shift = SHA3_ROTL[t];
123
+ const Th = rotlH(curH, curL, shift);
124
+ const Tl = rotlL(curH, curL, shift);
125
+ const PI = SHA3_PI[t];
126
+ curH = s[PI];
127
+ curL = s[PI + 1];
128
+ s[PI] = Th;
129
+ s[PI + 1] = Tl;
130
+ }
131
+ // Chi (χ)
132
+ // Same as:
133
+ // for (let x = 0; x < 10; x++) B[x] = s[y + x];
134
+ // for (let x = 0; x < 10; x++) s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
135
+ for (let y = 0; y < 50; y += 10) {
136
+ const b0 = s[y],
137
+ b1 = s[y + 1],
138
+ b2 = s[y + 2],
139
+ b3 = s[y + 3];
140
+ s[y] ^= ~s[y + 2] & s[y + 4];
141
+ s[y + 1] ^= ~s[y + 3] & s[y + 5];
142
+ s[y + 2] ^= ~s[y + 4] & s[y + 6];
143
+ s[y + 3] ^= ~s[y + 5] & s[y + 7];
144
+ s[y + 4] ^= ~s[y + 6] & s[y + 8];
145
+ s[y + 5] ^= ~s[y + 7] & s[y + 9];
146
+ s[y + 6] ^= ~s[y + 8] & b0;
147
+ s[y + 7] ^= ~s[y + 9] & b1;
148
+ s[y + 8] ^= ~b0 & b2;
149
+ s[y + 9] ^= ~b1 & b3;
150
+ }
151
+ // Iota (ι)
152
+ s[0] ^= SHA3_IOTA_H[round];
153
+ s[1] ^= SHA3_IOTA_L[round];
154
+ }
155
+ clean(B);
156
+ }
157
+
158
+ /**
159
+ * Keccak sponge function.
160
+ * @param blockLen - absorb/squeeze rate in bytes
161
+ * @param suffix - domain separation suffix byte
162
+ * @param outputLen - default digest length in bytes. This base sponge only
163
+ * requires a non-negative integer; wrappers that need positive output
164
+ * lengths must enforce that themselves.
165
+ * @param enableXOF - whether XOF output is allowed
166
+ * @param rounds - number of Keccak-f rounds
167
+ * @example
168
+ * Build a sponge state, absorb bytes, then finalize a digest.
169
+ * ```ts
170
+ * const hash = new Keccak(136, 0x06, 32);
171
+ * hash.update(new Uint8Array([1, 2, 3]));
172
+ * hash.digest();
173
+ * ```
174
+ */
175
+ export class Keccak implements Hash<Keccak>, HashXOF<Keccak> {
176
+ protected state: Uint8Array;
177
+ protected pos = 0;
178
+ protected posOut = 0;
179
+ protected finished = false;
180
+ protected state32: Uint32Array;
181
+ protected destroyed = false;
182
+
183
+ public blockLen: number;
184
+ public suffix: number;
185
+ public outputLen: number;
186
+ public canXOF: boolean;
187
+ protected enableXOF = false;
188
+ protected rounds: number;
189
+
190
+ // NOTE: we accept arguments in bytes instead of bits here.
191
+ constructor(
192
+ blockLen: number,
193
+ suffix: number,
194
+ outputLen: number,
195
+ enableXOF = false,
196
+ rounds: number = 24
197
+ ) {
198
+ anumber(blockLen, 'blockLen');
199
+ anumber(suffix, 'suffix');
200
+ anumber(rounds, 'rounds');
201
+ abool(enableXOF, 'enableXOF');
202
+ this.blockLen = blockLen;
203
+ this.suffix = suffix;
204
+ this.outputLen = outputLen;
205
+ this.enableXOF = enableXOF;
206
+ this.canXOF = enableXOF;
207
+ this.rounds = rounds;
208
+ // Can be passed from user as dkLen
209
+ anumber(outputLen, 'outputLen');
210
+ // Only keccak-f1600 is supported: 1600 bits (5x5 matrix of 64bit) === 200 bytes of state.
211
+ if (!(0 < blockLen && blockLen < 200)) throw new Error('"blockLen" must be 1..199');
212
+ this.state = new Uint8Array(200);
213
+ this.state32 = u32(this.state);
214
+ }
215
+ clone(): Keccak {
216
+ return this._cloneInto();
217
+ }
218
+ protected keccak(): void {
219
+ swap32IfBE(this.state32);
220
+ keccakP(this.state32, this.rounds);
221
+ swap32IfBE(this.state32);
222
+ this.posOut = 0;
223
+ this.pos = 0;
224
+ }
225
+ update(data: TArg<Uint8Array>): this {
226
+ aexists(this);
227
+ abytes(data);
228
+ const { blockLen, state, state32 } = this;
229
+ const len = data.length;
230
+ // Absorb full blocks with u32 XORs when both sides are 4-byte aligned.
231
+ // XOR of same-position words equals XOR of same-position bytes, so this is endianness-safe.
232
+ const canUseU32 = blockLen % 4 === 0 && data.byteOffset % 4 === 0;
233
+ const blockLen32 = blockLen / 4;
234
+ const data32 = canUseU32 && len >= blockLen ? u32(data) : undefined;
235
+ for (let pos = 0; pos < len;) {
236
+ if (data32 !== undefined && this.pos === 0 && pos % 4 === 0 && len - pos >= blockLen) {
237
+ for (let i = 0, o = pos / 4; i < blockLen32; i++) state32[i] ^= data32[o + i];
238
+ pos += blockLen;
239
+ // Subclasses (_KeccakPRG) read `this.pos` inside their `keccak()` override,
240
+ // so it must reflect the fully-absorbed block before the permutation fires.
241
+ this.pos = blockLen;
242
+ this.keccak();
243
+ continue;
244
+ }
245
+ const take = Math.min(blockLen - this.pos, len - pos);
246
+ for (let i = 0; i < take; i++) state[this.pos++] ^= data[pos++];
247
+ if (this.pos === blockLen) this.keccak();
248
+ }
249
+ return this;
250
+ }
251
+ protected finish(): void {
252
+ if (this.finished) return;
253
+ this.finished = true;
254
+ const { state, suffix, pos, blockLen } = this;
255
+ // FIPS 202 appends the SHA3/SHAKE domain-separation suffix before pad10*1.
256
+ // These byte values already include the first padding bit, while the
257
+ // final `0x80` below supplies the closing `1` bit in the last rate byte.
258
+ state[pos] ^= suffix;
259
+ // If that combined suffix lands in the last rate byte and already sets
260
+ // bit 7, absorb it first so the final pad10*1 bit can be xored into a
261
+ // fresh block.
262
+ if ((suffix & 0x80) !== 0 && pos === blockLen - 1) this.keccak();
263
+ state[blockLen - 1] ^= 0x80;
264
+ this.keccak();
265
+ }
266
+ protected writeInto(out: TArg<Uint8Array>): TRet<Uint8Array> {
267
+ aexists(this, false);
268
+ abytes(out);
269
+ this.finish();
270
+ const bufferOut = this.state;
271
+ const { blockLen } = this;
272
+ for (let pos = 0, len = out.length; pos < len;) {
273
+ if (this.posOut >= blockLen) this.keccak();
274
+ const take = Math.min(blockLen - this.posOut, len - pos);
275
+ out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
276
+ this.posOut += take;
277
+ pos += take;
278
+ }
279
+ return out as TRet<Uint8Array>;
280
+ }
281
+ xofInto(out: TArg<Uint8Array>): TRet<Uint8Array> {
282
+ // Plain SHA3/Keccak usage with XOF is probably a mistake, but this base
283
+ // class is also reused by SHAKE/cSHAKE/KMAC/TupleHash/ParallelHash/
284
+ // TurboSHAKE/KangarooTwelve wrappers that intentionally enable XOF.
285
+ if (!this.enableXOF) throw new Error('XOF is not enabled');
286
+ return this.writeInto(out);
287
+ }
288
+ xof(bytes: number): TRet<Uint8Array> {
289
+ anumber(bytes);
290
+ return this.xofInto(new Uint8Array(bytes));
291
+ }
292
+ digestInto(out: TArg<Uint8Array>): void {
293
+ aoutput(out, this);
294
+ if (this.finished) throw new Error('digest() was already called');
295
+ // `aoutput(...)` allows oversized buffers; digestInto() must fill only the advertised digest.
296
+ this.writeInto(out.length === this.outputLen ? out : out.subarray(0, this.outputLen));
297
+ this.destroy();
298
+ }
299
+ digest(): TRet<Uint8Array> {
300
+ const out = new Uint8Array(this.outputLen);
301
+ this.digestInto(out);
302
+ return out as TRet<Uint8Array>;
303
+ }
304
+ destroy(): void {
305
+ this.destroyed = true;
306
+ clean(this.state);
307
+ }
308
+ _cloneInto(to?: Keccak): Keccak {
309
+ const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
310
+ to ||= new Keccak(blockLen, suffix, outputLen, enableXOF, rounds);
311
+ // Reused destinations can come from a different rate/capacity variant, so clone must rewrite
312
+ // the sponge geometry as well as the state words.
313
+ to.blockLen = blockLen;
314
+ to.state32.set(this.state32);
315
+ // Sponge padding and XOF output are positional, so both offsets are part of the clone state.
316
+ to.pos = this.pos;
317
+ to.posOut = this.posOut;
318
+ to.finished = this.finished;
319
+ to.rounds = rounds;
320
+ // Suffix can change in cSHAKE
321
+ to.suffix = suffix;
322
+ to.outputLen = outputLen;
323
+ to.enableXOF = enableXOF;
324
+ // Clones must preserve the public capability bit too; `_KMAC` reuses this path and deep clone
325
+ // tests compare instance fields directly, so leaving `canXOF` behind makes the clone lie.
326
+ to.canXOF = this.canXOF;
327
+ to.destroyed = this.destroyed;
328
+ return to;
329
+ }
330
+ }
331
+
332
+ const genKeccak = (
333
+ suffix: number,
334
+ blockLen: number,
335
+ outputLen: number,
336
+ info: TArg<HashInfo> = {}
337
+ ) => createHasher(() => new Keccak(blockLen, suffix, outputLen), info);
338
+
339
+ /**
340
+ * SHA3-224 hash function.
341
+ * @param msg - message bytes to hash
342
+ * @param opts - Reserved hash options.
343
+ * @returns Digest bytes.
344
+ * @example
345
+ * Hash a message with SHA3-224.
346
+ * ```ts
347
+ * sha3_224(new Uint8Array([97, 98, 99]));
348
+ * ```
349
+ */
350
+ export const sha3_224: TRet<CHash> = /* @__PURE__ */ genKeccak(
351
+ 0x06,
352
+ 144,
353
+ 28,
354
+ /* @__PURE__ */ oidNist(0x07)
355
+ );
356
+ /**
357
+ * SHA3-256 hash function. Different from keccak-256.
358
+ * @param msg - message bytes to hash
359
+ * @param opts - Reserved hash options.
360
+ * @returns Digest bytes.
361
+ * @example
362
+ * Hash a message with SHA3-256.
363
+ * ```ts
364
+ * sha3_256(new Uint8Array([97, 98, 99]));
365
+ * ```
366
+ */
367
+ export const sha3_256: TRet<CHash> = /* @__PURE__ */ genKeccak(
368
+ 0x06,
369
+ 136,
370
+ 32,
371
+ /* @__PURE__ */ oidNist(0x08)
372
+ );
373
+ /**
374
+ * SHA3-384 hash function.
375
+ * @param msg - message bytes to hash
376
+ * @param opts - Reserved hash options.
377
+ * @returns Digest bytes.
378
+ * @example
379
+ * Hash a message with SHA3-384.
380
+ * ```ts
381
+ * sha3_384(new Uint8Array([97, 98, 99]));
382
+ * ```
383
+ */
384
+ export const sha3_384: TRet<CHash> = /* @__PURE__ */ genKeccak(
385
+ 0x06,
386
+ 104,
387
+ 48,
388
+ /* @__PURE__ */ oidNist(0x09)
389
+ );
390
+ /**
391
+ * SHA3-512 hash function.
392
+ * @param msg - message bytes to hash
393
+ * @param opts - Reserved hash options.
394
+ * @returns Digest bytes.
395
+ * @example
396
+ * Hash a message with SHA3-512.
397
+ * ```ts
398
+ * sha3_512(new Uint8Array([97, 98, 99]));
399
+ * ```
400
+ */
401
+ export const sha3_512: TRet<CHash> = /* @__PURE__ */ genKeccak(
402
+ 0x06,
403
+ 72,
404
+ 64,
405
+ /* @__PURE__ */ oidNist(0x0a)
406
+ );
407
+
408
+ /**
409
+ * Keccak-224 hash function.
410
+ * @param msg - message bytes to hash
411
+ * @param opts - Reserved hash options.
412
+ * @returns Digest bytes.
413
+ * @example
414
+ * Hash a message with Keccak-224.
415
+ * ```ts
416
+ * keccak_224(new Uint8Array([97, 98, 99]));
417
+ * ```
418
+ */
419
+ export const keccak_224: TRet<CHash> = /* @__PURE__ */ genKeccak(0x01, 144, 28);
420
+ /**
421
+ * Keccak-256 hash function. Different from SHA3-256.
422
+ * @param msg - message bytes to hash
423
+ * @param opts - Reserved hash options.
424
+ * @returns Digest bytes.
425
+ * @example
426
+ * Hash a message with Keccak-256.
427
+ * ```ts
428
+ * keccak_256(new Uint8Array([97, 98, 99]));
429
+ * ```
430
+ */
431
+ export const keccak_256: TRet<CHash> = /* @__PURE__ */ genKeccak(0x01, 136, 32);
432
+ /**
433
+ * Keccak-384 hash function.
434
+ * @param msg - message bytes to hash
435
+ * @param opts - Reserved hash options.
436
+ * @returns Digest bytes.
437
+ * @example
438
+ * Hash a message with Keccak-384.
439
+ * ```ts
440
+ * keccak_384(new Uint8Array([97, 98, 99]));
441
+ * ```
442
+ */
443
+ export const keccak_384: TRet<CHash> = /* @__PURE__ */ genKeccak(0x01, 104, 48);
444
+ /**
445
+ * Keccak-512 hash function.
446
+ * @param msg - message bytes to hash
447
+ * @param opts - Reserved hash options.
448
+ * @returns Digest bytes.
449
+ * @example
450
+ * Hash a message with Keccak-512.
451
+ * ```ts
452
+ * keccak_512(new Uint8Array([97, 98, 99]));
453
+ * ```
454
+ */
455
+ export const keccak_512: TRet<CHash> = /* @__PURE__ */ genKeccak(0x01, 72, 64);
456
+
457
+ /** Options for SHAKE XOF. */
458
+ export type ShakeOpts = {
459
+ /** Desired number of output bytes. */
460
+ dkLen?: number;
461
+ };
462
+
463
+ const genShake = (suffix: number, blockLen: number, outputLen: number, info: TArg<HashInfo> = {}) =>
464
+ createHasher<Keccak, ShakeOpts>((opts: ShakeOpts = {}) => {
465
+ opts = checkOpts({}, opts);
466
+ return new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true);
467
+ }, info);
468
+
469
+ /**
470
+ * SHAKE128 XOF with 128-bit security and a 16-byte default output.
471
+ * @param msg - message bytes to hash
472
+ * @param opts - Optional output-length override. See {@link ShakeOpts}.
473
+ * @returns Digest bytes.
474
+ * @example
475
+ * Hash a message with SHAKE128.
476
+ * ```ts
477
+ * shake128(new Uint8Array([97, 98, 99]), { dkLen: 32 });
478
+ * ```
479
+ */
480
+ export const shake128: TRet<CHashXOF<Keccak, ShakeOpts>> =
481
+ /* @__PURE__ */
482
+ genShake(0x1f, 168, 16, /* @__PURE__ */ oidNist(0x0b));
483
+ /**
484
+ * SHAKE256 XOF with 256-bit security and a 32-byte default output.
485
+ * @param msg - message bytes to hash
486
+ * @param opts - Optional output-length override. See {@link ShakeOpts}.
487
+ * @returns Digest bytes.
488
+ * @example
489
+ * Hash a message with SHAKE256.
490
+ * ```ts
491
+ * shake256(new Uint8Array([97, 98, 99]), { dkLen: 64 });
492
+ * ```
493
+ */
494
+ export const shake256: TRet<CHashXOF<Keccak, ShakeOpts>> =
495
+ /* @__PURE__ */
496
+ genShake(0x1f, 136, 32, /* @__PURE__ */ oidNist(0x0c));
497
+
498
+ /**
499
+ * SHAKE128 XOF with 256-bit output (NIST version).
500
+ * @param msg - message bytes to hash
501
+ * @param opts - Optional output-length override. See {@link ShakeOpts}.
502
+ * @returns Digest bytes.
503
+ * @example
504
+ * Hash a message with SHAKE128 using a 32-byte default output.
505
+ * ```ts
506
+ * shake128_32(new Uint8Array([97, 98, 99]), { dkLen: 32 });
507
+ * ```
508
+ */
509
+ export const shake128_32: TRet<CHashXOF<Keccak, ShakeOpts>> =
510
+ /* @__PURE__ */
511
+ genShake(0x1f, 168, 32, /* @__PURE__ */ oidNist(0x0b));
512
+ /**
513
+ * SHAKE256 XOF with 512-bit output (NIST version).
514
+ * @param msg - message bytes to hash
515
+ * @param opts - Optional output-length override. See {@link ShakeOpts}.
516
+ * @returns Digest bytes.
517
+ * @example
518
+ * Hash a message with SHAKE256 using a 64-byte default output.
519
+ * ```ts
520
+ * shake256_64(new Uint8Array([97, 98, 99]), { dkLen: 64 });
521
+ * ```
522
+ */
523
+ export const shake256_64: TRet<CHashXOF<Keccak, ShakeOpts>> =
524
+ /* @__PURE__ */
525
+ genShake(0x1f, 136, 64, /* @__PURE__ */ oidNist(0x0c));