plugin-app-builder-advance 0.0.0-stage → 0.1.8
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/PHUONG-AN-TRIEN-KHAI.md +73 -0
- package/client-v2.d.ts +1 -0
- package/client-v2.js +1 -0
- package/client.d.ts +1 -0
- package/client.js +1 -0
- package/dist/ai/skills/app-builder-records/SKILLS.md +8 -0
- package/dist/ai/skills/app-builder-ui/SKILLS.md +14 -0
- package/dist/ai/skills/app-builder-workflows/SKILLS.md +8 -0
- package/dist/client/index.js +10 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/externalVersion.js +26 -0
- package/dist/index.js +42 -0
- package/dist/locale/en-US.json +122 -0
- package/dist/locale/vi-VN.json +122 -0
- package/dist/locale/zh-CN.json +122 -0
- package/dist/node_modules/cron-parser/.eslintrc.json +15 -0
- package/dist/node_modules/cron-parser/.travis.yml +7 -0
- package/dist/node_modules/cron-parser/LICENSE +21 -0
- package/dist/node_modules/cron-parser/component.json +11 -0
- package/dist/node_modules/cron-parser/index.d.ts +1 -0
- package/dist/node_modules/cron-parser/lib/date.js +252 -0
- package/dist/node_modules/cron-parser/lib/expression.js +983 -0
- package/dist/node_modules/cron-parser/lib/field_compactor.js +70 -0
- package/dist/node_modules/cron-parser/lib/field_stringify.js +38 -0
- package/dist/node_modules/cron-parser/lib/parser.js +1 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/build/amd/luxon.js +8489 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/build/cjs-browser/luxon.js +8487 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/build/global/luxon.js +8490 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/build/global/luxon.min.js +1 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/build/node/luxon.js +7522 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/package.json +96 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/datetime.js +2169 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/duration.js +880 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/errors.js +61 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/conversions.js +157 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/diff.js +80 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/digits.js +76 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/english.js +233 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/formats.js +191 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/formatter.js +386 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/invalid.js +14 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/locale.js +482 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/regexParser.js +335 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/tokenParser.js +424 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/util.js +292 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/zoneUtil.js +36 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/info.js +193 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/interval.js +602 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/luxon.js +26 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/luxonFilled.js +13 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/settings.js +137 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zone.js +88 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zones/IANAZone.js +191 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zones/fixedOffsetZone.js +94 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zones/invalidZone.js +53 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zones/localZone.js +63 -0
- package/dist/node_modules/cron-parser/package.json +1 -0
- package/dist/node_modules/cron-parser/test/31_of_month.js +17 -0
- package/dist/node_modules/cron-parser/test/bug.js +29 -0
- package/dist/node_modules/cron-parser/test/crondate.js +16 -0
- package/dist/node_modules/cron-parser/test/crontab.example +7 -0
- package/dist/node_modules/cron-parser/test/empty_around_comma.js +22 -0
- package/dist/node_modules/cron-parser/test/expression.js +1489 -0
- package/dist/node_modules/cron-parser/test/field_compactor.js +250 -0
- package/dist/node_modules/cron-parser/test/field_stringify.js +84 -0
- package/dist/node_modules/cron-parser/test/fields.js +32 -0
- package/dist/node_modules/cron-parser/test/increment_on_first_iteration.js +22 -0
- package/dist/node_modules/cron-parser/test/index-ts3.test-d.ts +133 -0
- package/dist/node_modules/cron-parser/test/index.test-d.ts +138 -0
- package/dist/node_modules/cron-parser/test/leap_year.js +17 -0
- package/dist/node_modules/cron-parser/test/parser.js +46 -0
- package/dist/node_modules/cron-parser/test/parser_crondate_formats.js +145 -0
- package/dist/node_modules/cron-parser/test/parser_day_of_month.js +169 -0
- package/dist/node_modules/cron-parser/test/prev_date.js +32 -0
- package/dist/node_modules/cron-parser/test/stringify.js +402 -0
- package/dist/node_modules/cron-parser/test/timezone.js +422 -0
- package/dist/node_modules/cron-parser/types/common.d.ts +131 -0
- package/dist/node_modules/cron-parser/types/index.d.ts +45 -0
- package/dist/node_modules/cron-parser/types/ts3/index.d.ts +28 -0
- package/dist/node_modules/light-my-request/.gitattributes +2 -0
- package/dist/node_modules/light-my-request/.github/dependabot.yml +13 -0
- package/dist/node_modules/light-my-request/.github/stale.yml +21 -0
- package/dist/node_modules/light-my-request/.github/workflows/benchmark.yml +30 -0
- package/dist/node_modules/light-my-request/.github/workflows/ci.yml +23 -0
- package/dist/node_modules/light-my-request/LICENSE +32 -0
- package/dist/node_modules/light-my-request/benchmark/benchmark.js +164 -0
- package/dist/node_modules/light-my-request/build/build-validation.js +100 -0
- package/dist/node_modules/light-my-request/eslint.config.js +9 -0
- package/dist/node_modules/light-my-request/index.js +2 -0
- package/dist/node_modules/light-my-request/lib/config-validator.js +919 -0
- package/dist/node_modules/light-my-request/lib/form-data.js +79 -0
- package/dist/node_modules/light-my-request/lib/parse-url.js +47 -0
- package/dist/node_modules/light-my-request/lib/request.js +290 -0
- package/dist/node_modules/light-my-request/lib/response.js +240 -0
- package/dist/node_modules/light-my-request/node_modules/cookie/dist/index.d.ts +148 -0
- package/dist/node_modules/light-my-request/node_modules/cookie/dist/index.js +350 -0
- package/dist/node_modules/light-my-request/node_modules/cookie/package.json +47 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/.gitattributes +2 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/.github/dependabot.yml +13 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/.github/workflows/ci.yml +24 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/.taprc +2 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/benchmarks/warn.js +25 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/eslint.config.js +6 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/examples/example.js +11 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/index.js +124 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/package.json +73 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-interpolated-string.test.js +29 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-once-only.test.js +28 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-reset.test.js +36 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-set.test.js +30 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-unlimited.test.js +37 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/index.test.js +99 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/issue-88.test.js +33 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/jest.test.js +22 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/no-warnings.test.js +80 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/types/index.d.ts +37 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/types/index.test-d.ts +36 -0
- package/dist/node_modules/light-my-request/package.json +1 -0
- package/dist/node_modules/light-my-request/test/async-await.test.js +55 -0
- package/dist/node_modules/light-my-request/test/index.test.js +2316 -0
- package/dist/node_modules/light-my-request/test/request.test.js +16 -0
- package/dist/node_modules/light-my-request/test/response.test.js +19 -0
- package/dist/node_modules/light-my-request/test/stream.test.js +359 -0
- package/dist/node_modules/light-my-request/types/index.d.ts +128 -0
- package/dist/node_modules/light-my-request/types/index.test-d.ts +149 -0
- package/dist/node_modules/zod/LICENSE +21 -0
- package/dist/node_modules/zod/index.cjs +1 -0
- package/dist/node_modules/zod/index.d.cts +4 -0
- package/dist/node_modules/zod/index.d.ts +4 -0
- package/dist/node_modules/zod/index.js +4 -0
- package/dist/node_modules/zod/locales/index.cjs +17 -0
- package/dist/node_modules/zod/locales/index.d.cts +1 -0
- package/dist/node_modules/zod/locales/index.d.ts +1 -0
- package/dist/node_modules/zod/locales/index.js +1 -0
- package/dist/node_modules/zod/locales/package.json +6 -0
- package/dist/node_modules/zod/mini/index.cjs +17 -0
- package/dist/node_modules/zod/mini/index.d.cts +1 -0
- package/dist/node_modules/zod/mini/index.d.ts +1 -0
- package/dist/node_modules/zod/mini/index.js +1 -0
- package/dist/node_modules/zod/mini/package.json +6 -0
- package/dist/node_modules/zod/package.json +1 -0
- package/dist/node_modules/zod/src/index.ts +4 -0
- package/dist/node_modules/zod/src/locales/index.ts +1 -0
- package/dist/node_modules/zod/src/mini/index.ts +1 -0
- package/dist/node_modules/zod/src/v3/ZodError.ts +330 -0
- package/dist/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
- package/dist/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
- package/dist/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
- package/dist/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
- package/dist/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
- package/dist/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
- package/dist/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
- package/dist/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
- package/dist/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
- package/dist/node_modules/zod/src/v3/errors.ts +13 -0
- package/dist/node_modules/zod/src/v3/external.ts +6 -0
- package/dist/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
- package/dist/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
- package/dist/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
- package/dist/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
- package/dist/node_modules/zod/src/v3/helpers/typeAliases.ts +2 -0
- package/dist/node_modules/zod/src/v3/helpers/util.ts +224 -0
- package/dist/node_modules/zod/src/v3/index.ts +4 -0
- package/dist/node_modules/zod/src/v3/locales/en.ts +124 -0
- package/dist/node_modules/zod/src/v3/standard-schema.ts +113 -0
- package/dist/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
- package/dist/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
- package/dist/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
- package/dist/node_modules/zod/src/v3/tests/array.test.ts +71 -0
- package/dist/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
- package/dist/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
- package/dist/node_modules/zod/src/v3/tests/base.test.ts +29 -0
- package/dist/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
- package/dist/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
- package/dist/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
- package/dist/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
- package/dist/node_modules/zod/src/v3/tests/complex.test.ts +70 -0
- package/dist/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
- package/dist/node_modules/zod/src/v3/tests/date.test.ts +32 -0
- package/dist/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
- package/dist/node_modules/zod/src/v3/tests/default.test.ts +112 -0
- package/dist/node_modules/zod/src/v3/tests/description.test.ts +33 -0
- package/dist/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
- package/dist/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
- package/dist/node_modules/zod/src/v3/tests/error.test.ts +551 -0
- package/dist/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
- package/dist/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
- package/dist/node_modules/zod/src/v3/tests/function.test.ts +261 -0
- package/dist/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
- package/dist/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
- package/dist/node_modules/zod/src/v3/tests/intersection.test.ts +110 -0
- package/dist/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
- package/dist/node_modules/zod/src/v3/tests/language-server.test.ts +207 -0
- package/dist/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
- package/dist/node_modules/zod/src/v3/tests/map.test.ts +110 -0
- package/dist/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
- package/dist/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
- package/dist/node_modules/zod/src/v3/tests/nan.test.ts +24 -0
- package/dist/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
- package/dist/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
- package/dist/node_modules/zod/src/v3/tests/number.test.ts +176 -0
- package/dist/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
- package/dist/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
- package/dist/node_modules/zod/src/v3/tests/object.test.ts +434 -0
- package/dist/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
- package/dist/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
- package/dist/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
- package/dist/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
- package/dist/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
- package/dist/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
- package/dist/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
- package/dist/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
- package/dist/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
- package/dist/node_modules/zod/src/v3/tests/readonly.test.ts +194 -0
- package/dist/node_modules/zod/src/v3/tests/record.test.ts +171 -0
- package/dist/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
- package/dist/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
- package/dist/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
- package/dist/node_modules/zod/src/v3/tests/set.test.ts +142 -0
- package/dist/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
- package/dist/node_modules/zod/src/v3/tests/string.test.ts +916 -0
- package/dist/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
- package/dist/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
- package/dist/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
- package/dist/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
- package/dist/node_modules/zod/src/v3/tests/void.test.ts +15 -0
- package/dist/node_modules/zod/src/v3/types.ts +5138 -0
- package/dist/node_modules/zod/src/v4/classic/checks.ts +32 -0
- package/dist/node_modules/zod/src/v4/classic/coerce.ts +27 -0
- package/dist/node_modules/zod/src/v4/classic/compat.ts +70 -0
- package/dist/node_modules/zod/src/v4/classic/errors.ts +82 -0
- package/dist/node_modules/zod/src/v4/classic/external.ts +51 -0
- package/dist/node_modules/zod/src/v4/classic/from-json-schema.ts +643 -0
- package/dist/node_modules/zod/src/v4/classic/index.ts +5 -0
- package/dist/node_modules/zod/src/v4/classic/iso.ts +90 -0
- package/dist/node_modules/zod/src/v4/classic/parse.ts +82 -0
- package/dist/node_modules/zod/src/v4/classic/schemas.ts +2409 -0
- package/dist/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
- package/dist/node_modules/zod/src/v4/classic/tests/apply.test.ts +59 -0
- package/dist/node_modules/zod/src/v4/classic/tests/array.test.ts +264 -0
- package/dist/node_modules/zod/src/v4/classic/tests/assignability.test.ts +210 -0
- package/dist/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
- package/dist/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
- package/dist/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
- package/dist/node_modules/zod/src/v4/classic/tests/bigint.test.ts +54 -0
- package/dist/node_modules/zod/src/v4/classic/tests/brand.test.ts +106 -0
- package/dist/node_modules/zod/src/v4/classic/tests/catch.test.ts +276 -0
- package/dist/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
- package/dist/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +573 -0
- package/dist/node_modules/zod/src/v4/classic/tests/codec.test.ts +562 -0
- package/dist/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
- package/dist/node_modules/zod/src/v4/classic/tests/continuability.test.ts +374 -0
- package/dist/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
- package/dist/node_modules/zod/src/v4/classic/tests/date.test.ts +62 -0
- package/dist/node_modules/zod/src/v4/classic/tests/datetime.test.ts +302 -0
- package/dist/node_modules/zod/src/v4/classic/tests/default.test.ts +365 -0
- package/dist/node_modules/zod/src/v4/classic/tests/describe-meta-checks.test.ts +27 -0
- package/dist/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
- package/dist/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +661 -0
- package/dist/node_modules/zod/src/v4/classic/tests/enum.test.ts +285 -0
- package/dist/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +595 -0
- package/dist/node_modules/zod/src/v4/classic/tests/error.test.ts +711 -0
- package/dist/node_modules/zod/src/v4/classic/tests/file.test.ts +96 -0
- package/dist/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +179 -0
- package/dist/node_modules/zod/src/v4/classic/tests/fix-json-issue.test.ts +26 -0
- package/dist/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +734 -0
- package/dist/node_modules/zod/src/v4/classic/tests/function.test.ts +360 -0
- package/dist/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
- package/dist/node_modules/zod/src/v4/classic/tests/hash.test.ts +68 -0
- package/dist/node_modules/zod/src/v4/classic/tests/index.test.ts +939 -0
- package/dist/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +60 -0
- package/dist/node_modules/zod/src/v4/classic/tests/intersection.test.ts +198 -0
- package/dist/node_modules/zod/src/v4/classic/tests/json.test.ts +109 -0
- package/dist/node_modules/zod/src/v4/classic/tests/lazy.test.ts +227 -0
- package/dist/node_modules/zod/src/v4/classic/tests/literal.test.ts +117 -0
- package/dist/node_modules/zod/src/v4/classic/tests/map.test.ts +330 -0
- package/dist/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
- package/dist/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
- package/dist/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +101 -0
- package/dist/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
- package/dist/node_modules/zod/src/v4/classic/tests/number.test.ts +270 -0
- package/dist/node_modules/zod/src/v4/classic/tests/object.test.ts +640 -0
- package/dist/node_modules/zod/src/v4/classic/tests/optional.test.ts +223 -0
- package/dist/node_modules/zod/src/v4/classic/tests/partial.test.ts +427 -0
- package/dist/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +211 -0
- package/dist/node_modules/zod/src/v4/classic/tests/pipe.test.ts +101 -0
- package/dist/node_modules/zod/src/v4/classic/tests/prefault.test.ts +74 -0
- package/dist/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +282 -0
- package/dist/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
- package/dist/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
- package/dist/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
- package/dist/node_modules/zod/src/v4/classic/tests/readonly.test.ts +252 -0
- package/dist/node_modules/zod/src/v4/classic/tests/record.test.ts +600 -0
- package/dist/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +582 -0
- package/dist/node_modules/zod/src/v4/classic/tests/refine.test.ts +570 -0
- package/dist/node_modules/zod/src/v4/classic/tests/registries.test.ts +243 -0
- package/dist/node_modules/zod/src/v4/classic/tests/set.test.ts +181 -0
- package/dist/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +134 -0
- package/dist/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +125 -0
- package/dist/node_modules/zod/src/v4/classic/tests/string.test.ts +1175 -0
- package/dist/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +106 -0
- package/dist/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +771 -0
- package/dist/node_modules/zod/src/v4/classic/tests/to-json-schema-methods.test.ts +438 -0
- package/dist/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +2975 -0
- package/dist/node_modules/zod/src/v4/classic/tests/transform.test.ts +361 -0
- package/dist/node_modules/zod/src/v4/classic/tests/tuple.test.ts +183 -0
- package/dist/node_modules/zod/src/v4/classic/tests/union.test.ts +219 -0
- package/dist/node_modules/zod/src/v4/classic/tests/url.test.ts +13 -0
- package/dist/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
- package/dist/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
- package/dist/node_modules/zod/src/v4/core/api.ts +1798 -0
- package/dist/node_modules/zod/src/v4/core/checks.ts +1293 -0
- package/dist/node_modules/zod/src/v4/core/config.ts +15 -0
- package/dist/node_modules/zod/src/v4/core/core.ts +138 -0
- package/dist/node_modules/zod/src/v4/core/doc.ts +44 -0
- package/dist/node_modules/zod/src/v4/core/errors.ts +448 -0
- package/dist/node_modules/zod/src/v4/core/index.ts +16 -0
- package/dist/node_modules/zod/src/v4/core/json-schema-generator.ts +126 -0
- package/dist/node_modules/zod/src/v4/core/json-schema-processors.ts +667 -0
- package/dist/node_modules/zod/src/v4/core/json-schema.ts +147 -0
- package/dist/node_modules/zod/src/v4/core/parse.ts +195 -0
- package/dist/node_modules/zod/src/v4/core/regexes.ts +183 -0
- package/dist/node_modules/zod/src/v4/core/registries.ts +105 -0
- package/dist/node_modules/zod/src/v4/core/schemas.ts +4543 -0
- package/dist/node_modules/zod/src/v4/core/standard-schema.ts +159 -0
- package/dist/node_modules/zod/src/v4/core/tests/extend.test.ts +59 -0
- package/dist/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
- package/dist/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
- package/dist/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
- package/dist/node_modules/zod/src/v4/core/tests/locales/es.test.ts +181 -0
- package/dist/node_modules/zod/src/v4/core/tests/locales/he.test.ts +379 -0
- package/dist/node_modules/zod/src/v4/core/tests/locales/nl.test.ts +46 -0
- package/dist/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
- package/dist/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
- package/dist/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +83 -0
- package/dist/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +67 -0
- package/dist/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts +45 -0
- package/dist/node_modules/zod/src/v4/core/to-json-schema.ts +613 -0
- package/dist/node_modules/zod/src/v4/core/util.ts +966 -0
- package/dist/node_modules/zod/src/v4/core/versions.ts +5 -0
- package/dist/node_modules/zod/src/v4/core/zsf.ts +323 -0
- package/dist/node_modules/zod/src/v4/index.ts +4 -0
- package/dist/node_modules/zod/src/v4/locales/ar.ts +115 -0
- package/dist/node_modules/zod/src/v4/locales/az.ts +111 -0
- package/dist/node_modules/zod/src/v4/locales/be.ts +176 -0
- package/dist/node_modules/zod/src/v4/locales/bg.ts +128 -0
- package/dist/node_modules/zod/src/v4/locales/ca.ts +116 -0
- package/dist/node_modules/zod/src/v4/locales/cs.ts +118 -0
- package/dist/node_modules/zod/src/v4/locales/da.ts +123 -0
- package/dist/node_modules/zod/src/v4/locales/de.ts +116 -0
- package/dist/node_modules/zod/src/v4/locales/en.ts +119 -0
- package/dist/node_modules/zod/src/v4/locales/eo.ts +118 -0
- package/dist/node_modules/zod/src/v4/locales/es.ts +141 -0
- package/dist/node_modules/zod/src/v4/locales/fa.ts +126 -0
- package/dist/node_modules/zod/src/v4/locales/fi.ts +121 -0
- package/dist/node_modules/zod/src/v4/locales/fr-CA.ts +116 -0
- package/dist/node_modules/zod/src/v4/locales/fr.ts +116 -0
- package/dist/node_modules/zod/src/v4/locales/he.ts +246 -0
- package/dist/node_modules/zod/src/v4/locales/hu.ts +117 -0
- package/dist/node_modules/zod/src/v4/locales/hy.ts +164 -0
- package/dist/node_modules/zod/src/v4/locales/id.ts +115 -0
- package/dist/node_modules/zod/src/v4/locales/index.ts +49 -0
- package/dist/node_modules/zod/src/v4/locales/is.ts +119 -0
- package/dist/node_modules/zod/src/v4/locales/it.ts +116 -0
- package/dist/node_modules/zod/src/v4/locales/ja.ts +114 -0
- package/dist/node_modules/zod/src/v4/locales/ka.ts +123 -0
- package/dist/node_modules/zod/src/v4/locales/kh.ts +7 -0
- package/dist/node_modules/zod/src/v4/locales/km.ts +119 -0
- package/dist/node_modules/zod/src/v4/locales/ko.ts +121 -0
- package/dist/node_modules/zod/src/v4/locales/lt.ts +239 -0
- package/dist/node_modules/zod/src/v4/locales/mk.ts +118 -0
- package/dist/node_modules/zod/src/v4/locales/ms.ts +115 -0
- package/dist/node_modules/zod/src/v4/locales/nl.ts +121 -0
- package/dist/node_modules/zod/src/v4/locales/no.ts +116 -0
- package/dist/node_modules/zod/src/v4/locales/ota.ts +117 -0
- package/dist/node_modules/zod/src/v4/locales/pl.ts +118 -0
- package/dist/node_modules/zod/src/v4/locales/ps.ts +126 -0
- package/dist/node_modules/zod/src/v4/locales/pt.ts +116 -0
- package/dist/node_modules/zod/src/v4/locales/ru.ts +176 -0
- package/dist/node_modules/zod/src/v4/locales/sl.ts +118 -0
- package/dist/node_modules/zod/src/v4/locales/sv.ts +119 -0
- package/dist/node_modules/zod/src/v4/locales/ta.ts +118 -0
- package/dist/node_modules/zod/src/v4/locales/th.ts +119 -0
- package/dist/node_modules/zod/src/v4/locales/tr.ts +111 -0
- package/dist/node_modules/zod/src/v4/locales/ua.ts +7 -0
- package/dist/node_modules/zod/src/v4/locales/uk.ts +117 -0
- package/dist/node_modules/zod/src/v4/locales/ur.ts +119 -0
- package/dist/node_modules/zod/src/v4/locales/uz.ts +116 -0
- package/dist/node_modules/zod/src/v4/locales/vi.ts +117 -0
- package/dist/node_modules/zod/src/v4/locales/yo.ts +124 -0
- package/dist/node_modules/zod/src/v4/locales/zh-CN.ts +116 -0
- package/dist/node_modules/zod/src/v4/locales/zh-TW.ts +115 -0
- package/dist/node_modules/zod/src/v4/mini/checks.ts +32 -0
- package/dist/node_modules/zod/src/v4/mini/coerce.ts +27 -0
- package/dist/node_modules/zod/src/v4/mini/external.ts +40 -0
- package/dist/node_modules/zod/src/v4/mini/index.ts +3 -0
- package/dist/node_modules/zod/src/v4/mini/iso.ts +66 -0
- package/dist/node_modules/zod/src/v4/mini/parse.ts +14 -0
- package/dist/node_modules/zod/src/v4/mini/schemas.ts +1916 -0
- package/dist/node_modules/zod/src/v4/mini/tests/apply.test.ts +24 -0
- package/dist/node_modules/zod/src/v4/mini/tests/assignability.test.ts +129 -0
- package/dist/node_modules/zod/src/v4/mini/tests/brand.test.ts +94 -0
- package/dist/node_modules/zod/src/v4/mini/tests/checks.test.ts +144 -0
- package/dist/node_modules/zod/src/v4/mini/tests/codec.test.ts +529 -0
- package/dist/node_modules/zod/src/v4/mini/tests/computed.test.ts +36 -0
- package/dist/node_modules/zod/src/v4/mini/tests/error.test.ts +22 -0
- package/dist/node_modules/zod/src/v4/mini/tests/functions.test.ts +5 -0
- package/dist/node_modules/zod/src/v4/mini/tests/index.test.ts +963 -0
- package/dist/node_modules/zod/src/v4/mini/tests/number.test.ts +95 -0
- package/dist/node_modules/zod/src/v4/mini/tests/object.test.ts +227 -0
- package/dist/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
- package/dist/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +275 -0
- package/dist/node_modules/zod/src/v4/mini/tests/standard-schema.test.ts +50 -0
- package/dist/node_modules/zod/src/v4/mini/tests/string.test.ts +347 -0
- package/dist/node_modules/zod/src/v4-mini/index.ts +1 -0
- package/dist/node_modules/zod/v3/ZodError.cjs +138 -0
- package/dist/node_modules/zod/v3/ZodError.d.cts +164 -0
- package/dist/node_modules/zod/v3/ZodError.d.ts +164 -0
- package/dist/node_modules/zod/v3/ZodError.js +133 -0
- package/dist/node_modules/zod/v3/errors.cjs +17 -0
- package/dist/node_modules/zod/v3/errors.d.cts +5 -0
- package/dist/node_modules/zod/v3/errors.d.ts +5 -0
- package/dist/node_modules/zod/v3/errors.js +9 -0
- package/dist/node_modules/zod/v3/external.cjs +22 -0
- package/dist/node_modules/zod/v3/external.d.cts +6 -0
- package/dist/node_modules/zod/v3/external.d.ts +6 -0
- package/dist/node_modules/zod/v3/external.js +6 -0
- package/dist/node_modules/zod/v3/helpers/enumUtil.cjs +2 -0
- package/dist/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
- package/dist/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
- package/dist/node_modules/zod/v3/helpers/enumUtil.js +1 -0
- package/dist/node_modules/zod/v3/helpers/errorUtil.cjs +9 -0
- package/dist/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
- package/dist/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
- package/dist/node_modules/zod/v3/helpers/errorUtil.js +6 -0
- package/dist/node_modules/zod/v3/helpers/parseUtil.cjs +124 -0
- package/dist/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
- package/dist/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
- package/dist/node_modules/zod/v3/helpers/parseUtil.js +109 -0
- package/dist/node_modules/zod/v3/helpers/partialUtil.cjs +2 -0
- package/dist/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
- package/dist/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
- package/dist/node_modules/zod/v3/helpers/partialUtil.js +1 -0
- package/dist/node_modules/zod/v3/helpers/typeAliases.cjs +2 -0
- package/dist/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
- package/dist/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
- package/dist/node_modules/zod/v3/helpers/typeAliases.js +1 -0
- package/dist/node_modules/zod/v3/helpers/util.cjs +137 -0
- package/dist/node_modules/zod/v3/helpers/util.d.cts +85 -0
- package/dist/node_modules/zod/v3/helpers/util.d.ts +85 -0
- package/dist/node_modules/zod/v3/helpers/util.js +133 -0
- package/dist/node_modules/zod/v3/index.cjs +33 -0
- package/dist/node_modules/zod/v3/index.d.cts +4 -0
- package/dist/node_modules/zod/v3/index.d.ts +4 -0
- package/dist/node_modules/zod/v3/index.js +4 -0
- package/dist/node_modules/zod/v3/locales/en.cjs +112 -0
- package/dist/node_modules/zod/v3/locales/en.d.cts +3 -0
- package/dist/node_modules/zod/v3/locales/en.d.ts +3 -0
- package/dist/node_modules/zod/v3/locales/en.js +109 -0
- package/dist/node_modules/zod/v3/package.json +6 -0
- package/dist/node_modules/zod/v3/standard-schema.cjs +2 -0
- package/dist/node_modules/zod/v3/standard-schema.d.cts +102 -0
- package/dist/node_modules/zod/v3/standard-schema.d.ts +102 -0
- package/dist/node_modules/zod/v3/standard-schema.js +1 -0
- package/dist/node_modules/zod/v3/types.cjs +3777 -0
- package/dist/node_modules/zod/v3/types.d.cts +1034 -0
- package/dist/node_modules/zod/v3/types.d.ts +1034 -0
- package/dist/node_modules/zod/v3/types.js +3695 -0
- package/dist/node_modules/zod/v4/classic/checks.cjs +33 -0
- package/dist/node_modules/zod/v4/classic/checks.d.cts +1 -0
- package/dist/node_modules/zod/v4/classic/checks.d.ts +1 -0
- package/dist/node_modules/zod/v4/classic/checks.js +1 -0
- package/dist/node_modules/zod/v4/classic/coerce.cjs +47 -0
- package/dist/node_modules/zod/v4/classic/coerce.d.cts +17 -0
- package/dist/node_modules/zod/v4/classic/coerce.d.ts +17 -0
- package/dist/node_modules/zod/v4/classic/coerce.js +17 -0
- package/dist/node_modules/zod/v4/classic/compat.cjs +61 -0
- package/dist/node_modules/zod/v4/classic/compat.d.cts +50 -0
- package/dist/node_modules/zod/v4/classic/compat.d.ts +50 -0
- package/dist/node_modules/zod/v4/classic/compat.js +31 -0
- package/dist/node_modules/zod/v4/classic/errors.cjs +74 -0
- package/dist/node_modules/zod/v4/classic/errors.d.cts +30 -0
- package/dist/node_modules/zod/v4/classic/errors.d.ts +30 -0
- package/dist/node_modules/zod/v4/classic/errors.js +48 -0
- package/dist/node_modules/zod/v4/classic/external.cjs +73 -0
- package/dist/node_modules/zod/v4/classic/external.d.cts +15 -0
- package/dist/node_modules/zod/v4/classic/external.d.ts +15 -0
- package/dist/node_modules/zod/v4/classic/external.js +20 -0
- package/dist/node_modules/zod/v4/classic/from-json-schema.cjs +610 -0
- package/dist/node_modules/zod/v4/classic/from-json-schema.d.cts +12 -0
- package/dist/node_modules/zod/v4/classic/from-json-schema.d.ts +12 -0
- package/dist/node_modules/zod/v4/classic/from-json-schema.js +584 -0
- package/dist/node_modules/zod/v4/classic/index.cjs +33 -0
- package/dist/node_modules/zod/v4/classic/index.d.cts +4 -0
- package/dist/node_modules/zod/v4/classic/index.d.ts +4 -0
- package/dist/node_modules/zod/v4/classic/index.js +4 -0
- package/dist/node_modules/zod/v4/classic/iso.cjs +60 -0
- package/dist/node_modules/zod/v4/classic/iso.d.cts +22 -0
- package/dist/node_modules/zod/v4/classic/iso.d.ts +22 -0
- package/dist/node_modules/zod/v4/classic/iso.js +30 -0
- package/dist/node_modules/zod/v4/classic/package.json +6 -0
- package/dist/node_modules/zod/v4/classic/parse.cjs +41 -0
- package/dist/node_modules/zod/v4/classic/parse.d.cts +31 -0
- package/dist/node_modules/zod/v4/classic/parse.d.ts +31 -0
- package/dist/node_modules/zod/v4/classic/parse.js +15 -0
- package/dist/node_modules/zod/v4/classic/schemas.cjs +1272 -0
- package/dist/node_modules/zod/v4/classic/schemas.d.cts +739 -0
- package/dist/node_modules/zod/v4/classic/schemas.d.ts +739 -0
- package/dist/node_modules/zod/v4/classic/schemas.js +1157 -0
- package/dist/node_modules/zod/v4/core/api.cjs +1222 -0
- package/dist/node_modules/zod/v4/core/api.d.cts +304 -0
- package/dist/node_modules/zod/v4/core/api.d.ts +304 -0
- package/dist/node_modules/zod/v4/core/api.js +1082 -0
- package/dist/node_modules/zod/v4/core/checks.cjs +601 -0
- package/dist/node_modules/zod/v4/core/checks.d.cts +278 -0
- package/dist/node_modules/zod/v4/core/checks.d.ts +278 -0
- package/dist/node_modules/zod/v4/core/checks.js +575 -0
- package/dist/node_modules/zod/v4/core/core.cjs +83 -0
- package/dist/node_modules/zod/v4/core/core.d.cts +70 -0
- package/dist/node_modules/zod/v4/core/core.d.ts +70 -0
- package/dist/node_modules/zod/v4/core/core.js +76 -0
- package/dist/node_modules/zod/v4/core/doc.cjs +39 -0
- package/dist/node_modules/zod/v4/core/doc.d.cts +14 -0
- package/dist/node_modules/zod/v4/core/doc.d.ts +14 -0
- package/dist/node_modules/zod/v4/core/doc.js +35 -0
- package/dist/node_modules/zod/v4/core/errors.cjs +213 -0
- package/dist/node_modules/zod/v4/core/errors.d.cts +220 -0
- package/dist/node_modules/zod/v4/core/errors.d.ts +220 -0
- package/dist/node_modules/zod/v4/core/errors.js +182 -0
- package/dist/node_modules/zod/v4/core/index.cjs +47 -0
- package/dist/node_modules/zod/v4/core/index.d.cts +16 -0
- package/dist/node_modules/zod/v4/core/index.d.ts +16 -0
- package/dist/node_modules/zod/v4/core/index.js +16 -0
- package/dist/node_modules/zod/v4/core/json-schema-generator.cjs +99 -0
- package/dist/node_modules/zod/v4/core/json-schema-generator.d.cts +65 -0
- package/dist/node_modules/zod/v4/core/json-schema-generator.d.ts +65 -0
- package/dist/node_modules/zod/v4/core/json-schema-generator.js +95 -0
- package/dist/node_modules/zod/v4/core/json-schema-processors.cjs +648 -0
- package/dist/node_modules/zod/v4/core/json-schema-processors.d.cts +49 -0
- package/dist/node_modules/zod/v4/core/json-schema-processors.d.ts +49 -0
- package/dist/node_modules/zod/v4/core/json-schema-processors.js +605 -0
- package/dist/node_modules/zod/v4/core/json-schema.cjs +2 -0
- package/dist/node_modules/zod/v4/core/json-schema.d.cts +88 -0
- package/dist/node_modules/zod/v4/core/json-schema.d.ts +88 -0
- package/dist/node_modules/zod/v4/core/json-schema.js +1 -0
- package/dist/node_modules/zod/v4/core/package.json +6 -0
- package/dist/node_modules/zod/v4/core/parse.cjs +131 -0
- package/dist/node_modules/zod/v4/core/parse.d.cts +49 -0
- package/dist/node_modules/zod/v4/core/parse.d.ts +49 -0
- package/dist/node_modules/zod/v4/core/parse.js +93 -0
- package/dist/node_modules/zod/v4/core/regexes.cjs +166 -0
- package/dist/node_modules/zod/v4/core/regexes.d.cts +79 -0
- package/dist/node_modules/zod/v4/core/regexes.d.ts +79 -0
- package/dist/node_modules/zod/v4/core/regexes.js +133 -0
- package/dist/node_modules/zod/v4/core/registries.cjs +56 -0
- package/dist/node_modules/zod/v4/core/registries.d.cts +35 -0
- package/dist/node_modules/zod/v4/core/registries.d.ts +35 -0
- package/dist/node_modules/zod/v4/core/registries.js +51 -0
- package/dist/node_modules/zod/v4/core/schemas.cjs +2126 -0
- package/dist/node_modules/zod/v4/core/schemas.d.cts +1146 -0
- package/dist/node_modules/zod/v4/core/schemas.d.ts +1146 -0
- package/dist/node_modules/zod/v4/core/schemas.js +2095 -0
- package/dist/node_modules/zod/v4/core/standard-schema.cjs +2 -0
- package/dist/node_modules/zod/v4/core/standard-schema.d.cts +126 -0
- package/dist/node_modules/zod/v4/core/standard-schema.d.ts +126 -0
- package/dist/node_modules/zod/v4/core/standard-schema.js +1 -0
- package/dist/node_modules/zod/v4/core/to-json-schema.cjs +446 -0
- package/dist/node_modules/zod/v4/core/to-json-schema.d.cts +114 -0
- package/dist/node_modules/zod/v4/core/to-json-schema.d.ts +114 -0
- package/dist/node_modules/zod/v4/core/to-json-schema.js +437 -0
- package/dist/node_modules/zod/v4/core/util.cjs +710 -0
- package/dist/node_modules/zod/v4/core/util.d.cts +199 -0
- package/dist/node_modules/zod/v4/core/util.d.ts +199 -0
- package/dist/node_modules/zod/v4/core/util.js +651 -0
- package/dist/node_modules/zod/v4/core/versions.cjs +8 -0
- package/dist/node_modules/zod/v4/core/versions.d.cts +5 -0
- package/dist/node_modules/zod/v4/core/versions.d.ts +5 -0
- package/dist/node_modules/zod/v4/core/versions.js +5 -0
- package/dist/node_modules/zod/v4/index.cjs +22 -0
- package/dist/node_modules/zod/v4/index.d.cts +3 -0
- package/dist/node_modules/zod/v4/index.d.ts +3 -0
- package/dist/node_modules/zod/v4/index.js +3 -0
- package/dist/node_modules/zod/v4/locales/ar.cjs +133 -0
- package/dist/node_modules/zod/v4/locales/ar.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/ar.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/ar.js +106 -0
- package/dist/node_modules/zod/v4/locales/az.cjs +132 -0
- package/dist/node_modules/zod/v4/locales/az.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/az.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/az.js +105 -0
- package/dist/node_modules/zod/v4/locales/be.cjs +183 -0
- package/dist/node_modules/zod/v4/locales/be.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/be.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/be.js +156 -0
- package/dist/node_modules/zod/v4/locales/bg.cjs +147 -0
- package/dist/node_modules/zod/v4/locales/bg.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/bg.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/bg.js +120 -0
- package/dist/node_modules/zod/v4/locales/ca.cjs +134 -0
- package/dist/node_modules/zod/v4/locales/ca.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/ca.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/ca.js +107 -0
- package/dist/node_modules/zod/v4/locales/cs.cjs +138 -0
- package/dist/node_modules/zod/v4/locales/cs.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/cs.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/cs.js +111 -0
- package/dist/node_modules/zod/v4/locales/da.cjs +142 -0
- package/dist/node_modules/zod/v4/locales/da.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/da.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/da.js +115 -0
- package/dist/node_modules/zod/v4/locales/de.cjs +135 -0
- package/dist/node_modules/zod/v4/locales/de.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/de.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/de.js +108 -0
- package/dist/node_modules/zod/v4/locales/en.cjs +136 -0
- package/dist/node_modules/zod/v4/locales/en.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/en.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/en.js +109 -0
- package/dist/node_modules/zod/v4/locales/eo.cjs +136 -0
- package/dist/node_modules/zod/v4/locales/eo.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/eo.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/eo.js +109 -0
- package/dist/node_modules/zod/v4/locales/es.cjs +159 -0
- package/dist/node_modules/zod/v4/locales/es.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/es.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/es.js +132 -0
- package/dist/node_modules/zod/v4/locales/fa.cjs +141 -0
- package/dist/node_modules/zod/v4/locales/fa.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/fa.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/fa.js +114 -0
- package/dist/node_modules/zod/v4/locales/fi.cjs +139 -0
- package/dist/node_modules/zod/v4/locales/fi.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/fi.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/fi.js +112 -0
- package/dist/node_modules/zod/v4/locales/fr-CA.cjs +134 -0
- package/dist/node_modules/zod/v4/locales/fr-CA.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/fr-CA.js +107 -0
- package/dist/node_modules/zod/v4/locales/fr.cjs +135 -0
- package/dist/node_modules/zod/v4/locales/fr.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/fr.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/fr.js +108 -0
- package/dist/node_modules/zod/v4/locales/he.cjs +241 -0
- package/dist/node_modules/zod/v4/locales/he.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/he.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/he.js +214 -0
- package/dist/node_modules/zod/v4/locales/hu.cjs +135 -0
- package/dist/node_modules/zod/v4/locales/hu.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/hu.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/hu.js +108 -0
- package/dist/node_modules/zod/v4/locales/hy.cjs +174 -0
- package/dist/node_modules/zod/v4/locales/hy.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/hy.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/hy.js +147 -0
- package/dist/node_modules/zod/v4/locales/id.cjs +133 -0
- package/dist/node_modules/zod/v4/locales/id.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/id.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/id.js +106 -0
- package/dist/node_modules/zod/v4/locales/index.cjs +104 -0
- package/dist/node_modules/zod/v4/locales/index.d.cts +49 -0
- package/dist/node_modules/zod/v4/locales/index.d.ts +49 -0
- package/dist/node_modules/zod/v4/locales/index.js +49 -0
- package/dist/node_modules/zod/v4/locales/is.cjs +136 -0
- package/dist/node_modules/zod/v4/locales/is.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/is.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/is.js +109 -0
- package/dist/node_modules/zod/v4/locales/it.cjs +135 -0
- package/dist/node_modules/zod/v4/locales/it.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/it.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/it.js +108 -0
- package/dist/node_modules/zod/v4/locales/ja.cjs +134 -0
- package/dist/node_modules/zod/v4/locales/ja.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/ja.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/ja.js +107 -0
- package/dist/node_modules/zod/v4/locales/ka.cjs +139 -0
- package/dist/node_modules/zod/v4/locales/ka.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/ka.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/ka.js +112 -0
- package/dist/node_modules/zod/v4/locales/kh.cjs +12 -0
- package/dist/node_modules/zod/v4/locales/kh.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/kh.d.ts +5 -0
- package/dist/node_modules/zod/v4/locales/kh.js +5 -0
- package/dist/node_modules/zod/v4/locales/km.cjs +137 -0
- package/dist/node_modules/zod/v4/locales/km.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/km.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/km.js +110 -0
- package/dist/node_modules/zod/v4/locales/ko.cjs +138 -0
- package/dist/node_modules/zod/v4/locales/ko.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/ko.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/ko.js +111 -0
- package/dist/node_modules/zod/v4/locales/lt.cjs +230 -0
- package/dist/node_modules/zod/v4/locales/lt.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/lt.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/lt.js +203 -0
- package/dist/node_modules/zod/v4/locales/mk.cjs +136 -0
- package/dist/node_modules/zod/v4/locales/mk.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/mk.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/mk.js +109 -0
- package/dist/node_modules/zod/v4/locales/ms.cjs +134 -0
- package/dist/node_modules/zod/v4/locales/ms.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/ms.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/ms.js +107 -0
- package/dist/node_modules/zod/v4/locales/nl.cjs +137 -0
- package/dist/node_modules/zod/v4/locales/nl.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/nl.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/nl.js +110 -0
- package/dist/node_modules/zod/v4/locales/no.cjs +135 -0
- package/dist/node_modules/zod/v4/locales/no.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/no.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/no.js +108 -0
- package/dist/node_modules/zod/v4/locales/ota.cjs +136 -0
- package/dist/node_modules/zod/v4/locales/ota.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/ota.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/ota.js +109 -0
- package/dist/node_modules/zod/v4/locales/package.json +6 -0
- package/dist/node_modules/zod/v4/locales/pl.cjs +136 -0
- package/dist/node_modules/zod/v4/locales/pl.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/pl.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/pl.js +109 -0
- package/dist/node_modules/zod/v4/locales/ps.cjs +141 -0
- package/dist/node_modules/zod/v4/locales/ps.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/ps.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/ps.js +114 -0
- package/dist/node_modules/zod/v4/locales/pt.cjs +135 -0
- package/dist/node_modules/zod/v4/locales/pt.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/pt.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/pt.js +108 -0
- package/dist/node_modules/zod/v4/locales/ru.cjs +183 -0
- package/dist/node_modules/zod/v4/locales/ru.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/ru.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/ru.js +156 -0
- package/dist/node_modules/zod/v4/locales/sl.cjs +136 -0
- package/dist/node_modules/zod/v4/locales/sl.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/sl.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/sl.js +109 -0
- package/dist/node_modules/zod/v4/locales/sv.cjs +137 -0
- package/dist/node_modules/zod/v4/locales/sv.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/sv.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/sv.js +110 -0
- package/dist/node_modules/zod/v4/locales/ta.cjs +137 -0
- package/dist/node_modules/zod/v4/locales/ta.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/ta.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/ta.js +110 -0
- package/dist/node_modules/zod/v4/locales/th.cjs +137 -0
- package/dist/node_modules/zod/v4/locales/th.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/th.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/th.js +110 -0
- package/dist/node_modules/zod/v4/locales/tr.cjs +132 -0
- package/dist/node_modules/zod/v4/locales/tr.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/tr.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/tr.js +105 -0
- package/dist/node_modules/zod/v4/locales/ua.cjs +12 -0
- package/dist/node_modules/zod/v4/locales/ua.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/ua.d.ts +5 -0
- package/dist/node_modules/zod/v4/locales/ua.js +5 -0
- package/dist/node_modules/zod/v4/locales/uk.cjs +135 -0
- package/dist/node_modules/zod/v4/locales/uk.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/uk.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/uk.js +108 -0
- package/dist/node_modules/zod/v4/locales/ur.cjs +137 -0
- package/dist/node_modules/zod/v4/locales/ur.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/ur.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/ur.js +110 -0
- package/dist/node_modules/zod/v4/locales/uz.cjs +136 -0
- package/dist/node_modules/zod/v4/locales/uz.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/uz.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/uz.js +109 -0
- package/dist/node_modules/zod/v4/locales/vi.cjs +135 -0
- package/dist/node_modules/zod/v4/locales/vi.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/vi.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/vi.js +108 -0
- package/dist/node_modules/zod/v4/locales/yo.cjs +134 -0
- package/dist/node_modules/zod/v4/locales/yo.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/yo.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/yo.js +107 -0
- package/dist/node_modules/zod/v4/locales/zh-CN.cjs +136 -0
- package/dist/node_modules/zod/v4/locales/zh-CN.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/zh-CN.js +109 -0
- package/dist/node_modules/zod/v4/locales/zh-TW.cjs +134 -0
- package/dist/node_modules/zod/v4/locales/zh-TW.d.cts +5 -0
- package/dist/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
- package/dist/node_modules/zod/v4/locales/zh-TW.js +107 -0
- package/dist/node_modules/zod/v4/mini/checks.cjs +34 -0
- package/dist/node_modules/zod/v4/mini/checks.d.cts +1 -0
- package/dist/node_modules/zod/v4/mini/checks.d.ts +1 -0
- package/dist/node_modules/zod/v4/mini/checks.js +1 -0
- package/dist/node_modules/zod/v4/mini/coerce.cjs +52 -0
- package/dist/node_modules/zod/v4/mini/coerce.d.cts +7 -0
- package/dist/node_modules/zod/v4/mini/coerce.d.ts +7 -0
- package/dist/node_modules/zod/v4/mini/coerce.js +22 -0
- package/dist/node_modules/zod/v4/mini/external.cjs +63 -0
- package/dist/node_modules/zod/v4/mini/external.d.cts +12 -0
- package/dist/node_modules/zod/v4/mini/external.d.ts +12 -0
- package/dist/node_modules/zod/v4/mini/external.js +14 -0
- package/dist/node_modules/zod/v4/mini/index.cjs +32 -0
- package/dist/node_modules/zod/v4/mini/index.d.cts +3 -0
- package/dist/node_modules/zod/v4/mini/index.d.ts +3 -0
- package/dist/node_modules/zod/v4/mini/index.js +3 -0
- package/dist/node_modules/zod/v4/mini/iso.cjs +64 -0
- package/dist/node_modules/zod/v4/mini/iso.d.cts +22 -0
- package/dist/node_modules/zod/v4/mini/iso.d.ts +22 -0
- package/dist/node_modules/zod/v4/mini/iso.js +34 -0
- package/dist/node_modules/zod/v4/mini/package.json +6 -0
- package/dist/node_modules/zod/v4/mini/parse.cjs +16 -0
- package/dist/node_modules/zod/v4/mini/parse.d.cts +1 -0
- package/dist/node_modules/zod/v4/mini/parse.d.ts +1 -0
- package/dist/node_modules/zod/v4/mini/parse.js +1 -0
- package/dist/node_modules/zod/v4/mini/schemas.cjs +1046 -0
- package/dist/node_modules/zod/v4/mini/schemas.d.cts +427 -0
- package/dist/node_modules/zod/v4/mini/schemas.d.ts +427 -0
- package/dist/node_modules/zod/v4/mini/schemas.js +925 -0
- package/dist/node_modules/zod/v4/package.json +6 -0
- package/dist/node_modules/zod/v4-mini/index.cjs +17 -0
- package/dist/node_modules/zod/v4-mini/index.d.cts +1 -0
- package/dist/node_modules/zod/v4-mini/index.d.ts +1 -0
- package/dist/node_modules/zod/v4-mini/index.js +1 -0
- package/dist/node_modules/zod/v4-mini/package.json +6 -0
- package/dist/server/collections/appBuilderExecutions.js +47 -0
- package/dist/server/collections/appBuilderGrants.js +44 -0
- package/dist/server/collections/appBuilderPlans.js +56 -0
- package/dist/server/collections/appBuilderPolicies.js +46 -0
- package/dist/server/collections/appBuilderWorkflows.js +46 -0
- package/dist/server/column-continuation.js +230 -0
- package/dist/server/contracts.js +214 -0
- package/dist/server/index.js +42 -0
- package/dist/server/native.js +208 -0
- package/dist/server/plans.js +321 -0
- package/dist/server/plugin.js +204 -0
- package/dist/server/records.js +323 -0
- package/dist/server/surfaces.js +339 -0
- package/dist/server/workflows.js +446 -0
- package/dist/shared/constants.js +86 -0
- package/dist/shared/tabs.js +68 -0
- package/package.json +65 -4
- package/server.d.ts +1 -0
- package/server.js +1 -0
- package/src/ai/skills/app-builder-records/SKILLS.md +8 -0
- package/src/ai/skills/app-builder-ui/SKILLS.md +14 -0
- package/src/ai/skills/app-builder-workflows/SKILLS.md +8 -0
- package/src/client/index.tsx +28 -0
- package/src/client-v2/builder.tsx +374 -0
- package/src/client-v2/index.tsx +32 -0
- package/src/index.ts +10 -0
- package/src/locale/en-US.json +122 -0
- package/src/locale/vi-VN.json +122 -0
- package/src/locale/zh-CN.json +122 -0
- package/src/server/collections/appBuilderExecutions.ts +26 -0
- package/src/server/collections/appBuilderGrants.ts +23 -0
- package/src/server/collections/appBuilderPlans.ts +35 -0
- package/src/server/collections/appBuilderPolicies.ts +25 -0
- package/src/server/collections/appBuilderWorkflows.ts +25 -0
- package/src/server/column-continuation.ts +239 -0
- package/src/server/contracts.ts +196 -0
- package/src/server/index.ts +10 -0
- package/src/server/native.ts +183 -0
- package/src/server/plans.ts +334 -0
- package/src/server/plugin.ts +211 -0
- package/src/server/records.ts +338 -0
- package/src/server/surfaces.ts +372 -0
- package/src/server/workflows.ts +467 -0
- package/src/shared/constants.ts +43 -0
- package/src/shared/tabs.ts +45 -0
- package/README.md +0 -3
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { Context } from '@nocobase/actions';
|
|
11
|
+
import type { Application } from '@nocobase/server';
|
|
12
|
+
import type { Model } from '@nocobase/database';
|
|
13
|
+
import { randomUUID } from 'node:crypto';
|
|
14
|
+
import { list, object, TAB_CONTEXT } from '../shared/constants';
|
|
15
|
+
import type { Dict, Decision } from '../shared/constants';
|
|
16
|
+
import { fault, hash, policy, uiInput, rowInput, workflowInput } from './contracts';
|
|
17
|
+
import type { PlanSpec } from './contracts';
|
|
18
|
+
import { principal, native, toolTurns } from './native';
|
|
19
|
+
import type { Principal } from './native';
|
|
20
|
+
import { applyRecord, planRecords, requireFields } from './records';
|
|
21
|
+
import { applyUi, inspect, planUi, resourceOf, selectionFor, surface } from './surfaces';
|
|
22
|
+
import { applyWorkflow, planWorkflow } from './workflows';
|
|
23
|
+
import { Op } from '@nocobase/database';
|
|
24
|
+
|
|
25
|
+
type Chat = { session: string; turn: string; item?: Dict };
|
|
26
|
+
function surfaceAttachments(context: unknown) {
|
|
27
|
+
return list(context).filter((item) => item.type === TAB_CONTEXT || item.type === 'flow-model');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async function uiAttachment(app: Application, chat: Chat): Promise<Dict | undefined> {
|
|
31
|
+
if (chat.item) return chat.item;
|
|
32
|
+
// Only a tab persists across turns. A later block pick or ambiguous selection supersedes it.
|
|
33
|
+
let before = chat.turn;
|
|
34
|
+
const limit = 32;
|
|
35
|
+
for (;;) {
|
|
36
|
+
const messages = await app.db.getRepository('aiMessages').find({
|
|
37
|
+
filter: { sessionId: chat.session, role: 'user', messageId: { $lt: before } },
|
|
38
|
+
sort: ['-messageId'],
|
|
39
|
+
fields: ['messageId', 'workContext'],
|
|
40
|
+
limit,
|
|
41
|
+
});
|
|
42
|
+
for (const message of messages) {
|
|
43
|
+
const items = surfaceAttachments(message.get('workContext'));
|
|
44
|
+
if (items.length) return items.length === 1 && items[0].type === TAB_CONTEXT ? items[0] : undefined;
|
|
45
|
+
}
|
|
46
|
+
if (messages.length < limit) return;
|
|
47
|
+
before = String(messages[messages.length - 1].get('messageId'));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async function chatContext(
|
|
52
|
+
app: Application,
|
|
53
|
+
user: Principal,
|
|
54
|
+
session: unknown,
|
|
55
|
+
boundTurn?: string,
|
|
56
|
+
beforeMessage?: unknown,
|
|
57
|
+
): Promise<Chat> {
|
|
58
|
+
if (typeof session !== 'string' || !session || session.length > 180) fault('Atlas conversation required');
|
|
59
|
+
const hasEmployeeColumn = Boolean(app.db.getModel('aiConversations')?.rawAttributes?.aiEmployeeUsername);
|
|
60
|
+
const owner = await app.db.getRepository('aiConversations').count({
|
|
61
|
+
filter: {
|
|
62
|
+
sessionId: session,
|
|
63
|
+
userId: user.actor.id,
|
|
64
|
+
...(hasEmployeeColumn ? { aiEmployeeUsername: 'atlas' } : {}),
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
if (!owner) fault('Conversation unavailable', 403);
|
|
68
|
+
const turn = await app.db.getRepository('aiMessages').findOne({
|
|
69
|
+
filter: {
|
|
70
|
+
sessionId: session,
|
|
71
|
+
role: 'user',
|
|
72
|
+
...(boundTurn ? { messageId: boundTurn } : beforeMessage ? { messageId: { $lte: beforeMessage } } : {}),
|
|
73
|
+
},
|
|
74
|
+
sort: ['-messageId'],
|
|
75
|
+
fields: ['messageId', 'workContext'],
|
|
76
|
+
});
|
|
77
|
+
if (!turn) fault('Atlas conversation required');
|
|
78
|
+
const attached = surfaceAttachments(turn.get('workContext'));
|
|
79
|
+
if (attached.length > 1) fault('Attach a single block or tab');
|
|
80
|
+
return { session, turn: String(turn.get('messageId')), item: attached[0] };
|
|
81
|
+
}
|
|
82
|
+
function planView(plan: Model) {
|
|
83
|
+
const spec = plan.get('spec') as PlanSpec;
|
|
84
|
+
return {
|
|
85
|
+
planId: plan.get('id'),
|
|
86
|
+
state: plan.get('state'),
|
|
87
|
+
target: spec.selection?.uid,
|
|
88
|
+
preview: spec.preview,
|
|
89
|
+
domain: spec.domain,
|
|
90
|
+
results: plan.get('results'),
|
|
91
|
+
artifact: plan.get('artifact'),
|
|
92
|
+
error: plan.get('lastError'),
|
|
93
|
+
expiresAt: plan.get('expiresAt'),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
export class BuilderPlans {
|
|
97
|
+
constructor(readonly app: Application) {}
|
|
98
|
+
get repo() {
|
|
99
|
+
return this.app.db.getRepository('appBuilderPlans');
|
|
100
|
+
}
|
|
101
|
+
async decision(user: Principal, spec: PlanSpec) {
|
|
102
|
+
const records = await this.app.db
|
|
103
|
+
.getRepository('appBuilderPolicies')
|
|
104
|
+
.find({ filter: { role: { $in: user.actor.roles }, operation: { $in: spec.ops } } });
|
|
105
|
+
const rules = user.actor.roles.flatMap((role) =>
|
|
106
|
+
spec.ops.map((operation) => ({
|
|
107
|
+
operation,
|
|
108
|
+
mode:
|
|
109
|
+
(records.find((r) => r.get('role') === role && r.get('operation') === operation)?.get('mode') as Decision) ??
|
|
110
|
+
'ask',
|
|
111
|
+
})),
|
|
112
|
+
);
|
|
113
|
+
return policy(spec.ops, rules);
|
|
114
|
+
}
|
|
115
|
+
async tool(ctx: Context, index: number, args: Dict) {
|
|
116
|
+
const user = principal(ctx);
|
|
117
|
+
const values = object(ctx.action.params.values);
|
|
118
|
+
if (values.aiEmployee && values.aiEmployee !== 'atlas') fault('Atlas conversation required', 403);
|
|
119
|
+
const chat = await chatContext(this.app, user, values.sessionId, toolTurns.get(ctx), values.messageId);
|
|
120
|
+
if (Array.isArray(values.messages)) {
|
|
121
|
+
const selected = surfaceAttachments(list(values.messages).find((m) => m.role === 'user')?.workContext);
|
|
122
|
+
if (selected.length > 1 || selected[0]?.uid !== chat.item?.uid || selected[0]?.type !== chat.item?.type)
|
|
123
|
+
fault('Selection changed', 409);
|
|
124
|
+
}
|
|
125
|
+
if (index >= 4) return this.act(ctx, String(args.planId), index === 4 ? 'submit' : 'result', chat);
|
|
126
|
+
const item = index <= 1 ? await uiAttachment(this.app, chat) : chat.item;
|
|
127
|
+
const selection = item ? await selectionFor(this.app, user, item) : undefined;
|
|
128
|
+
if (index <= 1 && !selection) fault('Attach a single block or tab');
|
|
129
|
+
if (!index) return inspect(this.app, ctx, user, selection);
|
|
130
|
+
let spec: PlanSpec;
|
|
131
|
+
if (index === 1) spec = await planUi(this.app, ctx, user, selection, uiInput.parse(args));
|
|
132
|
+
else if (index === 2) {
|
|
133
|
+
const data = rowInput.parse(args);
|
|
134
|
+
let filter: Dict | undefined;
|
|
135
|
+
if (selection?.kind === 'table') {
|
|
136
|
+
const info = resourceOf(await surface(this.app, user, selection));
|
|
137
|
+
if (info.collection !== data.collection || info.dataSource !== data.dataSource)
|
|
138
|
+
fault('Selected collection mismatch');
|
|
139
|
+
filter = selection.filter;
|
|
140
|
+
}
|
|
141
|
+
spec = await planRecords(this.app, ctx, user, data, selection, filter);
|
|
142
|
+
} else spec = await planWorkflow(this.app, ctx, user, workflowInput.parse(args));
|
|
143
|
+
if ((await this.decision(user, spec)) === 'block') fault('Blocked by role policy', 403);
|
|
144
|
+
const roleHash = hash(user.actor);
|
|
145
|
+
const id = hash([this.app.name, user.actor.id, chat.session, chat.turn, roleHash, spec]).slice(0, 48);
|
|
146
|
+
const [plan] = await this.repo.model.findOrCreate({
|
|
147
|
+
where: { id },
|
|
148
|
+
defaults: {
|
|
149
|
+
id,
|
|
150
|
+
appName: this.app.name,
|
|
151
|
+
owner: user.actor.id,
|
|
152
|
+
roleHash,
|
|
153
|
+
session: chat.session,
|
|
154
|
+
turn: chat.turn,
|
|
155
|
+
state: 'planned',
|
|
156
|
+
spec,
|
|
157
|
+
results: [],
|
|
158
|
+
expiresAt: new Date(Date.now() + 30 * 60_000),
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
return planView(plan);
|
|
162
|
+
}
|
|
163
|
+
async act(ctx: Context, id: string, action: 'view' | 'confirm' | 'reject' | 'submit' | 'result', fromTool?: Chat) {
|
|
164
|
+
const user = principal(ctx);
|
|
165
|
+
const plan = await this.repo.findOne({ filterByTk: id });
|
|
166
|
+
if (
|
|
167
|
+
!plan ||
|
|
168
|
+
plan.get('appName') !== this.app.name ||
|
|
169
|
+
plan.get('owner') !== user.actor.id ||
|
|
170
|
+
plan.get('roleHash') !== hash(user.actor)
|
|
171
|
+
)
|
|
172
|
+
fault('Plan unavailable', 403);
|
|
173
|
+
const chat = fromTool ?? (await chatContext(this.app, user, plan.get('session')));
|
|
174
|
+
if (chat.session !== plan.get('session')) fault('Plan unavailable', 403);
|
|
175
|
+
const spec = plan.get('spec') as PlanSpec;
|
|
176
|
+
if (
|
|
177
|
+
plan.get('state') === 'running' &&
|
|
178
|
+
new Date(plan.get('updatedAt') as string).getTime() < Date.now() - 5 * 60_000
|
|
179
|
+
) {
|
|
180
|
+
await this.repo.model.update(
|
|
181
|
+
{ state: 'partial', lease: null, runToken: null, lastError: 'Interrupted action. Verify before retrying' },
|
|
182
|
+
{ where: { id, state: 'running', runToken: plan.get('runToken'), updatedAt: plan.get('updatedAt') } },
|
|
183
|
+
);
|
|
184
|
+
await plan.reload();
|
|
185
|
+
}
|
|
186
|
+
const state = String(plan.get('state'));
|
|
187
|
+
const readOnly = action === 'view' || action === 'result';
|
|
188
|
+
const terminal = ['done', 'rejected'].includes(state);
|
|
189
|
+
if (!readOnly && chat.turn !== plan.get('turn')) fault('Conversation turn changed', 409);
|
|
190
|
+
if (spec.selection && !(readOnly && terminal)) {
|
|
191
|
+
const item =
|
|
192
|
+
chat.turn === plan.get('turn')
|
|
193
|
+
? spec.domain === 'ui' && spec.selection.kind === 'tab'
|
|
194
|
+
? await uiAttachment(this.app, chat)
|
|
195
|
+
: chat.item
|
|
196
|
+
: { uid: spec.selection.uid, type: spec.selection.kind === 'tab' ? TAB_CONTEXT : 'flow-model' };
|
|
197
|
+
if (!item || item.uid !== spec.selection.uid) fault('Selection changed', 409);
|
|
198
|
+
const live = await selectionFor(this.app, user, item);
|
|
199
|
+
if (live.pageUid !== spec.selection.pageUid || live.tabUid !== spec.selection.tabUid)
|
|
200
|
+
fault('Selection changed', 409);
|
|
201
|
+
}
|
|
202
|
+
const mode = await this.decision(user, spec);
|
|
203
|
+
if (mode === 'block') fault('Blocked by role policy', 403);
|
|
204
|
+
// An old preview may contain business values. Only expose values for rows still readable by this role.
|
|
205
|
+
let visible = planView(plan);
|
|
206
|
+
if (spec.domain === 'records') {
|
|
207
|
+
const input = rowInput.parse(spec.input);
|
|
208
|
+
await requireFields(this.app, ctx, input.dataSource, input.collection, 'list', Object.keys(input.values));
|
|
209
|
+
const pk = String(spec.preview.keyField);
|
|
210
|
+
const snapshot = list(spec.preview.rows);
|
|
211
|
+
const sample = snapshot.slice(0, 10);
|
|
212
|
+
const readable = sample.length
|
|
213
|
+
? list(
|
|
214
|
+
await native(this.app, user, {
|
|
215
|
+
resource: input.collection,
|
|
216
|
+
source: input.dataSource,
|
|
217
|
+
action: 'list',
|
|
218
|
+
query: {
|
|
219
|
+
filter: { [pk]: { $in: sample.map((r) => r.key) } },
|
|
220
|
+
fields: [pk, ...Object.keys(input.values)],
|
|
221
|
+
pageSize: 10,
|
|
222
|
+
},
|
|
223
|
+
fields: [pk, ...Object.keys(input.values)],
|
|
224
|
+
}),
|
|
225
|
+
)
|
|
226
|
+
: [];
|
|
227
|
+
const keys = new Set(readable.map((r) => String(r[pk])));
|
|
228
|
+
visible = {
|
|
229
|
+
...visible,
|
|
230
|
+
preview: {
|
|
231
|
+
dataSource: input.dataSource,
|
|
232
|
+
collection: input.collection,
|
|
233
|
+
count: spec.preview.count,
|
|
234
|
+
fields: Object.keys(input.values),
|
|
235
|
+
values: input.values,
|
|
236
|
+
sample: sample.filter((r) => keys.has(String(r.key))),
|
|
237
|
+
},
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
if (action === 'view' || action === 'result' || ['done', 'rejected', 'running'].includes(state)) return visible;
|
|
241
|
+
if (new Date(plan.get('expiresAt') as string).getTime() < Date.now()) fault('Plan expired', 409);
|
|
242
|
+
if (action === 'reject') {
|
|
243
|
+
await this.repo.model.update({ state: 'rejected' }, { where: { id, state: ['planned', 'pending', 'partial'] } });
|
|
244
|
+
return { ...visible, state: (await plan.reload()).get('state') };
|
|
245
|
+
}
|
|
246
|
+
if (action === 'submit' && mode === 'ask') {
|
|
247
|
+
await this.repo.model.update({ state: 'pending' }, { where: { id, state: ['planned', 'partial'] } });
|
|
248
|
+
return { ...visible, state: (await plan.reload()).get('state') };
|
|
249
|
+
}
|
|
250
|
+
if (action === 'confirm' && !['pending', 'partial'].includes(state)) fault('Submit the plan before approving', 409);
|
|
251
|
+
const runToken = randomUUID();
|
|
252
|
+
const lease = hash([this.app.name, spec.lock]);
|
|
253
|
+
// A worker renews while a native action is in flight. A lost worker leaves its last verified step as a checkpoint.
|
|
254
|
+
await this.repo.model.update(
|
|
255
|
+
{ state: 'partial', lease: null, runToken: null, lastError: 'Interrupted action. Verify before retrying' },
|
|
256
|
+
{ where: { lease, state: 'running', updatedAt: { [Op.lt]: new Date(Date.now() - 5 * 60_000) } } },
|
|
257
|
+
);
|
|
258
|
+
let changed: number;
|
|
259
|
+
try {
|
|
260
|
+
[changed] = await this.repo.model.update(
|
|
261
|
+
{ state: 'running', lease, runToken, lastError: null },
|
|
262
|
+
{ where: { id, state: ['planned', 'partial', 'pending'] } },
|
|
263
|
+
);
|
|
264
|
+
} catch (e) {
|
|
265
|
+
if (e instanceof Error && e.name === 'SequelizeUniqueConstraintError') fault('Another plan is applying', 409);
|
|
266
|
+
throw e;
|
|
267
|
+
}
|
|
268
|
+
if (!changed) return { ...visible, state: (await plan.reload()).get('state') };
|
|
269
|
+
const results = list(plan.get('results'));
|
|
270
|
+
const total =
|
|
271
|
+
spec.domain === 'records'
|
|
272
|
+
? Number(spec.preview.count)
|
|
273
|
+
: spec.domain === 'ui'
|
|
274
|
+
? uiInput.parse(spec.input).operations.length
|
|
275
|
+
: 1;
|
|
276
|
+
let renewing = false;
|
|
277
|
+
const heartbeat = setInterval(async () => {
|
|
278
|
+
if (renewing) return;
|
|
279
|
+
renewing = true;
|
|
280
|
+
try {
|
|
281
|
+
await this.repo.model.update({ updatedAt: new Date() }, { where: { id, runToken }, silent: false });
|
|
282
|
+
} catch {
|
|
283
|
+
this.app.logger.warn('Builder plan heartbeat delayed', { planId: id });
|
|
284
|
+
} finally {
|
|
285
|
+
renewing = false;
|
|
286
|
+
}
|
|
287
|
+
}, 30_000);
|
|
288
|
+
heartbeat.unref();
|
|
289
|
+
try {
|
|
290
|
+
for (let i = results.length; i < total; i++) {
|
|
291
|
+
if (!(await this.repo.model.count({ where: { id, state: 'running', runToken } })))
|
|
292
|
+
fault('Another plan is applying', 409);
|
|
293
|
+
const now = await this.decision(user, spec);
|
|
294
|
+
if (now === 'block') fault('Blocked by role policy', 403);
|
|
295
|
+
if (now === 'ask' && action !== 'confirm') fault('Approval required', 409);
|
|
296
|
+
const result =
|
|
297
|
+
spec.domain === 'records'
|
|
298
|
+
? await applyRecord(this.app, ctx, user, spec, i)
|
|
299
|
+
: spec.domain === 'workflow'
|
|
300
|
+
? await applyWorkflow(this.app, ctx, user, spec, id, async (artifact) => {
|
|
301
|
+
await this.repo.model.update({ artifact }, { where: { id, runToken } });
|
|
302
|
+
})
|
|
303
|
+
: await applyUi(this.app, ctx, user, spec, i, String(results[i - 1]?.after ?? spec.before));
|
|
304
|
+
results.push(result);
|
|
305
|
+
await this.repo.model.update({ results: [...results] }, { where: { id, state: 'running', runToken } });
|
|
306
|
+
}
|
|
307
|
+
await this.repo.model.update({ state: 'done', lease: null, runToken: null }, { where: { id, runToken } });
|
|
308
|
+
} catch (e) {
|
|
309
|
+
const message = e instanceof Error && 'status' in e ? e.message : 'Action could not be verified';
|
|
310
|
+
await this.repo.model.update(
|
|
311
|
+
{ state: 'partial', lease: null, runToken: null, lastError: message },
|
|
312
|
+
{ where: { id, runToken } },
|
|
313
|
+
);
|
|
314
|
+
} finally {
|
|
315
|
+
clearInterval(heartbeat);
|
|
316
|
+
}
|
|
317
|
+
await plan.reload();
|
|
318
|
+
this.app.logger.info('Atlas builder plan', {
|
|
319
|
+
planId: id,
|
|
320
|
+
actor: user.actor.id,
|
|
321
|
+
role: user.actor.role,
|
|
322
|
+
domain: spec.domain,
|
|
323
|
+
state: plan.get('state'),
|
|
324
|
+
completed: results.length,
|
|
325
|
+
});
|
|
326
|
+
return {
|
|
327
|
+
...visible,
|
|
328
|
+
state: plan.get('state'),
|
|
329
|
+
results: plan.get('results'),
|
|
330
|
+
artifact: plan.get('artifact'),
|
|
331
|
+
error: plan.get('lastError'),
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { Plugin } from '@nocobase/server';
|
|
11
|
+
import { Op } from '@nocobase/database';
|
|
12
|
+
import type { Context } from '@nocobase/actions';
|
|
13
|
+
import type { ToolsOptions } from '@nocobase/ai';
|
|
14
|
+
import { z } from 'zod';
|
|
15
|
+
import { NS, RESOURCE, TOOLS, SKILLS, OPERATIONS, DECISIONS, array, list, object } from '../shared/constants';
|
|
16
|
+
import type { Dict } from '../shared/constants';
|
|
17
|
+
import { fault, grantInput, identifier, rowInput, uiInput, uid, workflowInput } from './contracts';
|
|
18
|
+
import { installRequestChecks, principal } from './native';
|
|
19
|
+
import { BuilderPlans } from './plans';
|
|
20
|
+
import { installColumnContinuation } from './column-continuation';
|
|
21
|
+
import { installWorkflow } from './workflows';
|
|
22
|
+
|
|
23
|
+
const descriptions = [
|
|
24
|
+
'Inspect the selected block or the most recent tab in this conversation, including on follow-up turns. Returns model UIDs, titles, fields, columns and the tab’s tableOrder in layout order.',
|
|
25
|
+
'Add a column to an existing Table by passing just {"field":"status","target":"<inspected Table UID>"} with the actual field name and UID. For other UI changes pass operations. Then submit the returned planId.',
|
|
26
|
+
'Preview an update to existing records by primary key, field conditions, or attached Table filter. Returns frozen target count and a planId.',
|
|
27
|
+
'Preview a disabled native workflow draft or a separate enable operation. Use sourceId for a revision. Ordered nodes use after and branch references. Then submit the plan.',
|
|
28
|
+
'Submit a prepared plan. A pending plan requires the person in this chat to approve its card. Only done means applied. Report partial results.',
|
|
29
|
+
'Read the current state and verified results of this plan in its original conversation.',
|
|
30
|
+
];
|
|
31
|
+
const idInput = z.strictObject({ planId: z.string().regex(/^[a-f0-9]{48}$/) });
|
|
32
|
+
const uiToolInput = z
|
|
33
|
+
.strictObject({
|
|
34
|
+
field: identifier.optional().describe('Existing collection field name to display as a Table column.'),
|
|
35
|
+
target: uid.optional().describe('UID of the chosen Table when adding a column from a tab.'),
|
|
36
|
+
operations: uiInput.shape.operations.optional().describe('Batch of UI changes. Omit when using field.'),
|
|
37
|
+
})
|
|
38
|
+
.refine((input) => (input.field ? !input.operations : !!input.operations && !input.target));
|
|
39
|
+
const schemas = [
|
|
40
|
+
z.strictObject({}),
|
|
41
|
+
uiToolInput,
|
|
42
|
+
rowInput,
|
|
43
|
+
z.strictObject({ workflow: workflowInput }),
|
|
44
|
+
idInput,
|
|
45
|
+
idInput,
|
|
46
|
+
];
|
|
47
|
+
const policyInput = z.strictObject({ role: identifier, operation: z.enum(OPERATIONS), mode: z.enum(DECISIONS) });
|
|
48
|
+
const adminActions = ['settings', 'savePolicy', 'saveGrant', 'bindAtlas'];
|
|
49
|
+
type Handler = (ctx: Context) => Promise<unknown>;
|
|
50
|
+
function errorText(ctx: Context, e: unknown) {
|
|
51
|
+
const key =
|
|
52
|
+
e instanceof z.ZodError
|
|
53
|
+
? 'Invalid builder input'
|
|
54
|
+
: e instanceof Error && 'status' in e
|
|
55
|
+
? e.message
|
|
56
|
+
: 'Builder action failed';
|
|
57
|
+
return ctx.t(key, { ns: NS });
|
|
58
|
+
}
|
|
59
|
+
export default class AppBuilderAdvance extends Plugin {
|
|
60
|
+
async load() {
|
|
61
|
+
const plans = new BuilderPlans(this.app);
|
|
62
|
+
installRequestChecks(this.app);
|
|
63
|
+
installColumnContinuation();
|
|
64
|
+
installWorkflow(this.app);
|
|
65
|
+
let previous: Dict | undefined;
|
|
66
|
+
this.app.on('beforeStart', async () => {
|
|
67
|
+
if (!this.db.hasCollection('aiEmployees')) return;
|
|
68
|
+
const existed = await this.db.getRepository('appBuilderPolicies').count({ filterByTk: 'atlas-binding' });
|
|
69
|
+
if (existed)
|
|
70
|
+
previous = object(
|
|
71
|
+
(await this.db.getRepository('aiEmployees').findOne({ filter: { username: 'atlas' } }))?.get('skillSettings'),
|
|
72
|
+
);
|
|
73
|
+
});
|
|
74
|
+
this.app.on('afterStart', async () => {
|
|
75
|
+
await this.bindAtlas(previous);
|
|
76
|
+
previous = undefined;
|
|
77
|
+
});
|
|
78
|
+
this.app.cronJobManager.addJob({
|
|
79
|
+
cronTime: '0 15 2 * * *',
|
|
80
|
+
onTick: async () => {
|
|
81
|
+
const cutoff = new Date(Date.now() - 7 * 24 * 60 * 60_000);
|
|
82
|
+
await plans.repo.model.destroy({
|
|
83
|
+
where: { appName: this.app.name, expiresAt: { [Op.lt]: cutoff }, updatedAt: { [Op.lt]: cutoff } },
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
const handlers: Record<string, Handler> = {
|
|
88
|
+
view: (ctx) => plans.act(ctx, idInput.parse(ctx.action.params.values).planId, 'view'),
|
|
89
|
+
confirm: (ctx) => plans.act(ctx, idInput.parse(ctx.action.params.values).planId, 'confirm'),
|
|
90
|
+
reject: (ctx) => plans.act(ctx, idInput.parse(ctx.action.params.values).planId, 'reject'),
|
|
91
|
+
settings: async () => ({
|
|
92
|
+
operations: OPERATIONS,
|
|
93
|
+
roles: (await this.db.getRepository('roles').find({ fields: ['name', 'title'] })).map((r) => r.toJSON()),
|
|
94
|
+
policies: (
|
|
95
|
+
await this.db.getRepository('appBuilderPolicies').find({ filter: { operation: { $in: [...OPERATIONS] } } })
|
|
96
|
+
).map((r) => r.toJSON()),
|
|
97
|
+
grants: (await this.db.getRepository('appBuilderGrants').find()).map((r) => r.get('spec')),
|
|
98
|
+
}),
|
|
99
|
+
savePolicy: async (ctx) => {
|
|
100
|
+
const rule = policyInput.parse(ctx.action.params.values);
|
|
101
|
+
if (!(await this.db.getRepository('roles').count({ filterByTk: rule.role }))) fault('Role unavailable');
|
|
102
|
+
await this.db
|
|
103
|
+
.getRepository('appBuilderPolicies')
|
|
104
|
+
.updateOrCreate({ filterKeys: ['id'], values: { id: rule.role + '/' + rule.operation, ...rule } });
|
|
105
|
+
return rule;
|
|
106
|
+
},
|
|
107
|
+
saveGrant: async (ctx) => {
|
|
108
|
+
const grant = grantInput.parse(ctx.action.params.values);
|
|
109
|
+
if (
|
|
110
|
+
grant.enabled &&
|
|
111
|
+
!(await this.db.getRepository('appBuilderWorkflows').count({ filter: { workflowKey: grant.workflowKey } }))
|
|
112
|
+
)
|
|
113
|
+
fault('Managed workflow required');
|
|
114
|
+
if (
|
|
115
|
+
grant.enabled &&
|
|
116
|
+
!(await this.db.getRepository('rolesUsers').count({ filter: { userId: grant.userId, roleName: grant.role } }))
|
|
117
|
+
)
|
|
118
|
+
fault('Role unavailable');
|
|
119
|
+
await this.db
|
|
120
|
+
.getRepository('appBuilderGrants')
|
|
121
|
+
.updateOrCreate({ filterKeys: ['id'], values: { id: grant.workflowKey, spec: grant } });
|
|
122
|
+
return { workflowKey: grant.workflowKey, enabled: grant.enabled };
|
|
123
|
+
},
|
|
124
|
+
bindAtlas: () => this.bindAtlas(),
|
|
125
|
+
};
|
|
126
|
+
this.app.resourceManager.define({
|
|
127
|
+
name: RESOURCE,
|
|
128
|
+
actions: Object.fromEntries(
|
|
129
|
+
Object.entries(handlers).map(([name, handler]) => [
|
|
130
|
+
name,
|
|
131
|
+
async (ctx: Context, next: () => Promise<void>) => {
|
|
132
|
+
principal(ctx);
|
|
133
|
+
try {
|
|
134
|
+
ctx.body = await handler(ctx);
|
|
135
|
+
} catch (e) {
|
|
136
|
+
const status = Number(object(e).status) || (e instanceof z.ZodError ? 400 : 500);
|
|
137
|
+
ctx.throw(status, errorText(ctx, e));
|
|
138
|
+
}
|
|
139
|
+
await next();
|
|
140
|
+
},
|
|
141
|
+
]),
|
|
142
|
+
),
|
|
143
|
+
});
|
|
144
|
+
this.app.acl.allow(RESOURCE, ['view', 'confirm', 'reject'], 'loggedIn');
|
|
145
|
+
this.app.acl.registerSnippet({ name: 'pm.' + this.name, actions: adminActions.map((a) => RESOURCE + ':' + a) });
|
|
146
|
+
const manager = this.app.aiManager?.toolsManager;
|
|
147
|
+
manager?.registerTools(
|
|
148
|
+
TOOLS.map(
|
|
149
|
+
(name, index): ToolsOptions => ({
|
|
150
|
+
scope: 'CUSTOM',
|
|
151
|
+
execution: 'backend',
|
|
152
|
+
defaultPermission: 'ALLOW',
|
|
153
|
+
definition: { name, description: descriptions[index], schema: schemas[index] },
|
|
154
|
+
introduction: { title: '{{t("' + name + '", { ns: "' + NS + '" })}}', about: descriptions[index] },
|
|
155
|
+
invoke: async (ctx, args: Dict) => {
|
|
156
|
+
try {
|
|
157
|
+
const parsed = object(schemas[index].parse(args));
|
|
158
|
+
const input: Dict =
|
|
159
|
+
index === 1 && parsed.field
|
|
160
|
+
? { operations: [{ kind: 'addField', field: parsed.field, target: parsed.target }] }
|
|
161
|
+
: parsed;
|
|
162
|
+
const result = await plans.tool(ctx, index, index === 3 ? object(input.workflow) : input);
|
|
163
|
+
return { status: 'success', content: JSON.stringify(result) };
|
|
164
|
+
} catch (e) {
|
|
165
|
+
return { status: 'error', content: errorText(ctx, e) };
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
}),
|
|
169
|
+
),
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
async afterEnable() {
|
|
173
|
+
await this.bindAtlas();
|
|
174
|
+
}
|
|
175
|
+
async install() {
|
|
176
|
+
await this.bindAtlas();
|
|
177
|
+
}
|
|
178
|
+
async bindAtlas(previous?: Dict) {
|
|
179
|
+
if (!this.db.hasCollection('aiEmployees')) return { bound: false };
|
|
180
|
+
const repo = this.db.getRepository('aiEmployees');
|
|
181
|
+
if (!repo) return { bound: false };
|
|
182
|
+
return this.db.sequelize.transaction(async (transaction) => {
|
|
183
|
+
const atlas = await repo.model.findOne({ where: { username: 'atlas' }, transaction, lock: true });
|
|
184
|
+
if (!atlas) return { bound: false };
|
|
185
|
+
const settings = object(atlas.get('skillSettings'));
|
|
186
|
+
const existing = list(previous?.tools ?? settings.tools);
|
|
187
|
+
const skills = array(previous?.skills ?? settings.skills);
|
|
188
|
+
const tools = previous
|
|
189
|
+
? existing
|
|
190
|
+
: [
|
|
191
|
+
...existing,
|
|
192
|
+
...TOOLS.filter((name) => !existing.some((t) => t.name === name)).map((name) => ({ name, autoCall: true })),
|
|
193
|
+
];
|
|
194
|
+
await atlas.update(
|
|
195
|
+
{
|
|
196
|
+
skillSettings: {
|
|
197
|
+
...settings,
|
|
198
|
+
...previous,
|
|
199
|
+
tools,
|
|
200
|
+
skills: previous ? skills : [...new Set([...skills, ...SKILLS])],
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
{ transaction },
|
|
204
|
+
);
|
|
205
|
+
await this.db
|
|
206
|
+
.getRepository('appBuilderPolicies')
|
|
207
|
+
.firstOrCreate({ filterKeys: ['id'], values: { id: 'atlas-binding' }, transaction });
|
|
208
|
+
return { bound: true, tools: TOOLS.length, skills: SKILLS.length };
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|