toolcraft 0.0.749 → 0.0.751
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.
- package/composition.json +23 -3
- package/dist/composition.json +23 -3
- package/dist/human-in-loop/approvals-commands.d.ts +1 -1
- package/dist/index.d.ts +1 -262
- package/dist/index.js +1 -573
- package/dist/runtime-platform.d.ts +2 -0
- package/dist/runtime-platform.js +2 -0
- package/dist/runtime-platform.workerd.d.ts +3 -0
- package/dist/runtime-platform.workerd.js +10 -0
- package/dist/runtime.d.ts +262 -0
- package/dist/runtime.js +576 -0
- package/node_modules/@noble/hashes/LICENSE +21 -0
- package/node_modules/@noble/hashes/README.md +478 -0
- package/node_modules/@noble/hashes/_blake.d.ts +20 -0
- package/node_modules/@noble/hashes/_blake.js +59 -0
- package/node_modules/@noble/hashes/_md.d.ts +95 -0
- package/node_modules/@noble/hashes/_md.js +209 -0
- package/node_modules/@noble/hashes/_u64.d.ts +36 -0
- package/node_modules/@noble/hashes/_u64.js +77 -0
- package/node_modules/@noble/hashes/argon2.d.ts +148 -0
- package/node_modules/@noble/hashes/argon2.js +577 -0
- package/node_modules/@noble/hashes/blake1.d.ts +162 -0
- package/node_modules/@noble/hashes/blake1.js +630 -0
- package/node_modules/@noble/hashes/blake2.d.ts +203 -0
- package/node_modules/@noble/hashes/blake2.js +573 -0
- package/node_modules/@noble/hashes/blake3.d.ts +68 -0
- package/node_modules/@noble/hashes/blake3.js +310 -0
- package/node_modules/@noble/hashes/eskdf.d.ts +91 -0
- package/node_modules/@noble/hashes/eskdf.js +225 -0
- package/node_modules/@noble/hashes/hkdf.d.ts +70 -0
- package/node_modules/@noble/hashes/hkdf.js +152 -0
- package/node_modules/@noble/hashes/hmac.d.ts +50 -0
- package/node_modules/@noble/hashes/hmac.js +93 -0
- package/node_modules/@noble/hashes/index.d.ts +1 -0
- package/node_modules/@noble/hashes/index.js +34 -0
- package/node_modules/@noble/hashes/legacy.d.ts +107 -0
- package/node_modules/@noble/hashes/legacy.js +348 -0
- package/node_modules/@noble/hashes/package.json +91 -0
- package/node_modules/@noble/hashes/pbkdf2.d.ts +66 -0
- package/node_modules/@noble/hashes/pbkdf2.js +176 -0
- package/node_modules/@noble/hashes/scrypt.d.ts +98 -0
- package/node_modules/@noble/hashes/scrypt.js +304 -0
- package/node_modules/@noble/hashes/sha2.d.ts +176 -0
- package/node_modules/@noble/hashes/sha2.js +446 -0
- package/node_modules/@noble/hashes/sha3-addons.d.ts +533 -0
- package/node_modules/@noble/hashes/sha3-addons.js +973 -0
- package/node_modules/@noble/hashes/sha3.d.ts +208 -0
- package/node_modules/@noble/hashes/sha3.js +475 -0
- package/node_modules/@noble/hashes/src/_blake.ts +67 -0
- package/node_modules/@noble/hashes/src/_md.ts +227 -0
- package/node_modules/@noble/hashes/src/_u64.ts +111 -0
- package/node_modules/@noble/hashes/src/argon2.ts +693 -0
- package/node_modules/@noble/hashes/src/blake1.ts +677 -0
- package/node_modules/@noble/hashes/src/blake2.ts +648 -0
- package/node_modules/@noble/hashes/src/blake3.ts +344 -0
- package/node_modules/@noble/hashes/src/eskdf.ts +265 -0
- package/node_modules/@noble/hashes/src/hkdf.ts +161 -0
- package/node_modules/@noble/hashes/src/hmac.ts +130 -0
- package/node_modules/@noble/hashes/src/index.ts +33 -0
- package/node_modules/@noble/hashes/src/legacy.ts +361 -0
- package/node_modules/@noble/hashes/src/pbkdf2.ts +219 -0
- package/node_modules/@noble/hashes/src/scrypt.ts +375 -0
- package/node_modules/@noble/hashes/src/sha2.ts +486 -0
- package/node_modules/@noble/hashes/src/sha3-addons.ts +1157 -0
- package/node_modules/@noble/hashes/src/sha3.ts +525 -0
- package/node_modules/@noble/hashes/src/utils.ts +978 -0
- package/node_modules/@noble/hashes/src/webcrypto.ts +283 -0
- package/node_modules/@noble/hashes/utils.d.ts +560 -0
- package/node_modules/@noble/hashes/utils.js +687 -0
- package/node_modules/@noble/hashes/webcrypto.d.ts +121 -0
- package/node_modules/@noble/hashes/webcrypto.js +228 -0
- package/node_modules/@poe-code/agent-mcp-config/dist/apply.js +23 -9
- package/node_modules/@poe-code/config-mutations/README.md +2 -0
- package/node_modules/@poe-code/config-mutations/dist/execution/apply-mutation.js +4 -5
- package/node_modules/@poe-code/config-mutations/dist/execution/path-utils.d.ts +3 -4
- package/node_modules/@poe-code/config-mutations/dist/execution/path-utils.js +3 -3
- package/node_modules/@poe-code/config-mutations/dist/template/render.js +1 -1
- package/node_modules/@poe-code/config-mutations/dist/testing/mock-fs.d.ts +2 -2
- package/node_modules/@poe-code/config-mutations/dist/testing/mock-fs.js +3 -6
- package/node_modules/@poe-code/config-mutations/dist/types.d.ts +4 -2
- package/node_modules/@poe-code/process-runner/README.md +2 -1
- package/node_modules/@poe-code/process-runner/dist/transfer-filesystem.d.ts +1 -0
- package/node_modules/@poe-code/process-runner/dist/transfer-filesystem.js +1 -0
- package/node_modules/@poe-code/process-runner/dist/transfer-filesystem.workerd.d.ts +2 -0
- package/node_modules/@poe-code/process-runner/dist/transfer-filesystem.workerd.js +1 -0
- package/node_modules/@poe-code/process-runner/dist/types.d.ts +1 -1
- package/node_modules/@poe-code/process-runner/dist/workspace-transfer.d.ts +6 -5
- package/node_modules/@poe-code/process-runner/dist/workspace-transfer.js +67 -29
- package/node_modules/@poe-code/process-runner/package.json +13 -0
- package/node_modules/@poe-code/safe-fs/LICENSE +21 -0
- package/node_modules/@poe-code/safe-fs/PROVENANCE.json +428 -0
- package/node_modules/@poe-code/safe-fs/README.md +411 -0
- package/node_modules/@poe-code/safe-fs/dist/bridge/confinement.d.ts +3 -0
- package/node_modules/@poe-code/safe-fs/dist/bridge/confinement.js +171 -0
- package/node_modules/@poe-code/safe-fs/dist/bridge/filesystem.d.ts +93 -0
- package/node_modules/@poe-code/safe-fs/dist/bridge/filesystem.js +453 -0
- package/node_modules/@poe-code/safe-fs/dist/bridge/index.d.ts +7 -0
- package/node_modules/@poe-code/safe-fs/dist/bridge/index.js +19 -0
- package/node_modules/@poe-code/safe-fs/dist/bridge/stats.d.ts +4 -0
- package/node_modules/@poe-code/safe-fs/dist/bridge/stats.js +37 -0
- package/node_modules/@poe-code/safe-fs/dist/bridge/types.d.ts +81 -0
- package/node_modules/@poe-code/safe-fs/dist/bridge/types.js +1 -0
- package/node_modules/@poe-code/safe-fs/dist/bridge/values.d.ts +6 -0
- package/node_modules/@poe-code/safe-fs/dist/bridge/values.js +65 -0
- package/node_modules/@poe-code/safe-fs/dist/config/memory.d.ts +3 -0
- package/node_modules/@poe-code/safe-fs/dist/config/memory.js +7 -0
- package/node_modules/@poe-code/safe-fs/dist/config/real.d.ts +5 -0
- package/node_modules/@poe-code/safe-fs/dist/config/real.js +16 -0
- package/node_modules/@poe-code/safe-fs/dist/config/registry.d.ts +2 -0
- package/node_modules/@poe-code/safe-fs/dist/config/registry.js +15 -0
- package/node_modules/@poe-code/safe-fs/dist/config.d.ts +15 -0
- package/node_modules/@poe-code/safe-fs/dist/config.js +46 -0
- package/node_modules/@poe-code/safe-fs/dist/config.node.d.ts +2 -0
- package/node_modules/@poe-code/safe-fs/dist/config.node.js +11 -0
- package/node_modules/@poe-code/safe-fs/dist/config.portable.d.ts +3 -0
- package/node_modules/@poe-code/safe-fs/dist/config.portable.js +9 -0
- package/node_modules/@poe-code/safe-fs/dist/contracts/abort.d.ts +5 -0
- package/node_modules/@poe-code/safe-fs/dist/contracts/abort.js +34 -0
- package/node_modules/@poe-code/safe-fs/dist/contracts/cleanup.d.ts +1 -0
- package/node_modules/@poe-code/safe-fs/dist/contracts/cleanup.js +9 -0
- package/node_modules/@poe-code/safe-fs/dist/contracts/descriptor.d.ts +38 -0
- package/node_modules/@poe-code/safe-fs/dist/contracts/descriptor.js +1 -0
- package/node_modules/@poe-code/safe-fs/dist/contracts/errors.d.ts +53 -0
- package/node_modules/@poe-code/safe-fs/dist/contracts/errors.js +99 -0
- package/node_modules/@poe-code/safe-fs/dist/contracts/filesystem.d.ts +379 -0
- package/node_modules/@poe-code/safe-fs/dist/contracts/filesystem.js +1 -0
- package/node_modules/@poe-code/safe-fs/dist/contracts/index.d.ts +6 -0
- package/node_modules/@poe-code/safe-fs/dist/contracts/index.js +6 -0
- package/node_modules/@poe-code/safe-fs/dist/contracts/io.d.ts +12 -0
- package/node_modules/@poe-code/safe-fs/dist/contracts/io.js +321 -0
- package/node_modules/@poe-code/safe-fs/dist/contracts/object.d.ts +134 -0
- package/node_modules/@poe-code/safe-fs/dist/contracts/object.js +97 -0
- package/node_modules/@poe-code/safe-fs/dist/contracts/path.d.ts +3 -0
- package/node_modules/@poe-code/safe-fs/dist/contracts/path.js +2 -0
- package/node_modules/@poe-code/safe-fs/dist/contracts/portable-path.d.ts +21 -0
- package/node_modules/@poe-code/safe-fs/dist/contracts/portable-path.js +78 -0
- package/node_modules/@poe-code/safe-fs/dist/contracts/virtual-path.d.ts +15 -0
- package/node_modules/@poe-code/safe-fs/dist/contracts/virtual-path.js +162 -0
- package/node_modules/@poe-code/safe-fs/dist/core.d.ts +19 -0
- package/node_modules/@poe-code/safe-fs/dist/core.js +17 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/capabilities.d.ts +10 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/capabilities.js +216 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/conditional-chmod.d.ts +7 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/conditional-chmod.js +19 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/descriptor.d.ts +21 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/descriptor.js +279 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/devices/index.d.ts +59 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/devices/index.js +875 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/devices/path.d.ts +7 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/devices/path.js +250 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/devices/stream.d.ts +6 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/devices/stream.js +136 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/directory-admission.d.ts +3 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/directory-admission.js +14 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/memory/atomic-view.d.ts +11 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/memory/atomic-view.js +13 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/memory/index.d.ts +186 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/memory/index.js +3771 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/memory/ledger.d.ts +26 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/memory/ledger.js +96 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/memory/limits.d.ts +13 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/memory/limits.js +26 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/memory/missing-target.d.ts +15 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/memory/missing-target.js +144 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/mount/comparison.d.ts +19 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/mount/comparison.js +118 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/mount/identity.d.ts +6 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/mount/identity.js +29 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/mount/index.d.ts +74 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/mount/index.js +1291 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/object-authority.d.ts +27 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/object-authority.js +287 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/object-publication/index.d.ts +45 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/object-publication/index.js +531 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/overlay/index.d.ts +87 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/overlay/index.js +1185 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/overlay/memory-publication.d.ts +42 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/overlay/memory-publication.js +558 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/path-namespace.d.ts +4 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/path-namespace.js +63 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/quota/index.d.ts +12 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/quota/index.js +520 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/readonly/index.d.ts +37 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/readonly/index.js +208 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/real/allocation.d.ts +1 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/real/allocation.js +8 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/real/index.d.ts +105 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/real/index.js +1259 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/authority.d.ts +7 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/authority.js +38 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/filesystem.d.ts +130 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/filesystem.js +1137 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/bytes.d.ts +1 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/bytes.js +9 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/index.d.ts +2 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/index.js +1 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/request-fetch.d.ts +15 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/request-fetch.js +74 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/request-node.d.ts +4 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/request-node.js +111 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/request.d.ts +17 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/request.js +89 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/signature.d.ts +20 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/signature.js +76 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/transport.d.ts +3 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/transport.js +478 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/types.d.ts +30 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/types.js +1 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/xml.d.ts +14 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/http/xml.js +192 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/index.d.ts +8 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/index.js +4 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/key-order.d.ts +2 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/key-order.js +11 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/manifest-admission.d.ts +8 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/manifest-admission.js +167 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/mock.d.ts +48 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/mock.js +249 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/namespace.d.ts +13 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/namespace.js +400 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/registry.d.ts +10 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/registry.js +73 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/transport.d.ts +103 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/s3/transport.js +28 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/scoped.d.ts +19 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/scoped.js +663 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/staging-ancestry.d.ts +8 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/staging-ancestry.js +115 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/staging-cleanup.d.ts +5 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/staging-cleanup.js +63 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/webdav/index.d.ts +2 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/webdav/index.js +1 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/webdav/resource-id.d.ts +18 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/webdav/resource-id.js +109 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/webdav/webdav.d.ts +141 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/webdav/webdav.js +1377 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/webdav/xml.d.ts +15 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/webdav/xml.js +59 -0
- package/node_modules/@poe-code/safe-fs/dist/index.d.ts +25 -0
- package/node_modules/@poe-code/safe-fs/dist/index.js +21 -0
- package/node_modules/@poe-code/safe-fs/dist/native/fs-seek/linux-x64-glibc.node +0 -0
- package/node_modules/@poe-code/safe-fs/dist/native/fs-seek/loader.d.ts +5 -0
- package/node_modules/@poe-code/safe-fs/dist/native/fs-seek/loader.mjs +120 -0
- package/node_modules/@poe-code/safe-fs/dist/native/fs-seek/manifest.json +46 -0
- package/node_modules/@poe-code/safe-fs/dist/node/filesystem.d.ts +19 -0
- package/node_modules/@poe-code/safe-fs/dist/node/filesystem.js +30 -0
- package/node_modules/@poe-code/safe-fs/dist/node/host.d.ts +3 -0
- package/node_modules/@poe-code/safe-fs/dist/node/host.js +78 -0
- package/node_modules/@poe-code/safe-fs/dist/node/index.d.ts +3 -0
- package/node_modules/@poe-code/safe-fs/dist/node/index.js +2 -0
- package/node_modules/@poe-code/safe-fs/dist/node/native-seek-unavailable.d.ts +1 -0
- package/node_modules/@poe-code/safe-fs/dist/node/native-seek-unavailable.js +5 -0
- package/node_modules/@poe-code/safe-fs/dist/node/native-seek.d.ts +3 -0
- package/node_modules/@poe-code/safe-fs/dist/node/native-seek.js +54 -0
- package/node_modules/@poe-code/safe-fs/dist/node/stats.d.ts +1 -0
- package/node_modules/@poe-code/safe-fs/dist/node/stats.js +1 -0
- package/node_modules/@poe-code/safe-fs/dist/node/values.d.ts +1 -0
- package/node_modules/@poe-code/safe-fs/dist/node/values.js +1 -0
- package/node_modules/@poe-code/safe-fs/dist/node-host.d.ts +1 -0
- package/node_modules/@poe-code/safe-fs/dist/node-host.js +1 -0
- package/node_modules/@poe-code/safe-fs/dist/node-unavailable.d.ts +1 -0
- package/node_modules/@poe-code/safe-fs/dist/node-unavailable.js +1 -0
- package/node_modules/@poe-code/safe-fs/dist/package.json +29 -0
- package/node_modules/@poe-code/safe-fs/dist/platform/browser-path.d.ts +1 -0
- package/node_modules/@poe-code/safe-fs/dist/platform/browser-path.js +1 -0
- package/node_modules/@poe-code/safe-fs/dist/platform/browser.d.ts +26 -0
- package/node_modules/@poe-code/safe-fs/dist/platform/browser.js +58 -0
- package/node_modules/@poe-code/safe-fs/dist/platform/node-path.d.ts +1 -0
- package/node_modules/@poe-code/safe-fs/dist/platform/node-path.js +1 -0
- package/node_modules/@poe-code/safe-fs/dist/platform/node.d.ts +26 -0
- package/node_modules/@poe-code/safe-fs/dist/platform/node.js +64 -0
- package/node_modules/@poe-code/safe-fs/dist/platform/transport-budget.d.ts +9 -0
- package/node_modules/@poe-code/safe-fs/dist/platform/transport-budget.js +17 -0
- package/node_modules/@poe-code/safe-fs/dist/python/emscripten.d.ts +15 -0
- package/node_modules/@poe-code/safe-fs/dist/python/emscripten.js +357 -0
- package/node_modules/@poe-code/safe-fs/dist/python/filesystem.d.ts +51 -0
- package/node_modules/@poe-code/safe-fs/dist/python/filesystem.js +243 -0
- package/node_modules/@poe-code/safe-fs/dist/python/flags.d.ts +3 -0
- package/node_modules/@poe-code/safe-fs/dist/python/flags.js +14 -0
- package/node_modules/@poe-code/safe-fs/dist/python/index.d.ts +9 -0
- package/node_modules/@poe-code/safe-fs/dist/python/index.js +5 -0
- package/node_modules/@poe-code/safe-fs/dist/python/native.d.ts +18 -0
- package/node_modules/@poe-code/safe-fs/dist/python/native.js +446 -0
- package/node_modules/@poe-code/safe-fs/dist/python/request.d.ts +2 -0
- package/node_modules/@poe-code/safe-fs/dist/python/request.js +61 -0
- package/node_modules/@poe-code/safe-fs/dist/python/stat.d.ts +8 -0
- package/node_modules/@poe-code/safe-fs/dist/python/stat.js +34 -0
- package/node_modules/@poe-code/safe-fs/dist/runtime-core.d.ts +27 -0
- package/node_modules/@poe-code/safe-fs/dist/runtime-core.js +57 -0
- package/node_modules/@poe-code/safe-fs/dist/testing/atomic-filesystem.d.ts +16 -0
- package/node_modules/@poe-code/safe-fs/dist/testing/atomic-filesystem.js +496 -0
- package/node_modules/@poe-code/safe-fs/dist/testing/object-io-control.d.ts +23 -0
- package/node_modules/@poe-code/safe-fs/dist/testing/object-io-control.js +39 -0
- package/node_modules/@poe-code/safe-fs/dist/testing/object-io-metrics.d.ts +31 -0
- package/node_modules/@poe-code/safe-fs/dist/testing/object-io-metrics.js +143 -0
- package/node_modules/@poe-code/safe-fs/dist/testing/object-publication.d.ts +19 -0
- package/node_modules/@poe-code/safe-fs/dist/testing/object-publication.js +209 -0
- package/node_modules/@poe-code/safe-fs/dist/xml.d.ts +1 -0
- package/node_modules/@poe-code/safe-fs/dist/xml.js +1 -0
- package/node_modules/@poe-code/safe-fs/package.json +189 -0
- package/node_modules/@poe-code/task-list/README.md +2 -0
- package/node_modules/@poe-code/task-list/dist/backends/gh-issues-client.d.ts +1 -1
- package/node_modules/@poe-code/task-list/dist/backends/gh-issues-client.js +11 -4
- package/node_modules/@poe-code/task-list/dist/backends/markdown-dir.js +2 -2
- package/node_modules/@poe-code/task-list/dist/backends/utils.js +5 -7
- package/node_modules/@poe-code/task-list/dist/backends/yaml-file.js +1 -1
- package/node_modules/@poe-code/task-list/dist/default-host.d.ts +2 -0
- package/node_modules/@poe-code/task-list/dist/default-host.js +2 -0
- package/node_modules/@poe-code/task-list/dist/default-host.workerd.d.ts +4 -0
- package/node_modules/@poe-code/task-list/dist/default-host.workerd.js +6 -0
- package/node_modules/@poe-code/task-list/dist/filesystem.d.ts +3 -0
- package/node_modules/@poe-code/task-list/dist/filesystem.js +32 -0
- package/node_modules/@poe-code/task-list/dist/move.js +3 -3
- package/node_modules/@poe-code/task-list/dist/open.js +2 -5
- package/node_modules/@poe-code/task-list/dist/paths.d.ts +12 -0
- package/node_modules/@poe-code/task-list/dist/paths.js +7 -0
- package/node_modules/@poe-code/task-list/dist/types.d.ts +6 -5
- package/node_modules/@poe-code/task-list/package.json +9 -0
- package/node_modules/@poe-code/terminal-text/LICENSE +21 -0
- package/node_modules/@poe-code/terminal-text/README.md +12 -0
- package/node_modules/@poe-code/terminal-text/dist/index.d.ts +2 -0
- package/node_modules/@poe-code/terminal-text/dist/index.js +20 -0
- package/node_modules/@poe-code/terminal-text/package.json +22 -0
- package/node_modules/@poe-code/xml-ast/LICENSE +21 -0
- package/node_modules/@poe-code/xml-ast/README.md +28 -0
- package/node_modules/@poe-code/xml-ast/dist/index.d.ts +47 -0
- package/node_modules/@poe-code/xml-ast/dist/index.js +635 -0
- package/node_modules/@poe-code/xml-ast/package.json +25 -0
- package/node_modules/auth-store/README.md +35 -0
- package/node_modules/auth-store/dist/index.browser.d.ts +4 -0
- package/node_modules/auth-store/dist/index.browser.js +2 -0
- package/node_modules/auth-store/dist/provider-store.d.ts +1 -1
- package/node_modules/auth-store/dist/safe-fs-secret-store.d.ts +21 -0
- package/node_modules/auth-store/dist/safe-fs-secret-store.js +119 -0
- package/node_modules/auth-store/dist/secret-store.d.ts +12 -0
- package/node_modules/auth-store/dist/secret-store.js +1 -0
- package/node_modules/auth-store/dist/transaction-lock.d.ts +2 -4
- package/node_modules/auth-store/dist/types.d.ts +2 -9
- package/node_modules/auth-store/package.json +16 -2
- package/node_modules/tiny-http-mcp-server/dist/composition.json +16 -1
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/README.md +25 -0
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/authorization-state.js +4 -4
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/default-oauth-client-provider.js +6 -40
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/oauth-form.d.ts +10 -0
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/oauth-form.js +20 -0
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/pkce.js +4 -3
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/register-client.d.ts +14 -0
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/register-client.js +53 -0
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/resumable.d.ts +16 -2
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/resumable.js +29 -9
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/revoke-token.d.ts +12 -0
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/revoke-token.js +23 -0
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/token-endpoint.js +6 -19
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/http-fetch.js +1 -1
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/index.browser.d.ts +6 -2
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/index.browser.js +5 -1
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/index.d.ts +5 -2
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/index.js +4 -1
- package/node_modules/tiny-http-mcp-server/package.json +4 -4
- package/node_modules/tiny-mcp-client/README.md +2 -0
- package/node_modules/tiny-mcp-client/dist/index.browser.d.ts +25 -23
- package/node_modules/tiny-mcp-client/dist/index.browser.js +116 -1
- package/node_modules/tiny-mcp-client/dist/index.d.ts +25 -23
- package/node_modules/tiny-mcp-client/dist/index.js +1034 -561
- package/node_modules/tiny-mcp-client/package.json +15 -0
- package/node_modules/tiny-stdio-mcp-server/dist/composition.json +1 -1
- package/node_modules/toolcraft-design/dist/components/table.js +6 -0
- package/node_modules/toolcraft-design/dist/escape-terminal-text.d.ts +1 -2
- package/node_modules/toolcraft-design/dist/escape-terminal-text.js +1 -20
- package/node_modules/toolcraft-design/dist/terminal-markdown/parser/frontmatter.js +2 -1
- package/node_modules/toolcraft-design/dist/terminal-markdown/parser.js +2 -1
- package/node_modules/toolcraft-schema/dist/json-schema/utils.js +3 -0
- package/node_modules/toolcraft-schema/package.json +1 -1
- package/package.json +32 -7
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal helpers for blake hash.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
import { rotr, type TRet } from './utils.ts';
|
|
6
|
+
|
|
7
|
+
// Unrealized speed-up: a file-local copy of rotr measured ~1-2% faster blake2s/blake256/blake3
|
|
8
|
+
// on Node 24 (V8 does not inline it into G1s/G2s across the module boundary). Reused from
|
|
9
|
+
// utils for deduplication.
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal blake permutation table.
|
|
13
|
+
* Rows `0..9` serve BLAKE2s, rows `0..11` serve BLAKE2b with `10..11 = 0..1`, and Blake1 also
|
|
14
|
+
* reuses the later rows shown below. Blake1 expands rounds `10..15` as `SIGMA[i % 10]`, so rows
|
|
15
|
+
* `10..15` intentionally repeat rows `0..5` for the 14-round (256) and 16-round (512) variants.
|
|
16
|
+
*/
|
|
17
|
+
// prettier-ignore
|
|
18
|
+
export const BSIGMA: TRet<Uint8Array> = /* @__PURE__ */ Uint8Array.from([
|
|
19
|
+
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
|
20
|
+
14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3,
|
|
21
|
+
11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4,
|
|
22
|
+
7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8,
|
|
23
|
+
9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13,
|
|
24
|
+
2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9,
|
|
25
|
+
12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11,
|
|
26
|
+
13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10,
|
|
27
|
+
6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5,
|
|
28
|
+
10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0,
|
|
29
|
+
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
|
30
|
+
14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3,
|
|
31
|
+
// Blake1, unused in others
|
|
32
|
+
11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4,
|
|
33
|
+
7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8,
|
|
34
|
+
9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13,
|
|
35
|
+
2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9,
|
|
36
|
+
]);
|
|
37
|
+
|
|
38
|
+
// prettier-ignore
|
|
39
|
+
export type Num4 = { a: number; b: number; c: number; d: number; };
|
|
40
|
+
|
|
41
|
+
// Unrealized speed-up: G1s/G2s return a fresh {a,b,c,d} per call (160×/blake2s block), which
|
|
42
|
+
// V8's escape analysis does not eliminate when G stays a real call. Writing into one reused
|
|
43
|
+
// module-level slot instead measured +4-6% blake2s/blake256 1MB throughput on Node 24 — but
|
|
44
|
+
// ~2% slower blake3 (whose profile inlines G and scalar-replaces the fresh object) and no
|
|
45
|
+
// difference on 32-byte inputs. Kept simple.
|
|
46
|
+
|
|
47
|
+
// 32-bit / BLAKE2s first half of G, with the fixed `(16, 12)` rotation pair.
|
|
48
|
+
// Parameter `x` is the RFC 7693 first-half message word, or Blake1's pre-mixed
|
|
49
|
+
// `m[sigma[r][2i]] ^ u[sigma[r][2i+1]]` addend in the 32-bit path.
|
|
50
|
+
export function G1s(a: number, b: number, c: number, d: number, x: number): Num4 {
|
|
51
|
+
a = (a + b + x) | 0;
|
|
52
|
+
d = rotr(d ^ a, 16);
|
|
53
|
+
c = (c + d) | 0;
|
|
54
|
+
b = rotr(b ^ c, 12);
|
|
55
|
+
return { a, b, c, d };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// 32-bit / BLAKE2s second half of G.
|
|
59
|
+
// Parameter `x` is the RFC 7693 second-half (`y`) message word, or Blake1's pre-mixed
|
|
60
|
+
// `m[sigma[r][2i + 1]] ^ u[sigma[r][2i]]` addend in the 32-bit path.
|
|
61
|
+
export function G2s(a: number, b: number, c: number, d: number, x: number): Num4 {
|
|
62
|
+
a = (a + b + x) | 0;
|
|
63
|
+
d = rotr(d ^ a, 8);
|
|
64
|
+
c = (c + d) | 0;
|
|
65
|
+
b = rotr(b ^ c, 7);
|
|
66
|
+
return { a, b, c, d };
|
|
67
|
+
}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal Merkle-Damgard hash utils.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
import { setU64FromNum } from './_u64.ts';
|
|
6
|
+
import { abytes, aexists, aoutput, createView, type Hash, type TArg, type TRet } from './utils.ts';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Shared 32-bit conditional boolean primitive reused by SHA-256, SHA-1, and MD5 `F`.
|
|
10
|
+
* Returns bits from `b` when `a` is set, otherwise from `c`.
|
|
11
|
+
* The XOR form is equivalent to MD5's `F(X,Y,Z) = XY v not(X)Z` because the masked terms never
|
|
12
|
+
* set the same bit.
|
|
13
|
+
* @param a - selector word
|
|
14
|
+
* @param b - word chosen when selector bit is set
|
|
15
|
+
* @param c - word chosen when selector bit is clear
|
|
16
|
+
* @returns Mixed 32-bit word.
|
|
17
|
+
* @example
|
|
18
|
+
* Combine three words with the shared 32-bit choice primitive.
|
|
19
|
+
* ```ts
|
|
20
|
+
* Chi(0xffffffff, 0x12345678, 0x87654321);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export function Chi(a: number, b: number, c: number): number {
|
|
24
|
+
return (a & b) ^ (~a & c);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Shared 32-bit majority primitive reused by SHA-256 and SHA-1.
|
|
29
|
+
* Returns bits shared by at least two inputs.
|
|
30
|
+
* @param a - first input word
|
|
31
|
+
* @param b - second input word
|
|
32
|
+
* @param c - third input word
|
|
33
|
+
* @returns Mixed 32-bit word.
|
|
34
|
+
* @example
|
|
35
|
+
* Combine three words with the shared 32-bit majority primitive.
|
|
36
|
+
* ```ts
|
|
37
|
+
* Maj(0xffffffff, 0x12345678, 0x87654321);
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export function Maj(a: number, b: number, c: number): number {
|
|
41
|
+
return (a & b) ^ (a & c) ^ (b & c);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Merkle-Damgard hash construction base class.
|
|
46
|
+
* Could be used to create MD5, RIPEMD, SHA1, SHA2.
|
|
47
|
+
* Accepts only byte-aligned `Uint8Array` input, even when the underlying spec describes bit
|
|
48
|
+
* strings with partial-byte tails.
|
|
49
|
+
* @param blockLen - internal block size in bytes
|
|
50
|
+
* @param outputLen - digest size in bytes
|
|
51
|
+
* @param padOffset - trailing length field size in bytes
|
|
52
|
+
* @param isLE - whether length and state words are encoded in little-endian
|
|
53
|
+
* @example
|
|
54
|
+
* Use a concrete subclass to get the shared Merkle-Damgard update/digest flow.
|
|
55
|
+
* ```ts
|
|
56
|
+
* import { _SHA1 } from '@noble/hashes/legacy.js';
|
|
57
|
+
* const hash = new _SHA1();
|
|
58
|
+
* hash.update(new Uint8Array([97, 98, 99]));
|
|
59
|
+
* hash.digest();
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export abstract class HashMD<T extends HashMD<T>> implements Hash<T> {
|
|
63
|
+
// Subclasses must treat `buf` as read-only: `update()` may pass a direct view over caller input
|
|
64
|
+
// when it can process whole blocks without buffering first.
|
|
65
|
+
protected abstract process(buf: DataView, offset: number): void;
|
|
66
|
+
protected abstract get(): number[];
|
|
67
|
+
protected abstract set(...args: number[]): void;
|
|
68
|
+
// Each state layout must own this call site. At a monomorphic site TurboFan inlines get()/set()
|
|
69
|
+
// and scalar-replaces the tuple, so no secret-bearing array is allocated. Sharing this site
|
|
70
|
+
// across HashMD shapes makes it megamorphic: the tuple is materialized, cannot be explicitly
|
|
71
|
+
// wiped, and clone-heavy KDFs regress.
|
|
72
|
+
abstract _cloneInto(to?: T): T;
|
|
73
|
+
abstract destroy(): void;
|
|
74
|
+
protected abstract roundClean(): void;
|
|
75
|
+
|
|
76
|
+
readonly blockLen: number;
|
|
77
|
+
readonly outputLen: number;
|
|
78
|
+
readonly canXOF = false;
|
|
79
|
+
readonly padOffset: number;
|
|
80
|
+
readonly isLE: boolean;
|
|
81
|
+
|
|
82
|
+
// For partial updates less than block size
|
|
83
|
+
protected buffer: Uint8Array;
|
|
84
|
+
protected view: DataView;
|
|
85
|
+
protected finished = false;
|
|
86
|
+
protected length = 0;
|
|
87
|
+
protected pos = 0;
|
|
88
|
+
protected destroyed = false;
|
|
89
|
+
|
|
90
|
+
constructor(blockLen: number, outputLen: number, padOffset: number, isLE: boolean) {
|
|
91
|
+
this.blockLen = blockLen;
|
|
92
|
+
this.outputLen = outputLen;
|
|
93
|
+
this.padOffset = padOffset;
|
|
94
|
+
this.isLE = isLE;
|
|
95
|
+
this.buffer = new Uint8Array(blockLen);
|
|
96
|
+
this.view = createView(this.buffer);
|
|
97
|
+
}
|
|
98
|
+
update(data: TArg<Uint8Array>): this {
|
|
99
|
+
aexists(this);
|
|
100
|
+
abytes(data);
|
|
101
|
+
const { view, buffer, blockLen } = this;
|
|
102
|
+
const len = data.length;
|
|
103
|
+
let processed = false;
|
|
104
|
+
for (let pos = 0; pos < len;) {
|
|
105
|
+
const take = Math.min(blockLen - this.pos, len - pos);
|
|
106
|
+
// Fast path only when there is no buffered partial block: `take === blockLen` implies
|
|
107
|
+
// `this.pos === 0`, so we can process full blocks directly from the input view.
|
|
108
|
+
if (take === blockLen) {
|
|
109
|
+
const dataView = createView(data);
|
|
110
|
+
for (; blockLen <= len - pos; pos += blockLen) this.process(dataView, pos);
|
|
111
|
+
processed = true;
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
// When the whole input is buffered in one go (common for short messages), passing `data`
|
|
115
|
+
// directly avoids allocating a subarray view.
|
|
116
|
+
buffer.set(pos === 0 && take === len ? data : data.subarray(pos, pos + take), this.pos);
|
|
117
|
+
this.pos += take;
|
|
118
|
+
pos += take;
|
|
119
|
+
if (this.pos === blockLen) {
|
|
120
|
+
this.process(view, 0);
|
|
121
|
+
this.pos = 0;
|
|
122
|
+
processed = true;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
this.length += data.length;
|
|
126
|
+
// Shared schedule buffers only pick up input-derived words inside process(); if everything
|
|
127
|
+
// was buffered without processing, there is nothing to zero.
|
|
128
|
+
if (processed) this.roundClean();
|
|
129
|
+
return this;
|
|
130
|
+
}
|
|
131
|
+
digestInto(out: TArg<Uint8Array>): void {
|
|
132
|
+
aexists(this);
|
|
133
|
+
aoutput(out, this);
|
|
134
|
+
this.finished = true;
|
|
135
|
+
// Padding
|
|
136
|
+
// We can avoid allocation of buffer for padding completely if it
|
|
137
|
+
// was previously not allocated here. But it won't change performance.
|
|
138
|
+
const { buffer, view, blockLen, isLE } = this;
|
|
139
|
+
let { pos } = this;
|
|
140
|
+
// append the bit '1' to the message, then zero-pad the rest of the block
|
|
141
|
+
buffer[pos++] = 0b10000000;
|
|
142
|
+
buffer.fill(0, pos);
|
|
143
|
+
// we have less than padOffset left in buffer, so we cannot put length in
|
|
144
|
+
// current block, need process it and pad again
|
|
145
|
+
if (this.padOffset > blockLen - pos) {
|
|
146
|
+
this.process(view, 0);
|
|
147
|
+
buffer.fill(0);
|
|
148
|
+
}
|
|
149
|
+
// `padOffset` reserves the whole length field. For SHA-384/512 the high 64 bits stay zero from
|
|
150
|
+
// the padding fill above, and JS will overflow before user input can make that half non-zero.
|
|
151
|
+
// So we only need to write the low 64 bits here (`length * 8` only scales the exponent of an
|
|
152
|
+
// integer below 2**53, so the split inside the helper stays exact).
|
|
153
|
+
setU64FromNum(view, blockLen - 8, this.length * 8, isLE);
|
|
154
|
+
this.process(view, 0);
|
|
155
|
+
// The final block above is processed outside update(), so the shared message-schedule
|
|
156
|
+
// buffers (e.g. SHA256_W) would otherwise retain input-derived words after digest().
|
|
157
|
+
this.roundClean();
|
|
158
|
+
// digest() passes our own `buffer` as `out`; reuse its cached view instead of allocating one.
|
|
159
|
+
const oview = out === buffer ? view : createView(out);
|
|
160
|
+
const len = this.outputLen;
|
|
161
|
+
// NOTE: we do division by 4 later, which must be fused in single op with modulo by JIT
|
|
162
|
+
const outLen = len / 4;
|
|
163
|
+
const state = this.get();
|
|
164
|
+
// Subclass-misconfiguration invariant: outputLen must be 32-bit aligned and fit the state.
|
|
165
|
+
if (len % 4 || outLen > state.length) throw new Error('invalid outputLen');
|
|
166
|
+
for (let i = 0; i < outLen; i++) oview.setUint32(4 * i, state[i], isLE);
|
|
167
|
+
}
|
|
168
|
+
digest(): TRet<Uint8Array> {
|
|
169
|
+
const { buffer, outputLen } = this;
|
|
170
|
+
this.digestInto(buffer);
|
|
171
|
+
// Copy before destroy(): subclasses wipe `buffer` during cleanup, but `digest()` must return
|
|
172
|
+
// fresh bytes to the caller.
|
|
173
|
+
const res = buffer.slice(0, outputLen);
|
|
174
|
+
this.destroy();
|
|
175
|
+
return res as TRet<Uint8Array>;
|
|
176
|
+
}
|
|
177
|
+
protected _cloneIntoMeta(to: T): T {
|
|
178
|
+
const { buffer, length, finished, destroyed, pos } = this;
|
|
179
|
+
to.destroyed = destroyed;
|
|
180
|
+
to.finished = finished;
|
|
181
|
+
to.length = length;
|
|
182
|
+
to.pos = pos;
|
|
183
|
+
// Only partial-block bytes need copying: when `length % blockLen === 0`, `pos === 0` and
|
|
184
|
+
// later `update()` / `digestInto()` overwrite `to.buffer` from the start before reading it.
|
|
185
|
+
if (pos) to.buffer.set(buffer); // Avoid a hot modulo guard.
|
|
186
|
+
return to as unknown as any;
|
|
187
|
+
}
|
|
188
|
+
clone(): T {
|
|
189
|
+
return this._cloneInto();
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.
|
|
195
|
+
* Check out `test/misc/sha2-gen-iv.js` for recomputation guide.
|
|
196
|
+
*/
|
|
197
|
+
|
|
198
|
+
/** Initial SHA256 state from RFC 6234 §6.1: the first 32 bits of the fractional parts of the
|
|
199
|
+
* square roots of the first eight prime numbers. Exported as a shared table; callers must treat
|
|
200
|
+
* it as read-only because constructors copy words from it by index. */
|
|
201
|
+
export const SHA256_IV: TRet<Uint32Array> = /* @__PURE__ */ Uint32Array.from([
|
|
202
|
+
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,
|
|
203
|
+
]);
|
|
204
|
+
|
|
205
|
+
/** Initial SHA224 state `H(0)` from RFC 6234 §6.1. Exported as a shared table; callers must
|
|
206
|
+
* treat it as read-only because constructors copy words from it by index. */
|
|
207
|
+
export const SHA224_IV: TRet<Uint32Array> = /* @__PURE__ */ Uint32Array.from([
|
|
208
|
+
0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4,
|
|
209
|
+
]);
|
|
210
|
+
|
|
211
|
+
/** Initial SHA384 state from RFC 6234 §6.3: eight RFC 64-bit `H(0)` words stored as sixteen
|
|
212
|
+
* big-endian 32-bit halves. Derived from the fractional parts of the square roots of the ninth
|
|
213
|
+
* through sixteenth prime numbers. Exported as a shared table; callers must treat it as read-only
|
|
214
|
+
* because constructors copy halves from it by index. */
|
|
215
|
+
export const SHA384_IV: TRet<Uint32Array> = /* @__PURE__ */ Uint32Array.from([
|
|
216
|
+
0xcbbb9d5d, 0xc1059ed8, 0x629a292a, 0x367cd507, 0x9159015a, 0x3070dd17, 0x152fecd8, 0xf70e5939,
|
|
217
|
+
0x67332667, 0xffc00b31, 0x8eb44a87, 0x68581511, 0xdb0c2e0d, 0x64f98fa7, 0x47b5481d, 0xbefa4fa4,
|
|
218
|
+
]);
|
|
219
|
+
|
|
220
|
+
/** Initial SHA512 state from RFC 6234 §6.3: eight RFC 64-bit `H(0)` words stored as sixteen
|
|
221
|
+
* big-endian 32-bit halves. Derived from the fractional parts of the square roots of the first
|
|
222
|
+
* eight prime numbers. Exported as a shared table; callers must treat it as read-only because
|
|
223
|
+
* constructors copy halves from it by index. */
|
|
224
|
+
export const SHA512_IV: TRet<Uint32Array> = /* @__PURE__ */ Uint32Array.from([
|
|
225
|
+
0x6a09e667, 0xf3bcc908, 0xbb67ae85, 0x84caa73b, 0x3c6ef372, 0xfe94f82b, 0xa54ff53a, 0x5f1d36f1,
|
|
226
|
+
0x510e527f, 0xade682d1, 0x9b05688c, 0x2b3e6c1f, 0x1f83d9ab, 0xfb41bd6b, 0x5be0cd19, 0x137e2179,
|
|
227
|
+
]);
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal helpers for u64.
|
|
3
|
+
* BigUint64Array is too slow as per 2026, so we implement it using
|
|
4
|
+
* Uint32Array.
|
|
5
|
+
* @privateRemarks TODO: re-check {@link https://issues.chromium.org/issues/42212588}
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import type { TRet } from './utils.ts';
|
|
9
|
+
|
|
10
|
+
const U32_MASK64 = /* @__PURE__ */ (() => BigInt(2 ** 32 - 1))();
|
|
11
|
+
const _32n = /* @__PURE__ */ BigInt(32);
|
|
12
|
+
|
|
13
|
+
// Split bigint into two 32-bit halves. With `le=true`, returned fields become `{ h: low, l: high
|
|
14
|
+
// }` to match little-endian word order rather than the property names.
|
|
15
|
+
function fromBig(
|
|
16
|
+
n: bigint,
|
|
17
|
+
le = false
|
|
18
|
+
): {
|
|
19
|
+
h: number;
|
|
20
|
+
l: number;
|
|
21
|
+
} {
|
|
22
|
+
if (le) return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };
|
|
23
|
+
return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Split bigint list into `[highWords, lowWords]` when `le=false`; with `le=true`, the first array
|
|
27
|
+
// holds the low halves because `fromBig(...)` swaps the semantic meaning of `h` and `l`.
|
|
28
|
+
function split(lst: bigint[], le = false): TRet<Uint32Array[]> {
|
|
29
|
+
const len = lst.length;
|
|
30
|
+
let Ah = new Uint32Array(len);
|
|
31
|
+
let Al = new Uint32Array(len);
|
|
32
|
+
for (let i = 0; i < len; i++) {
|
|
33
|
+
const { h, l } = fromBig(lst[i], le);
|
|
34
|
+
[Ah[i], Al[i]] = [h, l];
|
|
35
|
+
}
|
|
36
|
+
return [Ah, Al] as TRet<Uint32Array[]>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Combine explicit `(high, low)` 32-bit halves into a bigint; `>>> 0` normalizes signed JS
|
|
40
|
+
// bitwise results back to uint32 first, and little-endian callers must swap.
|
|
41
|
+
const toBig = (h: number, l: number): bigint => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);
|
|
42
|
+
// Split a JS number into u32 halves without a BigInt allocation. Exact only for integers
|
|
43
|
+
// `0 <= n < 2**53`; callers use it on byte / bit counters, which JS length math caps far below
|
|
44
|
+
// that (an ArrayBuffer cannot exceed 2**53 - 1 bytes).
|
|
45
|
+
const fromNumH = (n: number): number => (n / 2 ** 32) | 0;
|
|
46
|
+
const fromNumL = (n: number): number => n >>> 0;
|
|
47
|
+
// Drop-in replacement for `view.setBigUint64(byteOffset, BigInt(n), isLE)` without the per-call
|
|
48
|
+
// BigInt allocation. Same `n < 2**53` precondition as `fromNumH`/`fromNumL`.
|
|
49
|
+
function setU64FromNum(view: DataView, byteOffset: number, n: number, isLE: boolean): void {
|
|
50
|
+
const h = fromNumH(n);
|
|
51
|
+
const l = fromNumL(n);
|
|
52
|
+
view.setUint32(byteOffset, isLE ? l : h, isLE);
|
|
53
|
+
view.setUint32(byteOffset + 4, isLE ? h : l, isLE);
|
|
54
|
+
}
|
|
55
|
+
// High 32-bit half of a 64-bit logical right shift for `s` in `0..31`.
|
|
56
|
+
const shrSH = (h: number, _l: number, s: number): number => h >>> s;
|
|
57
|
+
// Low 32-bit half of a 64-bit logical right shift, valid for `s` in `1..31`.
|
|
58
|
+
const shrSL = (h: number, l: number, s: number): number => (h << (32 - s)) | (l >>> s);
|
|
59
|
+
// High 32-bit half of a 64-bit right rotate, valid for `s` in `1..31`.
|
|
60
|
+
const rotrSH = (h: number, l: number, s: number): number => (h >>> s) | (l << (32 - s));
|
|
61
|
+
// Low 32-bit half of a 64-bit right rotate, valid for `s` in `1..31`.
|
|
62
|
+
const rotrSL = (h: number, l: number, s: number): number => (h << (32 - s)) | (l >>> s);
|
|
63
|
+
// High 32-bit half of a 64-bit right rotate, valid for `s` in `33..63`; `32` uses `rotr32*`.
|
|
64
|
+
const rotrBH = (h: number, l: number, s: number): number => (h << (64 - s)) | (l >>> (s - 32));
|
|
65
|
+
// Low 32-bit half of a 64-bit right rotate, valid for `s` in `33..63`; `32` uses `rotr32*`.
|
|
66
|
+
const rotrBL = (h: number, l: number, s: number): number => (h >>> (s - 32)) | (l << (64 - s));
|
|
67
|
+
// High 32-bit half of a 64-bit right rotate for `s === 32`; this is just the swapped low half.
|
|
68
|
+
const rotr32H = (_h: number, l: number): number => l;
|
|
69
|
+
// Low 32-bit half of a 64-bit right rotate for `s === 32`; this is just the swapped high half.
|
|
70
|
+
const rotr32L = (h: number, _l: number): number => h;
|
|
71
|
+
// 64-bit left rotates (rotl*) are not defined here: sha3.ts, their only consumer, keeps
|
|
72
|
+
// local copies so V8 inlines them into keccakP.
|
|
73
|
+
|
|
74
|
+
// Add two split 64-bit words and return the split `{ h, l }` sum.
|
|
75
|
+
// JS uses 32-bit signed integers for bitwise operations, so we cannot simply shift the carry out
|
|
76
|
+
// of the low sum and instead use division.
|
|
77
|
+
function add(
|
|
78
|
+
Ah: number,
|
|
79
|
+
Al: number,
|
|
80
|
+
Bh: number,
|
|
81
|
+
Bl: number
|
|
82
|
+
): {
|
|
83
|
+
h: number;
|
|
84
|
+
l: number;
|
|
85
|
+
} {
|
|
86
|
+
const l = (Al >>> 0) + (Bl >>> 0);
|
|
87
|
+
return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };
|
|
88
|
+
}
|
|
89
|
+
// Addition with more than 2 elements
|
|
90
|
+
// Unmasked low-word accumulator for 3-way addition; pass the raw result into `add3H(...)`.
|
|
91
|
+
const add3L = (Al: number, Bl: number, Cl: number): number => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
|
|
92
|
+
// High-word finalize step for 3-way addition; `low` must be the untruncated output of `add3L(...)`.
|
|
93
|
+
const add3H = (low: number, Ah: number, Bh: number, Ch: number): number =>
|
|
94
|
+
(Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;
|
|
95
|
+
// Unmasked low-word accumulator for 4-way addition; pass the raw result into `add4H(...)`.
|
|
96
|
+
const add4L = (Al: number, Bl: number, Cl: number, Dl: number): number =>
|
|
97
|
+
(Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
|
|
98
|
+
// High-word finalize step for 4-way addition; `low` must be the untruncated output of `add4L(...)`.
|
|
99
|
+
const add4H = (low: number, Ah: number, Bh: number, Ch: number, Dh: number): number =>
|
|
100
|
+
(Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;
|
|
101
|
+
// Unmasked low-word accumulator for 5-way addition; pass the raw result into `add5H(...)`.
|
|
102
|
+
const add5L = (Al: number, Bl: number, Cl: number, Dl: number, El: number): number =>
|
|
103
|
+
(Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
|
|
104
|
+
// High-word finalize step for 5-way addition; `low` must be the untruncated output of `add5L(...)`.
|
|
105
|
+
const add5H = (low: number, Ah: number, Bh: number, Ch: number, Dh: number, Eh: number): number =>
|
|
106
|
+
(Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;
|
|
107
|
+
|
|
108
|
+
// prettier-ignore
|
|
109
|
+
export {
|
|
110
|
+
add, add3H, add3L, add4H, add4L, add5H, add5L, fromBig, fromNumH, fromNumL, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL, setU64FromNum, shrSH, shrSL, split, toBig
|
|
111
|
+
};
|