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.
- 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,446 @@
|
|
|
1
|
+
import { translatePythonOpenFlags } from './flags.js';
|
|
2
|
+
import { writePythonStat } from './emscripten.js';
|
|
3
|
+
const errno = {
|
|
4
|
+
EACCES: 2, EAGAIN: 6, EBADF: 8, EBUSY: 10, ECANCELED: 11, EEXIST: 20, EFBIG: 22,
|
|
5
|
+
EINTR: 27, EINVAL: 28, EIO: 29, EISDIR: 31, ELOOP: 32, EMFILE: 33,
|
|
6
|
+
ENAMETOOLONG: 37, ENFILE: 41, ENOENT: 44, ENOMEM: 48, ENOSPC: 51,
|
|
7
|
+
ENOSYS: 52, ENOTSUP: 138, EOPNOTSUPP: 138, ENOTDIR: 54, ENOTEMPTY: 55, ENOTTY: 59,
|
|
8
|
+
EOVERFLOW: 61, EPERM: 63, EPIPE: 64, ERANGE: 68, EROFS: 69, ESPIPE: 70,
|
|
9
|
+
ETIMEDOUT: 73, EXDEV: 75,
|
|
10
|
+
};
|
|
11
|
+
export function createPythonNativeSyscalls(options) {
|
|
12
|
+
const { runtime, signal, maxTransferBytes, runtimeMount } = options;
|
|
13
|
+
if (maxTransferBytes !== Infinity && (!Number.isSafeInteger(maxTransferBytes) || maxTransferBytes < 1))
|
|
14
|
+
throw new RangeError('Invalid native transfer limit');
|
|
15
|
+
const descriptors = new Map();
|
|
16
|
+
const closedStdio = new Set();
|
|
17
|
+
let cwd = options.cwd;
|
|
18
|
+
let closing;
|
|
19
|
+
let pending;
|
|
20
|
+
const fail = (code) => { throw { code }; };
|
|
21
|
+
const heap = () => runtime.HEAPU8;
|
|
22
|
+
const view = () => new DataView(heap().buffer, heap().byteOffset, heap().byteLength);
|
|
23
|
+
const range = (pointer, length) => {
|
|
24
|
+
if (!Number.isSafeInteger(pointer) || !Number.isSafeInteger(length) || pointer < 0 || length < 0 || pointer + length > heap().byteLength)
|
|
25
|
+
fail('EINVAL');
|
|
26
|
+
};
|
|
27
|
+
const text = (pointer) => {
|
|
28
|
+
range(pointer, 1);
|
|
29
|
+
const end = heap().indexOf(0, pointer);
|
|
30
|
+
if (end < 0)
|
|
31
|
+
fail('EINVAL');
|
|
32
|
+
try {
|
|
33
|
+
return new TextDecoder('utf-8', { fatal: true }).decode(heap().subarray(pointer, end));
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return fail('EINVAL');
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const integer = (value) => {
|
|
40
|
+
const number = Number(value);
|
|
41
|
+
if (!Number.isSafeInteger(number))
|
|
42
|
+
fail('EOVERFLOW');
|
|
43
|
+
return number;
|
|
44
|
+
};
|
|
45
|
+
const descriptor = (fd) => descriptors.get(fd) ?? fail('EBADF');
|
|
46
|
+
const pathAt = (fd, pointer, allowEmpty = false) => {
|
|
47
|
+
const path = text(pointer);
|
|
48
|
+
if (!path && !allowEmpty)
|
|
49
|
+
fail('ENOENT');
|
|
50
|
+
if (path.startsWith('/'))
|
|
51
|
+
return path;
|
|
52
|
+
const base = fd === -100 ? cwd : descriptor(fd).path;
|
|
53
|
+
if (fd !== -100 && path)
|
|
54
|
+
fail('ENOTDIR');
|
|
55
|
+
return path ? base + '/' + path : base;
|
|
56
|
+
};
|
|
57
|
+
const privatePath = (path) => {
|
|
58
|
+
const parts = [];
|
|
59
|
+
for (const part of path.split('/')) {
|
|
60
|
+
if (part === '..')
|
|
61
|
+
parts.pop();
|
|
62
|
+
else if (part && part !== '.')
|
|
63
|
+
parts.push(part);
|
|
64
|
+
}
|
|
65
|
+
const normalized = '/' + parts.join('/');
|
|
66
|
+
const privateNamespace = normalized === runtimeMount || normalized.startsWith(runtimeMount + '/');
|
|
67
|
+
if ((path === runtimeMount || path.startsWith(runtimeMount + '/')) && !privateNamespace)
|
|
68
|
+
fail('EACCES');
|
|
69
|
+
return privateNamespace;
|
|
70
|
+
};
|
|
71
|
+
const request = async (op, ...args) => {
|
|
72
|
+
signal.throwIfAborted();
|
|
73
|
+
const result = await options.dispatch({ op, args });
|
|
74
|
+
signal.throwIfAborted();
|
|
75
|
+
return result;
|
|
76
|
+
};
|
|
77
|
+
const original = (name, args) => options.original?.(name, args) ?? fail('ENOSYS');
|
|
78
|
+
const privateDescriptor = (fd) => {
|
|
79
|
+
const stream = runtime.FS.getStream?.(fd);
|
|
80
|
+
return !descriptors.has(fd) && typeof stream?.path === 'string' && privatePath(stream.path);
|
|
81
|
+
};
|
|
82
|
+
const allocate = (entry) => {
|
|
83
|
+
const refuse = () => fail('ENOTSUP');
|
|
84
|
+
const stream = runtime.FS.createStream({ path: entry.path, flags: entry.flags,
|
|
85
|
+
seekable: entry.seekable, position: entry.position,
|
|
86
|
+
node: { mode: 0o100000 }, stream_ops: { read: refuse, write: refuse, close: refuse } });
|
|
87
|
+
descriptors.set(stream.fd, entry);
|
|
88
|
+
return stream.fd;
|
|
89
|
+
};
|
|
90
|
+
const closeDescriptor = async (fd) => {
|
|
91
|
+
const entry = descriptor(fd);
|
|
92
|
+
descriptors.delete(fd);
|
|
93
|
+
runtime.FS.closeStream(fd);
|
|
94
|
+
if (--entry.references === 0)
|
|
95
|
+
await options.dispatch({ op: 'close', args: [entry.handle] });
|
|
96
|
+
};
|
|
97
|
+
const project = (value) => {
|
|
98
|
+
const type = value.type === 'directory' ? 0o40000 : value.type === 'symlink' ? 0o120000 : value.type === 'character' ? 0o20000 : 0o100000;
|
|
99
|
+
return { ...value, mode: value.mode | type, rdev: value.type === 'character' ? undefined : 0,
|
|
100
|
+
blksize: value.ioBlockSize ?? value.preferredIoBlockSize,
|
|
101
|
+
blocks: value.allocatedBytes === undefined ? undefined : Math.ceil(value.allocatedBytes / 512) };
|
|
102
|
+
};
|
|
103
|
+
const stat = (pointer, value) => {
|
|
104
|
+
try {
|
|
105
|
+
return writePythonStat(heap(), pointer, project(value));
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
return fail('EOVERFLOW');
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
const transfer = async (name, args) => {
|
|
112
|
+
const [fd, vectors, count] = args.map(integer);
|
|
113
|
+
const positioned = name === 'fd_pread' || name === 'fd_pwrite';
|
|
114
|
+
const output = integer(args[positioned ? 4 : 3]);
|
|
115
|
+
const writing = name === 'fd_write' || name === 'fd_pwrite';
|
|
116
|
+
let position = positioned ? integer(args[3]) : null;
|
|
117
|
+
range(vectors, count * 8);
|
|
118
|
+
range(output, 4);
|
|
119
|
+
if (position !== null && position < 0)
|
|
120
|
+
fail('EINVAL');
|
|
121
|
+
const entry = fd > 2 ? descriptor(fd) : undefined;
|
|
122
|
+
if (closedStdio.has(fd))
|
|
123
|
+
fail('EBADF');
|
|
124
|
+
if (!entry && (fd < 0 || positioned || (writing ? fd === 0 : fd !== 0)))
|
|
125
|
+
fail('EBADF');
|
|
126
|
+
if (entry && (entry.flags & 3) === (writing ? 0 : 1))
|
|
127
|
+
fail('EBADF');
|
|
128
|
+
if (entry && !positioned && (writing ? entry.capabilities.positionedWrite && !(entry.flags & 1024) : entry.capabilities.positionedRead))
|
|
129
|
+
position = entry.position;
|
|
130
|
+
let total = 0;
|
|
131
|
+
for (let index = 0; index < count; index++) {
|
|
132
|
+
const pointer = view().getUint32(vectors + index * 8, true);
|
|
133
|
+
const length = view().getUint32(vectors + index * 8 + 4, true);
|
|
134
|
+
range(pointer, length);
|
|
135
|
+
let offset = 0;
|
|
136
|
+
while (offset < length) {
|
|
137
|
+
const size = Math.min(length - offset, maxTransferBytes);
|
|
138
|
+
let transferred;
|
|
139
|
+
try {
|
|
140
|
+
if (writing) {
|
|
141
|
+
const bytes = Uint8Array.from(heap().subarray(pointer + offset, pointer + offset + size));
|
|
142
|
+
transferred = entry ? await request('write', entry.handle, bytes, position)
|
|
143
|
+
: (await request(fd === 1 ? 'stdout' : 'stderr', Array.from(bytes)), size);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
const bytes = entry ? await request('read', entry.handle, size, position) : await request('stdin', size);
|
|
147
|
+
if (!(bytes instanceof Uint8Array) && !Array.isArray(bytes) || bytes.length > size)
|
|
148
|
+
fail('EIO');
|
|
149
|
+
heap().set(bytes, pointer + offset);
|
|
150
|
+
transferred = bytes.length;
|
|
151
|
+
}
|
|
152
|
+
if (!Number.isSafeInteger(transferred) || transferred < 0 || transferred > size)
|
|
153
|
+
fail('EIO');
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
if (!total)
|
|
157
|
+
throw error;
|
|
158
|
+
view().setUint32(output, total, true);
|
|
159
|
+
return 0;
|
|
160
|
+
}
|
|
161
|
+
total += transferred;
|
|
162
|
+
offset += transferred;
|
|
163
|
+
if (position !== null)
|
|
164
|
+
position += transferred;
|
|
165
|
+
if (entry && !positioned)
|
|
166
|
+
entry.position = writing && entry.flags & 1024
|
|
167
|
+
? await request('position', entry.handle) : entry.position + transferred;
|
|
168
|
+
if (transferred < size || !writing) {
|
|
169
|
+
view().setUint32(output, total, true);
|
|
170
|
+
return 0;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
view().setUint32(output, total, true);
|
|
175
|
+
return 0;
|
|
176
|
+
};
|
|
177
|
+
const execute = async (name, args) => {
|
|
178
|
+
signal.throwIfAborted();
|
|
179
|
+
const first = integer(args[0] ?? 0);
|
|
180
|
+
const second = integer(args[1] ?? 0);
|
|
181
|
+
const third = integer(args[2] ?? 0);
|
|
182
|
+
const fourth = integer(args[3] ?? 0);
|
|
183
|
+
if (name.startsWith('fd_') && privateDescriptor(first)) {
|
|
184
|
+
if (name === 'fd_write' || name === 'fd_pwrite')
|
|
185
|
+
fail('EROFS');
|
|
186
|
+
return original(name, args);
|
|
187
|
+
}
|
|
188
|
+
switch (name) {
|
|
189
|
+
case '__syscall_openat': {
|
|
190
|
+
const path = pathAt(first, second);
|
|
191
|
+
if (privatePath(path)) {
|
|
192
|
+
if ((third & 3) !== 0 || (third & (64 | 512)))
|
|
193
|
+
fail('EROFS');
|
|
194
|
+
return original(name, args);
|
|
195
|
+
}
|
|
196
|
+
if (fourth)
|
|
197
|
+
range(fourth, 4);
|
|
198
|
+
const mode = (fourth ? view().getUint32(fourth, true) : 0o666) & ~(options.getUmask?.() ?? 0);
|
|
199
|
+
const openOptions = { ...translatePythonOpenFlags(third, mode), exactMode: true };
|
|
200
|
+
const handle = await options.dispatch({ op: 'open', args: [path, openOptions] });
|
|
201
|
+
try {
|
|
202
|
+
signal.throwIfAborted();
|
|
203
|
+
const capabilities = await request('descriptorCapabilities', handle);
|
|
204
|
+
if ((third & 1024) && !capabilities.position)
|
|
205
|
+
fail('ENOTSUP');
|
|
206
|
+
const access = third & 3;
|
|
207
|
+
const seekable = (access === 1 || capabilities.positionedRead === true)
|
|
208
|
+
&& (access === 0 || ((third & 1024) ? capabilities.position === true : capabilities.positionedWrite === true));
|
|
209
|
+
return allocate({ handle, path, flags: third, capabilities, seekable, position: 0, references: 1 });
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
await options.dispatch({ op: 'close', args: [handle] }).catch(() => { });
|
|
213
|
+
throw error;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
case 'fd_read':
|
|
217
|
+
case 'fd_pread':
|
|
218
|
+
case 'fd_write':
|
|
219
|
+
case 'fd_pwrite': return transfer(name, args);
|
|
220
|
+
case 'fd_close':
|
|
221
|
+
if (first <= 2) {
|
|
222
|
+
if (first < 0 || closedStdio.has(first))
|
|
223
|
+
fail('EBADF');
|
|
224
|
+
const status = options.original?.(name, args) ?? 0;
|
|
225
|
+
if (status === 0)
|
|
226
|
+
closedStdio.add(first);
|
|
227
|
+
return status;
|
|
228
|
+
}
|
|
229
|
+
await closeDescriptor(first);
|
|
230
|
+
return 0;
|
|
231
|
+
case 'fd_seek': {
|
|
232
|
+
if (first < 0 || closedStdio.has(first))
|
|
233
|
+
fail('EBADF');
|
|
234
|
+
if (first <= 2)
|
|
235
|
+
fail('ESPIPE');
|
|
236
|
+
const entry = descriptor(first);
|
|
237
|
+
if (!entry.seekable)
|
|
238
|
+
fail('ESPIPE');
|
|
239
|
+
if (third < 0 || third > 2)
|
|
240
|
+
fail('EINVAL');
|
|
241
|
+
const position = second + (third === 0 ? 0 : third === 1 ? entry.position : (await request('fstat', entry.handle)).size);
|
|
242
|
+
if (!Number.isSafeInteger(position) || position < 0)
|
|
243
|
+
fail('EINVAL');
|
|
244
|
+
range(fourth, 8);
|
|
245
|
+
entry.position = position;
|
|
246
|
+
view().setBigInt64(fourth, BigInt(position), true);
|
|
247
|
+
return 0;
|
|
248
|
+
}
|
|
249
|
+
case 'fd_sync':
|
|
250
|
+
case '__syscall_fdatasync':
|
|
251
|
+
await request('sync', descriptor(first).handle, name === '__syscall_fdatasync');
|
|
252
|
+
return 0;
|
|
253
|
+
case '__syscall_fstat64':
|
|
254
|
+
if (first < 0 || closedStdio.has(first))
|
|
255
|
+
fail('EBADF');
|
|
256
|
+
if (first <= 2 || privateDescriptor(first))
|
|
257
|
+
return original(name, args);
|
|
258
|
+
return stat(second, await request('fstat', descriptor(first).handle));
|
|
259
|
+
case '__syscall_stat64':
|
|
260
|
+
case '__syscall_lstat64': {
|
|
261
|
+
const path = pathAt(-100, first);
|
|
262
|
+
if (privatePath(path))
|
|
263
|
+
return original(name, args);
|
|
264
|
+
return stat(second, await request(name === '__syscall_stat64' ? 'stat' : 'lstat', path));
|
|
265
|
+
}
|
|
266
|
+
case '__syscall_newfstatat': {
|
|
267
|
+
if (fourth & ~(256 | 4096))
|
|
268
|
+
fail('EINVAL');
|
|
269
|
+
const path = pathAt(first, second, Boolean(fourth & 4096));
|
|
270
|
+
if (privatePath(path))
|
|
271
|
+
return original(name, args);
|
|
272
|
+
return stat(third, await request(fourth & 256 ? 'lstat' : 'stat', path));
|
|
273
|
+
}
|
|
274
|
+
case '__syscall_getcwd': {
|
|
275
|
+
const bytes = new TextEncoder().encode(cwd + '\0');
|
|
276
|
+
if (!second)
|
|
277
|
+
fail('EINVAL');
|
|
278
|
+
if (bytes.length > second)
|
|
279
|
+
fail('ERANGE');
|
|
280
|
+
range(first, bytes.length);
|
|
281
|
+
heap().set(bytes, first);
|
|
282
|
+
return bytes.length;
|
|
283
|
+
}
|
|
284
|
+
case '__syscall_chdir': {
|
|
285
|
+
const path = pathAt(-100, first);
|
|
286
|
+
if (privatePath(path))
|
|
287
|
+
fail('ENOTSUP');
|
|
288
|
+
const resolved = await request('realpath', path);
|
|
289
|
+
if ((await request('stat', resolved)).type !== 'directory')
|
|
290
|
+
fail('ENOTDIR');
|
|
291
|
+
cwd = resolved;
|
|
292
|
+
runtime.FS.currentPath = cwd;
|
|
293
|
+
return 0;
|
|
294
|
+
}
|
|
295
|
+
case '__syscall_ioctl':
|
|
296
|
+
if (first < 0 || closedStdio.has(first))
|
|
297
|
+
fail('EBADF');
|
|
298
|
+
if (first > 2 && !privateDescriptor(first))
|
|
299
|
+
descriptor(first);
|
|
300
|
+
return fail('ENOTTY');
|
|
301
|
+
case '__syscall_fcntl64': {
|
|
302
|
+
if (first < 0 || closedStdio.has(first))
|
|
303
|
+
fail('EBADF');
|
|
304
|
+
if (first <= 2 || privateDescriptor(first))
|
|
305
|
+
return original(name, args);
|
|
306
|
+
const entry = descriptor(first);
|
|
307
|
+
if (second === 1 || second === 2)
|
|
308
|
+
return 0;
|
|
309
|
+
if (second === 3)
|
|
310
|
+
return entry.flags;
|
|
311
|
+
return fail('ENOTSUP');
|
|
312
|
+
}
|
|
313
|
+
case '__syscall_dup': {
|
|
314
|
+
const entry = descriptor(first);
|
|
315
|
+
const fd = allocate(entry);
|
|
316
|
+
entry.references++;
|
|
317
|
+
return fd;
|
|
318
|
+
}
|
|
319
|
+
case '__syscall_ftruncate64':
|
|
320
|
+
await request('ftruncate', descriptor(first).handle, second);
|
|
321
|
+
return 0;
|
|
322
|
+
case '__syscall_getdents64':
|
|
323
|
+
if (privateDescriptor(first))
|
|
324
|
+
return original(name, args);
|
|
325
|
+
descriptor(first);
|
|
326
|
+
return fail('ENOTSUP');
|
|
327
|
+
case '__syscall_faccessat': {
|
|
328
|
+
if (fourth !== 0)
|
|
329
|
+
fail('ENOTSUP');
|
|
330
|
+
const path = pathAt(first, second);
|
|
331
|
+
if (privatePath(path))
|
|
332
|
+
return third & 2 ? fail('EROFS') : original(name, args);
|
|
333
|
+
await request('access', path, third);
|
|
334
|
+
return 0;
|
|
335
|
+
}
|
|
336
|
+
case '__syscall_mkdirat':
|
|
337
|
+
case '__syscall_unlinkat': {
|
|
338
|
+
const path = pathAt(first, second);
|
|
339
|
+
if (privatePath(path))
|
|
340
|
+
fail('EROFS');
|
|
341
|
+
if (name === '__syscall_mkdirat')
|
|
342
|
+
await request('mkdir', path, { mode: third & 0o7777 & ~(options.getUmask?.() ?? 0), exactMode: true });
|
|
343
|
+
else {
|
|
344
|
+
if (third !== 0 && third !== 512)
|
|
345
|
+
fail('EINVAL');
|
|
346
|
+
await request(third === 512 ? 'rmdir' : 'rm', path);
|
|
347
|
+
}
|
|
348
|
+
return 0;
|
|
349
|
+
}
|
|
350
|
+
case '__syscall_rmdir':
|
|
351
|
+
case '__syscall_chmod':
|
|
352
|
+
case '__syscall_truncate64': {
|
|
353
|
+
const path = pathAt(-100, first);
|
|
354
|
+
if (privatePath(path))
|
|
355
|
+
fail('EROFS');
|
|
356
|
+
if (name === '__syscall_rmdir')
|
|
357
|
+
await request('rmdir', path);
|
|
358
|
+
else
|
|
359
|
+
await request(name === '__syscall_chmod' ? 'chmod' : 'truncate', path, second);
|
|
360
|
+
return 0;
|
|
361
|
+
}
|
|
362
|
+
case '__syscall_renameat': {
|
|
363
|
+
const source = pathAt(first, second);
|
|
364
|
+
const destination = pathAt(third, fourth);
|
|
365
|
+
if (privatePath(source) || privatePath(destination))
|
|
366
|
+
fail('EROFS');
|
|
367
|
+
await request('rename', source, destination);
|
|
368
|
+
return 0;
|
|
369
|
+
}
|
|
370
|
+
case '__syscall_symlinkat': {
|
|
371
|
+
const destination = pathAt(second, third);
|
|
372
|
+
if (privatePath(destination))
|
|
373
|
+
fail('EROFS');
|
|
374
|
+
await request('symlink', text(first), destination);
|
|
375
|
+
return 0;
|
|
376
|
+
}
|
|
377
|
+
case '__syscall_readlinkat': {
|
|
378
|
+
const path = pathAt(first, second);
|
|
379
|
+
if (privatePath(path))
|
|
380
|
+
return original(name, args);
|
|
381
|
+
if (fourth < 1)
|
|
382
|
+
fail('EINVAL');
|
|
383
|
+
range(third, fourth);
|
|
384
|
+
const bytes = new TextEncoder().encode(await request('readlink', path)).subarray(0, fourth);
|
|
385
|
+
heap().set(bytes, third);
|
|
386
|
+
return bytes.length;
|
|
387
|
+
}
|
|
388
|
+
default: return fail('ENOSYS');
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
return {
|
|
392
|
+
async metadata(path, follow) {
|
|
393
|
+
if (closing || pending)
|
|
394
|
+
fail('EBUSY');
|
|
395
|
+
const operation = (async () => {
|
|
396
|
+
signal.throwIfAborted();
|
|
397
|
+
if (path === '')
|
|
398
|
+
fail('ENOENT');
|
|
399
|
+
if (typeof path === 'number' && (path < 0 || closedStdio.has(path)))
|
|
400
|
+
fail('EBADF');
|
|
401
|
+
if (typeof path === 'number' && (path <= 2 || privateDescriptor(path)) || typeof path === 'string' && privatePath(path.startsWith('/') ? path : cwd + '/' + path)) {
|
|
402
|
+
const value = typeof path === 'number' ? runtime.FS.fstat(path) : follow ? runtime.FS.stat(path) : runtime.FS.lstat(path);
|
|
403
|
+
return { ...value, atimeMs: value.atime.getTime(), mtimeMs: value.mtime.getTime(), ctimeMs: value.ctime.getTime() };
|
|
404
|
+
}
|
|
405
|
+
const value = typeof path === 'number' ? await request('fstat', descriptor(path).handle)
|
|
406
|
+
: await request(follow ? 'stat' : 'lstat', path.startsWith('/') ? path : cwd + '/' + path);
|
|
407
|
+
return project(value);
|
|
408
|
+
})();
|
|
409
|
+
pending = operation;
|
|
410
|
+
try {
|
|
411
|
+
return await operation;
|
|
412
|
+
}
|
|
413
|
+
finally {
|
|
414
|
+
pending = undefined;
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
invoke(name, args) {
|
|
418
|
+
if (closing || pending)
|
|
419
|
+
return Promise.resolve((name.startsWith('fd_') ? 1 : -1) * errno.EBUSY);
|
|
420
|
+
const operation = execute(name, args).catch(error => {
|
|
421
|
+
const code = signal.aborted ? errno.ECANCELED : errno[error?.code ?? ''] ?? errno.EIO;
|
|
422
|
+
return (name.startsWith('fd_') ? 1 : -1) * code;
|
|
423
|
+
});
|
|
424
|
+
pending = operation;
|
|
425
|
+
void operation.then(() => { pending = undefined; });
|
|
426
|
+
return operation;
|
|
427
|
+
},
|
|
428
|
+
close() {
|
|
429
|
+
closing ??= (async () => {
|
|
430
|
+
await pending?.catch(() => { });
|
|
431
|
+
const failures = [];
|
|
432
|
+
for (const fd of [...descriptors.keys()]) {
|
|
433
|
+
try {
|
|
434
|
+
await closeDescriptor(fd);
|
|
435
|
+
}
|
|
436
|
+
catch (error) {
|
|
437
|
+
failures.push(error);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
if (failures.length)
|
|
441
|
+
throw new AggregateError(failures, 'Native Python descriptor cleanup failed');
|
|
442
|
+
})();
|
|
443
|
+
return closing;
|
|
444
|
+
},
|
|
445
|
+
};
|
|
446
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { FsError } from "../contracts/errors.js";
|
|
2
|
+
const argumentKinds = {
|
|
3
|
+
open: ["string", "object"], read: ["number", "number", "position"], write: ["number", "bytes", "position"],
|
|
4
|
+
descriptorCapabilities: ["number"], fstat: ["number"], close: ["number"], position: ["number"], ftruncate: ["number", "number"], sync: ["number", "boolean"],
|
|
5
|
+
stat: ["string"], lstat: ["string"], readdir: ["string"], realpath: ["string"], readlink: ["string"], rm: ["string"], rmdir: ["string"], rmtree: ["string"], rmtreeSupported: ["string"],
|
|
6
|
+
rename: ["string", "string"], symlink: ["string", "string"], link: ["string", "string"], mkdir: ["string", "optionalObject"],
|
|
7
|
+
chmod: ["string", "number"], truncate: ["string", "number"], access: ["string", "number"], utimes: ["string", "number", "number"],
|
|
8
|
+
};
|
|
9
|
+
export function parsePythonFsRequest(value, maxTransferBytes) {
|
|
10
|
+
if (!value || typeof value !== "object" || Reflect.ownKeys(value).some(key => key !== "op" && key !== "args"))
|
|
11
|
+
throw new FsError("EINVAL");
|
|
12
|
+
const op = Object.getOwnPropertyDescriptor(value, "op")?.value;
|
|
13
|
+
const args = Object.getOwnPropertyDescriptor(value, "args")?.value;
|
|
14
|
+
if (typeof op !== "string" || !Object.hasOwn(argumentKinds, op))
|
|
15
|
+
throw new FsError("ENOTSUP");
|
|
16
|
+
const kinds = argumentKinds[op];
|
|
17
|
+
if (!Array.isArray(args) || args.length > kinds.length || args.length < kinds.length - (kinds.at(-1) === "optionalObject" ? 1 : 0))
|
|
18
|
+
throw new FsError("EINVAL", { syscall: op });
|
|
19
|
+
const selected = [];
|
|
20
|
+
for (let index = 0; index < kinds.length; index++) {
|
|
21
|
+
const kind = kinds[index];
|
|
22
|
+
const descriptor = Object.getOwnPropertyDescriptor(args, String(index));
|
|
23
|
+
if (descriptor && !Object.hasOwn(descriptor, "value"))
|
|
24
|
+
throw new FsError("EINVAL", { syscall: op });
|
|
25
|
+
const argument = descriptor?.value;
|
|
26
|
+
if (kind === "bytes") {
|
|
27
|
+
if (!(argument instanceof Uint8Array) && !Array.isArray(argument))
|
|
28
|
+
throw new FsError("EINVAL", { syscall: op });
|
|
29
|
+
if (argument.length > maxTransferBytes)
|
|
30
|
+
throw new FsError("EFBIG", { syscall: op });
|
|
31
|
+
const owned = new Uint8Array(argument.length);
|
|
32
|
+
for (let byteIndex = 0; byteIndex < argument.length; byteIndex++) {
|
|
33
|
+
const entry = Object.getOwnPropertyDescriptor(argument, String(byteIndex));
|
|
34
|
+
const byte = entry?.value;
|
|
35
|
+
if (!entry || !Object.hasOwn(entry, "value") || typeof byte !== "number" || !Number.isInteger(byte) || byte < 0 || byte > 255)
|
|
36
|
+
throw new FsError("EINVAL", { syscall: op });
|
|
37
|
+
owned[byteIndex] = byte;
|
|
38
|
+
}
|
|
39
|
+
selected.push(owned);
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (kind === "position" ? argument !== null && typeof argument !== "number"
|
|
43
|
+
: kind === "optionalObject" ? argument !== undefined && (typeof argument !== "object" || argument === null || Array.isArray(argument))
|
|
44
|
+
: kind === "object" ? typeof argument !== "object" || argument === null || Array.isArray(argument)
|
|
45
|
+
: typeof argument !== kind)
|
|
46
|
+
throw new FsError("EINVAL", { syscall: op });
|
|
47
|
+
if (argument !== null && typeof argument === "object") {
|
|
48
|
+
const snapshot = {};
|
|
49
|
+
for (const key of Reflect.ownKeys(argument)) {
|
|
50
|
+
const field = Object.getOwnPropertyDescriptor(argument, key);
|
|
51
|
+
if (typeof key !== "string" || !field || !Object.hasOwn(field, "value"))
|
|
52
|
+
throw new FsError("EINVAL", { syscall: op });
|
|
53
|
+
Object.defineProperty(snapshot, key, { value: field.value, enumerable: true });
|
|
54
|
+
}
|
|
55
|
+
selected.push(snapshot);
|
|
56
|
+
}
|
|
57
|
+
else
|
|
58
|
+
selected.push(argument);
|
|
59
|
+
}
|
|
60
|
+
return { op, args: selected };
|
|
61
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FileStat } from "../contracts/filesystem.js";
|
|
2
|
+
export type PythonWireStat = Omit<FileStat, "identityScope">;
|
|
3
|
+
/** Invocation-local device numbers qualify canonical scope/dev without serializing opaque authority. */
|
|
4
|
+
export declare class PythonStatTranslator {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(maxDevices?: number);
|
|
7
|
+
translate(stat: FileStat): PythonWireStat;
|
|
8
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FsError } from "../contracts/errors.js";
|
|
2
|
+
/** Invocation-local device numbers qualify canonical scope/dev without serializing opaque authority. */
|
|
3
|
+
export class PythonStatTranslator {
|
|
4
|
+
#devices = new Map();
|
|
5
|
+
#maxDevices;
|
|
6
|
+
#next = 1;
|
|
7
|
+
constructor(maxDevices = Infinity) {
|
|
8
|
+
if (maxDevices !== Infinity && (!Number.isSafeInteger(maxDevices) || maxDevices < 1))
|
|
9
|
+
throw new FsError("EINVAL");
|
|
10
|
+
this.#maxDevices = maxDevices;
|
|
11
|
+
}
|
|
12
|
+
translate(stat) {
|
|
13
|
+
const { identityScope, dev, ino, ...rest } = stat;
|
|
14
|
+
if (!(typeof identityScope === "symbol" || typeof identityScope === "object" && identityScope !== null)
|
|
15
|
+
|| !Number.isSafeInteger(dev) || dev < 0 || !Number.isSafeInteger(ino) || ino < 0)
|
|
16
|
+
return rest;
|
|
17
|
+
let devices = this.#devices.get(identityScope);
|
|
18
|
+
let guestDevice = devices?.get(dev);
|
|
19
|
+
if (guestDevice === undefined) {
|
|
20
|
+
if (this.#next > this.#maxDevices)
|
|
21
|
+
throw new FsError("EFBIG", { syscall: "stat", message: "Python device identity limit exceeded" });
|
|
22
|
+
// The upper half of the uint32 guest ABI is reserved for runtime devices.
|
|
23
|
+
if (this.#next >= 0x80000000)
|
|
24
|
+
throw new FsError("EFBIG", { syscall: "stat", message: "Python device identity exceeds guest ABI range" });
|
|
25
|
+
if (!devices) {
|
|
26
|
+
devices = new Map();
|
|
27
|
+
this.#devices.set(identityScope, devices);
|
|
28
|
+
}
|
|
29
|
+
guestDevice = this.#next++;
|
|
30
|
+
devices.set(dev, guestDevice);
|
|
31
|
+
}
|
|
32
|
+
return { ...rest, dev: guestDevice, ino: ino };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export * from "./contracts/errors.js";
|
|
2
|
+
export * from "./contracts/filesystem.js";
|
|
3
|
+
export * from "./contracts/io.js";
|
|
4
|
+
export { compareIdentity, compareFileVersion } from "./fs/mount/identity.js";
|
|
5
|
+
export { openFileDescriptor } from "./fs/descriptor.js";
|
|
6
|
+
export type { DescriptorBackend, DescriptorOpenOptions } from "./fs/descriptor.js";
|
|
7
|
+
export { assertPathWithin, isPathWithin, normalizePath, relativePath, resolvePath, validatePath } from "./contracts/virtual-path.js";
|
|
8
|
+
export { basename, dirname, extname, isAbsolutePath, joinPath, posixPath } from "./contracts/portable-path.js";
|
|
9
|
+
import type { FileSystem } from "./contracts/filesystem.js";
|
|
10
|
+
export type { MemoryFileSystem, MemoryFileSystemLimits, MemoryFileSystemOptions, MemoryRedirectHandle } from "./fs/memory/index.js";
|
|
11
|
+
export declare function isUnmodifiedMemoryFileSystem(fs: FileSystem): boolean;
|
|
12
|
+
export declare function isCleanAbsolutePath(p: string): boolean;
|
|
13
|
+
export declare function tryGetMemoryDirectoryEntryNamesSync(fs: FileSystem, path: string): any;
|
|
14
|
+
export declare function tryReadMemoryFileViewSync(fs: FileSystem, path: string, maxBytes?: number, signal?: AbortSignal, captureSourceRef?: boolean, beforeRead?: () => void): Uint8Array | undefined;
|
|
15
|
+
export declare function tryResolveMemoryDevicePath(fs: FileSystem, path: string, followFinal?: boolean): string | undefined;
|
|
16
|
+
export * from "./fs/devices/index.js";
|
|
17
|
+
export { retargetScopedFileSystem, scopeFileSystem, retainFileSystemCleanup } from "./fs/scoped.js";
|
|
18
|
+
export type { RetainedFileSystemCleanupView, RetainedFileSystemCleanupOptions } from "./fs/scoped.js";
|
|
19
|
+
export { compareEntries, registerEntryView } from "./fs/mount/comparison.js";
|
|
20
|
+
export type { EntryViewResolver } from "./fs/mount/comparison.js";
|
|
21
|
+
export type { ConditionalMutationBinding } from "./fs/memory/index.js";
|
|
22
|
+
export declare function bindConditionalMutation<Result>(identityScope: object | symbol | undefined, binding: any, action: () => Promise<Result>): Promise<Result>;
|
|
23
|
+
export declare function tryOpenMemoryRedirectHandleSync(fs: FileSystem, path: string, append: boolean, mode: number, signal?: AbortSignal): any;
|
|
24
|
+
export declare function tryWriteMemoryFileSync(fs: FileSystem, path: string, data: Uint8Array, append: boolean, mode: number, signal?: AbortSignal): boolean;
|
|
25
|
+
export declare function tryMkdirMemorySync(fs: FileSystem, path: string, recursive: boolean, mode: number, signal?: AbortSignal, dirPrefixHint?: string): boolean;
|
|
26
|
+
export declare function tryRmRfMemorySync(fs: FileSystem, path: string, signal?: AbortSignal): boolean;
|
|
27
|
+
export declare function tryWriteMemoryFileInDirSync(fs: FileSystem, dirPrefix: string, name: string, data: Uint8Array, append: boolean, mode: number, signal?: AbortSignal): boolean;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export * from "./contracts/errors.js";
|
|
2
|
+
export * from "./contracts/filesystem.js";
|
|
3
|
+
export * from "./contracts/io.js";
|
|
4
|
+
export { compareIdentity, compareFileVersion } from "./fs/mount/identity.js";
|
|
5
|
+
export { openFileDescriptor } from "./fs/descriptor.js";
|
|
6
|
+
export { assertPathWithin, isPathWithin, normalizePath, relativePath, resolvePath, validatePath } from "./contracts/virtual-path.js";
|
|
7
|
+
export { basename, dirname, extname, isAbsolutePath, joinPath, posixPath } from "./contracts/portable-path.js";
|
|
8
|
+
const _getMemHooks = () => globalThis.__safeBashMemHooks;
|
|
9
|
+
export function isUnmodifiedMemoryFileSystem(fs) {
|
|
10
|
+
const proto = Object.getPrototypeOf(fs);
|
|
11
|
+
if (!proto || !_getMemHooks()?.protos?.has(proto))
|
|
12
|
+
return false;
|
|
13
|
+
return Object.getOwnPropertyNames(fs).every(name => {
|
|
14
|
+
const method = Object.getOwnPropertyDescriptor(proto, name)?.value;
|
|
15
|
+
return typeof method !== "function" || Object.getOwnPropertyDescriptor(fs, name)?.value === method;
|
|
16
|
+
}) && Object.getOwnPropertyNames(proto).every(name => {
|
|
17
|
+
const method = Object.getOwnPropertyDescriptor(proto, name)?.value;
|
|
18
|
+
return typeof method !== "function" || Reflect.get(fs, name) === method;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export function isCleanAbsolutePath(p) {
|
|
22
|
+
const fn = _getMemHooks()?.isCleanAbsolutePath;
|
|
23
|
+
if (fn)
|
|
24
|
+
return fn(p);
|
|
25
|
+
return p.length > 0 && p.charCodeAt(0) === 47 && !p.includes("//") && !p.includes("/.") && (p.length === 1 || p.charCodeAt(p.length - 1) !== 47);
|
|
26
|
+
}
|
|
27
|
+
export function tryGetMemoryDirectoryEntryNamesSync(fs, path) {
|
|
28
|
+
return (fs && _getMemHooks()?.byProto?.get(Object.getPrototypeOf(fs))?.tryGetMemoryDirectoryEntryNamesSync)?.(fs, path);
|
|
29
|
+
}
|
|
30
|
+
export function tryReadMemoryFileViewSync(fs, path, maxBytes, signal, captureSourceRef, beforeRead) {
|
|
31
|
+
return (fs && _getMemHooks()?.byProto?.get(Object.getPrototypeOf(fs))?.tryReadMemoryFileViewSync)?.(fs, path, maxBytes, signal, captureSourceRef, beforeRead);
|
|
32
|
+
}
|
|
33
|
+
export function tryResolveMemoryDevicePath(fs, path, followFinal) {
|
|
34
|
+
return (fs && _getMemHooks()?.byProto?.get(Object.getPrototypeOf(fs))?.tryResolveMemoryDevicePath)?.(fs, path, followFinal);
|
|
35
|
+
}
|
|
36
|
+
export * from "./fs/devices/index.js";
|
|
37
|
+
export { retargetScopedFileSystem, scopeFileSystem, retainFileSystemCleanup } from "./fs/scoped.js";
|
|
38
|
+
export { compareEntries, registerEntryView } from "./fs/mount/comparison.js";
|
|
39
|
+
export async function bindConditionalMutation(identityScope, binding, action) {
|
|
40
|
+
const fn = _getMemHooks()?.bindConditionalMutation;
|
|
41
|
+
return fn ? fn(identityScope, binding, action) : action();
|
|
42
|
+
}
|
|
43
|
+
export function tryOpenMemoryRedirectHandleSync(fs, path, append, mode, signal) {
|
|
44
|
+
return (fs && _getMemHooks()?.byProto?.get(Object.getPrototypeOf(fs))?.tryOpenMemoryRedirectHandleSync)?.(fs, path, append, mode, signal);
|
|
45
|
+
}
|
|
46
|
+
export function tryWriteMemoryFileSync(fs, path, data, append, mode, signal) {
|
|
47
|
+
return Boolean((fs && _getMemHooks()?.byProto?.get(Object.getPrototypeOf(fs))?.tryWriteMemoryFileSync)?.(fs, path, data, append, mode, signal));
|
|
48
|
+
}
|
|
49
|
+
export function tryMkdirMemorySync(fs, path, recursive, mode, signal, dirPrefixHint) {
|
|
50
|
+
return Boolean((fs && _getMemHooks()?.byProto?.get(Object.getPrototypeOf(fs))?.tryMkdirMemorySync)?.(fs, path, recursive, mode, signal, dirPrefixHint));
|
|
51
|
+
}
|
|
52
|
+
export function tryRmRfMemorySync(fs, path, signal) {
|
|
53
|
+
return Boolean((fs && _getMemHooks()?.byProto?.get(Object.getPrototypeOf(fs))?.tryRmRfMemorySync)?.(fs, path, signal));
|
|
54
|
+
}
|
|
55
|
+
export function tryWriteMemoryFileInDirSync(fs, dirPrefix, name, data, append, mode, signal) {
|
|
56
|
+
return Boolean((fs && _getMemHooks()?.byProto?.get(Object.getPrototypeOf(fs))?.tryWriteMemoryFileInDirSync)?.(fs, dirPrefix, name, data, append, mode, signal));
|
|
57
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FileSystem } from "../contracts/filesystem.js";
|
|
2
|
+
export interface AtomicFileSystemConformanceFixture {
|
|
3
|
+
readonly fs: FileSystem;
|
|
4
|
+
readonly peer?: FileSystem;
|
|
5
|
+
readonly root: string;
|
|
6
|
+
dispose(): void | Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export interface AtomicFileSystemConformanceOptions {
|
|
9
|
+
readonly createFixture: () => AtomicFileSystemConformanceFixture | Promise<AtomicFileSystemConformanceFixture>;
|
|
10
|
+
readonly includeSymlinks?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface AtomicFileSystemConformanceCase {
|
|
13
|
+
readonly name: string;
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export declare function createAtomicFileSystemConformance(options: AtomicFileSystemConformanceOptions): readonly AtomicFileSystemConformanceCase[];
|