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,310 @@
1
+ /**
2
+ * Blake3 fast hash is Blake2 with reduced security (round count). Can also be used as MAC & KDF.
3
+ *
4
+ * It is advertised as "the fastest cryptographic hash". However, it isn't true in JS.
5
+ * Why is this so slow? While it must be 6x faster than blake2b, perf diff is only 20%:
6
+ *
7
+ * * There is only 30% reduction in number of rounds from blake2s
8
+ * * Speed-up comes from tree structure, which is parallelized using SIMD & threading.
9
+ * These features are not present in JS, so we only get overhead from trees.
10
+ * * Parallelization only happens on 1024-byte chunks: there is no benefit for small inputs.
11
+ * * It is still possible to make it faster using: a) loop unrolling b) web workers c) wasm
12
+ * @module
13
+ */
14
+ import { SHA256_IV } from "./_md.js";
15
+ import { fromNumH, fromNumL } from "./_u64.js";
16
+ import { _BLAKE2, _compress } from "./blake2.js";
17
+ // prettier-ignore
18
+ import { abytes, aexists, anumber, aoutput, checkOpts, clean, copyBytes, createHasher, swap32IfBE, u32, u8 } from "./utils.js";
19
+ // Constructor-time mode flags (`KEYED_HASH`, `DERIVE_*`) plus per-node tree
20
+ // flags (`CHUNK_*`, `PARENT`, `ROOT`).
21
+ const B3_Flags = {
22
+ CHUNK_START: 0b1,
23
+ CHUNK_END: 0b10,
24
+ PARENT: 0b100,
25
+ ROOT: 0b1000,
26
+ KEYED_HASH: 0b10000,
27
+ DERIVE_KEY_CONTEXT: 0b100000,
28
+ DERIVE_KEY_MATERIAL: 0b1000000,
29
+ };
30
+ // Default BLAKE3 IV, cloned from the shared BLAKE2s / SHA-256 IV basis.
31
+ const B3_IV = /* @__PURE__ */ SHA256_IV.slice();
32
+ // Seven 16-word rounds of BLAKE3 message schedule, generated by repeatedly
33
+ // permuting the identity row.
34
+ const B3_SIGMA = /* @__PURE__ */ (() => {
35
+ const Id = Array.from({ length: 16 }, (_, i) => i);
36
+ const permute = (arr) => [2, 6, 3, 10, 7, 0, 4, 13, 1, 11, 12, 5, 9, 14, 15, 8].map((i) => arr[i]);
37
+ const res = [];
38
+ for (let i = 0, v = Id; i < 7; i++, v = permute(v))
39
+ res.push(...v);
40
+ return Uint8Array.from(res);
41
+ })();
42
+ /** Blake3 hash. Can be used as MAC and KDF with caller-encoded context bytes. */
43
+ export class _BLAKE3 extends _BLAKE2 {
44
+ canXOF = true;
45
+ chunkPos = 0; // Position of current block in chunk
46
+ // How many chunks we already have; exact while this stays within
47
+ // JS's safe-integer range.
48
+ chunksDone = 0;
49
+ flags = 0 | 0;
50
+ IV;
51
+ state;
52
+ stack = [];
53
+ // Output
54
+ posOut = 0;
55
+ bufferOut32 = new Uint32Array(16);
56
+ bufferOut;
57
+ // Index of output chunk; exact while this stays within JS's
58
+ // safe-integer range.
59
+ chunkOut = 0;
60
+ enableXOF = true;
61
+ constructor(opts = {}, flags = 0) {
62
+ opts = checkOpts({}, opts);
63
+ super(64, opts.dkLen === undefined ? 32 : opts.dkLen);
64
+ const { key, context } = opts;
65
+ const hasContext = context !== undefined;
66
+ if (key !== undefined) {
67
+ if (hasContext)
68
+ throw new Error('cannot use both "key" and "context"');
69
+ abytes(key, 32, 'key');
70
+ const k = copyBytes(key);
71
+ this.IV = u32(k);
72
+ swap32IfBE(this.IV);
73
+ this.flags = flags | B3_Flags.KEYED_HASH;
74
+ }
75
+ else if (hasContext) {
76
+ abytes(context, undefined, 'context');
77
+ const ctx = context;
78
+ const contextKey = new _BLAKE3({ dkLen: 32 }, B3_Flags.DERIVE_KEY_CONTEXT)
79
+ .update(ctx)
80
+ .digest();
81
+ this.IV = u32(contextKey);
82
+ swap32IfBE(this.IV);
83
+ this.flags = flags | B3_Flags.DERIVE_KEY_MATERIAL;
84
+ }
85
+ else {
86
+ this.IV = B3_IV; // Share the module-private immutable default IV.
87
+ this.flags = flags;
88
+ }
89
+ this.state = this.IV.slice();
90
+ this.bufferOut = u8(this.bufferOut32);
91
+ }
92
+ // _BLAKE2's scalar-state hooks are unused here: BLAKE3 keeps its tree/XOF state in arrays and
93
+ // copies it directly in _cloneInto().
94
+ get() {
95
+ return [];
96
+ }
97
+ set() { }
98
+ // Truncated chunk/parent compression: seed v8..v15 as IV[0..3], t0, t1,
99
+ // block length, and flags, then keep only the first 8 output words.
100
+ b2Compress(counter, flags, buf, bufPos = 0) {
101
+ const { state: s, pos } = this;
102
+ const t0 = fromNumL(counter);
103
+ const t1 = fromNumH(counter);
104
+ // prettier-ignore
105
+ const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = _compress(B3_SIGMA, bufPos, buf, 7, s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], B3_IV[0], B3_IV[1], B3_IV[2], B3_IV[3], t0, t1, pos, flags);
106
+ s[0] = v0 ^ v8;
107
+ s[1] = v1 ^ v9;
108
+ s[2] = v2 ^ v10;
109
+ s[3] = v3 ^ v11;
110
+ s[4] = v4 ^ v12;
111
+ s[5] = v5 ^ v13;
112
+ s[6] = v6 ^ v14;
113
+ s[7] = v7 ^ v15;
114
+ }
115
+ compress(buf, bufPos = 0, isLast = false) {
116
+ // Compress last block
117
+ let flags = this.flags;
118
+ if (!this.chunkPos)
119
+ flags |= B3_Flags.CHUNK_START;
120
+ if (this.chunkPos === 15 || isLast)
121
+ flags |= B3_Flags.CHUNK_END;
122
+ if (!isLast)
123
+ this.pos = this.blockLen;
124
+ this.b2Compress(this.chunksDone, flags, buf, bufPos);
125
+ this.chunkPos += 1;
126
+ // If current block is last in chunk (16 blocks), then compress chunks
127
+ if (this.chunkPos === 16 || isLast) {
128
+ let chunk = this.state;
129
+ this.state = this.IV.slice();
130
+ // If not the last one, compress only when there are trailing zeros in chunk counter
131
+ // Chunks are used as a binary tree where the current stack is the path.
132
+ // Zero means the current leaf is finished and can be compressed.
133
+ // 1 (001) - leaf not finished (just push current chunk to stack)
134
+ // 2 (010) - leaf finished at depth=1 (merge with last elm on stack and push back)
135
+ // 3 (011) - last leaf not finished
136
+ // 4 (100) - leafs finished at depth=1 and depth=2
137
+ // Reading the low bit is safe for parity, but keep division full-width: shifting would
138
+ // truncate the safe-integer chunk counter to 32 bits.
139
+ for (let last, chunks = this.chunksDone + 1; isLast || !(chunks & 1); chunks = Math.floor(chunks / 2)) {
140
+ if (!(last = this.stack.pop()))
141
+ break;
142
+ this.buffer32.set(last, 0);
143
+ this.buffer32.set(chunk, 8);
144
+ this.pos = this.blockLen;
145
+ this.b2Compress(0, this.flags | B3_Flags.PARENT, this.buffer32, 0);
146
+ chunk = this.state;
147
+ this.state = this.IV.slice();
148
+ }
149
+ this.chunksDone++;
150
+ this.chunkPos = 0;
151
+ this.stack.push(chunk);
152
+ }
153
+ this.pos = 0;
154
+ }
155
+ // Overriding hides _BLAKE2's flat implementation, which would otherwise be inherited
156
+ // and silently miss the tree state (CV stack, chunk counters; get()/set() are stubs here).
157
+ _cloneInto(to) {
158
+ const staleOutput = !!to && to.finished && !to.destroyed; // Save before super copies lifecycle.
159
+ to = super._cloneInto(to);
160
+ const { IV, flags, state, chunkPos, posOut, chunkOut, stack, chunksDone } = this;
161
+ to.state.set(state);
162
+ // Clone each CV stack entry by value so extending or destroying the clone
163
+ // cannot alias the source tree state.
164
+ to.stack = stack.map((i) => Uint32Array.from(i));
165
+ if (IV === B3_IV) {
166
+ if (to.IV !== B3_IV)
167
+ clean(to.IV);
168
+ to.IV = B3_IV; // Share immutable default; configured IVs stay private.
169
+ }
170
+ else if (to.IV === B3_IV) {
171
+ to.IV = IV.slice();
172
+ }
173
+ else {
174
+ to.IV.set(IV);
175
+ }
176
+ to.flags = flags;
177
+ to.chunkPos = chunkPos;
178
+ to.chunksDone = chunksDone;
179
+ to.posOut = posOut;
180
+ to.chunkOut = chunkOut;
181
+ to.enableXOF = this.enableXOF;
182
+ if (this.finished) {
183
+ to.bufferOut32.set(this.bufferOut32);
184
+ }
185
+ else if (staleOutput) {
186
+ clean(to.bufferOut32); // Wipe stale output; finish() overwrites scratch.
187
+ }
188
+ return to;
189
+ }
190
+ destroy() {
191
+ this.destroyed = true;
192
+ clean(this.state, this.buffer32, this.bufferOut32);
193
+ if (this.IV !== B3_IV)
194
+ clean(this.IV);
195
+ clean(...this.stack);
196
+ }
197
+ // Root/XOF compression: rerun the same ROOT inputs with incrementing output
198
+ // counter `t` and materialize all 16 output words.
199
+ // Same as b2Compress, but doesn't modify state and returns 16 u32 array (instead of 8)
200
+ b2CompressOut() {
201
+ const { state: s, pos, flags, buffer32, bufferOut32: out32 } = this;
202
+ const outCounter = this.chunkOut++;
203
+ const t0 = fromNumL(outCounter);
204
+ const t1 = fromNumH(outCounter);
205
+ swap32IfBE(buffer32);
206
+ // prettier-ignore
207
+ const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = _compress(B3_SIGMA, 0, buffer32, 7, s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], B3_IV[0], B3_IV[1], B3_IV[2], B3_IV[3], t0, t1, pos, flags);
208
+ out32[0] = v0 ^ v8;
209
+ out32[1] = v1 ^ v9;
210
+ out32[2] = v2 ^ v10;
211
+ out32[3] = v3 ^ v11;
212
+ out32[4] = v4 ^ v12;
213
+ out32[5] = v5 ^ v13;
214
+ out32[6] = v6 ^ v14;
215
+ out32[7] = v7 ^ v15;
216
+ out32[8] = s[0] ^ v8;
217
+ out32[9] = s[1] ^ v9;
218
+ out32[10] = s[2] ^ v10;
219
+ out32[11] = s[3] ^ v11;
220
+ out32[12] = s[4] ^ v12;
221
+ out32[13] = s[5] ^ v13;
222
+ out32[14] = s[6] ^ v14;
223
+ out32[15] = s[7] ^ v15;
224
+ swap32IfBE(buffer32);
225
+ swap32IfBE(out32);
226
+ this.posOut = 0;
227
+ }
228
+ finish() {
229
+ if (this.finished)
230
+ return;
231
+ this.finished = true;
232
+ // Padding
233
+ this.buffer.fill(0, this.pos);
234
+ // Process last chunk
235
+ let flags = this.flags | B3_Flags.ROOT;
236
+ if (this.stack.length) {
237
+ // Finalize the current chunk first, then rerun the last parent
238
+ // compression as ROOT with t = 0 and b = 64.
239
+ flags |= B3_Flags.PARENT;
240
+ swap32IfBE(this.buffer32);
241
+ this.compress(this.buffer32, 0, true);
242
+ swap32IfBE(this.buffer32);
243
+ this.chunksDone = 0;
244
+ this.pos = this.blockLen;
245
+ }
246
+ else {
247
+ flags |= (!this.chunkPos ? B3_Flags.CHUNK_START : 0) | B3_Flags.CHUNK_END;
248
+ }
249
+ this.flags = flags;
250
+ this.b2CompressOut();
251
+ }
252
+ writeInto(out) {
253
+ aexists(this, false);
254
+ abytes(out);
255
+ this.finish();
256
+ const { blockLen, bufferOut } = this;
257
+ for (let pos = 0, len = out.length; pos < len;) {
258
+ if (this.posOut >= blockLen)
259
+ this.b2CompressOut();
260
+ const take = Math.min(blockLen - this.posOut, len - pos);
261
+ out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
262
+ this.posOut += take;
263
+ pos += take;
264
+ }
265
+ return out;
266
+ }
267
+ xofInto(out) {
268
+ if (!this.enableXOF)
269
+ throw new Error('no XOF after digest()');
270
+ return this.writeInto(out);
271
+ }
272
+ xof(bytes) {
273
+ anumber(bytes);
274
+ return this.xofInto(new Uint8Array(bytes));
275
+ }
276
+ digestInto(out) {
277
+ aoutput(out, this);
278
+ if (this.finished)
279
+ throw new Error('digest() was already called');
280
+ this.enableXOF = false;
281
+ // `aoutput(...)` allows oversized buffers; digestInto() must fill only the configured digest.
282
+ this.writeInto(out.length === this.outputLen ? out : out.subarray(0, this.outputLen));
283
+ this.destroy();
284
+ }
285
+ digest() {
286
+ const out = new Uint8Array(this.outputLen);
287
+ this.digestInto(out);
288
+ return out;
289
+ }
290
+ }
291
+ /**
292
+ * BLAKE3 hash function. Can be used as MAC and KDF.
293
+ * @param msg - message that would be hashed
294
+ * @param opts - Optional output, MAC, or KDF configuration. `key` must be
295
+ * exactly 32 bytes, `context` is caller-encoded bytes, and `dkLen` can be
296
+ * 0..2^64-1 via the XOF-backed output path. See {@link Blake3Opts}.
297
+ * @returns Digest bytes.
298
+ * @example
299
+ * Hash, MAC, or derive key material with BLAKE3.
300
+ * ```ts
301
+ * import { blake3 } from '@noble/hashes/blake3.js';
302
+ * import { utf8ToBytes } from '@noble/hashes/utils.js';
303
+ * const data = new Uint8Array(32);
304
+ * const hash = blake3(data);
305
+ * const mac = blake3(data, { key: new Uint8Array(32) });
306
+ * const kdf = blake3(data, { context: utf8ToBytes('application name') });
307
+ * const xof = blake3(data, { dkLen: 64 });
308
+ * ```
309
+ */
310
+ export const blake3 = /* @__PURE__ */ createHasher((opts = {}) => new _BLAKE3(opts));
@@ -0,0 +1,91 @@
1
+ import { type TRet } from './utils.ts';
2
+ /**
3
+ * Scrypt KDF with the fixed ESKDF policy tuple `{ N: 2^19, r: 8, p: 1, dkLen: 32 }`.
4
+ * @param password - user password string, UTF-8 encoded before entering RFC 7914
5
+ * @param salt - unique salt string, UTF-8 encoded before entering RFC 7914
6
+ * @returns Derived 32-byte key.
7
+ * @example
8
+ * Derive the 32-byte scrypt key used by ESKDF.
9
+ * ```ts
10
+ * scrypt('password123', 'user@example.com');
11
+ * ```
12
+ */
13
+ export declare function scrypt(password: string, salt: string): TRet<Uint8Array>;
14
+ /**
15
+ * PBKDF2-HMAC-SHA256 with the fixed ESKDF policy tuple `{ sha256, c: 2^17, dkLen: 32 }`.
16
+ * @param password - user password string, UTF-8 encoded before entering PBKDF2-HMAC-SHA-256
17
+ * @param salt - unique salt string, UTF-8 encoded before entering PBKDF2-HMAC-SHA-256
18
+ * @returns Derived 32-byte key.
19
+ * @example
20
+ * Derive the 32-byte PBKDF2 key used by ESKDF.
21
+ * ```ts
22
+ * pbkdf2('password123', 'user@example.com');
23
+ * ```
24
+ */
25
+ export declare function pbkdf2(password: string, salt: string): TRet<Uint8Array>;
26
+ /**
27
+ * Derives main seed. Takes a lot of time; prefer the higher-level `eskdf(...)`
28
+ * flow unless you specifically need the raw main seed.
29
+ * Derives the main seed by xor'ing two branches:
30
+ * the scrypt branch uses a `0x01` separator byte on username/password,
31
+ * and the PBKDF2 branch uses `0x02`.
32
+ * Username and password strings are encoded by the underlying KDFs after the
33
+ * local separator bytes are appended.
34
+ * @param username - account identifier used as public salt
35
+ * @param password - user password string
36
+ * @returns Main 32-byte seed for the account.
37
+ * @throws If the username or password length is invalid. {@link Error}
38
+ * @example
39
+ * Derive the main ESKDF seed from username and password.
40
+ * ```ts
41
+ * deriveMainSeed('example-user', 'example-password');
42
+ * ```
43
+ */
44
+ export declare function deriveMainSeed(username: string, password: string): TRet<Uint8Array>;
45
+ type AccountID = number | string;
46
+ type OptsLength = {
47
+ keyLength: number;
48
+ };
49
+ type OptsMod = {
50
+ modulus: bigint;
51
+ };
52
+ type KeyOpts = undefined | OptsLength | OptsMod;
53
+ /** Not using classes because constructor cannot be async. */
54
+ export interface ESKDF {
55
+ /**
56
+ * Derives a child key. Child key will not be associated with any
57
+ * other child key because of properties of underlying KDF.
58
+ *
59
+ * @param protocol - 3-15 character protocol name
60
+ * @param accountId - numeric account identifier, or a string id for
61
+ * `password\d{0,3}`, `ssh`, `tor`, or `file`
62
+ * @param options - Optional child-key shaping parameters. See {@link KeyOpts}.
63
+ * @returns Derived child key bytes.
64
+ */
65
+ deriveChildKey: (protocol: string, accountId: AccountID, options?: KeyOpts) => TRet<Uint8Array>;
66
+ /** Deletes the main seed from the ESKDF instance. */
67
+ expire: () => void;
68
+ /**
69
+ * Human-readable fingerprint: first 6 bytes of
70
+ * `deriveChildKey('fingerprint', 0)`, formatted as uppercase
71
+ * colon-separated hex.
72
+ */
73
+ fingerprint: string;
74
+ }
75
+ /**
76
+ * ESKDF
77
+ * @param username - username, email, or identifier, min: 8 characters, should have enough entropy
78
+ * @param password - password, min: 8 characters, should have enough entropy
79
+ * @returns Frozen API that derives child keys and exposes the account fingerprint.
80
+ * @throws If the username or password length is invalid. {@link Error}
81
+ * @example
82
+ * Derive account-specific child keys from the main ESKDF seed.
83
+ * ```ts
84
+ * const kdf = await eskdf('example-university', 'beginning-new-example');
85
+ * const key = kdf.deriveChildKey('aes', 0);
86
+ * const fingerprint = kdf.fingerprint;
87
+ * kdf.expire();
88
+ * ```
89
+ */
90
+ export declare function eskdf(username: string, password: string): Promise<TRet<ESKDF>>;
91
+ export {};
@@ -0,0 +1,225 @@
1
+ /**
2
+ * Experimental KDF for AES.
3
+ * @module
4
+ */
5
+ import { hkdf } from "./hkdf.js";
6
+ import { pbkdf2 as _pbkdf2 } from "./pbkdf2.js";
7
+ import { scrypt as _scrypt } from "./scrypt.js";
8
+ import { sha256 } from "./sha2.js";
9
+ import { abytes, bytesToHex, clean, createView, hexToBytes, kdfInputToBytes, } from "./utils.js";
10
+ // A tiny KDF for various applications like AES key-gen.
11
+ // Uses HKDF in a non-standard way, so it's not "KDF-secure", only "PRF-secure".
12
+ // Which is good enough: assume sha2-256 retained preimage resistance.
13
+ // Fixed ESKDF scrypt work factor: interactive-latency target with about 512 MiB RAM per derivation.
14
+ const SCRYPT_FACTOR = /* @__PURE__ */ (() => 2 ** 19)();
15
+ // Fixed ESKDF PBKDF2 work factor: CPU-only companion branch in the same rough
16
+ // interactive-latency range.
17
+ const PBKDF2_FACTOR = /* @__PURE__ */ (() => 2 ** 17)();
18
+ /**
19
+ * Scrypt KDF with the fixed ESKDF policy tuple `{ N: 2^19, r: 8, p: 1, dkLen: 32 }`.
20
+ * @param password - user password string, UTF-8 encoded before entering RFC 7914
21
+ * @param salt - unique salt string, UTF-8 encoded before entering RFC 7914
22
+ * @returns Derived 32-byte key.
23
+ * @example
24
+ * Derive the 32-byte scrypt key used by ESKDF.
25
+ * ```ts
26
+ * scrypt('password123', 'user@example.com');
27
+ * ```
28
+ */
29
+ export function scrypt(password, salt) {
30
+ return _scrypt(password, salt, { N: SCRYPT_FACTOR, r: 8, p: 1, dkLen: 32 });
31
+ }
32
+ /**
33
+ * PBKDF2-HMAC-SHA256 with the fixed ESKDF policy tuple `{ sha256, c: 2^17, dkLen: 32 }`.
34
+ * @param password - user password string, UTF-8 encoded before entering PBKDF2-HMAC-SHA-256
35
+ * @param salt - unique salt string, UTF-8 encoded before entering PBKDF2-HMAC-SHA-256
36
+ * @returns Derived 32-byte key.
37
+ * @example
38
+ * Derive the 32-byte PBKDF2 key used by ESKDF.
39
+ * ```ts
40
+ * pbkdf2('password123', 'user@example.com');
41
+ * ```
42
+ */
43
+ export function pbkdf2(password, salt) {
44
+ return _pbkdf2(sha256, password, salt, { c: PBKDF2_FACTOR, dkLen: 32 });
45
+ }
46
+ // Combines two 32-byte byte arrays into a fresh 32-byte result without aliasing either input.
47
+ function xor32(a, b) {
48
+ abytes(a, 32);
49
+ abytes(b, 32);
50
+ const arr = new Uint8Array(32);
51
+ for (let i = 0; i < 32; i++) {
52
+ arr[i] = a[i] ^ b[i];
53
+ }
54
+ return arr;
55
+ }
56
+ // All local string length checks are in JS UTF-16 code units, not UTF-8 bytes.
57
+ function strHasLength(str, min, max) {
58
+ return typeof str === 'string' && str.length >= min && str.length <= max;
59
+ }
60
+ /**
61
+ * Derives main seed. Takes a lot of time; prefer the higher-level `eskdf(...)`
62
+ * flow unless you specifically need the raw main seed.
63
+ * Derives the main seed by xor'ing two branches:
64
+ * the scrypt branch uses a `0x01` separator byte on username/password,
65
+ * and the PBKDF2 branch uses `0x02`.
66
+ * Username and password strings are encoded by the underlying KDFs after the
67
+ * local separator bytes are appended.
68
+ * @param username - account identifier used as public salt
69
+ * @param password - user password string
70
+ * @returns Main 32-byte seed for the account.
71
+ * @throws If the username or password length is invalid. {@link Error}
72
+ * @example
73
+ * Derive the main ESKDF seed from username and password.
74
+ * ```ts
75
+ * deriveMainSeed('example-user', 'example-password');
76
+ * ```
77
+ */
78
+ export function deriveMainSeed(username, password) {
79
+ if (typeof username !== 'string')
80
+ kdfInputToBytes(username, 'username');
81
+ if (typeof password !== 'string')
82
+ kdfInputToBytes(password, 'password');
83
+ if (!strHasLength(username, 8, 255))
84
+ throw new Error('invalid username');
85
+ if (!strHasLength(password, 8, 255))
86
+ throw new Error('invalid password');
87
+ // Keep the protocol separators as the literal bytes 0x01 / 0x02 even after minification.
88
+ // Embedding them as non-printable characters directly can be awkward across
89
+ // JS tooling and environments.
90
+ const codes = { _1: 1, _2: 2 };
91
+ const sep = { s: String.fromCharCode(codes._1), p: String.fromCharCode(codes._2) };
92
+ const scr = scrypt(password + sep.s, username + sep.s);
93
+ const pbk = pbkdf2(password + sep.p, username + sep.p);
94
+ const res = xor32(scr, pbk);
95
+ clean(scr, pbk);
96
+ return res;
97
+ }
98
+ /**
99
+ * Converts protocol & accountId pair to HKDF params:
100
+ * `info` is UTF-8 protocol bytes, numeric ids become 4-byte BE `salt`,
101
+ * and string ids become UTF-8 `salt` bytes.
102
+ * Numeric and string account ids share the existing salt byte namespace;
103
+ * changing this would require a new ESKDF encoding, so callers should use one account
104
+ * id kind per application.
105
+ */
106
+ function getSaltInfo(protocol, accountId = 0) {
107
+ // Note that length here also repeats two lines below
108
+ // We do an additional length check here to reduce the scope of DoS attacks
109
+ if (!(strHasLength(protocol, 3, 15) && /^[a-z0-9]{3,15}$/.test(protocol))) {
110
+ throw new Error('invalid protocol');
111
+ }
112
+ // Exact-match only: substring matches like `assh` / `mentor` must not widen the public whitelist.
113
+ const allowsStr = /^(password\d{0,3}|ssh|tor|file)$/.test(protocol);
114
+ let salt; // Assigned below: either 4-byte BE account bytes or UTF-8 account bytes.
115
+ if (typeof accountId === 'string') {
116
+ if (!allowsStr)
117
+ throw new Error('accountId must be a number');
118
+ if (!strHasLength(accountId, 1, 255))
119
+ throw new Error('accountId must be string of length 1..255');
120
+ salt = kdfInputToBytes(accountId);
121
+ }
122
+ else if (Number.isSafeInteger(accountId)) {
123
+ if (accountId < 0 || accountId > Math.pow(2, 32) - 1)
124
+ throw new Error('invalid accountId');
125
+ // Convert to Big Endian Uint32
126
+ salt = new Uint8Array(4);
127
+ createView(salt).setUint32(0, accountId, false);
128
+ }
129
+ else {
130
+ throw new Error('accountId must be a number' + (allowsStr ? ' or string' : ''));
131
+ }
132
+ const info = kdfInputToBytes(protocol);
133
+ return { salt, info };
134
+ }
135
+ // Local modulus-size helper, not a general bigint-byte-length primitive:
136
+ // `<= 128n` is rejected by ESKDF policy.
137
+ function countBytes(num) {
138
+ if (typeof num !== 'bigint' || num <= BigInt(128))
139
+ throw new Error('invalid number');
140
+ return Math.ceil(num.toString(2).length / 8);
141
+ }
142
+ /**
143
+ * Parses keyLength and modulus options to extract length of result key.
144
+ * If modulus is used, adds 64 bits to it per the FIPS 186-5 Appendix A.3.1 /
145
+ * A.4.1 extra-bits guidance.
146
+ */
147
+ function getKeyLength(options) {
148
+ if (!options || typeof options !== 'object')
149
+ return 32;
150
+ const hasLen = 'keyLength' in options;
151
+ const hasMod = 'modulus' in options;
152
+ if (hasLen && hasMod)
153
+ throw new Error('cannot combine keyLength and modulus options');
154
+ if (!hasLen && !hasMod)
155
+ throw new Error('must have either keyLength or modulus option');
156
+ // FIPS 186-5 Appendix A.3.1 / A.4.1 calls for at least 64 extra bits.
157
+ const l = hasMod ? countBytes(options.modulus) + 8 : options.keyLength;
158
+ // HKDF-SHA256 ultimately caps output at 8160 bytes; values above that still fail in hkdf().
159
+ if (!(typeof l === 'number' && l >= 16 && l <= 8192))
160
+ throw new Error('invalid keyLength');
161
+ return l;
162
+ }
163
+ /**
164
+ * Converts key to bigint and divides it by modulus. Big Endian.
165
+ * Adapts FIPS 186-5 Appendix A.4.1: `getKeyLength()` already requested the
166
+ * extra 64-bit margin, and this step maps the result into `1..modulus-1`.
167
+ */
168
+ function modReduceKey(key, modulus) {
169
+ const _1 = BigInt(1);
170
+ const num = BigInt('0x' + bytesToHex(key)); // check for ui8a, then bytesToNumber()
171
+ const res = (num % (modulus - _1)) + _1; // Remove 0 from output
172
+ if (res < _1)
173
+ throw new Error('expected positive number'); // Guard against bad values
174
+ // Strip the extra 64-bit margin that `getKeyLength()` requested
175
+ // for bias reduction.
176
+ const len = key.length - 8;
177
+ const hex = res.toString(16).padStart(len * 2, '0'); // numberToHex()
178
+ const bytes = hexToBytes(hex);
179
+ if (bytes.length !== len)
180
+ throw new Error('invalid length of result key');
181
+ return bytes;
182
+ }
183
+ /**
184
+ * ESKDF
185
+ * @param username - username, email, or identifier, min: 8 characters, should have enough entropy
186
+ * @param password - password, min: 8 characters, should have enough entropy
187
+ * @returns Frozen API that derives child keys and exposes the account fingerprint.
188
+ * @throws If the username or password length is invalid. {@link Error}
189
+ * @example
190
+ * Derive account-specific child keys from the main ESKDF seed.
191
+ * ```ts
192
+ * const kdf = await eskdf('example-university', 'beginning-new-example');
193
+ * const key = kdf.deriveChildKey('aes', 0);
194
+ * const fingerprint = kdf.fingerprint;
195
+ * kdf.expire();
196
+ * ```
197
+ */
198
+ export async function eskdf(username, password) {
199
+ // We are using closure + object instead of class because
200
+ // we want to make `seed` non-accessible for any external function.
201
+ let seed = deriveMainSeed(username, password);
202
+ function deriveCK(protocol, accountId = 0, options) {
203
+ // Reject expired instances before deriving any HKDF inputs from the closure-held seed.
204
+ abytes(seed, 32);
205
+ const { salt, info } = getSaltInfo(protocol, accountId); // validate protocol & accountId
206
+ // Validate option shape and coarse length bounds;
207
+ // `hkdf()` still rejects non-integer lengths.
208
+ const keyLength = getKeyLength(options);
209
+ const key = hkdf(sha256, seed, salt, info, keyLength);
210
+ // Modulus has already been validated
211
+ return options && 'modulus' in options ? modReduceKey(key, options.modulus) : key;
212
+ }
213
+ function expire() {
214
+ // Overwrite the closure-held seed before dropping the reference.
215
+ if (seed)
216
+ seed.fill(1);
217
+ seed = undefined;
218
+ }
219
+ // prettier-ignore
220
+ const fingerprint = Array.from(deriveCK('fingerprint', 0))
221
+ .slice(0, 6)
222
+ .map((char) => char.toString(16).padStart(2, '0').toUpperCase())
223
+ .join(':');
224
+ return Object.freeze({ deriveChildKey: deriveCK, expire, fingerprint });
225
+ }