@openclaw/mxc-sandbox 0.0.0 → 2026.7.2-beta.1
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/README.md +351 -0
- package/dist/index.js +1323 -0
- package/dist/mxc-spawn-launcher.mjs +148 -0
- package/node_modules/@microsoft/mxc-sdk/LICENSE.md +21 -0
- package/node_modules/@microsoft/mxc-sdk/README.md +395 -0
- package/node_modules/@microsoft/mxc-sdk/bin/arm64/_manifest/spdx_2.2/ESRPClientLogs0613045248271.json +1 -0
- package/node_modules/@microsoft/mxc-sdk/bin/arm64/_manifest/spdx_2.2/ESRPClientLogs0613045452045.json +1 -0
- package/node_modules/@microsoft/mxc-sdk/bin/arm64/_manifest/spdx_2.2/ESRPClientLogs0613050048636.json +1 -0
- package/node_modules/@microsoft/mxc-sdk/bin/arm64/_manifest/spdx_2.2/bsi.cose +0 -0
- package/node_modules/@microsoft/mxc-sdk/bin/arm64/_manifest/spdx_2.2/bsi.json +1 -0
- package/node_modules/@microsoft/mxc-sdk/bin/arm64/_manifest/spdx_2.2/manifest.cat +0 -0
- package/node_modules/@microsoft/mxc-sdk/bin/arm64/_manifest/spdx_2.2/manifest.spdx.cose +0 -0
- package/node_modules/@microsoft/mxc-sdk/bin/arm64/_manifest/spdx_2.2/manifest.spdx.json +25812 -0
- package/node_modules/@microsoft/mxc-sdk/bin/arm64/_manifest/spdx_2.2/manifest.spdx.json.sha256 +1 -0
- package/node_modules/@microsoft/mxc-sdk/bin/arm64/linux-test-proxy +0 -0
- package/node_modules/@microsoft/mxc-sdk/bin/arm64/lxc-exec +0 -0
- package/node_modules/@microsoft/mxc-sdk/bin/arm64/mxc-diagnostic-console.exe +0 -0
- package/node_modules/@microsoft/mxc-sdk/bin/arm64/mxc-exec-mac +0 -0
- package/node_modules/@microsoft/mxc-sdk/bin/arm64/winhttp-proxy-shim.exe +0 -0
- package/node_modules/@microsoft/mxc-sdk/bin/arm64/wxc-exec.exe +0 -0
- package/node_modules/@microsoft/mxc-sdk/bin/arm64/wxc-host-prep.exe +0 -0
- package/node_modules/@microsoft/mxc-sdk/bin/arm64/wxc-test-proxy.exe +0 -0
- package/node_modules/@microsoft/mxc-sdk/bin/arm64/wxc-windows-sandbox-daemon.exe +0 -0
- package/node_modules/@microsoft/mxc-sdk/bin/arm64/wxc-windows-sandbox-guest.exe +0 -0
- package/node_modules/@microsoft/mxc-sdk/bin/x64/_manifest/spdx_2.2/ESRPClientLogs0613045534391.json +1 -0
- package/node_modules/@microsoft/mxc-sdk/bin/x64/_manifest/spdx_2.2/ESRPClientLogs0613050929378.json +1 -0
- package/node_modules/@microsoft/mxc-sdk/bin/x64/_manifest/spdx_2.2/bsi.cose +0 -0
- package/node_modules/@microsoft/mxc-sdk/bin/x64/_manifest/spdx_2.2/bsi.json +1 -0
- package/node_modules/@microsoft/mxc-sdk/bin/x64/_manifest/spdx_2.2/manifest.cat +0 -0
- package/node_modules/@microsoft/mxc-sdk/bin/x64/_manifest/spdx_2.2/manifest.spdx.cose +0 -0
- package/node_modules/@microsoft/mxc-sdk/bin/x64/_manifest/spdx_2.2/manifest.spdx.json +25812 -0
- package/node_modules/@microsoft/mxc-sdk/bin/x64/_manifest/spdx_2.2/manifest.spdx.json.sha256 +1 -0
- package/node_modules/@microsoft/mxc-sdk/bin/x64/linux-test-proxy +0 -0
- package/node_modules/@microsoft/mxc-sdk/bin/x64/lxc-exec +0 -0
- package/node_modules/@microsoft/mxc-sdk/bin/x64/mxc-diagnostic-console.exe +0 -0
- package/node_modules/@microsoft/mxc-sdk/bin/x64/winhttp-proxy-shim.exe +0 -0
- package/node_modules/@microsoft/mxc-sdk/bin/x64/wxc-exec.exe +0 -0
- package/node_modules/@microsoft/mxc-sdk/bin/x64/wxc-host-prep.exe +0 -0
- package/node_modules/@microsoft/mxc-sdk/bin/x64/wxc-test-proxy.exe +0 -0
- package/node_modules/@microsoft/mxc-sdk/bin/x64/wxc-windows-sandbox-daemon.exe +0 -0
- package/node_modules/@microsoft/mxc-sdk/bin/x64/wxc-windows-sandbox-guest.exe +0 -0
- package/node_modules/@microsoft/mxc-sdk/dist/diagnostic.d.ts +17 -0
- package/node_modules/@microsoft/mxc-sdk/dist/diagnostic.d.ts.map +1 -0
- package/node_modules/@microsoft/mxc-sdk/dist/diagnostic.js +150 -0
- package/node_modules/@microsoft/mxc-sdk/dist/diagnostic.js.map +1 -0
- package/node_modules/@microsoft/mxc-sdk/dist/errors.d.ts +27 -0
- package/node_modules/@microsoft/mxc-sdk/dist/errors.d.ts.map +1 -0
- package/node_modules/@microsoft/mxc-sdk/dist/errors.js +31 -0
- package/node_modules/@microsoft/mxc-sdk/dist/errors.js.map +1 -0
- package/node_modules/@microsoft/mxc-sdk/dist/helper.d.ts +101 -0
- package/node_modules/@microsoft/mxc-sdk/dist/helper.d.ts.map +1 -0
- package/node_modules/@microsoft/mxc-sdk/dist/helper.js +256 -0
- package/node_modules/@microsoft/mxc-sdk/dist/helper.js.map +1 -0
- package/node_modules/@microsoft/mxc-sdk/dist/index.d.ts +31 -0
- package/node_modules/@microsoft/mxc-sdk/dist/index.d.ts.map +1 -0
- package/node_modules/@microsoft/mxc-sdk/dist/index.js +40 -0
- package/node_modules/@microsoft/mxc-sdk/dist/index.js.map +1 -0
- package/node_modules/@microsoft/mxc-sdk/dist/logger.d.ts +11 -0
- package/node_modules/@microsoft/mxc-sdk/dist/logger.d.ts.map +1 -0
- package/node_modules/@microsoft/mxc-sdk/dist/logger.js +45 -0
- package/node_modules/@microsoft/mxc-sdk/dist/logger.js.map +1 -0
- package/node_modules/@microsoft/mxc-sdk/dist/platform.d.ts +55 -0
- package/node_modules/@microsoft/mxc-sdk/dist/platform.d.ts.map +1 -0
- package/node_modules/@microsoft/mxc-sdk/dist/platform.js +477 -0
- package/node_modules/@microsoft/mxc-sdk/dist/platform.js.map +1 -0
- package/node_modules/@microsoft/mxc-sdk/dist/policy.d.ts +80 -0
- package/node_modules/@microsoft/mxc-sdk/dist/policy.d.ts.map +1 -0
- package/node_modules/@microsoft/mxc-sdk/dist/policy.js +319 -0
- package/node_modules/@microsoft/mxc-sdk/dist/policy.js.map +1 -0
- package/node_modules/@microsoft/mxc-sdk/dist/sandbox.d.ts +189 -0
- package/node_modules/@microsoft/mxc-sdk/dist/sandbox.d.ts.map +1 -0
- package/node_modules/@microsoft/mxc-sdk/dist/sandbox.js +515 -0
- package/node_modules/@microsoft/mxc-sdk/dist/sandbox.js.map +1 -0
- package/node_modules/@microsoft/mxc-sdk/dist/state-aware-helper.d.ts +70 -0
- package/node_modules/@microsoft/mxc-sdk/dist/state-aware-helper.d.ts.map +1 -0
- package/node_modules/@microsoft/mxc-sdk/dist/state-aware-helper.js +184 -0
- package/node_modules/@microsoft/mxc-sdk/dist/state-aware-helper.js.map +1 -0
- package/node_modules/@microsoft/mxc-sdk/dist/state-aware-types.d.ts +130 -0
- package/node_modules/@microsoft/mxc-sdk/dist/state-aware-types.d.ts.map +1 -0
- package/node_modules/@microsoft/mxc-sdk/dist/state-aware-types.js +21 -0
- package/node_modules/@microsoft/mxc-sdk/dist/state-aware-types.js.map +1 -0
- package/node_modules/@microsoft/mxc-sdk/dist/state-aware.d.ts +39 -0
- package/node_modules/@microsoft/mxc-sdk/dist/state-aware.d.ts.map +1 -0
- package/node_modules/@microsoft/mxc-sdk/dist/state-aware.js +128 -0
- package/node_modules/@microsoft/mxc-sdk/dist/state-aware.js.map +1 -0
- package/node_modules/@microsoft/mxc-sdk/dist/types.d.ts +439 -0
- package/node_modules/@microsoft/mxc-sdk/dist/types.d.ts.map +1 -0
- package/node_modules/@microsoft/mxc-sdk/dist/types.js +38 -0
- package/node_modules/@microsoft/mxc-sdk/dist/types.js.map +1 -0
- package/node_modules/@microsoft/mxc-sdk/package.json +54 -0
- package/node_modules/node-addon-api/LICENSE.md +9 -0
- package/node_modules/node-addon-api/README.md +319 -0
- package/node_modules/node-addon-api/common.gypi +20 -0
- package/node_modules/node-addon-api/except.gypi +25 -0
- package/node_modules/node-addon-api/index.js +12 -0
- package/node_modules/node-addon-api/napi-inl.deprecated.h +186 -0
- package/node_modules/node-addon-api/napi-inl.h +6607 -0
- package/node_modules/node-addon-api/napi.h +3201 -0
- package/node_modules/node-addon-api/node_addon_api.gyp +32 -0
- package/node_modules/node-addon-api/node_api.gyp +9 -0
- package/node_modules/node-addon-api/noexcept.gypi +26 -0
- package/node_modules/node-addon-api/nothing.c +0 -0
- package/node_modules/node-addon-api/package-support.json +21 -0
- package/node_modules/node-addon-api/package.json +480 -0
- package/node_modules/node-addon-api/tools/README.md +73 -0
- package/node_modules/node-addon-api/tools/check-napi.js +99 -0
- package/node_modules/node-addon-api/tools/clang-format.js +71 -0
- package/node_modules/node-addon-api/tools/conversion.js +301 -0
- package/node_modules/node-addon-api/tools/eslint-format.js +79 -0
- package/node_modules/node-pty/LICENSE +69 -0
- package/node_modules/node-pty/README.md +164 -0
- package/node_modules/node-pty/binding.gyp +150 -0
- package/node_modules/node-pty/lib/conpty_console_list_agent.js +25 -0
- package/node_modules/node-pty/lib/eventEmitter2.js +47 -0
- package/node_modules/node-pty/lib/index.js +52 -0
- package/node_modules/node-pty/lib/interfaces.js +7 -0
- package/node_modules/node-pty/lib/shared/conout.js +10 -0
- package/node_modules/node-pty/lib/terminal.js +190 -0
- package/node_modules/node-pty/lib/types.js +7 -0
- package/node_modules/node-pty/lib/unixTerminal.js +351 -0
- package/node_modules/node-pty/lib/utils.js +38 -0
- package/node_modules/node-pty/lib/windowsConoutConnection.js +125 -0
- package/node_modules/node-pty/lib/windowsPtyAgent.js +312 -0
- package/node_modules/node-pty/lib/windowsTerminal.js +209 -0
- package/node_modules/node-pty/lib/worker/conoutSocketWorker.js +22 -0
- package/node_modules/node-pty/package.json +66 -0
- package/node_modules/node-pty/prebuilds/darwin-arm64/pty.node +0 -0
- package/node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper +0 -0
- package/node_modules/node-pty/prebuilds/darwin-x64/pty.node +0 -0
- package/node_modules/node-pty/prebuilds/darwin-x64/spawn-helper +0 -0
- package/node_modules/node-pty/prebuilds/linux-arm64/pty.node +0 -0
- package/node_modules/node-pty/prebuilds/linux-x64/pty.node +0 -0
- package/node_modules/node-pty/prebuilds/win32-arm64/conpty/OpenConsole.exe +0 -0
- package/node_modules/node-pty/prebuilds/win32-arm64/conpty/conpty.dll +0 -0
- package/node_modules/node-pty/prebuilds/win32-arm64/conpty.node +0 -0
- package/node_modules/node-pty/prebuilds/win32-arm64/conpty.pdb +0 -0
- package/node_modules/node-pty/prebuilds/win32-arm64/conpty_console_list.node +0 -0
- package/node_modules/node-pty/prebuilds/win32-arm64/conpty_console_list.pdb +0 -0
- package/node_modules/node-pty/prebuilds/win32-x64/conpty/OpenConsole.exe +0 -0
- package/node_modules/node-pty/prebuilds/win32-x64/conpty/conpty.dll +0 -0
- package/node_modules/node-pty/prebuilds/win32-x64/conpty.node +0 -0
- package/node_modules/node-pty/prebuilds/win32-x64/conpty.pdb +0 -0
- package/node_modules/node-pty/prebuilds/win32-x64/conpty_console_list.node +0 -0
- package/node_modules/node-pty/prebuilds/win32-x64/conpty_console_list.pdb +0 -0
- package/node_modules/node-pty/scripts/post-install.js +76 -0
- package/node_modules/node-pty/scripts/prebuild.js +34 -0
- package/node_modules/node-pty/src/unix/pty.cc +876 -0
- package/node_modules/node-pty/src/unix/spawn-helper.cc +23 -0
- package/node_modules/node-pty/src/win/conpty.cc +616 -0
- package/node_modules/node-pty/src/win/conpty.h +41 -0
- package/node_modules/node-pty/src/win/conpty_console_list.cc +44 -0
- package/node_modules/node-pty/src/win/path_util.cc +95 -0
- package/node_modules/node-pty/src/win/path_util.h +26 -0
- package/node_modules/node-pty/third_party/conpty/1.25.260303002/win10-arm64/OpenConsole.exe +0 -0
- package/node_modules/node-pty/third_party/conpty/1.25.260303002/win10-arm64/conpty.dll +0 -0
- package/node_modules/node-pty/third_party/conpty/1.25.260303002/win10-x64/OpenConsole.exe +0 -0
- package/node_modules/node-pty/third_party/conpty/1.25.260303002/win10-x64/conpty.dll +0 -0
- package/node_modules/node-pty/typings/node-pty.d.ts +215 -0
- package/node_modules/semver/LICENSE +15 -0
- package/node_modules/semver/README.md +680 -0
- package/node_modules/semver/bin/semver.js +195 -0
- package/node_modules/semver/classes/comparator.js +143 -0
- package/node_modules/semver/classes/index.js +7 -0
- package/node_modules/semver/classes/range.js +577 -0
- package/node_modules/semver/classes/semver.js +350 -0
- package/node_modules/semver/functions/clean.js +8 -0
- package/node_modules/semver/functions/cmp.js +54 -0
- package/node_modules/semver/functions/coerce.js +62 -0
- package/node_modules/semver/functions/compare-build.js +9 -0
- package/node_modules/semver/functions/compare-loose.js +5 -0
- package/node_modules/semver/functions/compare.js +7 -0
- package/node_modules/semver/functions/diff.js +60 -0
- package/node_modules/semver/functions/eq.js +5 -0
- package/node_modules/semver/functions/gt.js +5 -0
- package/node_modules/semver/functions/gte.js +5 -0
- package/node_modules/semver/functions/inc.js +21 -0
- package/node_modules/semver/functions/lt.js +5 -0
- package/node_modules/semver/functions/lte.js +5 -0
- package/node_modules/semver/functions/major.js +5 -0
- package/node_modules/semver/functions/minor.js +5 -0
- package/node_modules/semver/functions/neq.js +5 -0
- package/node_modules/semver/functions/parse.js +18 -0
- package/node_modules/semver/functions/patch.js +5 -0
- package/node_modules/semver/functions/prerelease.js +8 -0
- package/node_modules/semver/functions/rcompare.js +5 -0
- package/node_modules/semver/functions/rsort.js +5 -0
- package/node_modules/semver/functions/satisfies.js +12 -0
- package/node_modules/semver/functions/sort.js +5 -0
- package/node_modules/semver/functions/truncate.js +48 -0
- package/node_modules/semver/functions/valid.js +8 -0
- package/node_modules/semver/index.js +93 -0
- package/node_modules/semver/internal/constants.js +37 -0
- package/node_modules/semver/internal/debug.js +11 -0
- package/node_modules/semver/internal/identifiers.js +29 -0
- package/node_modules/semver/internal/lrucache.js +42 -0
- package/node_modules/semver/internal/parse-options.js +17 -0
- package/node_modules/semver/internal/re.js +223 -0
- package/node_modules/semver/package.json +78 -0
- package/node_modules/semver/preload.js +4 -0
- package/node_modules/semver/range.bnf +17 -0
- package/node_modules/semver/ranges/gtr.js +6 -0
- package/node_modules/semver/ranges/intersects.js +9 -0
- package/node_modules/semver/ranges/ltr.js +6 -0
- package/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/node_modules/semver/ranges/min-version.js +63 -0
- package/node_modules/semver/ranges/outside.js +82 -0
- package/node_modules/semver/ranges/simplify.js +49 -0
- package/node_modules/semver/ranges/subset.js +249 -0
- package/node_modules/semver/ranges/to-comparators.js +10 -0
- package/node_modules/semver/ranges/valid.js +13 -0
- package/node_modules/zod/LICENSE +21 -0
- package/node_modules/zod/README.md +191 -0
- package/node_modules/zod/index.cjs +33 -0
- package/node_modules/zod/index.d.cts +4 -0
- package/node_modules/zod/index.d.ts +4 -0
- package/node_modules/zod/index.js +4 -0
- package/node_modules/zod/locales/index.cjs +17 -0
- package/node_modules/zod/locales/index.d.cts +1 -0
- package/node_modules/zod/locales/index.d.ts +1 -0
- package/node_modules/zod/locales/index.js +1 -0
- package/node_modules/zod/locales/package.json +7 -0
- package/node_modules/zod/mini/index.cjs +32 -0
- package/node_modules/zod/mini/index.d.cts +3 -0
- package/node_modules/zod/mini/index.d.ts +3 -0
- package/node_modules/zod/mini/index.js +3 -0
- package/node_modules/zod/mini/package.json +7 -0
- package/node_modules/zod/package.json +135 -0
- package/node_modules/zod/src/index.ts +4 -0
- package/node_modules/zod/src/locales/index.ts +1 -0
- package/node_modules/zod/src/mini/index.ts +3 -0
- package/node_modules/zod/src/v3/ZodError.ts +330 -0
- package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
- package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
- package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
- package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
- package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
- package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
- package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
- package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
- package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
- package/node_modules/zod/src/v3/errors.ts +13 -0
- package/node_modules/zod/src/v3/external.ts +6 -0
- package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
- package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
- package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
- package/node_modules/zod/src/v3/helpers/typeAliases.ts +2 -0
- package/node_modules/zod/src/v3/helpers/util.ts +224 -0
- package/node_modules/zod/src/v3/index.ts +4 -0
- package/node_modules/zod/src/v3/locales/en.ts +124 -0
- package/node_modules/zod/src/v3/standard-schema.ts +113 -0
- package/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
- package/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
- package/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
- package/node_modules/zod/src/v3/tests/array.test.ts +71 -0
- package/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
- package/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
- package/node_modules/zod/src/v3/tests/base.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
- package/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
- package/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
- package/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
- package/node_modules/zod/src/v3/tests/complex.test.ts +70 -0
- package/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
- package/node_modules/zod/src/v3/tests/date.test.ts +32 -0
- package/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
- package/node_modules/zod/src/v3/tests/default.test.ts +112 -0
- package/node_modules/zod/src/v3/tests/description.test.ts +33 -0
- package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
- package/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
- package/node_modules/zod/src/v3/tests/error.test.ts +551 -0
- package/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
- package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
- package/node_modules/zod/src/v3/tests/function.test.ts +261 -0
- package/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
- package/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
- package/node_modules/zod/src/v3/tests/intersection.test.ts +110 -0
- package/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
- package/node_modules/zod/src/v3/tests/language-server.test.ts +207 -0
- package/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
- package/node_modules/zod/src/v3/tests/map.test.ts +110 -0
- package/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
- package/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
- package/node_modules/zod/src/v3/tests/nan.test.ts +24 -0
- package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
- package/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
- package/node_modules/zod/src/v3/tests/number.test.ts +176 -0
- package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/object.test.ts +434 -0
- package/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
- package/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
- package/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
- package/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
- package/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
- package/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
- package/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
- package/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
- package/node_modules/zod/src/v3/tests/readonly.test.ts +194 -0
- package/node_modules/zod/src/v3/tests/record.test.ts +171 -0
- package/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
- package/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
- package/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
- package/node_modules/zod/src/v3/tests/set.test.ts +142 -0
- package/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
- package/node_modules/zod/src/v3/tests/string.test.ts +916 -0
- package/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
- package/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
- package/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
- package/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
- package/node_modules/zod/src/v3/tests/void.test.ts +15 -0
- package/node_modules/zod/src/v3/types.ts +5138 -0
- package/node_modules/zod/src/v4/classic/checks.ts +32 -0
- package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
- package/node_modules/zod/src/v4/classic/compat.ts +70 -0
- package/node_modules/zod/src/v4/classic/errors.ts +82 -0
- package/node_modules/zod/src/v4/classic/external.ts +52 -0
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +659 -0
- package/node_modules/zod/src/v4/classic/index.ts +5 -0
- package/node_modules/zod/src/v4/classic/iso.ts +90 -0
- package/node_modules/zod/src/v4/classic/parse.ts +82 -0
- package/node_modules/zod/src/v4/classic/schemas.ts +2672 -0
- package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/apply.test.ts +59 -0
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +264 -0
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +216 -0
- package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
- package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +54 -0
- package/node_modules/zod/src/v4/classic/tests/brand.test.ts +106 -0
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +326 -0
- package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
- package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +573 -0
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +703 -0
- package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +374 -0
- package/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
- package/node_modules/zod/src/v4/classic/tests/date.test.ts +62 -0
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +302 -0
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +409 -0
- package/node_modules/zod/src/v4/classic/tests/describe-meta-checks.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +197 -0
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +694 -0
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +285 -0
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +807 -0
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +711 -0
- package/node_modules/zod/src/v4/classic/tests/file.test.ts +96 -0
- package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +179 -0
- package/node_modules/zod/src/v4/classic/tests/fix-json-issue.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +895 -0
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +360 -0
- package/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
- package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +39 -0
- package/node_modules/zod/src/v4/classic/tests/hash.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +939 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +60 -0
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +198 -0
- package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +46 -0
- package/node_modules/zod/src/v4/classic/tests/json.test.ts +109 -0
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +227 -0
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +117 -0
- package/node_modules/zod/src/v4/classic/tests/locales_ka.test.ts +29 -0
- package/node_modules/zod/src/v4/classic/tests/locales_ro.test.ts +24 -0
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +330 -0
- package/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
- package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
- package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +101 -0
- package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +325 -0
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +717 -0
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +333 -0
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +450 -0
- package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +211 -0
- package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +101 -0
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +74 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +351 -0
- package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
- package/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +252 -0
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +717 -0
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +631 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +633 -0
- package/node_modules/zod/src/v4/classic/tests/registries.test.ts +243 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +181 -0
- package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +134 -0
- package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +125 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +1224 -0
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +106 -0
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +771 -0
- package/node_modules/zod/src/v4/classic/tests/to-json-schema-methods.test.ts +438 -0
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +3125 -0
- package/node_modules/zod/src/v4/classic/tests/transform.test.ts +378 -0
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +496 -0
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +273 -0
- package/node_modules/zod/src/v4/classic/tests/url.test.ts +13 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
- package/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
- package/node_modules/zod/src/v4/core/api.ts +1823 -0
- package/node_modules/zod/src/v4/core/checks.ts +1293 -0
- package/node_modules/zod/src/v4/core/config.ts +15 -0
- package/node_modules/zod/src/v4/core/core.ts +153 -0
- package/node_modules/zod/src/v4/core/doc.ts +44 -0
- package/node_modules/zod/src/v4/core/errors.ts +455 -0
- package/node_modules/zod/src/v4/core/index.ts +16 -0
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +126 -0
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +666 -0
- package/node_modules/zod/src/v4/core/json-schema.ts +147 -0
- package/node_modules/zod/src/v4/core/parse.ts +195 -0
- package/node_modules/zod/src/v4/core/regexes.ts +190 -0
- package/node_modules/zod/src/v4/core/registries.ts +105 -0
- package/node_modules/zod/src/v4/core/schemas.ts +4730 -0
- package/node_modules/zod/src/v4/core/standard-schema.ts +159 -0
- package/node_modules/zod/src/v4/core/tests/extend.test.ts +59 -0
- package/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
- package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +215 -0
- package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
- package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +181 -0
- package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +72 -0
- package/node_modules/zod/src/v4/core/tests/locales/he.test.ts +379 -0
- package/node_modules/zod/src/v4/core/tests/locales/hr.test.ts +163 -0
- package/node_modules/zod/src/v4/core/tests/locales/nl.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
- package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
- package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +105 -0
- package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +125 -0
- package/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts +45 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +622 -0
- package/node_modules/zod/src/v4/core/util.ts +983 -0
- package/node_modules/zod/src/v4/core/versions.ts +5 -0
- package/node_modules/zod/src/v4/core/zsf.ts +323 -0
- package/node_modules/zod/src/v4/index.ts +4 -0
- package/node_modules/zod/src/v4/locales/ar.ts +115 -0
- package/node_modules/zod/src/v4/locales/az.ts +111 -0
- package/node_modules/zod/src/v4/locales/be.ts +176 -0
- package/node_modules/zod/src/v4/locales/bg.ts +128 -0
- package/node_modules/zod/src/v4/locales/ca.ts +116 -0
- package/node_modules/zod/src/v4/locales/cs.ts +118 -0
- package/node_modules/zod/src/v4/locales/da.ts +123 -0
- package/node_modules/zod/src/v4/locales/de.ts +116 -0
- package/node_modules/zod/src/v4/locales/el.ts +121 -0
- package/node_modules/zod/src/v4/locales/en.ts +123 -0
- package/node_modules/zod/src/v4/locales/eo.ts +118 -0
- package/node_modules/zod/src/v4/locales/es.ts +141 -0
- package/node_modules/zod/src/v4/locales/fa.ts +126 -0
- package/node_modules/zod/src/v4/locales/fi.ts +121 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +116 -0
- package/node_modules/zod/src/v4/locales/fr.ts +132 -0
- package/node_modules/zod/src/v4/locales/he.ts +246 -0
- package/node_modules/zod/src/v4/locales/hr.ts +131 -0
- package/node_modules/zod/src/v4/locales/hu.ts +117 -0
- package/node_modules/zod/src/v4/locales/hy.ts +164 -0
- package/node_modules/zod/src/v4/locales/id.ts +115 -0
- package/node_modules/zod/src/v4/locales/index.ts +52 -0
- package/node_modules/zod/src/v4/locales/is.ts +119 -0
- package/node_modules/zod/src/v4/locales/it.ts +116 -0
- package/node_modules/zod/src/v4/locales/ja.ts +114 -0
- package/node_modules/zod/src/v4/locales/ka.ts +123 -0
- package/node_modules/zod/src/v4/locales/kh.ts +7 -0
- package/node_modules/zod/src/v4/locales/km.ts +119 -0
- package/node_modules/zod/src/v4/locales/ko.ts +121 -0
- package/node_modules/zod/src/v4/locales/lt.ts +239 -0
- package/node_modules/zod/src/v4/locales/mk.ts +118 -0
- package/node_modules/zod/src/v4/locales/ms.ts +115 -0
- package/node_modules/zod/src/v4/locales/nl.ts +121 -0
- package/node_modules/zod/src/v4/locales/no.ts +116 -0
- package/node_modules/zod/src/v4/locales/ota.ts +117 -0
- package/node_modules/zod/src/v4/locales/pl.ts +118 -0
- package/node_modules/zod/src/v4/locales/ps.ts +126 -0
- package/node_modules/zod/src/v4/locales/pt.ts +116 -0
- package/node_modules/zod/src/v4/locales/ro.ts +129 -0
- package/node_modules/zod/src/v4/locales/ru.ts +176 -0
- package/node_modules/zod/src/v4/locales/sl.ts +118 -0
- package/node_modules/zod/src/v4/locales/sv.ts +119 -0
- package/node_modules/zod/src/v4/locales/ta.ts +118 -0
- package/node_modules/zod/src/v4/locales/th.ts +119 -0
- package/node_modules/zod/src/v4/locales/tr.ts +111 -0
- package/node_modules/zod/src/v4/locales/ua.ts +7 -0
- package/node_modules/zod/src/v4/locales/uk.ts +117 -0
- package/node_modules/zod/src/v4/locales/ur.ts +119 -0
- package/node_modules/zod/src/v4/locales/uz.ts +117 -0
- package/node_modules/zod/src/v4/locales/vi.ts +117 -0
- package/node_modules/zod/src/v4/locales/yo.ts +124 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +116 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +115 -0
- package/node_modules/zod/src/v4/mini/checks.ts +32 -0
- package/node_modules/zod/src/v4/mini/coerce.ts +27 -0
- package/node_modules/zod/src/v4/mini/external.ts +41 -0
- package/node_modules/zod/src/v4/mini/index.ts +3 -0
- package/node_modules/zod/src/v4/mini/iso.ts +66 -0
- package/node_modules/zod/src/v4/mini/parse.ts +14 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +1947 -0
- package/node_modules/zod/src/v4/mini/tests/apply.test.ts +24 -0
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +129 -0
- package/node_modules/zod/src/v4/mini/tests/brand.test.ts +94 -0
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +144 -0
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +548 -0
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +36 -0
- package/node_modules/zod/src/v4/mini/tests/error.test.ts +22 -0
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +5 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +993 -0
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +95 -0
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +227 -0
- package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +325 -0
- package/node_modules/zod/src/v4/mini/tests/standard-schema.test.ts +50 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +352 -0
- package/node_modules/zod/src/v4-mini/index.ts +3 -0
- package/node_modules/zod/v3/ZodError.cjs +138 -0
- package/node_modules/zod/v3/ZodError.d.cts +164 -0
- package/node_modules/zod/v3/ZodError.d.ts +164 -0
- package/node_modules/zod/v3/ZodError.js +133 -0
- package/node_modules/zod/v3/errors.cjs +17 -0
- package/node_modules/zod/v3/errors.d.cts +5 -0
- package/node_modules/zod/v3/errors.d.ts +5 -0
- package/node_modules/zod/v3/errors.js +9 -0
- package/node_modules/zod/v3/external.cjs +22 -0
- package/node_modules/zod/v3/external.d.cts +6 -0
- package/node_modules/zod/v3/external.d.ts +6 -0
- package/node_modules/zod/v3/external.js +6 -0
- package/node_modules/zod/v3/helpers/enumUtil.cjs +2 -0
- package/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
- package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
- package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
- package/node_modules/zod/v3/helpers/errorUtil.cjs +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
- package/node_modules/zod/v3/helpers/parseUtil.cjs +124 -0
- package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
- package/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
- package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
- package/node_modules/zod/v3/helpers/partialUtil.cjs +2 -0
- package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
- package/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
- package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
- package/node_modules/zod/v3/helpers/typeAliases.cjs +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
- package/node_modules/zod/v3/helpers/util.cjs +137 -0
- package/node_modules/zod/v3/helpers/util.d.cts +85 -0
- package/node_modules/zod/v3/helpers/util.d.ts +85 -0
- package/node_modules/zod/v3/helpers/util.js +133 -0
- package/node_modules/zod/v3/index.cjs +33 -0
- package/node_modules/zod/v3/index.d.cts +4 -0
- package/node_modules/zod/v3/index.d.ts +4 -0
- package/node_modules/zod/v3/index.js +4 -0
- package/node_modules/zod/v3/locales/en.cjs +112 -0
- package/node_modules/zod/v3/locales/en.d.cts +3 -0
- package/node_modules/zod/v3/locales/en.d.ts +3 -0
- package/node_modules/zod/v3/locales/en.js +109 -0
- package/node_modules/zod/v3/package.json +7 -0
- package/node_modules/zod/v3/standard-schema.cjs +2 -0
- package/node_modules/zod/v3/standard-schema.d.cts +102 -0
- package/node_modules/zod/v3/standard-schema.d.ts +102 -0
- package/node_modules/zod/v3/standard-schema.js +1 -0
- package/node_modules/zod/v3/types.cjs +3777 -0
- package/node_modules/zod/v3/types.d.cts +1034 -0
- package/node_modules/zod/v3/types.d.ts +1034 -0
- package/node_modules/zod/v3/types.js +3695 -0
- package/node_modules/zod/v4/classic/checks.cjs +33 -0
- package/node_modules/zod/v4/classic/checks.d.cts +1 -0
- package/node_modules/zod/v4/classic/checks.d.ts +1 -0
- package/node_modules/zod/v4/classic/checks.js +1 -0
- package/node_modules/zod/v4/classic/coerce.cjs +47 -0
- package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
- package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
- package/node_modules/zod/v4/classic/coerce.js +17 -0
- package/node_modules/zod/v4/classic/compat.cjs +61 -0
- package/node_modules/zod/v4/classic/compat.d.cts +50 -0
- package/node_modules/zod/v4/classic/compat.d.ts +50 -0
- package/node_modules/zod/v4/classic/compat.js +31 -0
- package/node_modules/zod/v4/classic/errors.cjs +74 -0
- package/node_modules/zod/v4/classic/errors.d.cts +30 -0
- package/node_modules/zod/v4/classic/errors.d.ts +30 -0
- package/node_modules/zod/v4/classic/errors.js +48 -0
- package/node_modules/zod/v4/classic/external.cjs +73 -0
- package/node_modules/zod/v4/classic/external.d.cts +16 -0
- package/node_modules/zod/v4/classic/external.d.ts +16 -0
- package/node_modules/zod/v4/classic/external.js +20 -0
- package/node_modules/zod/v4/classic/from-json-schema.cjs +625 -0
- package/node_modules/zod/v4/classic/from-json-schema.d.cts +12 -0
- package/node_modules/zod/v4/classic/from-json-schema.d.ts +12 -0
- package/node_modules/zod/v4/classic/from-json-schema.js +599 -0
- package/node_modules/zod/v4/classic/index.cjs +33 -0
- package/node_modules/zod/v4/classic/index.d.cts +4 -0
- package/node_modules/zod/v4/classic/index.d.ts +4 -0
- package/node_modules/zod/v4/classic/index.js +4 -0
- package/node_modules/zod/v4/classic/iso.cjs +60 -0
- package/node_modules/zod/v4/classic/iso.d.cts +22 -0
- package/node_modules/zod/v4/classic/iso.d.ts +22 -0
- package/node_modules/zod/v4/classic/iso.js +30 -0
- package/node_modules/zod/v4/classic/package.json +7 -0
- package/node_modules/zod/v4/classic/parse.cjs +41 -0
- package/node_modules/zod/v4/classic/parse.d.cts +31 -0
- package/node_modules/zod/v4/classic/parse.d.ts +31 -0
- package/node_modules/zod/v4/classic/parse.js +15 -0
- package/node_modules/zod/v4/classic/schemas.cjs +1511 -0
- package/node_modules/zod/v4/classic/schemas.d.cts +767 -0
- package/node_modules/zod/v4/classic/schemas.d.ts +767 -0
- package/node_modules/zod/v4/classic/schemas.js +1395 -0
- package/node_modules/zod/v4/core/api.cjs +1227 -0
- package/node_modules/zod/v4/core/api.d.cts +325 -0
- package/node_modules/zod/v4/core/api.d.ts +325 -0
- package/node_modules/zod/v4/core/api.js +1087 -0
- package/node_modules/zod/v4/core/checks.cjs +601 -0
- package/node_modules/zod/v4/core/checks.d.cts +278 -0
- package/node_modules/zod/v4/core/checks.d.ts +278 -0
- package/node_modules/zod/v4/core/checks.js +575 -0
- package/node_modules/zod/v4/core/core.cjs +85 -0
- package/node_modules/zod/v4/core/core.d.cts +70 -0
- package/node_modules/zod/v4/core/core.d.ts +70 -0
- package/node_modules/zod/v4/core/core.js +78 -0
- package/node_modules/zod/v4/core/doc.cjs +39 -0
- package/node_modules/zod/v4/core/doc.d.cts +14 -0
- package/node_modules/zod/v4/core/doc.d.ts +14 -0
- package/node_modules/zod/v4/core/doc.js +35 -0
- package/node_modules/zod/v4/core/errors.cjs +216 -0
- package/node_modules/zod/v4/core/errors.d.cts +221 -0
- package/node_modules/zod/v4/core/errors.d.ts +221 -0
- package/node_modules/zod/v4/core/errors.js +185 -0
- package/node_modules/zod/v4/core/index.cjs +47 -0
- package/node_modules/zod/v4/core/index.d.cts +16 -0
- package/node_modules/zod/v4/core/index.d.ts +16 -0
- package/node_modules/zod/v4/core/index.js +16 -0
- package/node_modules/zod/v4/core/json-schema-generator.cjs +99 -0
- package/node_modules/zod/v4/core/json-schema-generator.d.cts +65 -0
- package/node_modules/zod/v4/core/json-schema-generator.d.ts +65 -0
- package/node_modules/zod/v4/core/json-schema-generator.js +95 -0
- package/node_modules/zod/v4/core/json-schema-processors.cjs +644 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.cts +49 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.ts +49 -0
- package/node_modules/zod/v4/core/json-schema-processors.js +601 -0
- package/node_modules/zod/v4/core/json-schema.cjs +2 -0
- package/node_modules/zod/v4/core/json-schema.d.cts +88 -0
- package/node_modules/zod/v4/core/json-schema.d.ts +88 -0
- package/node_modules/zod/v4/core/json-schema.js +1 -0
- package/node_modules/zod/v4/core/package.json +7 -0
- package/node_modules/zod/v4/core/parse.cjs +131 -0
- package/node_modules/zod/v4/core/parse.d.cts +49 -0
- package/node_modules/zod/v4/core/parse.d.ts +49 -0
- package/node_modules/zod/v4/core/parse.js +93 -0
- package/node_modules/zod/v4/core/regexes.cjs +172 -0
- package/node_modules/zod/v4/core/regexes.d.cts +85 -0
- package/node_modules/zod/v4/core/regexes.d.ts +85 -0
- package/node_modules/zod/v4/core/regexes.js +139 -0
- package/node_modules/zod/v4/core/registries.cjs +56 -0
- package/node_modules/zod/v4/core/registries.d.cts +35 -0
- package/node_modules/zod/v4/core/registries.d.ts +35 -0
- package/node_modules/zod/v4/core/registries.js +51 -0
- package/node_modules/zod/v4/core/schemas.cjs +2270 -0
- package/node_modules/zod/v4/core/schemas.d.cts +1184 -0
- package/node_modules/zod/v4/core/schemas.d.ts +1184 -0
- package/node_modules/zod/v4/core/schemas.js +2239 -0
- package/node_modules/zod/v4/core/standard-schema.cjs +2 -0
- package/node_modules/zod/v4/core/standard-schema.d.cts +126 -0
- package/node_modules/zod/v4/core/standard-schema.d.ts +126 -0
- package/node_modules/zod/v4/core/standard-schema.js +1 -0
- package/node_modules/zod/v4/core/to-json-schema.cjs +457 -0
- package/node_modules/zod/v4/core/to-json-schema.d.cts +114 -0
- package/node_modules/zod/v4/core/to-json-schema.d.ts +114 -0
- package/node_modules/zod/v4/core/to-json-schema.js +448 -0
- package/node_modules/zod/v4/core/util.cjs +734 -0
- package/node_modules/zod/v4/core/util.d.cts +200 -0
- package/node_modules/zod/v4/core/util.d.ts +200 -0
- package/node_modules/zod/v4/core/util.js +674 -0
- package/node_modules/zod/v4/core/versions.cjs +8 -0
- package/node_modules/zod/v4/core/versions.d.cts +5 -0
- package/node_modules/zod/v4/core/versions.d.ts +5 -0
- package/node_modules/zod/v4/core/versions.js +5 -0
- package/node_modules/zod/v4/index.cjs +22 -0
- package/node_modules/zod/v4/index.d.cts +3 -0
- package/node_modules/zod/v4/index.d.ts +3 -0
- package/node_modules/zod/v4/index.js +3 -0
- package/node_modules/zod/v4/locales/ar.cjs +133 -0
- package/node_modules/zod/v4/locales/ar.d.cts +5 -0
- package/node_modules/zod/v4/locales/ar.d.ts +4 -0
- package/node_modules/zod/v4/locales/ar.js +106 -0
- package/node_modules/zod/v4/locales/az.cjs +132 -0
- package/node_modules/zod/v4/locales/az.d.cts +5 -0
- package/node_modules/zod/v4/locales/az.d.ts +4 -0
- package/node_modules/zod/v4/locales/az.js +105 -0
- package/node_modules/zod/v4/locales/be.cjs +183 -0
- package/node_modules/zod/v4/locales/be.d.cts +5 -0
- package/node_modules/zod/v4/locales/be.d.ts +4 -0
- package/node_modules/zod/v4/locales/be.js +156 -0
- package/node_modules/zod/v4/locales/bg.cjs +147 -0
- package/node_modules/zod/v4/locales/bg.d.cts +5 -0
- package/node_modules/zod/v4/locales/bg.d.ts +4 -0
- package/node_modules/zod/v4/locales/bg.js +120 -0
- package/node_modules/zod/v4/locales/ca.cjs +134 -0
- package/node_modules/zod/v4/locales/ca.d.cts +5 -0
- package/node_modules/zod/v4/locales/ca.d.ts +4 -0
- package/node_modules/zod/v4/locales/ca.js +107 -0
- package/node_modules/zod/v4/locales/cs.cjs +138 -0
- package/node_modules/zod/v4/locales/cs.d.cts +5 -0
- package/node_modules/zod/v4/locales/cs.d.ts +4 -0
- package/node_modules/zod/v4/locales/cs.js +111 -0
- package/node_modules/zod/v4/locales/da.cjs +142 -0
- package/node_modules/zod/v4/locales/da.d.cts +5 -0
- package/node_modules/zod/v4/locales/da.d.ts +4 -0
- package/node_modules/zod/v4/locales/da.js +115 -0
- package/node_modules/zod/v4/locales/de.cjs +135 -0
- package/node_modules/zod/v4/locales/de.d.cts +5 -0
- package/node_modules/zod/v4/locales/de.d.ts +4 -0
- package/node_modules/zod/v4/locales/de.js +108 -0
- package/node_modules/zod/v4/locales/el.cjs +136 -0
- package/node_modules/zod/v4/locales/el.d.cts +5 -0
- package/node_modules/zod/v4/locales/el.d.ts +4 -0
- package/node_modules/zod/v4/locales/el.js +109 -0
- package/node_modules/zod/v4/locales/en.cjs +140 -0
- package/node_modules/zod/v4/locales/en.d.cts +5 -0
- package/node_modules/zod/v4/locales/en.d.ts +4 -0
- package/node_modules/zod/v4/locales/en.js +113 -0
- package/node_modules/zod/v4/locales/eo.cjs +136 -0
- package/node_modules/zod/v4/locales/eo.d.cts +5 -0
- package/node_modules/zod/v4/locales/eo.d.ts +4 -0
- package/node_modules/zod/v4/locales/eo.js +109 -0
- package/node_modules/zod/v4/locales/es.cjs +159 -0
- package/node_modules/zod/v4/locales/es.d.cts +5 -0
- package/node_modules/zod/v4/locales/es.d.ts +4 -0
- package/node_modules/zod/v4/locales/es.js +132 -0
- package/node_modules/zod/v4/locales/fa.cjs +141 -0
- package/node_modules/zod/v4/locales/fa.d.cts +5 -0
- package/node_modules/zod/v4/locales/fa.d.ts +4 -0
- package/node_modules/zod/v4/locales/fa.js +114 -0
- package/node_modules/zod/v4/locales/fi.cjs +139 -0
- package/node_modules/zod/v4/locales/fi.d.cts +5 -0
- package/node_modules/zod/v4/locales/fi.d.ts +4 -0
- package/node_modules/zod/v4/locales/fi.js +112 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +134 -0
- package/node_modules/zod/v4/locales/fr-CA.d.cts +5 -0
- package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
- package/node_modules/zod/v4/locales/fr-CA.js +107 -0
- package/node_modules/zod/v4/locales/fr.cjs +152 -0
- package/node_modules/zod/v4/locales/fr.d.cts +5 -0
- package/node_modules/zod/v4/locales/fr.d.ts +4 -0
- package/node_modules/zod/v4/locales/fr.js +125 -0
- package/node_modules/zod/v4/locales/he.cjs +241 -0
- package/node_modules/zod/v4/locales/he.d.cts +5 -0
- package/node_modules/zod/v4/locales/he.d.ts +4 -0
- package/node_modules/zod/v4/locales/he.js +214 -0
- package/node_modules/zod/v4/locales/hr.cjs +149 -0
- package/node_modules/zod/v4/locales/hr.d.cts +5 -0
- package/node_modules/zod/v4/locales/hr.d.ts +4 -0
- package/node_modules/zod/v4/locales/hr.js +122 -0
- package/node_modules/zod/v4/locales/hu.cjs +135 -0
- package/node_modules/zod/v4/locales/hu.d.cts +5 -0
- package/node_modules/zod/v4/locales/hu.d.ts +4 -0
- package/node_modules/zod/v4/locales/hu.js +108 -0
- package/node_modules/zod/v4/locales/hy.cjs +174 -0
- package/node_modules/zod/v4/locales/hy.d.cts +5 -0
- package/node_modules/zod/v4/locales/hy.d.ts +4 -0
- package/node_modules/zod/v4/locales/hy.js +147 -0
- package/node_modules/zod/v4/locales/id.cjs +133 -0
- package/node_modules/zod/v4/locales/id.d.cts +5 -0
- package/node_modules/zod/v4/locales/id.d.ts +4 -0
- package/node_modules/zod/v4/locales/id.js +106 -0
- package/node_modules/zod/v4/locales/index.cjs +111 -0
- package/node_modules/zod/v4/locales/index.d.cts +52 -0
- package/node_modules/zod/v4/locales/index.d.ts +52 -0
- package/node_modules/zod/v4/locales/index.js +52 -0
- package/node_modules/zod/v4/locales/is.cjs +136 -0
- package/node_modules/zod/v4/locales/is.d.cts +5 -0
- package/node_modules/zod/v4/locales/is.d.ts +4 -0
- package/node_modules/zod/v4/locales/is.js +109 -0
- package/node_modules/zod/v4/locales/it.cjs +135 -0
- package/node_modules/zod/v4/locales/it.d.cts +5 -0
- package/node_modules/zod/v4/locales/it.d.ts +4 -0
- package/node_modules/zod/v4/locales/it.js +108 -0
- package/node_modules/zod/v4/locales/ja.cjs +134 -0
- package/node_modules/zod/v4/locales/ja.d.cts +5 -0
- package/node_modules/zod/v4/locales/ja.d.ts +4 -0
- package/node_modules/zod/v4/locales/ja.js +107 -0
- package/node_modules/zod/v4/locales/ka.cjs +139 -0
- package/node_modules/zod/v4/locales/ka.d.cts +5 -0
- package/node_modules/zod/v4/locales/ka.d.ts +4 -0
- package/node_modules/zod/v4/locales/ka.js +112 -0
- package/node_modules/zod/v4/locales/kh.cjs +12 -0
- package/node_modules/zod/v4/locales/kh.d.cts +5 -0
- package/node_modules/zod/v4/locales/kh.d.ts +5 -0
- package/node_modules/zod/v4/locales/kh.js +5 -0
- package/node_modules/zod/v4/locales/km.cjs +137 -0
- package/node_modules/zod/v4/locales/km.d.cts +5 -0
- package/node_modules/zod/v4/locales/km.d.ts +4 -0
- package/node_modules/zod/v4/locales/km.js +110 -0
- package/node_modules/zod/v4/locales/ko.cjs +138 -0
- package/node_modules/zod/v4/locales/ko.d.cts +5 -0
- package/node_modules/zod/v4/locales/ko.d.ts +4 -0
- package/node_modules/zod/v4/locales/ko.js +111 -0
- package/node_modules/zod/v4/locales/lt.cjs +230 -0
- package/node_modules/zod/v4/locales/lt.d.cts +5 -0
- package/node_modules/zod/v4/locales/lt.d.ts +4 -0
- package/node_modules/zod/v4/locales/lt.js +203 -0
- package/node_modules/zod/v4/locales/mk.cjs +136 -0
- package/node_modules/zod/v4/locales/mk.d.cts +5 -0
- package/node_modules/zod/v4/locales/mk.d.ts +4 -0
- package/node_modules/zod/v4/locales/mk.js +109 -0
- package/node_modules/zod/v4/locales/ms.cjs +134 -0
- package/node_modules/zod/v4/locales/ms.d.cts +5 -0
- package/node_modules/zod/v4/locales/ms.d.ts +4 -0
- package/node_modules/zod/v4/locales/ms.js +107 -0
- package/node_modules/zod/v4/locales/nl.cjs +137 -0
- package/node_modules/zod/v4/locales/nl.d.cts +5 -0
- package/node_modules/zod/v4/locales/nl.d.ts +4 -0
- package/node_modules/zod/v4/locales/nl.js +110 -0
- package/node_modules/zod/v4/locales/no.cjs +135 -0
- package/node_modules/zod/v4/locales/no.d.cts +5 -0
- package/node_modules/zod/v4/locales/no.d.ts +4 -0
- package/node_modules/zod/v4/locales/no.js +108 -0
- package/node_modules/zod/v4/locales/ota.cjs +136 -0
- package/node_modules/zod/v4/locales/ota.d.cts +5 -0
- package/node_modules/zod/v4/locales/ota.d.ts +4 -0
- package/node_modules/zod/v4/locales/ota.js +109 -0
- package/node_modules/zod/v4/locales/package.json +7 -0
- package/node_modules/zod/v4/locales/pl.cjs +136 -0
- package/node_modules/zod/v4/locales/pl.d.cts +5 -0
- package/node_modules/zod/v4/locales/pl.d.ts +4 -0
- package/node_modules/zod/v4/locales/pl.js +109 -0
- package/node_modules/zod/v4/locales/ps.cjs +141 -0
- package/node_modules/zod/v4/locales/ps.d.cts +5 -0
- package/node_modules/zod/v4/locales/ps.d.ts +4 -0
- package/node_modules/zod/v4/locales/ps.js +114 -0
- package/node_modules/zod/v4/locales/pt.cjs +135 -0
- package/node_modules/zod/v4/locales/pt.d.cts +5 -0
- package/node_modules/zod/v4/locales/pt.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt.js +108 -0
- package/node_modules/zod/v4/locales/ro.cjs +146 -0
- package/node_modules/zod/v4/locales/ro.d.cts +5 -0
- package/node_modules/zod/v4/locales/ro.d.ts +4 -0
- package/node_modules/zod/v4/locales/ro.js +119 -0
- package/node_modules/zod/v4/locales/ru.cjs +183 -0
- package/node_modules/zod/v4/locales/ru.d.cts +5 -0
- package/node_modules/zod/v4/locales/ru.d.ts +4 -0
- package/node_modules/zod/v4/locales/ru.js +156 -0
- package/node_modules/zod/v4/locales/sl.cjs +136 -0
- package/node_modules/zod/v4/locales/sl.d.cts +5 -0
- package/node_modules/zod/v4/locales/sl.d.ts +4 -0
- package/node_modules/zod/v4/locales/sl.js +109 -0
- package/node_modules/zod/v4/locales/sv.cjs +137 -0
- package/node_modules/zod/v4/locales/sv.d.cts +5 -0
- package/node_modules/zod/v4/locales/sv.d.ts +4 -0
- package/node_modules/zod/v4/locales/sv.js +110 -0
- package/node_modules/zod/v4/locales/ta.cjs +137 -0
- package/node_modules/zod/v4/locales/ta.d.cts +5 -0
- package/node_modules/zod/v4/locales/ta.d.ts +4 -0
- package/node_modules/zod/v4/locales/ta.js +110 -0
- package/node_modules/zod/v4/locales/th.cjs +137 -0
- package/node_modules/zod/v4/locales/th.d.cts +5 -0
- package/node_modules/zod/v4/locales/th.d.ts +4 -0
- package/node_modules/zod/v4/locales/th.js +110 -0
- package/node_modules/zod/v4/locales/tr.cjs +132 -0
- package/node_modules/zod/v4/locales/tr.d.cts +5 -0
- package/node_modules/zod/v4/locales/tr.d.ts +4 -0
- package/node_modules/zod/v4/locales/tr.js +105 -0
- package/node_modules/zod/v4/locales/ua.cjs +12 -0
- package/node_modules/zod/v4/locales/ua.d.cts +5 -0
- package/node_modules/zod/v4/locales/ua.d.ts +5 -0
- package/node_modules/zod/v4/locales/ua.js +5 -0
- package/node_modules/zod/v4/locales/uk.cjs +135 -0
- package/node_modules/zod/v4/locales/uk.d.cts +5 -0
- package/node_modules/zod/v4/locales/uk.d.ts +4 -0
- package/node_modules/zod/v4/locales/uk.js +108 -0
- package/node_modules/zod/v4/locales/ur.cjs +137 -0
- package/node_modules/zod/v4/locales/ur.d.cts +5 -0
- package/node_modules/zod/v4/locales/ur.d.ts +4 -0
- package/node_modules/zod/v4/locales/ur.js +110 -0
- package/node_modules/zod/v4/locales/uz.cjs +137 -0
- package/node_modules/zod/v4/locales/uz.d.cts +5 -0
- package/node_modules/zod/v4/locales/uz.d.ts +4 -0
- package/node_modules/zod/v4/locales/uz.js +110 -0
- package/node_modules/zod/v4/locales/vi.cjs +135 -0
- package/node_modules/zod/v4/locales/vi.d.cts +5 -0
- package/node_modules/zod/v4/locales/vi.d.ts +4 -0
- package/node_modules/zod/v4/locales/vi.js +108 -0
- package/node_modules/zod/v4/locales/yo.cjs +134 -0
- package/node_modules/zod/v4/locales/yo.d.cts +5 -0
- package/node_modules/zod/v4/locales/yo.d.ts +4 -0
- package/node_modules/zod/v4/locales/yo.js +107 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +136 -0
- package/node_modules/zod/v4/locales/zh-CN.d.cts +5 -0
- package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
- package/node_modules/zod/v4/locales/zh-CN.js +109 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +134 -0
- package/node_modules/zod/v4/locales/zh-TW.d.cts +5 -0
- package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
- package/node_modules/zod/v4/locales/zh-TW.js +107 -0
- package/node_modules/zod/v4/mini/checks.cjs +34 -0
- package/node_modules/zod/v4/mini/checks.d.cts +1 -0
- package/node_modules/zod/v4/mini/checks.d.ts +1 -0
- package/node_modules/zod/v4/mini/checks.js +1 -0
- package/node_modules/zod/v4/mini/coerce.cjs +52 -0
- package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
- package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
- package/node_modules/zod/v4/mini/coerce.js +22 -0
- package/node_modules/zod/v4/mini/external.cjs +63 -0
- package/node_modules/zod/v4/mini/external.d.cts +13 -0
- package/node_modules/zod/v4/mini/external.d.ts +13 -0
- package/node_modules/zod/v4/mini/external.js +14 -0
- package/node_modules/zod/v4/mini/index.cjs +32 -0
- package/node_modules/zod/v4/mini/index.d.cts +3 -0
- package/node_modules/zod/v4/mini/index.d.ts +3 -0
- package/node_modules/zod/v4/mini/index.js +3 -0
- package/node_modules/zod/v4/mini/iso.cjs +64 -0
- package/node_modules/zod/v4/mini/iso.d.cts +22 -0
- package/node_modules/zod/v4/mini/iso.d.ts +22 -0
- package/node_modules/zod/v4/mini/iso.js +34 -0
- package/node_modules/zod/v4/mini/package.json +7 -0
- package/node_modules/zod/v4/mini/parse.cjs +16 -0
- package/node_modules/zod/v4/mini/parse.d.cts +1 -0
- package/node_modules/zod/v4/mini/parse.d.ts +1 -0
- package/node_modules/zod/v4/mini/parse.js +1 -0
- package/node_modules/zod/v4/mini/schemas.cjs +1083 -0
- package/node_modules/zod/v4/mini/schemas.d.cts +445 -0
- package/node_modules/zod/v4/mini/schemas.d.ts +445 -0
- package/node_modules/zod/v4/mini/schemas.js +961 -0
- package/node_modules/zod/v4/package.json +7 -0
- package/node_modules/zod/v4-mini/index.cjs +32 -0
- package/node_modules/zod/v4-mini/index.d.cts +3 -0
- package/node_modules/zod/v4-mini/index.d.ts +3 -0
- package/node_modules/zod/v4-mini/index.js +3 -0
- package/node_modules/zod/v4-mini/package.json +7 -0
- package/npm-shrinkwrap.json +66 -0
- package/openclaw.plugin.json +42 -0
- package/package.json +59 -10
package/dist/index.js
ADDED
|
@@ -0,0 +1,1323 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
3
|
+
import * as path$1 from "node:path";
|
|
4
|
+
import path, { posix, win32 } from "node:path";
|
|
5
|
+
import { buildPluginConfigSchema } from "openclaw/plugin-sdk/core";
|
|
6
|
+
import { formatPluginConfigIssue, mapPluginConfigIssues } from "openclaw/plugin-sdk/extension-shared";
|
|
7
|
+
import { MAX_TIMER_TIMEOUT_SECONDS } from "openclaw/plugin-sdk/number-runtime";
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
import { createWritableRenameTargetResolver, registerSandboxBackend, resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/sandbox";
|
|
10
|
+
import * as fs$1 from "node:fs";
|
|
11
|
+
import fs, { lstatSync, mkdtempSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
12
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
13
|
+
import { runCommandBuffered } from "openclaw/plugin-sdk/process-runtime";
|
|
14
|
+
import { removePathWithinRoot, root } from "openclaw/plugin-sdk/file-access-runtime";
|
|
15
|
+
import { isPathInside } from "openclaw/plugin-sdk/security-runtime";
|
|
16
|
+
import { fileURLToPath } from "node:url";
|
|
17
|
+
import { execFileSync } from "node:child_process";
|
|
18
|
+
//#region extensions/mxc/src/config.ts
|
|
19
|
+
const MXC_CONTAINMENTS = ["process", "processcontainer"];
|
|
20
|
+
const MXC_NETWORK_MODES = ["none", "default"];
|
|
21
|
+
const DEFAULT_CONTAINMENT = "process";
|
|
22
|
+
const DEFAULT_NETWORK = "none";
|
|
23
|
+
const DEFAULT_TIMEOUT_SECONDS = 120;
|
|
24
|
+
const DEFAULT_DEBUG = false;
|
|
25
|
+
const nonEmptyTrimmedString = (message) => z.string({ error: message }).trim().min(1, { error: message });
|
|
26
|
+
const MxcPluginConfigSchema = z.strictObject({
|
|
27
|
+
mxcBinaryPath: nonEmptyTrimmedString("mxcBinaryPath must be a non-empty string").optional(),
|
|
28
|
+
containment: z.enum(MXC_CONTAINMENTS, { error: `containment must be one of ${MXC_CONTAINMENTS.join(", ")}` }).optional(),
|
|
29
|
+
network: z.enum(MXC_NETWORK_MODES, { error: `network must be one of ${MXC_NETWORK_MODES.join(", ")}` }).optional(),
|
|
30
|
+
timeoutSeconds: z.number({ error: `timeoutSeconds must be a number between 1 and ${MAX_TIMER_TIMEOUT_SECONDS}` }).min(1, { error: "timeoutSeconds must be a number >= 1" }).max(MAX_TIMER_TIMEOUT_SECONDS, { error: `timeoutSeconds must be a number <= ${MAX_TIMER_TIMEOUT_SECONDS}` }).optional(),
|
|
31
|
+
debug: z.boolean({ error: "debug must be a boolean" }).optional(),
|
|
32
|
+
mxcPolicyPaths: z.array(nonEmptyTrimmedString("mxcPolicyPaths must be an array of non-empty strings"), { error: "mxcPolicyPaths must be an array of non-empty strings" }).optional()
|
|
33
|
+
});
|
|
34
|
+
function createMxcPluginConfigSchema() {
|
|
35
|
+
return buildPluginConfigSchema(MxcPluginConfigSchema, { safeParse(value) {
|
|
36
|
+
if (value === void 0) return {
|
|
37
|
+
success: true,
|
|
38
|
+
data: void 0
|
|
39
|
+
};
|
|
40
|
+
const parsed = MxcPluginConfigSchema.safeParse(value);
|
|
41
|
+
if (parsed.success) return {
|
|
42
|
+
success: true,
|
|
43
|
+
data: parsed.data
|
|
44
|
+
};
|
|
45
|
+
return {
|
|
46
|
+
success: false,
|
|
47
|
+
error: { issues: mapPluginConfigIssues(parsed.error.issues) }
|
|
48
|
+
};
|
|
49
|
+
} });
|
|
50
|
+
}
|
|
51
|
+
function resolveConfig(value) {
|
|
52
|
+
if (value === void 0) return {
|
|
53
|
+
mxcBinaryPath: void 0,
|
|
54
|
+
containment: DEFAULT_CONTAINMENT,
|
|
55
|
+
network: DEFAULT_NETWORK,
|
|
56
|
+
timeoutSeconds: DEFAULT_TIMEOUT_SECONDS,
|
|
57
|
+
debug: DEFAULT_DEBUG
|
|
58
|
+
};
|
|
59
|
+
const parsed = MxcPluginConfigSchema.safeParse(value);
|
|
60
|
+
if (!parsed.success) {
|
|
61
|
+
const message = formatPluginConfigIssue(parsed.error.issues[0]);
|
|
62
|
+
throw new Error(`Invalid mxc plugin config: ${message}`);
|
|
63
|
+
}
|
|
64
|
+
const config = parsed.data;
|
|
65
|
+
const resolved = {
|
|
66
|
+
mxcBinaryPath: config.mxcBinaryPath,
|
|
67
|
+
containment: config.containment ?? DEFAULT_CONTAINMENT,
|
|
68
|
+
network: config.network ?? DEFAULT_NETWORK,
|
|
69
|
+
timeoutSeconds: config.timeoutSeconds ?? DEFAULT_TIMEOUT_SECONDS,
|
|
70
|
+
debug: config.debug ?? DEFAULT_DEBUG,
|
|
71
|
+
mxcPolicyPaths: resolveMxcPolicyPaths(config.mxcPolicyPaths)
|
|
72
|
+
};
|
|
73
|
+
if (config.timeoutSeconds !== void 0) resolved.timeoutSecondsConfigured = true;
|
|
74
|
+
return resolved;
|
|
75
|
+
}
|
|
76
|
+
function resolveMxcPolicyPaths(value) {
|
|
77
|
+
if (value === void 0) return;
|
|
78
|
+
return value.map((entry, index) => {
|
|
79
|
+
if (!isAbsolutePath(entry)) throw new Error(`Invalid mxc plugin config: mxcPolicyPaths[${index}] must be an absolute path`);
|
|
80
|
+
return entry;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function isAbsolutePath(value) {
|
|
84
|
+
return win32.isAbsolute(value) || posix.isAbsolute(value);
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region extensions/mxc/src/binary-resolver.ts
|
|
88
|
+
/**
|
|
89
|
+
* Resolve the bin/ directory inside the installed @microsoft/mxc-sdk package.
|
|
90
|
+
* Returns the arch-specific subdirectory (x64 or arm64) if available.
|
|
91
|
+
*/
|
|
92
|
+
function resolveSdkBinDir() {
|
|
93
|
+
try {
|
|
94
|
+
const sdkPkgPath = createRequire(import.meta.url).resolve("@microsoft/mxc-sdk/package.json");
|
|
95
|
+
const sdkRoot = path$1.dirname(sdkPkgPath);
|
|
96
|
+
const arch = process.arch === "arm64" ? "arm64" : "x64";
|
|
97
|
+
const archBin = path$1.join(sdkRoot, "bin", arch);
|
|
98
|
+
if (fs$1.existsSync(archBin)) return archBin;
|
|
99
|
+
const flatBin = path$1.join(sdkRoot, "bin");
|
|
100
|
+
if (fs$1.existsSync(flatBin)) return flatBin;
|
|
101
|
+
} catch {}
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
function buildSearchPaths(binary, sdkBinDir) {
|
|
105
|
+
return sdkBinDir ? [path$1.join(sdkBinDir, binary)] : [];
|
|
106
|
+
}
|
|
107
|
+
/** SDK-owned search paths for wxc-exec on Windows. */
|
|
108
|
+
function wxcSearchPaths() {
|
|
109
|
+
return buildSearchPaths("wxc-exec.exe", resolveSdkBinDir());
|
|
110
|
+
}
|
|
111
|
+
function findBinary(searchPaths) {
|
|
112
|
+
for (const p of searchPaths) if (fs$1.existsSync(p)) return p;
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Resolves the MXC executor binary path.
|
|
117
|
+
* @param configOverride Optional user-configured path override.
|
|
118
|
+
* @returns Absolute path to the binary.
|
|
119
|
+
* @throws If the binary cannot be found.
|
|
120
|
+
*/
|
|
121
|
+
function resolveMxcBinaryPath(configOverride) {
|
|
122
|
+
if (configOverride) {
|
|
123
|
+
const resolvedOverride = path$1.win32.isAbsolute(configOverride) ? configOverride : path$1.resolve(configOverride);
|
|
124
|
+
if (!fs$1.existsSync(resolvedOverride)) throw new Error(`MXC binary not found at configured path: ${configOverride}`);
|
|
125
|
+
return resolvedOverride;
|
|
126
|
+
}
|
|
127
|
+
const binaryName = "wxc-exec.exe";
|
|
128
|
+
const found = findBinary(wxcSearchPaths());
|
|
129
|
+
if (!found) throw new Error(`MXC executor "${binaryName}" not found. Install @microsoft/mxc-sdk or set mxcBinaryPath in config.`);
|
|
130
|
+
return found;
|
|
131
|
+
}
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region extensions/mxc/src/workspace-skill-mounts.ts
|
|
134
|
+
const MATERIALIZED_SANDBOX_SKILLS_WORKSPACE_PARTS = [".openclaw", "sandbox-skills"];
|
|
135
|
+
function containerJoin(root, ...parts) {
|
|
136
|
+
const normalizedRoot = root.endsWith("/") && root !== "/" ? root.slice(0, -1) : root;
|
|
137
|
+
const suffix = parts.map((part) => part.replace(/^\/+|\/+$/g, "")).filter(Boolean).join("/");
|
|
138
|
+
return suffix ? `${normalizedRoot}/${suffix}` : normalizedRoot;
|
|
139
|
+
}
|
|
140
|
+
function resolveMaterializedSandboxSkillsWorkspaceDir(rootDir) {
|
|
141
|
+
return path.join(rootDir, ...MATERIALIZED_SANDBOX_SKILLS_WORKSPACE_PARTS);
|
|
142
|
+
}
|
|
143
|
+
function isExistingMxcSkillMountSource(params) {
|
|
144
|
+
try {
|
|
145
|
+
if (!lstatSync(params.hostPath).isDirectory()) return false;
|
|
146
|
+
return isPathInside(realpathSync(path.resolve(params.rootDir)), realpathSync(path.resolve(params.hostPath)));
|
|
147
|
+
} catch {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function resolveMxcReadOnlySkillMounts(params) {
|
|
152
|
+
if (params.workspaceAccess !== "rw") return [];
|
|
153
|
+
const materializedSkillsWorkspaceDir = params.skillsWorkspaceDir ?? resolveMaterializedSandboxSkillsWorkspaceDir(params.agentWorkspaceDir);
|
|
154
|
+
return [
|
|
155
|
+
{
|
|
156
|
+
hostPath: path.join(params.agentWorkspaceDir, "skills"),
|
|
157
|
+
containerPath: containerJoin(params.workdir, "skills"),
|
|
158
|
+
rootDir: params.agentWorkspaceDir
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
hostPath: path.join(params.agentWorkspaceDir, ".agents", "skills"),
|
|
162
|
+
containerPath: containerJoin(params.workdir, ".agents", "skills"),
|
|
163
|
+
rootDir: params.agentWorkspaceDir
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
hostPath: path.join(materializedSkillsWorkspaceDir, "skills"),
|
|
167
|
+
containerPath: containerJoin(params.workdir, ...MATERIALIZED_SANDBOX_SKILLS_WORKSPACE_PARTS, "skills"),
|
|
168
|
+
rootDir: materializedSkillsWorkspaceDir
|
|
169
|
+
}
|
|
170
|
+
].filter((mount) => isExistingMxcSkillMountSource({
|
|
171
|
+
rootDir: mount.rootDir,
|
|
172
|
+
hostPath: mount.hostPath
|
|
173
|
+
})).map(({ hostPath, containerPath }) => ({
|
|
174
|
+
hostPath,
|
|
175
|
+
containerPath
|
|
176
|
+
}));
|
|
177
|
+
}
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region extensions/mxc/src/fs-bridge.ts
|
|
180
|
+
function createMxcFsBridge(params) {
|
|
181
|
+
return new MxcFsBridge(params.sandbox);
|
|
182
|
+
}
|
|
183
|
+
var MxcFsBridge = class {
|
|
184
|
+
constructor(sandbox) {
|
|
185
|
+
this.sandbox = sandbox;
|
|
186
|
+
this.defaultContainerRoot = path.resolve(this.sandbox.containerWorkdir);
|
|
187
|
+
this.protectedSkillMounts = resolveMxcProtectedSkillMounts$1(this.sandbox);
|
|
188
|
+
this.workspaceMounts = resolveWorkspaceMounts(this.sandbox);
|
|
189
|
+
this.resolveRenameTargets = createWritableRenameTargetResolver((target) => this.resolveTarget(target), (target, action) => this.ensureWritable(target, action));
|
|
190
|
+
}
|
|
191
|
+
resolvePath(params) {
|
|
192
|
+
const target = this.resolveTarget(params);
|
|
193
|
+
return {
|
|
194
|
+
hostPath: target.hostPath,
|
|
195
|
+
relativePath: target.relativePath,
|
|
196
|
+
containerPath: target.containerPath
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
async readFile(params) {
|
|
200
|
+
const target = this.resolveTarget(params);
|
|
201
|
+
return await (await root(target.mount.hostRoot)).readBytes(target.mountRelativePath, { hardlinks: "reject" });
|
|
202
|
+
}
|
|
203
|
+
async writeFile(params) {
|
|
204
|
+
const target = this.resolveTarget(params);
|
|
205
|
+
this.ensureWritable(target, "write files");
|
|
206
|
+
const buffer = Buffer.isBuffer(params.data) ? params.data : Buffer.from(params.data, params.encoding ?? "utf8");
|
|
207
|
+
await (await root(target.mount.hostRoot)).write(target.mountRelativePath, buffer, { mkdir: params.mkdir !== false });
|
|
208
|
+
}
|
|
209
|
+
async mkdirp(params) {
|
|
210
|
+
const target = this.resolveTarget(params);
|
|
211
|
+
this.ensureWritable(target, "create directories");
|
|
212
|
+
if (target.mountRelativePath.length === 0) return;
|
|
213
|
+
await (await root(target.mount.hostRoot)).mkdir(target.mountRelativePath);
|
|
214
|
+
}
|
|
215
|
+
async remove(params) {
|
|
216
|
+
const target = this.resolveTarget(params);
|
|
217
|
+
this.ensureWritable(target, "remove files");
|
|
218
|
+
await removePathWithinRoot({
|
|
219
|
+
rootDir: target.mount.hostRoot,
|
|
220
|
+
relativePath: target.mountRelativePath,
|
|
221
|
+
recursive: params.recursive,
|
|
222
|
+
force: params.force ?? false
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
async rename(params) {
|
|
226
|
+
const { from: source, to: target } = this.resolveRenameTargets(params);
|
|
227
|
+
if (!isSameMountRoot(source.mount.hostRoot, target.mount.hostRoot)) throw new Error(`Sandbox rename must stay within the same mounted root: ${source.containerPath} -> ${target.containerPath}`);
|
|
228
|
+
const root$1 = await root(source.mount.hostRoot);
|
|
229
|
+
const targetParent = resolveRelativeParentPath(target.mountRelativePath);
|
|
230
|
+
if (targetParent) await root$1.mkdir(targetParent);
|
|
231
|
+
await root$1.move(source.mountRelativePath, target.mountRelativePath, { overwrite: true });
|
|
232
|
+
}
|
|
233
|
+
async stat(params) {
|
|
234
|
+
const target = this.resolveTarget(params);
|
|
235
|
+
const root$2 = await root(target.mount.hostRoot);
|
|
236
|
+
if (!await root$2.exists(target.mountRelativePath)) return null;
|
|
237
|
+
const stats = await root$2.stat(target.mountRelativePath);
|
|
238
|
+
return {
|
|
239
|
+
type: stats.isDirectory ? "directory" : stats.isFile ? "file" : "other",
|
|
240
|
+
size: stats.size,
|
|
241
|
+
mtimeMs: stats.mtimeMs
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
resolveTarget(params) {
|
|
245
|
+
const input = params.filePath.trim();
|
|
246
|
+
const cwd = params.cwd?.trim() ? path.resolve(params.cwd) : this.defaultContainerRoot;
|
|
247
|
+
const containerPath = path.isAbsolute(input) ? path.resolve(input) : path.resolve(cwd, input);
|
|
248
|
+
return this.resolveMountedTarget(containerPath, this.protectedSkillMounts) ?? this.resolveMountedTarget(containerPath, this.workspaceMounts) ?? this.throwSandboxRootEscape(params.filePath);
|
|
249
|
+
}
|
|
250
|
+
resolveMountedTarget(containerPath, mounts) {
|
|
251
|
+
for (const mount of mounts) {
|
|
252
|
+
if (!isPathInside(mount.containerRoot, containerPath)) continue;
|
|
253
|
+
const mountRelativePath = path.relative(mount.containerRoot, containerPath);
|
|
254
|
+
return {
|
|
255
|
+
hostPath: path.join(mount.hostRoot, mountRelativePath),
|
|
256
|
+
relativePath: mountRelativePath,
|
|
257
|
+
containerPath,
|
|
258
|
+
mount,
|
|
259
|
+
mountRelativePath,
|
|
260
|
+
writable: mount.writable
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
return null;
|
|
264
|
+
}
|
|
265
|
+
throwSandboxRootEscape(filePath) {
|
|
266
|
+
const allowedRoots = [...new Set(this.workspaceMounts.map((mount) => mount.containerRoot))].join(", ");
|
|
267
|
+
throw new Error(`Path escapes sandbox root (${allowedRoots}; container root ${this.sandbox.containerWorkdir}): ${filePath}. Use a path under ${this.sandbox.containerWorkdir}\\ instead.`);
|
|
268
|
+
}
|
|
269
|
+
ensureWritable(target, action) {
|
|
270
|
+
if (!target.writable) throw new Error(`Sandbox path is read-only; cannot ${action}: ${target.containerPath}`);
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
function resolveWorkspaceMounts(sandbox) {
|
|
274
|
+
const containerRoot = path.resolve(sandbox.containerWorkdir);
|
|
275
|
+
const workspaceDir = path.resolve(sandbox.workspaceDir);
|
|
276
|
+
const agentWorkspaceDir = path.resolve(sandbox.agentWorkspaceDir);
|
|
277
|
+
const mounts = sandbox.workspaceAccess === "rw" ? [{
|
|
278
|
+
hostRoot: agentWorkspaceDir,
|
|
279
|
+
containerRoot,
|
|
280
|
+
writable: true
|
|
281
|
+
}] : [{
|
|
282
|
+
hostRoot: workspaceDir,
|
|
283
|
+
containerRoot,
|
|
284
|
+
writable: false
|
|
285
|
+
}];
|
|
286
|
+
if (sandbox.workspaceAccess === "ro" && normalizePathForComparison$1(agentWorkspaceDir) !== normalizePathForComparison$1(workspaceDir)) mounts.push({
|
|
287
|
+
hostRoot: agentWorkspaceDir,
|
|
288
|
+
containerRoot: agentWorkspaceDir,
|
|
289
|
+
writable: false
|
|
290
|
+
});
|
|
291
|
+
return dedupeAndSortMounts(mounts);
|
|
292
|
+
}
|
|
293
|
+
function resolveMxcProtectedSkillMounts$1(sandbox) {
|
|
294
|
+
return dedupeAndSortMounts(resolveMxcReadOnlySkillMounts({
|
|
295
|
+
agentWorkspaceDir: sandbox.agentWorkspaceDir,
|
|
296
|
+
skillsWorkspaceDir: sandbox.skillsWorkspaceDir,
|
|
297
|
+
workdir: sandbox.containerWorkdir,
|
|
298
|
+
workspaceAccess: sandbox.workspaceAccess
|
|
299
|
+
}).map(normalizeMxcProtectedSkillMount));
|
|
300
|
+
}
|
|
301
|
+
function normalizeMxcProtectedSkillMount(mount) {
|
|
302
|
+
return {
|
|
303
|
+
hostRoot: path.resolve(mount.hostPath),
|
|
304
|
+
containerRoot: path.resolve(mount.containerPath),
|
|
305
|
+
writable: false
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
function dedupeAndSortMounts(mounts) {
|
|
309
|
+
const deduped = /* @__PURE__ */ new Map();
|
|
310
|
+
for (const mount of mounts) {
|
|
311
|
+
const key = `${normalizePathForComparison$1(mount.hostRoot)}::${normalizePathForComparison$1(mount.containerRoot)}`;
|
|
312
|
+
if (!deduped.has(key)) deduped.set(key, mount);
|
|
313
|
+
}
|
|
314
|
+
return [...deduped.values()].toSorted((left, right) => {
|
|
315
|
+
const lengthDiff = right.containerRoot.length - left.containerRoot.length;
|
|
316
|
+
if (lengthDiff !== 0) return lengthDiff;
|
|
317
|
+
return right.hostRoot.length - left.hostRoot.length;
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
function resolveRelativeParentPath(relativePath) {
|
|
321
|
+
const parent = path.dirname(relativePath);
|
|
322
|
+
return parent === "." || parent === "" ? null : parent;
|
|
323
|
+
}
|
|
324
|
+
function isSameMountRoot(first, second) {
|
|
325
|
+
return normalizePathForComparison$1(first) === normalizePathForComparison$1(second);
|
|
326
|
+
}
|
|
327
|
+
function normalizePathForComparison$1(value) {
|
|
328
|
+
const resolved = path.resolve(value);
|
|
329
|
+
return process.platform === "win32" ? resolved.toLowerCase() : resolved;
|
|
330
|
+
}
|
|
331
|
+
//#endregion
|
|
332
|
+
//#region extensions/mxc/src/sandbox-baseline.ts
|
|
333
|
+
/**
|
|
334
|
+
* Deterministic MXC sandbox baseline policy helpers.
|
|
335
|
+
*
|
|
336
|
+
* These helpers only include policy surfaces the Windows ProcessContainer path
|
|
337
|
+
* currently enforces: workspace/read-only/read-write paths and process timeout.
|
|
338
|
+
*/
|
|
339
|
+
const BASELINE_TIMEOUT_SECONDS = 300;
|
|
340
|
+
const DEFAULT_SANDBOX_BASELINE = {
|
|
341
|
+
filesystem: {
|
|
342
|
+
restrictToProjectDir: true,
|
|
343
|
+
additionalReadonlyPaths: [],
|
|
344
|
+
additionalReadwritePaths: []
|
|
345
|
+
},
|
|
346
|
+
process: {
|
|
347
|
+
timeoutSeconds: BASELINE_TIMEOUT_SECONDS,
|
|
348
|
+
timeoutSecondsConfigured: false
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
function resolveSandboxBaseline(input = {}) {
|
|
352
|
+
const timeoutSecondsConfigured = input.process?.timeoutSeconds !== void 0;
|
|
353
|
+
const timeoutSeconds = input.process?.timeoutSeconds ?? BASELINE_TIMEOUT_SECONDS;
|
|
354
|
+
if (!Number.isFinite(timeoutSeconds) || timeoutSeconds < 1) throw new RangeError("Sandbox baseline timeoutSeconds must be at least 1.");
|
|
355
|
+
return {
|
|
356
|
+
filesystem: {
|
|
357
|
+
restrictToProjectDir: input.filesystem?.restrictToProjectDir ?? true,
|
|
358
|
+
additionalReadonlyPaths: [...input.filesystem?.additionalReadonlyPaths ?? []],
|
|
359
|
+
additionalReadwritePaths: [...input.filesystem?.additionalReadwritePaths ?? []]
|
|
360
|
+
},
|
|
361
|
+
process: {
|
|
362
|
+
timeoutSeconds,
|
|
363
|
+
timeoutSecondsConfigured
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
function resolveSandboxTempDir(env = {}) {
|
|
368
|
+
return env.TEMP ?? env.TMP ?? "C:\\Windows\\Temp";
|
|
369
|
+
}
|
|
370
|
+
function resolveBaselineReadonlyPaths(env) {
|
|
371
|
+
const systemRoot = env.SystemRoot ?? env.WINDIR ?? "C:\\Windows";
|
|
372
|
+
return dedupeStable([
|
|
373
|
+
env.ProgramFiles ?? env.ProgramW6432 ?? "C:\\Program Files",
|
|
374
|
+
env["ProgramFiles(x86)"] ?? "C:\\Program Files (x86)",
|
|
375
|
+
win32.join(systemRoot, "System32"),
|
|
376
|
+
win32.join(systemRoot, "SysWOW64")
|
|
377
|
+
]);
|
|
378
|
+
}
|
|
379
|
+
function dedupeStable(values) {
|
|
380
|
+
const deduped = [];
|
|
381
|
+
const seen = /* @__PURE__ */ new Set();
|
|
382
|
+
for (const value of values) {
|
|
383
|
+
if (seen.has(value)) continue;
|
|
384
|
+
seen.add(value);
|
|
385
|
+
deduped.push(value);
|
|
386
|
+
}
|
|
387
|
+
return deduped;
|
|
388
|
+
}
|
|
389
|
+
//#endregion
|
|
390
|
+
//#region extensions/mxc/src/windows-command.ts
|
|
391
|
+
function resolveCmdShell() {
|
|
392
|
+
return process.env.ComSpec?.trim() || "cmd.exe";
|
|
393
|
+
}
|
|
394
|
+
function buildCommandLine(commandScript, args) {
|
|
395
|
+
const shell = resolveCmdShell();
|
|
396
|
+
if (args.length === 0) return `${shell} /d /s /c "${commandScript}"`;
|
|
397
|
+
const escapedArgs = args.map(cmdArgumentEscape).join(" ");
|
|
398
|
+
return `${shell} /d /s /c "${cmdArgumentEscape(commandScript)} ${escapedArgs}"`;
|
|
399
|
+
}
|
|
400
|
+
function cmdArgumentEscape(value) {
|
|
401
|
+
return `"${value.replaceAll("^", "^^").replaceAll("%", "%%").replaceAll(`"`, `""`)}"`;
|
|
402
|
+
}
|
|
403
|
+
function createWindowsCommandBridge(params) {
|
|
404
|
+
if (!params.args || params.args.length === 0) return {
|
|
405
|
+
command: params.script,
|
|
406
|
+
cleanup: () => {}
|
|
407
|
+
};
|
|
408
|
+
const bridgeDir = mkdtempSync(path.join(params.tempDir, ".openclaw-mxc-cmd-"));
|
|
409
|
+
const commandFile = path.join(bridgeDir, `${randomBytes(8).toString("hex")}.cmd`);
|
|
410
|
+
try {
|
|
411
|
+
writeFileSync(commandFile, `@echo off\r\n${params.script}`, {
|
|
412
|
+
flag: "wx",
|
|
413
|
+
mode: 384
|
|
414
|
+
});
|
|
415
|
+
} catch (err) {
|
|
416
|
+
rmSync(bridgeDir, {
|
|
417
|
+
force: true,
|
|
418
|
+
recursive: true
|
|
419
|
+
});
|
|
420
|
+
throw err;
|
|
421
|
+
}
|
|
422
|
+
return {
|
|
423
|
+
command: commandFile,
|
|
424
|
+
cleanup: () => rmSync(bridgeDir, {
|
|
425
|
+
force: true,
|
|
426
|
+
recursive: true
|
|
427
|
+
})
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
//#endregion
|
|
431
|
+
//#region extensions/mxc/src/windows-env.ts
|
|
432
|
+
const WINDOWS_PROCESS_ENV_DEFAULT_KEYS = [
|
|
433
|
+
"SystemRoot",
|
|
434
|
+
"SystemDrive",
|
|
435
|
+
"ComSpec",
|
|
436
|
+
"WINDIR",
|
|
437
|
+
"PATH",
|
|
438
|
+
"PATHEXT",
|
|
439
|
+
"TEMP",
|
|
440
|
+
"TMP",
|
|
441
|
+
"USERPROFILE",
|
|
442
|
+
"APPDATA",
|
|
443
|
+
"LOCALAPPDATA",
|
|
444
|
+
"ProgramData",
|
|
445
|
+
"ALLUSERSPROFILE",
|
|
446
|
+
"ProgramFiles",
|
|
447
|
+
"ProgramFiles(x86)",
|
|
448
|
+
"ProgramW6432",
|
|
449
|
+
"CommonProgramFiles",
|
|
450
|
+
"CommonProgramFiles(x86)",
|
|
451
|
+
"CommonProgramW6432",
|
|
452
|
+
"PUBLIC",
|
|
453
|
+
"HOMEDRIVE",
|
|
454
|
+
"HOMEPATH",
|
|
455
|
+
"USERNAME",
|
|
456
|
+
"USERDOMAIN",
|
|
457
|
+
"COMPUTERNAME",
|
|
458
|
+
"OS",
|
|
459
|
+
"PROCESSOR_ARCHITECTURE",
|
|
460
|
+
"PROCESSOR_IDENTIFIER",
|
|
461
|
+
"PROCESSOR_LEVEL",
|
|
462
|
+
"PROCESSOR_REVISION",
|
|
463
|
+
"NUMBER_OF_PROCESSORS"
|
|
464
|
+
];
|
|
465
|
+
const LAUNCHER_ENV_KEYS = [
|
|
466
|
+
"SystemRoot",
|
|
467
|
+
"SystemDrive",
|
|
468
|
+
"ComSpec",
|
|
469
|
+
"WINDIR",
|
|
470
|
+
"PATH",
|
|
471
|
+
"PATHEXT",
|
|
472
|
+
"TEMP",
|
|
473
|
+
"TMP",
|
|
474
|
+
"USERPROFILE",
|
|
475
|
+
"APPDATA",
|
|
476
|
+
"LOCALAPPDATA",
|
|
477
|
+
"ProgramFiles",
|
|
478
|
+
"ProgramFiles(x86)",
|
|
479
|
+
"ProgramW6432"
|
|
480
|
+
];
|
|
481
|
+
function getEnvValueCaseInsensitive(env, key) {
|
|
482
|
+
const exact = env[key];
|
|
483
|
+
if (exact !== void 0) return exact;
|
|
484
|
+
const normalizedKey = key.toLowerCase();
|
|
485
|
+
return Object.entries(env).find(([candidate]) => candidate.toLowerCase() === normalizedKey)?.[1];
|
|
486
|
+
}
|
|
487
|
+
function setCaseInsensitiveEnvEntry(entries, key, value) {
|
|
488
|
+
if (!key || key.includes("=") || value === void 0) return;
|
|
489
|
+
entries.set(key.toLowerCase(), {
|
|
490
|
+
key,
|
|
491
|
+
value
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
function normalizeWindowsProcessEnvRecord(callerEnv, hostEnv = process.env) {
|
|
495
|
+
const entries = /* @__PURE__ */ new Map();
|
|
496
|
+
for (const key of WINDOWS_PROCESS_ENV_DEFAULT_KEYS) setCaseInsensitiveEnvEntry(entries, key, getEnvValueCaseInsensitive(hostEnv, key));
|
|
497
|
+
for (const [key, value] of Object.entries(callerEnv)) setCaseInsensitiveEnvEntry(entries, key, value);
|
|
498
|
+
return [...entries.values()].toSorted((a, b) => a.key.localeCompare(b.key)).map(({ key, value }) => `${key}=${value}`);
|
|
499
|
+
}
|
|
500
|
+
function buildLauncherEnv(hostEnv = process.env) {
|
|
501
|
+
const env = {};
|
|
502
|
+
for (const key of LAUNCHER_ENV_KEYS) {
|
|
503
|
+
const value = getEnvValueCaseInsensitive(hostEnv, key);
|
|
504
|
+
if (value !== void 0) env[key] = value;
|
|
505
|
+
}
|
|
506
|
+
return env;
|
|
507
|
+
}
|
|
508
|
+
//#endregion
|
|
509
|
+
//#region extensions/mxc/src/mxc-container-config.ts
|
|
510
|
+
const MXC_SCHEMA_VERSION = "0.7.0-alpha";
|
|
511
|
+
const PROCESS_CONTAINER_NAME_MAX_LEN = 64;
|
|
512
|
+
function resolveCurrentBaselineContext(projectDir) {
|
|
513
|
+
return {
|
|
514
|
+
projectDir: path.resolve(projectDir),
|
|
515
|
+
hostEnv: {
|
|
516
|
+
SystemRoot: process.env.SystemRoot,
|
|
517
|
+
WINDIR: process.env.WINDIR,
|
|
518
|
+
ProgramFiles: process.env.ProgramFiles,
|
|
519
|
+
ProgramW6432: process.env.ProgramW6432,
|
|
520
|
+
"ProgramFiles(x86)": process.env["ProgramFiles(x86)"],
|
|
521
|
+
TEMP: process.env.TEMP,
|
|
522
|
+
TMP: process.env.TMP
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
function resolveMxcWorkspaceContext(params) {
|
|
527
|
+
const workspaceAccess = params.workspaceAccess ?? "rw";
|
|
528
|
+
const workspaceDir = path.resolve(params.workdir);
|
|
529
|
+
const agentWorkspaceDir = path.resolve(params.agentWorkspaceDir ?? params.workdir);
|
|
530
|
+
return {
|
|
531
|
+
workspaceDir,
|
|
532
|
+
agentWorkspaceDir,
|
|
533
|
+
activeWorkspaceDir: workspaceAccess === "rw" ? agentWorkspaceDir : workspaceDir,
|
|
534
|
+
...params.skillsWorkspaceDir ? { skillsWorkspaceDir: path.resolve(params.skillsWorkspaceDir) } : {},
|
|
535
|
+
workdir: workspaceDir,
|
|
536
|
+
workspaceAccess
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
function resolveMxcRuntimeWorkdir(workspace, requestedWorkdir) {
|
|
540
|
+
if (workspace.workspaceAccess !== "rw") return path.resolve(requestedWorkdir);
|
|
541
|
+
const relativePath = path.relative(workspace.workspaceDir, requestedWorkdir);
|
|
542
|
+
return relativePath === "" ? workspace.activeWorkspaceDir : path.join(workspace.activeWorkspaceDir, relativePath);
|
|
543
|
+
}
|
|
544
|
+
function buildMxcContainerConfig(params) {
|
|
545
|
+
const networkAllowed = params.config.network === "default";
|
|
546
|
+
const filesystem = buildFilesystemConfig({
|
|
547
|
+
baseline: params.baseline,
|
|
548
|
+
context: params.baselineContext,
|
|
549
|
+
sandboxTempDir: params.sandboxTempDir,
|
|
550
|
+
workspace: params.workspace
|
|
551
|
+
});
|
|
552
|
+
const processEnv = normalizeWindowsProcessEnvRecord({
|
|
553
|
+
...params.env,
|
|
554
|
+
TEMP: params.sandboxTempDir,
|
|
555
|
+
TMP: params.sandboxTempDir
|
|
556
|
+
});
|
|
557
|
+
return {
|
|
558
|
+
version: MXC_SCHEMA_VERSION,
|
|
559
|
+
containerId: params.containerId,
|
|
560
|
+
containment: params.config.containment,
|
|
561
|
+
lifecycle: { destroyOnExit: true },
|
|
562
|
+
process: {
|
|
563
|
+
commandLine: buildCommandLine(params.command, params.args ?? []),
|
|
564
|
+
cwd: resolveProcessCwd(params.workdir),
|
|
565
|
+
env: processEnv,
|
|
566
|
+
timeout: resolveProcessTimeoutSeconds(params.config, params.baseline) * 1e3
|
|
567
|
+
},
|
|
568
|
+
filesystem,
|
|
569
|
+
ui: {
|
|
570
|
+
disable: true,
|
|
571
|
+
clipboard: "none",
|
|
572
|
+
injection: false
|
|
573
|
+
},
|
|
574
|
+
network: {
|
|
575
|
+
defaultPolicy: networkAllowed ? "allow" : "block",
|
|
576
|
+
enforcementMode: "capabilities"
|
|
577
|
+
},
|
|
578
|
+
processContainer: {
|
|
579
|
+
name: processContainerName(params.runtimeId),
|
|
580
|
+
leastPrivilege: true,
|
|
581
|
+
capabilities: networkAllowed ? ["internetClient"] : [],
|
|
582
|
+
ui: {
|
|
583
|
+
isolation: "container",
|
|
584
|
+
desktopSystemControl: false,
|
|
585
|
+
systemSettings: "none",
|
|
586
|
+
ime: false
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
function buildFilesystemConfig(params) {
|
|
592
|
+
const readwritePathSpecs = resolveWorkspaceReadwritePathSpecs(params.workspace);
|
|
593
|
+
const readonlyPathSpecs = [
|
|
594
|
+
...resolveWorkspaceReadonlyPathSpecs(params.workspace),
|
|
595
|
+
...resolveBaselineReadonlyPathSpecs(params.baseline, params.context),
|
|
596
|
+
...resolveProtectedSkillPolicyPathSpecs(params.workspace)
|
|
597
|
+
];
|
|
598
|
+
if (params.baseline.filesystem.restrictToProjectDir) {
|
|
599
|
+
const projectDirPath = params.context.projectDir;
|
|
600
|
+
if (params.workspace.workspaceAccess === "rw") readwritePathSpecs.push(requiredFilesystemPath(projectDirPath));
|
|
601
|
+
else readonlyPathSpecs.push(requiredFilesystemPath(projectDirPath));
|
|
602
|
+
readwritePathSpecs.push(requiredFilesystemPath(path.resolve(params.sandboxTempDir)));
|
|
603
|
+
readwritePathSpecs.push(...params.baseline.configuredPaths.readwritePaths.map(createConfiguredFilesystemPath));
|
|
604
|
+
}
|
|
605
|
+
const protectedSkillPolicyPaths = resolveMxcProtectedSkillPolicyPaths(params.workspace);
|
|
606
|
+
assertNoMxcReadwriteReadonlyOverlap({
|
|
607
|
+
readwritePaths: resolveExistingFilesystemPaths(readwritePathSpecs, "readwrite"),
|
|
608
|
+
readonlyPaths: protectedSkillPolicyPaths
|
|
609
|
+
});
|
|
610
|
+
const readonlyPaths = resolveExistingFilesystemPaths(readonlyPathSpecs, "read-only");
|
|
611
|
+
const readwritePaths = resolveExistingFilesystemPaths(readwritePathSpecs, "readwrite");
|
|
612
|
+
assertNoMxcReadwriteReadonlyOverlap({
|
|
613
|
+
readwritePaths,
|
|
614
|
+
readonlyPaths
|
|
615
|
+
});
|
|
616
|
+
return {
|
|
617
|
+
readonlyPaths,
|
|
618
|
+
deniedPaths: void 0,
|
|
619
|
+
readwritePaths,
|
|
620
|
+
clearPolicyOnExit: true
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
function resolveWorkspaceReadwritePathSpecs(workspace) {
|
|
624
|
+
if (workspace.workspaceAccess !== "rw") return [];
|
|
625
|
+
return [requiredFilesystemPath(workspace.activeWorkspaceDir)];
|
|
626
|
+
}
|
|
627
|
+
function resolveWorkspaceReadonlyPathSpecs(workspace) {
|
|
628
|
+
if (workspace.workspaceAccess === "rw") return [];
|
|
629
|
+
const readonlyPathSpecs = [requiredFilesystemPath(workspace.workspaceDir)];
|
|
630
|
+
if (workspace.workspaceAccess === "ro" && normalizePathForComparison(workspace.agentWorkspaceDir) !== normalizePathForComparison(workspace.workspaceDir)) readonlyPathSpecs.push(requiredFilesystemPath(workspace.agentWorkspaceDir));
|
|
631
|
+
return readonlyPathSpecs;
|
|
632
|
+
}
|
|
633
|
+
function resolveBaselineReadonlyPathSpecs(baseline, context) {
|
|
634
|
+
return [...resolveBaselineReadonlyPaths(context.hostEnv).map((candidatePath) => optionalFilesystemPath(path.resolve(candidatePath))), ...baseline.configuredPaths.readonlyPaths.map(createConfiguredFilesystemPath)];
|
|
635
|
+
}
|
|
636
|
+
function resolveMxcProtectedSkillPolicyPaths(context) {
|
|
637
|
+
const deduped = /* @__PURE__ */ new Map();
|
|
638
|
+
for (const mount of resolveMxcProtectedSkillMounts(context)) {
|
|
639
|
+
const hostPath = path.resolve(mount.hostPath);
|
|
640
|
+
deduped.set(normalizePathForComparison(hostPath), hostPath);
|
|
641
|
+
const containerPath = path.resolve(mount.containerPath);
|
|
642
|
+
deduped.set(normalizePathForComparison(containerPath), containerPath);
|
|
643
|
+
}
|
|
644
|
+
return [...deduped.values()];
|
|
645
|
+
}
|
|
646
|
+
function resolveProtectedSkillPolicyPathSpecs(context) {
|
|
647
|
+
return resolveMxcProtectedSkillPolicyPaths(context).map((candidatePath) => optionalFilesystemPath(candidatePath));
|
|
648
|
+
}
|
|
649
|
+
function resolveMxcProtectedSkillMounts(context) {
|
|
650
|
+
return resolveMxcReadOnlySkillMounts({
|
|
651
|
+
agentWorkspaceDir: context.agentWorkspaceDir,
|
|
652
|
+
skillsWorkspaceDir: context.skillsWorkspaceDir,
|
|
653
|
+
workdir: context.workdir,
|
|
654
|
+
workspaceAccess: context.workspaceAccess
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
function resolveExistingFilesystemPaths(pathSpecs, accessLabel) {
|
|
658
|
+
const deduped = /* @__PURE__ */ new Map();
|
|
659
|
+
for (const pathSpec of pathSpecs) {
|
|
660
|
+
const key = normalizePathForComparison(pathSpec.path);
|
|
661
|
+
const existing = deduped.get(key);
|
|
662
|
+
if (existing) {
|
|
663
|
+
existing.required ||= pathSpec.required;
|
|
664
|
+
for (const source of pathSpec.sources ?? []) existing.sources.add(source);
|
|
665
|
+
continue;
|
|
666
|
+
}
|
|
667
|
+
deduped.set(key, {
|
|
668
|
+
path: pathSpec.path,
|
|
669
|
+
required: pathSpec.required,
|
|
670
|
+
sources: new Set(pathSpec.sources ?? [])
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
const resolvedPaths = [];
|
|
674
|
+
for (const pathSpec of deduped.values()) {
|
|
675
|
+
if (hostPathExists(pathSpec.path)) {
|
|
676
|
+
resolvedPaths.push(pathSpec.path);
|
|
677
|
+
continue;
|
|
678
|
+
}
|
|
679
|
+
if (!pathSpec.required) continue;
|
|
680
|
+
throw new Error(buildMissingFilesystemPathMessage(pathSpec.path, accessLabel, pathSpec.sources));
|
|
681
|
+
}
|
|
682
|
+
return resolvedPaths;
|
|
683
|
+
}
|
|
684
|
+
function requiredFilesystemPath(pathValue) {
|
|
685
|
+
return {
|
|
686
|
+
path: path.resolve(pathValue),
|
|
687
|
+
required: true
|
|
688
|
+
};
|
|
689
|
+
}
|
|
690
|
+
function optionalFilesystemPath(pathValue) {
|
|
691
|
+
return {
|
|
692
|
+
path: path.resolve(pathValue),
|
|
693
|
+
required: false
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
function createConfiguredFilesystemPath(pathEntry) {
|
|
697
|
+
return {
|
|
698
|
+
path: path.resolve(pathEntry.path),
|
|
699
|
+
required: true,
|
|
700
|
+
sources: pathEntry.sources
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
function buildMissingFilesystemPathMessage(pathValue, accessLabel, sources) {
|
|
704
|
+
const sourceLabel = [...sources].join(", ");
|
|
705
|
+
if (sourceLabel) return `MXC sandbox ${accessLabel} path ${pathValue} configured by ${sourceLabel} is missing on the host. Recreate the path or update the policy file before launching the sandbox.`;
|
|
706
|
+
return `MXC sandbox ${accessLabel} path ${pathValue} does not exist on the host.`;
|
|
707
|
+
}
|
|
708
|
+
function processContainerName(runtimeId) {
|
|
709
|
+
if (runtimeId.length <= PROCESS_CONTAINER_NAME_MAX_LEN) return runtimeId;
|
|
710
|
+
const hash = createHash("sha256").update(runtimeId).digest("hex").slice(0, 8);
|
|
711
|
+
return `${runtimeId.slice(0, PROCESS_CONTAINER_NAME_MAX_LEN - hash.length - 1)}-${hash}`;
|
|
712
|
+
}
|
|
713
|
+
function resolveProcessCwd(workdir) {
|
|
714
|
+
return workdir;
|
|
715
|
+
}
|
|
716
|
+
function resolveProcessTimeoutSeconds(config, baseline) {
|
|
717
|
+
if (config.timeoutSecondsConfigured === true) return Math.min(config.timeoutSeconds, baseline.process.timeoutSeconds);
|
|
718
|
+
return baseline.process.timeoutSeconds;
|
|
719
|
+
}
|
|
720
|
+
function assertNoMxcReadwriteReadonlyOverlap(params) {
|
|
721
|
+
for (const readwritePath of params.readwritePaths) for (const readonlyPath of params.readonlyPaths) if (pathsOverlap(readwritePath, readonlyPath)) throw new Error(`MXC readwrite path ${readwritePath} overlaps read-only path ${readonlyPath}. Windows MXC cannot safely enforce nested read-only overlays under writable paths.`);
|
|
722
|
+
}
|
|
723
|
+
function pathsOverlap(first, second) {
|
|
724
|
+
const left = normalizePathForComparison(first);
|
|
725
|
+
const right = normalizePathForComparison(second);
|
|
726
|
+
return isPathInside(left, right) || isPathInside(right, left);
|
|
727
|
+
}
|
|
728
|
+
function normalizePathForComparison(value) {
|
|
729
|
+
const resolved = path.resolve(value);
|
|
730
|
+
return process.platform === "win32" ? resolved.toLowerCase() : resolved;
|
|
731
|
+
}
|
|
732
|
+
function hostPathExists(candidatePath) {
|
|
733
|
+
try {
|
|
734
|
+
statSync(candidatePath);
|
|
735
|
+
return true;
|
|
736
|
+
} catch (err) {
|
|
737
|
+
if (isNodeError$2(err)) return false;
|
|
738
|
+
throw err;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
function isNodeError$2(err) {
|
|
742
|
+
return err instanceof Error && "code" in err;
|
|
743
|
+
}
|
|
744
|
+
//#endregion
|
|
745
|
+
//#region extensions/mxc/src/plugin-root.ts
|
|
746
|
+
function isMxcPluginRoot(dir) {
|
|
747
|
+
return fs.existsSync(path.join(dir, "openclaw.plugin.json")) && fs.existsSync(path.join(dir, "package.json"));
|
|
748
|
+
}
|
|
749
|
+
function resolveMxcPluginRoot(moduleUrl = import.meta.url) {
|
|
750
|
+
let cursor = path.dirname(fileURLToPath(moduleUrl));
|
|
751
|
+
for (let i = 0; i < 6; i += 1) {
|
|
752
|
+
if (isMxcPluginRoot(cursor)) return cursor;
|
|
753
|
+
const parent = path.dirname(cursor);
|
|
754
|
+
if (parent === cursor) break;
|
|
755
|
+
cursor = parent;
|
|
756
|
+
}
|
|
757
|
+
throw new Error(`[mxc] cannot locate plugin root from ${moduleUrl}`);
|
|
758
|
+
}
|
|
759
|
+
function resolveMxcLauncherPath(moduleUrl = import.meta.url) {
|
|
760
|
+
const root = resolveMxcPluginRoot(moduleUrl);
|
|
761
|
+
const sourceLauncher = path.join(root, "src", "mxc-spawn-launcher.mjs");
|
|
762
|
+
const rootDistLauncher = path.join(root, "mxc-spawn-launcher.mjs");
|
|
763
|
+
const packageDistLauncher = path.join(root, "dist", "mxc-spawn-launcher.mjs");
|
|
764
|
+
if (fs.existsSync(sourceLauncher)) return sourceLauncher;
|
|
765
|
+
if (fs.existsSync(rootDistLauncher)) return rootDistLauncher;
|
|
766
|
+
if (fs.existsSync(packageDistLauncher)) return packageDistLauncher;
|
|
767
|
+
throw new Error(`[mxc] launcher not found; searched ${sourceLauncher}, ${rootDistLauncher}, and ${packageDistLauncher}`);
|
|
768
|
+
}
|
|
769
|
+
//#endregion
|
|
770
|
+
//#region extensions/mxc/src/sandbox-policy-loader.ts
|
|
771
|
+
const stringArraySchema = z.array(z.string());
|
|
772
|
+
const hardeningBooleanSchema = z.literal(true);
|
|
773
|
+
const filesystemPolicySchema = z.object({
|
|
774
|
+
restrictToProjectDir: hardeningBooleanSchema.optional(),
|
|
775
|
+
additionalReadonlyPaths: stringArraySchema.optional(),
|
|
776
|
+
additionalReadwritePaths: stringArraySchema.optional()
|
|
777
|
+
}).strict();
|
|
778
|
+
const processPolicySchema = z.object({ timeoutSeconds: z.number().finite().min(1).optional() }).strict();
|
|
779
|
+
const SandboxPolicyLayerSchema = z.object({
|
|
780
|
+
filesystem: filesystemPolicySchema.optional(),
|
|
781
|
+
process: processPolicySchema.optional()
|
|
782
|
+
}).strict();
|
|
783
|
+
function loadSandboxBaselinePolicy(options = {}) {
|
|
784
|
+
const sources = [];
|
|
785
|
+
for (const policyPath of options.policyPaths ?? []) sources.push({
|
|
786
|
+
label: policyPath,
|
|
787
|
+
policy: readSandboxPolicyFile(policyPath)
|
|
788
|
+
});
|
|
789
|
+
const merged = mergeSandboxPolicyLayers(sources);
|
|
790
|
+
const resolved = resolveSandboxBaseline(merged);
|
|
791
|
+
return {
|
|
792
|
+
...resolved,
|
|
793
|
+
process: {
|
|
794
|
+
...resolved.process,
|
|
795
|
+
timeoutSecondsConfigured: sources.some(({ policy }) => policy.process?.timeoutSeconds !== void 0)
|
|
796
|
+
},
|
|
797
|
+
configuredPaths: merged.configuredPaths
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
function readSandboxPolicyFile(policyPath) {
|
|
801
|
+
let parsed;
|
|
802
|
+
try {
|
|
803
|
+
parsed = JSON.parse(readFileSync(policyPath, "utf-8"));
|
|
804
|
+
} catch (err) {
|
|
805
|
+
throw policyFileError(policyPath, err);
|
|
806
|
+
}
|
|
807
|
+
try {
|
|
808
|
+
return parseSandboxPolicyLayer(parsed, policyPath);
|
|
809
|
+
} catch (err) {
|
|
810
|
+
throw policyFileError(policyPath, err);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
function parseSandboxPolicyLayer(value, sourceLabel) {
|
|
814
|
+
const parsed = SandboxPolicyLayerSchema.safeParse(value);
|
|
815
|
+
if (!parsed.success) throw new TypeError(formatSandboxPolicyIssue(sourceLabel, parsed.error.issues[0]));
|
|
816
|
+
const filesystem = parsed.data.filesystem;
|
|
817
|
+
const readonlyPaths = normalizeConfiguredPaths(filesystem?.additionalReadonlyPaths, sourceLabel, "filesystem.additionalReadonlyPaths");
|
|
818
|
+
const readwritePaths = normalizeConfiguredPaths(filesystem?.additionalReadwritePaths, sourceLabel, "filesystem.additionalReadwritePaths");
|
|
819
|
+
return {
|
|
820
|
+
...parsed.data,
|
|
821
|
+
filesystem: filesystem ? {
|
|
822
|
+
...filesystem,
|
|
823
|
+
...readonlyPaths.length > 0 ? { additionalReadonlyPaths: readonlyPaths.map((entry) => entry.path) } : {},
|
|
824
|
+
...readwritePaths.length > 0 ? { additionalReadwritePaths: readwritePaths.map((entry) => entry.path) } : {}
|
|
825
|
+
} : void 0,
|
|
826
|
+
configuredPaths: {
|
|
827
|
+
readonlyPaths,
|
|
828
|
+
readwritePaths
|
|
829
|
+
}
|
|
830
|
+
};
|
|
831
|
+
}
|
|
832
|
+
function mergeSandboxPolicyLayers(sources) {
|
|
833
|
+
const timeoutCandidates = [DEFAULT_SANDBOX_BASELINE.process.timeoutSeconds];
|
|
834
|
+
const filesystem = {
|
|
835
|
+
restrictToProjectDir: DEFAULT_SANDBOX_BASELINE.filesystem.restrictToProjectDir,
|
|
836
|
+
additionalReadonlyPaths: [],
|
|
837
|
+
additionalReadwritePaths: []
|
|
838
|
+
};
|
|
839
|
+
const configuredPathMaps = {
|
|
840
|
+
readonlyPaths: /* @__PURE__ */ new Map(),
|
|
841
|
+
readwritePaths: /* @__PURE__ */ new Map()
|
|
842
|
+
};
|
|
843
|
+
for (const { policy, label } of sources) {
|
|
844
|
+
mergeFilesystemPolicy(filesystem, policy.filesystem);
|
|
845
|
+
mergeConfiguredPathEntries(configuredPathMaps.readonlyPaths, policy.configuredPaths.readonlyPaths);
|
|
846
|
+
mergeConfiguredPathEntries(configuredPathMaps.readwritePaths, policy.configuredPaths.readwritePaths);
|
|
847
|
+
const timeoutSeconds = policy.process?.timeoutSeconds;
|
|
848
|
+
if (timeoutSeconds !== void 0) {
|
|
849
|
+
assertPositiveFiniteNumber(timeoutSeconds, `${label}.process.timeoutSeconds`);
|
|
850
|
+
timeoutCandidates.push(timeoutSeconds);
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
return {
|
|
854
|
+
filesystem: {
|
|
855
|
+
...filesystem,
|
|
856
|
+
additionalReadonlyPaths: [...configuredPathMaps.readonlyPaths.values()].map((entry) => entry.path),
|
|
857
|
+
additionalReadwritePaths: [...configuredPathMaps.readwritePaths.values()].map((entry) => entry.path)
|
|
858
|
+
},
|
|
859
|
+
process: { timeoutSeconds: Math.min(...timeoutCandidates) },
|
|
860
|
+
configuredPaths: {
|
|
861
|
+
readonlyPaths: [...configuredPathMaps.readonlyPaths.values()],
|
|
862
|
+
readwritePaths: [...configuredPathMaps.readwritePaths.values()]
|
|
863
|
+
}
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
function mergeFilesystemPolicy(target, layer) {
|
|
867
|
+
if (!target || !layer) return;
|
|
868
|
+
target.restrictToProjectDir = mostRestrictiveBoolean(DEFAULT_SANDBOX_BASELINE.filesystem.restrictToProjectDir, target.restrictToProjectDir, layer.restrictToProjectDir);
|
|
869
|
+
}
|
|
870
|
+
function mergeConfiguredPathEntries(target, entries) {
|
|
871
|
+
for (const entry of entries) {
|
|
872
|
+
const existing = target.get(entry.path);
|
|
873
|
+
if (!existing) {
|
|
874
|
+
target.set(entry.path, entry);
|
|
875
|
+
continue;
|
|
876
|
+
}
|
|
877
|
+
target.set(entry.path, {
|
|
878
|
+
path: entry.path,
|
|
879
|
+
sources: [.../* @__PURE__ */ new Set([...existing.sources, ...entry.sources])]
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
function normalizeConfiguredPaths(values, sourceLabel, field) {
|
|
884
|
+
if (!values || values.length === 0) return [];
|
|
885
|
+
const deduped = /* @__PURE__ */ new Map();
|
|
886
|
+
for (const [index, value] of values.entries()) {
|
|
887
|
+
const source = `${sourceLabel}.${field}[${index}]`;
|
|
888
|
+
const trimmed = value.trim();
|
|
889
|
+
if (trimmed.length === 0) throw new TypeError(`Sandbox policy field ${source} must not be blank.`);
|
|
890
|
+
if (!win32.isAbsolute(trimmed)) throw new TypeError(`Sandbox policy field ${source} must be an absolute Windows path.`);
|
|
891
|
+
const normalized = win32.normalize(trimmed);
|
|
892
|
+
assertConfiguredPathExists(normalized, source);
|
|
893
|
+
const existing = deduped.get(normalized);
|
|
894
|
+
if (!existing) {
|
|
895
|
+
deduped.set(normalized, {
|
|
896
|
+
path: normalized,
|
|
897
|
+
sources: [source]
|
|
898
|
+
});
|
|
899
|
+
continue;
|
|
900
|
+
}
|
|
901
|
+
deduped.set(normalized, {
|
|
902
|
+
path: normalized,
|
|
903
|
+
sources: [.../* @__PURE__ */ new Set([...existing.sources, source])]
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
return [...deduped.values()];
|
|
907
|
+
}
|
|
908
|
+
function assertConfiguredPathExists(pathValue, source) {
|
|
909
|
+
try {
|
|
910
|
+
statSync(pathValue);
|
|
911
|
+
} catch (err) {
|
|
912
|
+
if (isNodeError$1(err)) {
|
|
913
|
+
if (err.code === "ENOENT") throw new Error(`Sandbox policy path ${pathValue} configured by ${source} does not exist on the host. Create the path or update the policy file.`, { cause: err });
|
|
914
|
+
throw new Error(`Sandbox policy path ${pathValue} configured by ${source} is not accessible on the host: ${formatError(err)}`, { cause: err });
|
|
915
|
+
}
|
|
916
|
+
throw err;
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
function mostRestrictiveBoolean(defaultValue, ...values) {
|
|
920
|
+
return defaultValue || values.some((value) => value === true);
|
|
921
|
+
}
|
|
922
|
+
function assertPositiveFiniteNumber(value, label) {
|
|
923
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 1) throw new TypeError(`Sandbox policy field ${label} must be a positive number.`);
|
|
924
|
+
}
|
|
925
|
+
function policyFileError(policyPath, err) {
|
|
926
|
+
if (isNodeError$1(err) && err.code === "ENOENT") return new Error(`Configured sandbox policy file ${policyPath} does not exist. Remove it from mxcPolicyPaths or create the file.`, { cause: err });
|
|
927
|
+
return new Error(`Failed to load sandbox policy file at ${policyPath}: ${formatError(err)}`, { cause: err instanceof Error ? err : void 0 });
|
|
928
|
+
}
|
|
929
|
+
function formatSandboxPolicyIssue(sourceLabel, issue) {
|
|
930
|
+
if (!issue) return `Sandbox policy at ${sourceLabel} is invalid.`;
|
|
931
|
+
if (issue.path.length === 0 && issue.code === "invalid_type") return `Sandbox policy at ${sourceLabel} must be a JSON object.`;
|
|
932
|
+
const fieldLabel = `${sourceLabel}${formatIssuePath(issue.path)}`;
|
|
933
|
+
if (issue.code === "unrecognized_keys" && issue.keys.length > 0) return `Sandbox policy field ${fieldLabel}.${issue.keys[0]} is not supported.`;
|
|
934
|
+
if (issue.code === "invalid_type" && issue.path.length === 1) return `Sandbox policy section ${fieldLabel} must be a JSON object.`;
|
|
935
|
+
if (issue.code === "invalid_type") return `Sandbox policy field ${fieldLabel} ${issue.message}.`;
|
|
936
|
+
if (issue.code === "too_small") return `Sandbox policy field ${fieldLabel} must be a positive number.`;
|
|
937
|
+
return `Sandbox policy field ${fieldLabel} ${issue.message}.`;
|
|
938
|
+
}
|
|
939
|
+
function formatIssuePath(pathSegments) {
|
|
940
|
+
let label = "";
|
|
941
|
+
for (const segment of pathSegments) {
|
|
942
|
+
if (typeof segment === "number") {
|
|
943
|
+
label += `[${segment}]`;
|
|
944
|
+
continue;
|
|
945
|
+
}
|
|
946
|
+
label += `.${String(segment)}`;
|
|
947
|
+
}
|
|
948
|
+
return label;
|
|
949
|
+
}
|
|
950
|
+
function formatError(err) {
|
|
951
|
+
if (err instanceof Error && err.message) return err.message;
|
|
952
|
+
return String(err);
|
|
953
|
+
}
|
|
954
|
+
function isNodeError$1(err) {
|
|
955
|
+
return err instanceof Error && "code" in err;
|
|
956
|
+
}
|
|
957
|
+
//#endregion
|
|
958
|
+
//#region extensions/mxc/src/mxc-backend.ts
|
|
959
|
+
const CONTAINER_ID_MAX_LEN = 80;
|
|
960
|
+
function uniqueContainerId(runtimeId) {
|
|
961
|
+
const suffix = randomBytes(4).toString("hex");
|
|
962
|
+
return `${runtimeId.length + suffix.length + 1 > CONTAINER_ID_MAX_LEN ? runtimeId.slice(0, CONTAINER_ID_MAX_LEN - suffix.length - 1) : runtimeId}-${suffix}`;
|
|
963
|
+
}
|
|
964
|
+
function createLauncherPayloadFile(payloadJson) {
|
|
965
|
+
const payloadDir = mkdtempSync(path.join(resolvePreferredOpenClawTmpDir(), "openclaw-mxc-payload-"));
|
|
966
|
+
const payloadFile = path.join(payloadDir, "payload.json");
|
|
967
|
+
try {
|
|
968
|
+
writeFileSync(payloadFile, payloadJson, {
|
|
969
|
+
flag: "wx",
|
|
970
|
+
mode: 384
|
|
971
|
+
});
|
|
972
|
+
} catch (err) {
|
|
973
|
+
rmSync(payloadDir, {
|
|
974
|
+
force: true,
|
|
975
|
+
recursive: true
|
|
976
|
+
});
|
|
977
|
+
throw err;
|
|
978
|
+
}
|
|
979
|
+
return {
|
|
980
|
+
payloadDir,
|
|
981
|
+
payloadFile
|
|
982
|
+
};
|
|
983
|
+
}
|
|
984
|
+
function cleanupLauncherPayloadFile(token) {
|
|
985
|
+
if (token && typeof token === "object" && "payloadDir" in token && typeof token.payloadDir === "string") {
|
|
986
|
+
rmSync(token.payloadDir, {
|
|
987
|
+
force: true,
|
|
988
|
+
recursive: true
|
|
989
|
+
});
|
|
990
|
+
if ("sandboxTempDir" in token && typeof token.sandboxTempDir === "string") rmSync(token.sandboxTempDir, {
|
|
991
|
+
force: true,
|
|
992
|
+
recursive: true
|
|
993
|
+
});
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
function createSandboxTempDir(hostEnv) {
|
|
997
|
+
return mkdtempSync(path.join(resolveSandboxTempDir(hostEnv), "openclaw-mxc-sandbox-"));
|
|
998
|
+
}
|
|
999
|
+
function assertWorkdirInsideWorkspace(workspaceDir, workdir) {
|
|
1000
|
+
const workspace = realpathForExistingPath(workspaceDir, "sandbox workspace");
|
|
1001
|
+
const candidate = realpathForPotentialPath(workdir);
|
|
1002
|
+
const relative = path.relative(workspace, candidate);
|
|
1003
|
+
if (relative === "" || !relative.startsWith("..") && !path.isAbsolute(relative)) return candidate;
|
|
1004
|
+
throw new Error(`MXC sandbox workdir ${workdir} is outside the sandbox workspace ${workspaceDir}. Use a workdir inside the sandbox workspace.`);
|
|
1005
|
+
}
|
|
1006
|
+
function resolveWorkdirInsideWorkspace(workspaceDir, workdir) {
|
|
1007
|
+
const candidate = assertWorkdirInsideWorkspace(workspaceDir, workdir);
|
|
1008
|
+
try {
|
|
1009
|
+
if (statSync(candidate).isDirectory()) return candidate;
|
|
1010
|
+
} catch (err) {
|
|
1011
|
+
if (isNodeError(err) && err.code === "ENOENT") throw new Error(`MXC sandbox workdir ${workdir} does not exist.`, { cause: err });
|
|
1012
|
+
throw err;
|
|
1013
|
+
}
|
|
1014
|
+
throw new Error(`MXC sandbox workdir ${workdir} is not a directory.`);
|
|
1015
|
+
}
|
|
1016
|
+
function realpathForExistingPath(value, label) {
|
|
1017
|
+
try {
|
|
1018
|
+
return realpathSync(path.resolve(value));
|
|
1019
|
+
} catch (err) {
|
|
1020
|
+
if (isNodeError(err) && err.code === "ENOENT") throw new Error(`MXC ${label} ${value} does not exist.`, { cause: err });
|
|
1021
|
+
throw err;
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
function realpathForPotentialPath(value) {
|
|
1025
|
+
const resolved = path.resolve(value);
|
|
1026
|
+
try {
|
|
1027
|
+
return realpathSync(resolved);
|
|
1028
|
+
} catch (err) {
|
|
1029
|
+
if (!isNodeError(err) || err.code !== "ENOENT") throw err;
|
|
1030
|
+
const parent = path.dirname(resolved);
|
|
1031
|
+
if (parent === resolved) throw new Error(`MXC sandbox workdir ${value} does not exist.`, { cause: err });
|
|
1032
|
+
return path.join(realpathForPotentialPath(parent), path.basename(resolved));
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
function isNodeError(err) {
|
|
1036
|
+
return err instanceof Error && "code" in err;
|
|
1037
|
+
}
|
|
1038
|
+
function buildMxcLauncherOptions(config, usePty) {
|
|
1039
|
+
const options = {
|
|
1040
|
+
debug: config.debug ?? false,
|
|
1041
|
+
executablePath: resolveMxcBinaryPath(config.mxcBinaryPath)
|
|
1042
|
+
};
|
|
1043
|
+
if (!usePty) options.usePty = false;
|
|
1044
|
+
return options;
|
|
1045
|
+
}
|
|
1046
|
+
function createMxcLauncherPayload(config, payload, usePty, sandboxTempDir) {
|
|
1047
|
+
const token = createLauncherPayloadFile(JSON.stringify({
|
|
1048
|
+
config: payload,
|
|
1049
|
+
options: buildMxcLauncherOptions(config, usePty)
|
|
1050
|
+
}));
|
|
1051
|
+
token.sandboxTempDir = sandboxTempDir;
|
|
1052
|
+
return token;
|
|
1053
|
+
}
|
|
1054
|
+
function buildMxcLauncherArgv(payloadFile) {
|
|
1055
|
+
return [
|
|
1056
|
+
process.execPath,
|
|
1057
|
+
resolveMxcLauncherPath(),
|
|
1058
|
+
"--payload-file",
|
|
1059
|
+
payloadFile
|
|
1060
|
+
];
|
|
1061
|
+
}
|
|
1062
|
+
/**
|
|
1063
|
+
* Creates a SandboxBackendHandle for a specific session.
|
|
1064
|
+
*/
|
|
1065
|
+
function createMxcSandboxBackendHandle(params) {
|
|
1066
|
+
const baseline = loadSandboxBaselinePolicy({ policyPaths: params.config.mxcPolicyPaths });
|
|
1067
|
+
return {
|
|
1068
|
+
id: "mxc",
|
|
1069
|
+
runtimeId: params.runtimeId,
|
|
1070
|
+
runtimeLabel: params.runtimeId,
|
|
1071
|
+
workdir: params.workdir,
|
|
1072
|
+
capabilities: {},
|
|
1073
|
+
async buildExecSpec({ command, workdir, env, usePty }) {
|
|
1074
|
+
const effectiveWorkdir = resolveWorkdirInsideWorkspace(params.workdir, workdir ?? params.workdir);
|
|
1075
|
+
const workspaceAccess = params.workspaceAccess ?? "rw";
|
|
1076
|
+
const workspace = resolveMxcWorkspaceContext({
|
|
1077
|
+
...params,
|
|
1078
|
+
workspaceAccess
|
|
1079
|
+
});
|
|
1080
|
+
const runtimeWorkdir = resolveMxcRuntimeWorkdir(workspace, effectiveWorkdir);
|
|
1081
|
+
const baselineContext = resolveCurrentBaselineContext(workspace.activeWorkspaceDir);
|
|
1082
|
+
const sandboxTempDir = createSandboxTempDir(baselineContext.hostEnv);
|
|
1083
|
+
try {
|
|
1084
|
+
const payload = buildMxcContainerConfig({
|
|
1085
|
+
config: params.config,
|
|
1086
|
+
baseline,
|
|
1087
|
+
baselineContext,
|
|
1088
|
+
runtimeId: params.runtimeId,
|
|
1089
|
+
containerId: uniqueContainerId(params.runtimeId),
|
|
1090
|
+
command,
|
|
1091
|
+
sandboxTempDir,
|
|
1092
|
+
workdir: runtimeWorkdir,
|
|
1093
|
+
workspace,
|
|
1094
|
+
env
|
|
1095
|
+
});
|
|
1096
|
+
const payloadFile = createMxcLauncherPayload(params.config, payload, usePty, sandboxTempDir);
|
|
1097
|
+
return {
|
|
1098
|
+
argv: buildMxcLauncherArgv(payloadFile.payloadFile),
|
|
1099
|
+
env: buildLauncherEnv(),
|
|
1100
|
+
stdinMode: usePty ? "pipe-open" : "pipe-closed",
|
|
1101
|
+
finalizeToken: payloadFile
|
|
1102
|
+
};
|
|
1103
|
+
} catch (err) {
|
|
1104
|
+
rmSync(sandboxTempDir, {
|
|
1105
|
+
force: true,
|
|
1106
|
+
recursive: true
|
|
1107
|
+
});
|
|
1108
|
+
throw err;
|
|
1109
|
+
}
|
|
1110
|
+
},
|
|
1111
|
+
async finalizeExec({ token }) {
|
|
1112
|
+
cleanupLauncherPayloadFile(token);
|
|
1113
|
+
},
|
|
1114
|
+
createFsBridge: ({ sandbox }) => createMxcFsBridge({ sandbox }),
|
|
1115
|
+
async runShellCommand(cmdParams) {
|
|
1116
|
+
const restrictiveConfig = {
|
|
1117
|
+
...params.config,
|
|
1118
|
+
network: "none",
|
|
1119
|
+
timeoutSeconds: 30,
|
|
1120
|
+
timeoutSecondsConfigured: true
|
|
1121
|
+
};
|
|
1122
|
+
const effectiveWorkdir = path.resolve(params.workdir);
|
|
1123
|
+
const workspaceAccess = params.workspaceAccess ?? "rw";
|
|
1124
|
+
const workspace = resolveMxcWorkspaceContext({
|
|
1125
|
+
...params,
|
|
1126
|
+
workspaceAccess
|
|
1127
|
+
});
|
|
1128
|
+
const runtimeWorkdir = resolveMxcRuntimeWorkdir(workspace, effectiveWorkdir);
|
|
1129
|
+
const baselineContext = resolveCurrentBaselineContext(workspace.activeWorkspaceDir);
|
|
1130
|
+
const sandboxTempDir = createSandboxTempDir(baselineContext.hostEnv);
|
|
1131
|
+
const commandBridge = createWindowsCommandBridge({
|
|
1132
|
+
args: cmdParams.args,
|
|
1133
|
+
script: cmdParams.script,
|
|
1134
|
+
tempDir: sandboxTempDir
|
|
1135
|
+
});
|
|
1136
|
+
const execInput = cmdParams.stdin === void 0 ? Buffer.alloc(0) : toBuffer(cmdParams.stdin);
|
|
1137
|
+
try {
|
|
1138
|
+
const payloadFile = createMxcLauncherPayload(restrictiveConfig, buildMxcContainerConfig({
|
|
1139
|
+
config: restrictiveConfig,
|
|
1140
|
+
baseline,
|
|
1141
|
+
baselineContext,
|
|
1142
|
+
runtimeId: params.runtimeId,
|
|
1143
|
+
containerId: uniqueContainerId(params.runtimeId),
|
|
1144
|
+
command: commandBridge.command,
|
|
1145
|
+
args: cmdParams.args,
|
|
1146
|
+
sandboxTempDir,
|
|
1147
|
+
workdir: runtimeWorkdir,
|
|
1148
|
+
workspace,
|
|
1149
|
+
env: {}
|
|
1150
|
+
}), false, sandboxTempDir);
|
|
1151
|
+
const argv = buildMxcLauncherArgv(payloadFile.payloadFile);
|
|
1152
|
+
try {
|
|
1153
|
+
const result = await runCommandBuffered(argv, {
|
|
1154
|
+
baseEnv: buildLauncherEnv(),
|
|
1155
|
+
input: execInput,
|
|
1156
|
+
maxOutputBytes: {
|
|
1157
|
+
stdout: 10 * 1024 * 1024,
|
|
1158
|
+
stderr: 10 * 1024 * 1024
|
|
1159
|
+
},
|
|
1160
|
+
signal: cmdParams.signal,
|
|
1161
|
+
timeoutMs: 3e4
|
|
1162
|
+
});
|
|
1163
|
+
if (cmdParams.signal?.aborted) throw cmdParams.signal.reason instanceof Error ? cmdParams.signal.reason : result.error ?? /* @__PURE__ */ new Error("MXC command aborted");
|
|
1164
|
+
const { stdout, stderr } = result;
|
|
1165
|
+
const code = result.termination === "exit" ? result.code ?? 1 : 1;
|
|
1166
|
+
if ((result.termination !== "exit" || code !== 0) && !cmdParams.allowFailure) {
|
|
1167
|
+
const commandError = result.error ?? /* @__PURE__ */ new Error(result.termination === "exit" ? `MXC command exited with code ${code}` : `MXC command terminated: ${result.termination}`);
|
|
1168
|
+
throw Object.assign(commandError, {
|
|
1169
|
+
stdout,
|
|
1170
|
+
stderr,
|
|
1171
|
+
status: code
|
|
1172
|
+
});
|
|
1173
|
+
}
|
|
1174
|
+
return {
|
|
1175
|
+
stdout,
|
|
1176
|
+
stderr,
|
|
1177
|
+
code
|
|
1178
|
+
};
|
|
1179
|
+
} finally {
|
|
1180
|
+
cleanupLauncherPayloadFile(payloadFile);
|
|
1181
|
+
}
|
|
1182
|
+
} finally {
|
|
1183
|
+
commandBridge.cleanup();
|
|
1184
|
+
rmSync(sandboxTempDir, {
|
|
1185
|
+
force: true,
|
|
1186
|
+
recursive: true
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
};
|
|
1191
|
+
}
|
|
1192
|
+
function toBuffer(value) {
|
|
1193
|
+
if (Buffer.isBuffer(value)) return value;
|
|
1194
|
+
return Buffer.from(value, "utf-8");
|
|
1195
|
+
}
|
|
1196
|
+
/** Manager for `openclaw sandbox list` and `openclaw sandbox remove`. */
|
|
1197
|
+
const mxcSandboxBackendManager = {
|
|
1198
|
+
async describeRuntime() {
|
|
1199
|
+
return {
|
|
1200
|
+
running: false,
|
|
1201
|
+
actualConfigLabel: "mxc-process",
|
|
1202
|
+
configLabelMatch: true
|
|
1203
|
+
};
|
|
1204
|
+
},
|
|
1205
|
+
async removeRuntime() {}
|
|
1206
|
+
};
|
|
1207
|
+
//#endregion
|
|
1208
|
+
//#region extensions/mxc/src/mxc-backend-factory.ts
|
|
1209
|
+
function sanitizeRuntimeId(value) {
|
|
1210
|
+
const slug = value.toLowerCase().replace(/[^a-z0-9_.-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 48);
|
|
1211
|
+
const hash = createHash("sha256").update(value).digest("hex").slice(0, 8);
|
|
1212
|
+
return `openclaw-mxc-${slug || "sandbox"}-${hash}`;
|
|
1213
|
+
}
|
|
1214
|
+
/** Factory function called by OpenClaw when sandbox.backend=mxc. */
|
|
1215
|
+
function createMxcSandboxBackendFactory(config) {
|
|
1216
|
+
return async function createMxcSandboxBackend(params) {
|
|
1217
|
+
if ((params.cfg.docker.binds?.length ?? 0) > 0) throw new Error("MXC sandbox backend does not support sandbox.docker.binds.");
|
|
1218
|
+
return createMxcSandboxBackendHandle({
|
|
1219
|
+
config,
|
|
1220
|
+
runtimeId: sanitizeRuntimeId(params.scopeKey),
|
|
1221
|
+
workdir: params.workspaceDir,
|
|
1222
|
+
agentWorkspaceDir: params.agentWorkspaceDir,
|
|
1223
|
+
...params.skillsWorkspaceDir ? { skillsWorkspaceDir: params.skillsWorkspaceDir } : {},
|
|
1224
|
+
workspaceAccess: params.cfg.workspaceAccess
|
|
1225
|
+
});
|
|
1226
|
+
};
|
|
1227
|
+
}
|
|
1228
|
+
//#endregion
|
|
1229
|
+
//#region extensions/mxc/src/readiness.ts
|
|
1230
|
+
const DEFAULT_DEPS = { execFileSync };
|
|
1231
|
+
function resolveWindowsSystemExecutable(name) {
|
|
1232
|
+
const systemRoot = process.env.SystemRoot || process.env.WINDIR;
|
|
1233
|
+
return path.win32.join(systemRoot || "C:\\Windows", "System32", name);
|
|
1234
|
+
}
|
|
1235
|
+
function assertWindowsIsoEnvBrokerInstalled(deps) {
|
|
1236
|
+
try {
|
|
1237
|
+
deps.execFileSync(resolveWindowsSystemExecutable("sc.exe"), ["query", "IsoEnvBroker"], {
|
|
1238
|
+
encoding: "utf-8",
|
|
1239
|
+
stdio: "pipe",
|
|
1240
|
+
timeout: 5e3,
|
|
1241
|
+
windowsHide: true
|
|
1242
|
+
});
|
|
1243
|
+
} catch (error) {
|
|
1244
|
+
const detail = error instanceof Error && error.message ? `: ${error.message.trim()}` : "";
|
|
1245
|
+
throw new Error(`[mxc] MXC Windows ProcessContainer sandbox is not ready: IsoEnvBroker service is not installed${detail}. Install the IsoEnvBroker service before enabling MXC sandbox execution.`, { cause: error });
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
function isSystemDrivePrepared(deps) {
|
|
1249
|
+
const systemDrive = process.env.SystemDrive || "C:";
|
|
1250
|
+
let output;
|
|
1251
|
+
try {
|
|
1252
|
+
output = deps.execFileSync(resolveWindowsSystemExecutable("icacls.exe"), [`${systemDrive}\\`], {
|
|
1253
|
+
encoding: "utf-8",
|
|
1254
|
+
stdio: "pipe",
|
|
1255
|
+
timeout: 5e3,
|
|
1256
|
+
windowsHide: true
|
|
1257
|
+
});
|
|
1258
|
+
} catch {
|
|
1259
|
+
return true;
|
|
1260
|
+
}
|
|
1261
|
+
return output.includes("S-1-15-2-1") || output.includes("APPLICATION PACKAGES");
|
|
1262
|
+
}
|
|
1263
|
+
function systemDrivePrepWarning(systemDrive) {
|
|
1264
|
+
return `[mxc] MXC sandbox host preparation incomplete: the system drive root (${systemDrive}\\) does not grant directory access to AppContainer processes, so directory listing (e.g. \`dir\`) inside the sandbox will fail with "Access is denied". Basic read/write workloads still run.\nFix (one-time, elevated): wxc-host-prep prepare-system-drive (ships with @microsoft/mxc-sdk).`;
|
|
1265
|
+
}
|
|
1266
|
+
/**
|
|
1267
|
+
* Emits an advisory warning when the system drive is not prepared for
|
|
1268
|
+
* AppContainer directory access. Non-fatal: the sandbox still activates.
|
|
1269
|
+
*/
|
|
1270
|
+
function warnMxcHostPrepIfNeeded(params = {}) {
|
|
1271
|
+
if ((params.platform ?? process.platform) !== "win32") return;
|
|
1272
|
+
if (!isSystemDrivePrepared({
|
|
1273
|
+
...DEFAULT_DEPS,
|
|
1274
|
+
...params.deps
|
|
1275
|
+
})) (params.warn ?? ((message) => console.warn(message)))(systemDrivePrepWarning(process.env.SystemDrive || "C:"));
|
|
1276
|
+
}
|
|
1277
|
+
function assertMxcReadiness(params = {}) {
|
|
1278
|
+
if ((params.platform ?? process.platform) !== "win32") return;
|
|
1279
|
+
assertWindowsIsoEnvBrokerInstalled({
|
|
1280
|
+
...DEFAULT_DEPS,
|
|
1281
|
+
...params.deps
|
|
1282
|
+
});
|
|
1283
|
+
}
|
|
1284
|
+
//#endregion
|
|
1285
|
+
//#region extensions/mxc/src/plugin.ts
|
|
1286
|
+
function registerMxcPlugin(api) {
|
|
1287
|
+
if (api.registrationMode !== "full") return;
|
|
1288
|
+
const config = resolveConfig(api.pluginConfig);
|
|
1289
|
+
if (process.platform !== "win32") {
|
|
1290
|
+
console.warn(`[mxc] Sandbox backend is Windows-only and not available on ${process.platform}. Plugin will be dormant.`);
|
|
1291
|
+
return;
|
|
1292
|
+
}
|
|
1293
|
+
try {
|
|
1294
|
+
resolveMxcBinaryPath(config.mxcBinaryPath);
|
|
1295
|
+
} catch (err) {
|
|
1296
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
1297
|
+
throw new Error(`[mxc] MXC sandbox backend cannot load: ${reason}. Install @microsoft/mxc-sdk or set mxcBinaryPath.`, { cause: err });
|
|
1298
|
+
}
|
|
1299
|
+
assertMxcReadiness();
|
|
1300
|
+
warnMxcHostPrepIfNeeded();
|
|
1301
|
+
const unregister = registerSandboxBackend("mxc", {
|
|
1302
|
+
factory: createMxcSandboxBackendFactory(config),
|
|
1303
|
+
manager: mxcSandboxBackendManager
|
|
1304
|
+
});
|
|
1305
|
+
api.registerService({
|
|
1306
|
+
id: "mxc-sandbox-cleanup",
|
|
1307
|
+
start() {},
|
|
1308
|
+
stop() {
|
|
1309
|
+
unregister();
|
|
1310
|
+
}
|
|
1311
|
+
});
|
|
1312
|
+
}
|
|
1313
|
+
//#endregion
|
|
1314
|
+
//#region extensions/mxc/index.ts
|
|
1315
|
+
var mxc_default = definePluginEntry({
|
|
1316
|
+
id: "mxc",
|
|
1317
|
+
name: "MXC Sandbox Execution",
|
|
1318
|
+
description: "OS-level sandboxed tool execution via MXC: runs commands in a Windows ProcessContainer with configured MXC policy files.",
|
|
1319
|
+
configSchema: createMxcPluginConfigSchema(),
|
|
1320
|
+
register: registerMxcPlugin
|
|
1321
|
+
});
|
|
1322
|
+
//#endregion
|
|
1323
|
+
export { mxc_default as default };
|