dp-worker 0.1.0
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/builtin-skills/sourcepool.md +228 -0
- package/builtin-skills/x.md +263 -0
- package/config.example.json +37 -0
- package/dist/agent/agent-types.d.ts +44 -0
- package/dist/agent/agent-types.js +23 -0
- package/dist/agent/agent-types.js.map +1 -0
- package/dist/agent/agent.d.ts +162 -0
- package/dist/agent/agent.js +670 -0
- package/dist/agent/agent.js.map +1 -0
- package/dist/agent/browser-lock.d.ts +36 -0
- package/dist/agent/browser-lock.js +46 -0
- package/dist/agent/browser-lock.js.map +1 -0
- package/dist/agent/chat-engine.d.ts +87 -0
- package/dist/agent/chat-engine.js +588 -0
- package/dist/agent/chat-engine.js.map +1 -0
- package/dist/agent/chrome-watchdog.d.ts +74 -0
- package/dist/agent/chrome-watchdog.js +136 -0
- package/dist/agent/chrome-watchdog.js.map +1 -0
- package/dist/agent/context.d.ts +148 -0
- package/dist/agent/context.js +521 -0
- package/dist/agent/context.js.map +1 -0
- package/dist/agent/duration.d.ts +2 -0
- package/dist/agent/duration.js +15 -0
- package/dist/agent/duration.js.map +1 -0
- package/dist/agent/executors/attachment-executor.d.ts +19 -0
- package/dist/agent/executors/attachment-executor.js +136 -0
- package/dist/agent/executors/attachment-executor.js.map +1 -0
- package/dist/agent/executors/memory-executor.d.ts +2 -0
- package/dist/agent/executors/memory-executor.js +13 -0
- package/dist/agent/executors/memory-executor.js.map +1 -0
- package/dist/agent/executors/org-executor.d.ts +8 -0
- package/dist/agent/executors/org-executor.js +47 -0
- package/dist/agent/executors/org-executor.js.map +1 -0
- package/dist/agent/executors/scheduler-executor.d.ts +21 -0
- package/dist/agent/executors/scheduler-executor.js +75 -0
- package/dist/agent/executors/scheduler-executor.js.map +1 -0
- package/dist/agent/executors/skill-executor.d.ts +10 -0
- package/dist/agent/executors/skill-executor.js +178 -0
- package/dist/agent/executors/skill-executor.js.map +1 -0
- package/dist/agent/executors/store-executor.d.ts +2 -0
- package/dist/agent/executors/store-executor.js +42 -0
- package/dist/agent/executors/store-executor.js.map +1 -0
- package/dist/agent/executors/web-fetch-executor.d.ts +17 -0
- package/dist/agent/executors/web-fetch-executor.js +164 -0
- package/dist/agent/executors/web-fetch-executor.js.map +1 -0
- package/dist/agent/frontend-multiplexer.d.ts +38 -0
- package/dist/agent/frontend-multiplexer.js +67 -0
- package/dist/agent/frontend-multiplexer.js.map +1 -0
- package/dist/agent/image-generator.d.ts +35 -0
- package/dist/agent/image-generator.js +266 -0
- package/dist/agent/image-generator.js.map +1 -0
- package/dist/agent/image-postprocess.d.ts +25 -0
- package/dist/agent/image-postprocess.js +82 -0
- package/dist/agent/image-postprocess.js.map +1 -0
- package/dist/agent/memory.d.ts +55 -0
- package/dist/agent/memory.js +401 -0
- package/dist/agent/memory.js.map +1 -0
- package/dist/agent/org-manager.d.ts +70 -0
- package/dist/agent/org-manager.js +280 -0
- package/dist/agent/org-manager.js.map +1 -0
- package/dist/agent/scheduler.d.ts +51 -0
- package/dist/agent/scheduler.js +302 -0
- package/dist/agent/scheduler.js.map +1 -0
- package/dist/agent/skill-generator.d.ts +116 -0
- package/dist/agent/skill-generator.js +704 -0
- package/dist/agent/skill-generator.js.map +1 -0
- package/dist/agent/storage-policy.d.ts +55 -0
- package/dist/agent/storage-policy.js +406 -0
- package/dist/agent/storage-policy.js.map +1 -0
- package/dist/agent/store.d.ts +58 -0
- package/dist/agent/store.js +309 -0
- package/dist/agent/store.js.map +1 -0
- package/dist/agent/task-runner.d.ts +34 -0
- package/dist/agent/task-runner.js +705 -0
- package/dist/agent/task-runner.js.map +1 -0
- package/dist/agent/tool-loop-detection.d.ts +60 -0
- package/dist/agent/tool-loop-detection.js +233 -0
- package/dist/agent/tool-loop-detection.js.map +1 -0
- package/dist/agent/tool-runner.d.ts +37 -0
- package/dist/agent/tool-runner.js +72 -0
- package/dist/agent/tool-runner.js.map +1 -0
- package/dist/browser/actions.d.ts +217 -0
- package/dist/browser/actions.js +3097 -0
- package/dist/browser/actions.js.map +1 -0
- package/dist/browser/builtin-page-cleanups.d.ts +19 -0
- package/dist/browser/builtin-page-cleanups.js +111 -0
- package/dist/browser/builtin-page-cleanups.js.map +1 -0
- package/dist/browser/chrome-process.d.ts +55 -0
- package/dist/browser/chrome-process.js +288 -0
- package/dist/browser/chrome-process.js.map +1 -0
- package/dist/browser/dispatch.d.ts +32 -0
- package/dist/browser/dispatch.js +582 -0
- package/dist/browser/dispatch.js.map +1 -0
- package/dist/browser/dom-helpers.d.ts +68 -0
- package/dist/browser/dom-helpers.js +477 -0
- package/dist/browser/dom-helpers.js.map +1 -0
- package/dist/browser/expect.d.ts +66 -0
- package/dist/browser/expect.js +314 -0
- package/dist/browser/expect.js.map +1 -0
- package/dist/browser/humanize.d.ts +56 -0
- package/dist/browser/humanize.js +216 -0
- package/dist/browser/humanize.js.map +1 -0
- package/dist/browser/locator-resolver.d.ts +88 -0
- package/dist/browser/locator-resolver.js +302 -0
- package/dist/browser/locator-resolver.js.map +1 -0
- package/dist/browser/manager.d.ts +95 -0
- package/dist/browser/manager.js +389 -0
- package/dist/browser/manager.js.map +1 -0
- package/dist/browser/script-runner.d.ts +117 -0
- package/dist/browser/script-runner.js +305 -0
- package/dist/browser/script-runner.js.map +1 -0
- package/dist/browser/selectors.d.ts +41 -0
- package/dist/browser/selectors.js +165 -0
- package/dist/browser/selectors.js.map +1 -0
- package/dist/browser/snapshot.d.ts +129 -0
- package/dist/browser/snapshot.js +504 -0
- package/dist/browser/snapshot.js.map +1 -0
- package/dist/browser/workspace-lock.d.ts +37 -0
- package/dist/browser/workspace-lock.js +286 -0
- package/dist/browser/workspace-lock.js.map +1 -0
- package/dist/center/center-client.d.ts +124 -0
- package/dist/center/center-client.js +316 -0
- package/dist/center/center-client.js.map +1 -0
- package/dist/center/center-frontend.d.ts +92 -0
- package/dist/center/center-frontend.js +459 -0
- package/dist/center/center-frontend.js.map +1 -0
- package/dist/center/session-sync.d.ts +85 -0
- package/dist/center/session-sync.js +345 -0
- package/dist/center/session-sync.js.map +1 -0
- package/dist/config/center-config.d.ts +60 -0
- package/dist/config/center-config.js +92 -0
- package/dist/config/center-config.js.map +1 -0
- package/dist/config/types.d.ts +93 -0
- package/dist/config/types.js +136 -0
- package/dist/config/types.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +395 -0
- package/dist/index.js.map +1 -0
- package/dist/llm/client.d.ts +24 -0
- package/dist/llm/client.js +696 -0
- package/dist/llm/client.js.map +1 -0
- package/dist/llm/message-optimizer.d.ts +50 -0
- package/dist/llm/message-optimizer.js +337 -0
- package/dist/llm/message-optimizer.js.map +1 -0
- package/dist/llm/tools.d.ts +37 -0
- package/dist/llm/tools.js +895 -0
- package/dist/llm/tools.js.map +1 -0
- package/dist/llm/types.d.ts +96 -0
- package/dist/llm/types.js +2 -0
- package/dist/llm/types.js.map +1 -0
- package/dist/logging/logger.d.ts +17 -0
- package/dist/logging/logger.js +54 -0
- package/dist/logging/logger.js.map +1 -0
- package/dist/scripts/migrate-history-to-store.d.ts +2 -0
- package/dist/scripts/migrate-history-to-store.js +250 -0
- package/dist/scripts/migrate-history-to-store.js.map +1 -0
- package/dist/telegram/bot.d.ts +28 -0
- package/dist/telegram/bot.js +546 -0
- package/dist/telegram/bot.js.map +1 -0
- package/dist/tui/tui.d.ts +12 -0
- package/dist/tui/tui.js +177 -0
- package/dist/tui/tui.js.map +1 -0
- package/dist/utils/safe-slice.d.ts +25 -0
- package/dist/utils/safe-slice.js +43 -0
- package/dist/utils/safe-slice.js.map +1 -0
- package/node_modules/dp-shared/dist/admin-broadcast.d.ts +26 -0
- package/node_modules/dp-shared/dist/admin-broadcast.d.ts.map +1 -0
- package/node_modules/dp-shared/dist/admin-broadcast.js +7 -0
- package/node_modules/dp-shared/dist/admin-broadcast.js.map +1 -0
- package/node_modules/dp-shared/dist/audit-contracts.d.ts +41 -0
- package/node_modules/dp-shared/dist/audit-contracts.d.ts.map +1 -0
- package/node_modules/dp-shared/dist/audit-contracts.js +30 -0
- package/node_modules/dp-shared/dist/audit-contracts.js.map +1 -0
- package/node_modules/dp-shared/dist/configs-contracts.d.ts +187 -0
- package/node_modules/dp-shared/dist/configs-contracts.d.ts.map +1 -0
- package/node_modules/dp-shared/dist/configs-contracts.js +165 -0
- package/node_modules/dp-shared/dist/configs-contracts.js.map +1 -0
- package/node_modules/dp-shared/dist/db-rows.d.ts +293 -0
- package/node_modules/dp-shared/dist/db-rows.d.ts.map +1 -0
- package/node_modules/dp-shared/dist/db-rows.js +222 -0
- package/node_modules/dp-shared/dist/db-rows.js.map +1 -0
- package/node_modules/dp-shared/dist/deploy-contracts.d.ts +34 -0
- package/node_modules/dp-shared/dist/deploy-contracts.d.ts.map +1 -0
- package/node_modules/dp-shared/dist/deploy-contracts.js +32 -0
- package/node_modules/dp-shared/dist/deploy-contracts.js.map +1 -0
- package/node_modules/dp-shared/dist/domain.d.ts +144 -0
- package/node_modules/dp-shared/dist/domain.d.ts.map +1 -0
- package/node_modules/dp-shared/dist/domain.js +81 -0
- package/node_modules/dp-shared/dist/domain.js.map +1 -0
- package/node_modules/dp-shared/dist/identities.d.ts +35 -0
- package/node_modules/dp-shared/dist/identities.d.ts.map +1 -0
- package/node_modules/dp-shared/dist/identities.js +27 -0
- package/node_modules/dp-shared/dist/identities.js.map +1 -0
- package/node_modules/dp-shared/dist/index.d.ts +24 -0
- package/node_modules/dp-shared/dist/index.d.ts.map +1 -0
- package/node_modules/dp-shared/dist/index.js +24 -0
- package/node_modules/dp-shared/dist/index.js.map +1 -0
- package/node_modules/dp-shared/dist/rest-contracts.d.ts +459 -0
- package/node_modules/dp-shared/dist/rest-contracts.d.ts.map +1 -0
- package/node_modules/dp-shared/dist/rest-contracts.js +318 -0
- package/node_modules/dp-shared/dist/rest-contracts.js.map +1 -0
- package/node_modules/dp-shared/dist/task-history-contracts.d.ts +210 -0
- package/node_modules/dp-shared/dist/task-history-contracts.d.ts.map +1 -0
- package/node_modules/dp-shared/dist/task-history-contracts.js +99 -0
- package/node_modules/dp-shared/dist/task-history-contracts.js.map +1 -0
- package/node_modules/dp-shared/dist/worker-detail-contracts.d.ts +212 -0
- package/node_modules/dp-shared/dist/worker-detail-contracts.d.ts.map +1 -0
- package/node_modules/dp-shared/dist/worker-detail-contracts.js +193 -0
- package/node_modules/dp-shared/dist/worker-detail-contracts.js.map +1 -0
- package/node_modules/dp-shared/dist/ws-protocol.d.ts +839 -0
- package/node_modules/dp-shared/dist/ws-protocol.d.ts.map +1 -0
- package/node_modules/dp-shared/dist/ws-protocol.js +264 -0
- package/node_modules/dp-shared/dist/ws-protocol.js.map +1 -0
- package/node_modules/dp-shared/package.json +31 -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/package.json +69 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized element-resolution layer.
|
|
3
|
+
*
|
|
4
|
+
* Browser actions used to each duplicate the same pattern: look the ref up
|
|
5
|
+
* in the in-memory map, fall back to a CSS selector, generate similar
|
|
6
|
+
* "ref not found" error messages, etc. As stale-ref auto-recovery and
|
|
7
|
+
* selector normalization grew, that duplication started to drift.
|
|
8
|
+
*
|
|
9
|
+
* This module owns:
|
|
10
|
+
* - selector normalization (delegated to ./selectors)
|
|
11
|
+
* - aria-ref lookup with stale-ref auto-recovery via captured metadata
|
|
12
|
+
* - role + name + text (Playwright getByRole / getByText) entry points
|
|
13
|
+
*
|
|
14
|
+
* Actions never call `page.locator(selector).first()` or `page.locator(\`aria-ref=${ref}\`)`
|
|
15
|
+
* directly anymore — they go through `resolveLocator` (or the lower-level
|
|
16
|
+
* helpers it exports for backward compat).
|
|
17
|
+
*/
|
|
18
|
+
import type { Locator, Page } from "playwright";
|
|
19
|
+
import { type ElementRef } from "./snapshot.js";
|
|
20
|
+
export interface LocatorInput {
|
|
21
|
+
ref?: string;
|
|
22
|
+
selector?: string;
|
|
23
|
+
role?: string;
|
|
24
|
+
name?: string;
|
|
25
|
+
/** Visible text match (Playwright getByText). */
|
|
26
|
+
text?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ResolveOptions {
|
|
29
|
+
/** Display label used in error messages ("element", "start element", etc.). */
|
|
30
|
+
label?: string;
|
|
31
|
+
/** Whether the action is destructive (gates fuzzy-name recovery). */
|
|
32
|
+
destructive?: boolean;
|
|
33
|
+
/** Name of the CSS-alternative parameter, or null when the action has none. */
|
|
34
|
+
selectorParam?: "selector" | "element" | null;
|
|
35
|
+
}
|
|
36
|
+
export interface ResolveOk {
|
|
37
|
+
ok: true;
|
|
38
|
+
locator: Locator;
|
|
39
|
+
label: string;
|
|
40
|
+
/** Ref that ultimately produced the locator (may differ from input on recovery). */
|
|
41
|
+
refUsed?: string;
|
|
42
|
+
/** Stable selector that ultimately produced the locator, when known. */
|
|
43
|
+
selectorUsed?: string;
|
|
44
|
+
/** Recovery path used, when applicable. */
|
|
45
|
+
recoveredVia?: "stableSelector" | "roleExactName" | "roleFuzzyName";
|
|
46
|
+
}
|
|
47
|
+
export interface ResolveFail {
|
|
48
|
+
ok: false;
|
|
49
|
+
message: string;
|
|
50
|
+
}
|
|
51
|
+
export type ResolveResult = ResolveOk | ResolveFail;
|
|
52
|
+
/**
|
|
53
|
+
* "Destructive" = a click that submits/posts/sends/deletes, where landing
|
|
54
|
+
* on the wrong button would do real damage. Recovery for these is restricted
|
|
55
|
+
* to high-confidence paths (stableSelector + role+exact-name); fuzzy name
|
|
56
|
+
* matches are refused so we never auto-click a "Post" lookalike.
|
|
57
|
+
*/
|
|
58
|
+
export declare function looksDestructive(meta: ElementRef): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Top-level resolver. Handles all four input shapes and unifies error
|
|
61
|
+
* formatting. Most action methods call this with only one of {ref, selector}
|
|
62
|
+
* set; role/name/text are exposed for callers that want Playwright's native
|
|
63
|
+
* accessibility-tree matching without a snapshot first.
|
|
64
|
+
*/
|
|
65
|
+
export declare function resolveLocator(page: Page, input: LocatorInput, opts?: ResolveOptions): Promise<ResolveResult>;
|
|
66
|
+
export declare function resolveSelector(page: Page, raw: unknown, paramName?: string): {
|
|
67
|
+
ok: true;
|
|
68
|
+
locator: Locator;
|
|
69
|
+
selector: string;
|
|
70
|
+
note?: string;
|
|
71
|
+
} | {
|
|
72
|
+
ok: false;
|
|
73
|
+
error: string;
|
|
74
|
+
};
|
|
75
|
+
export declare function refNotFoundMessage(ref: string, label?: string, selectorParam?: "selector" | "element" | null): string;
|
|
76
|
+
/**
|
|
77
|
+
* Resolve a ref to a Locator, with one bounded auto-recovery pass when the
|
|
78
|
+
* underlying DOM node is stale. Recovery order:
|
|
79
|
+
* 1. stableSelector (data-testid / unique id / unique [name|aria-label|placeholder])
|
|
80
|
+
* 2. role + exact accessible name (re-snapshotted)
|
|
81
|
+
* 3. role + fuzzy accessible name (skipped for destructive actions)
|
|
82
|
+
*
|
|
83
|
+
* Recovery only fires when there's exactly one high-confidence candidate.
|
|
84
|
+
* Ambiguous matches return the candidate list so the LLM can disambiguate.
|
|
85
|
+
*/
|
|
86
|
+
export declare function locateRefWithRecovery(page: Page, ref: string, opts?: ResolveOptions & {
|
|
87
|
+
allowRecovery?: boolean;
|
|
88
|
+
}): Promise<ResolveResult>;
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { normalizeSelector } from "./selectors.js";
|
|
2
|
+
import { takeSnapshot, getElementRef, getPreviousElementRef, } from "./snapshot.js";
|
|
3
|
+
const DESTRUCTIVE_NAME_RE = /\b(post|tweet|send|submit|confirm|delete|remove|buy|sell|transfer|pay|publish|reply|repost|retweet|cancel\s+order|approve)\b/i;
|
|
4
|
+
/**
|
|
5
|
+
* "Destructive" = a click that submits/posts/sends/deletes, where landing
|
|
6
|
+
* on the wrong button would do real damage. Recovery for these is restricted
|
|
7
|
+
* to high-confidence paths (stableSelector + role+exact-name); fuzzy name
|
|
8
|
+
* matches are refused so we never auto-click a "Post" lookalike.
|
|
9
|
+
*/
|
|
10
|
+
export function looksDestructive(meta) {
|
|
11
|
+
if (!meta)
|
|
12
|
+
return false;
|
|
13
|
+
return DESTRUCTIVE_NAME_RE.test(meta.name);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Top-level resolver. Handles all four input shapes and unifies error
|
|
17
|
+
* formatting. Most action methods call this with only one of {ref, selector}
|
|
18
|
+
* set; role/name/text are exposed for callers that want Playwright's native
|
|
19
|
+
* accessibility-tree matching without a snapshot first.
|
|
20
|
+
*/
|
|
21
|
+
export async function resolveLocator(page, input, opts = {}) {
|
|
22
|
+
if (input.ref != null) {
|
|
23
|
+
return locateRefWithRecovery(page, input.ref, opts);
|
|
24
|
+
}
|
|
25
|
+
if (input.selector != null) {
|
|
26
|
+
const r = resolveSelector(page, input.selector, opts.selectorParam ?? "selector");
|
|
27
|
+
if (!r.ok)
|
|
28
|
+
return { ok: false, message: r.error };
|
|
29
|
+
return {
|
|
30
|
+
ok: true,
|
|
31
|
+
locator: r.locator,
|
|
32
|
+
label: r.selector,
|
|
33
|
+
selectorUsed: r.selector,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (input.role) {
|
|
37
|
+
if (input.name != null) {
|
|
38
|
+
const loc = page.getByRole(input.role, {
|
|
39
|
+
name: input.name,
|
|
40
|
+
exact: true,
|
|
41
|
+
});
|
|
42
|
+
return {
|
|
43
|
+
ok: true,
|
|
44
|
+
locator: loc.first(),
|
|
45
|
+
label: `${input.role}: "${input.name}"`,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const loc = page.getByRole(input.role);
|
|
49
|
+
return {
|
|
50
|
+
ok: true,
|
|
51
|
+
locator: loc.first(),
|
|
52
|
+
label: `${input.role}`,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if (input.text != null) {
|
|
56
|
+
return {
|
|
57
|
+
ok: true,
|
|
58
|
+
locator: page.getByText(input.text).first(),
|
|
59
|
+
label: `text: "${input.text}"`,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
ok: false,
|
|
64
|
+
message: "resolveLocator requires one of {ref, selector, role, text}.",
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/* -------------------------------------------------------------------------- */
|
|
68
|
+
/* Selector path */
|
|
69
|
+
/* -------------------------------------------------------------------------- */
|
|
70
|
+
export function resolveSelector(page, raw, paramName = "selector") {
|
|
71
|
+
const norm = normalizeSelector(raw);
|
|
72
|
+
if (!norm.ok) {
|
|
73
|
+
return {
|
|
74
|
+
ok: false,
|
|
75
|
+
error: `Error: ${paramName} ${norm.error}. ` +
|
|
76
|
+
`Original: ${JSON.stringify(norm.original)}. ` +
|
|
77
|
+
`Tip: pass plain CSS like [data-testid="..."], no extra escaping.`,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
ok: true,
|
|
82
|
+
locator: page.locator(norm.selector).first(),
|
|
83
|
+
selector: norm.selector,
|
|
84
|
+
...(norm.note ? { note: norm.note } : {}),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/* -------------------------------------------------------------------------- */
|
|
88
|
+
/* Stale-ref auto-recovery */
|
|
89
|
+
/* -------------------------------------------------------------------------- */
|
|
90
|
+
export function refNotFoundMessage(ref, label = "element", selectorParam = "selector") {
|
|
91
|
+
const base = `Error: ${label} reference '${ref}' not found or stale. ` +
|
|
92
|
+
`Refs are invalidated by the next snapshot, navigation, tab switch, ` +
|
|
93
|
+
`dialog open/close, and React re-renders on focus ` +
|
|
94
|
+
`(common for Lexical/ProseMirror-style rich editors). ` +
|
|
95
|
+
`Take a fresh snapshot to get new refs`;
|
|
96
|
+
if (selectorParam === null) {
|
|
97
|
+
return `${base}.`;
|
|
98
|
+
}
|
|
99
|
+
return (`${base}, or pass ${selectorParam}='<css>' ` +
|
|
100
|
+
`(e.g. [data-testid="..."]) for stable elements.`);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Resolve a ref to a Locator, with one bounded auto-recovery pass when the
|
|
104
|
+
* underlying DOM node is stale. Recovery order:
|
|
105
|
+
* 1. stableSelector (data-testid / unique id / unique [name|aria-label|placeholder])
|
|
106
|
+
* 2. role + exact accessible name (re-snapshotted)
|
|
107
|
+
* 3. role + fuzzy accessible name (skipped for destructive actions)
|
|
108
|
+
*
|
|
109
|
+
* Recovery only fires when there's exactly one high-confidence candidate.
|
|
110
|
+
* Ambiguous matches return the candidate list so the LLM can disambiguate.
|
|
111
|
+
*/
|
|
112
|
+
export async function locateRefWithRecovery(page, ref, opts = {}) {
|
|
113
|
+
const labelHint = opts.label ?? "element";
|
|
114
|
+
const selectorParam = opts.selectorParam ?? "selector";
|
|
115
|
+
const allowRecovery = opts.allowRecovery !== false;
|
|
116
|
+
// Role-ref format: "role|name" (emitted by snapshots with refs:"role").
|
|
117
|
+
// Resolves via Playwright's accessibility tree on each call rather than
|
|
118
|
+
// through the eN cache — safer across rerenders, but only act-safe when
|
|
119
|
+
// the role+name pair is unique on the page.
|
|
120
|
+
const roleSep = ref.indexOf("|");
|
|
121
|
+
if (roleSep > 0 && !ref.startsWith("e")) {
|
|
122
|
+
const role = ref.slice(0, roleSep);
|
|
123
|
+
const name = ref.slice(roleSep + 1);
|
|
124
|
+
const loc = page.getByRole(role, {
|
|
125
|
+
name,
|
|
126
|
+
exact: true,
|
|
127
|
+
});
|
|
128
|
+
try {
|
|
129
|
+
const cnt = await loc.count();
|
|
130
|
+
if (cnt === 1) {
|
|
131
|
+
return {
|
|
132
|
+
ok: true,
|
|
133
|
+
locator: loc.first(),
|
|
134
|
+
label: `${role}: "${name}"`,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
if (cnt === 0) {
|
|
138
|
+
return {
|
|
139
|
+
ok: false,
|
|
140
|
+
message: `Error: role-ref ${JSON.stringify(ref)} did not match any element. ` +
|
|
141
|
+
`Take a fresh snapshot — the role+name pair may have changed.`,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
ok: false,
|
|
146
|
+
message: `Error: role-ref ${JSON.stringify(ref)} matched ${cnt} elements. ` +
|
|
147
|
+
`Use a more specific ref (snapshot with refs="aria") or a CSS selector.`,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
catch (err) {
|
|
151
|
+
return {
|
|
152
|
+
ok: false,
|
|
153
|
+
message: `Error resolving role-ref ${JSON.stringify(ref)}: ${err instanceof Error ? err.message : String(err)}`,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// Three lookup tiers, all fed into the same recovery machinery:
|
|
158
|
+
// 1. currentRefs → live: try aria-ref first, fall back to recovery
|
|
159
|
+
// 2. previousRefs → ref invalidated by a newer snapshot but we still
|
|
160
|
+
// know its metadata; skip the live lookup (it would
|
|
161
|
+
// point at the wrong DOM) and go straight to recovery
|
|
162
|
+
// 3. neither → return ref-not-found
|
|
163
|
+
const liveMeta = getElementRef(ref);
|
|
164
|
+
const histMeta = liveMeta ? undefined : getPreviousElementRef(ref);
|
|
165
|
+
const meta = liveMeta ?? histMeta;
|
|
166
|
+
if (!meta) {
|
|
167
|
+
return {
|
|
168
|
+
ok: false,
|
|
169
|
+
message: refNotFoundMessage(ref, labelHint, selectorParam),
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
// Live path: only valid for refs in the CURRENT snapshot map. Refs from
|
|
173
|
+
// the previous snapshot are stale by definition — their aria-ref entries
|
|
174
|
+
// belong to an old AX tree and would resolve to the wrong node.
|
|
175
|
+
if (liveMeta) {
|
|
176
|
+
const live = page.locator(`aria-ref=${ref}`);
|
|
177
|
+
try {
|
|
178
|
+
if ((await live.count()) > 0) {
|
|
179
|
+
return {
|
|
180
|
+
ok: true,
|
|
181
|
+
locator: live,
|
|
182
|
+
label: `${meta.role}: "${meta.name}"`,
|
|
183
|
+
refUsed: ref,
|
|
184
|
+
selectorUsed: meta.stableSelector,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
// fall through to recovery
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (!allowRecovery) {
|
|
193
|
+
return {
|
|
194
|
+
ok: false,
|
|
195
|
+
message: refNotFoundMessage(ref, labelHint, selectorParam),
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
// Recovery 1: stable selector still resolves uniquely.
|
|
199
|
+
if (meta.stableSelector) {
|
|
200
|
+
try {
|
|
201
|
+
const cnt = await page.locator(meta.stableSelector).count();
|
|
202
|
+
if (cnt === 1) {
|
|
203
|
+
const loc = page.locator(meta.stableSelector).first();
|
|
204
|
+
return {
|
|
205
|
+
ok: true,
|
|
206
|
+
locator: loc,
|
|
207
|
+
label: `${meta.role}: "${meta.name}" (recovered via stableSelector)`,
|
|
208
|
+
refUsed: ref,
|
|
209
|
+
selectorUsed: meta.stableSelector,
|
|
210
|
+
recoveredVia: "stableSelector",
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
catch {
|
|
215
|
+
// selector parse error or other — fall through.
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
// Re-snapshot to get fresh refs, then look for a same-role+name match.
|
|
219
|
+
let fresh;
|
|
220
|
+
try {
|
|
221
|
+
const snap = await takeSnapshot(page, { mode: "interactive" });
|
|
222
|
+
fresh = snap.elementRefs;
|
|
223
|
+
}
|
|
224
|
+
catch {
|
|
225
|
+
return {
|
|
226
|
+
ok: false,
|
|
227
|
+
message: refNotFoundMessage(ref, labelHint, selectorParam) +
|
|
228
|
+
` (recovery snapshot failed)`,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
// Recovery 2: role + exact name.
|
|
232
|
+
const exact = [];
|
|
233
|
+
for (const [r, m] of fresh) {
|
|
234
|
+
if (m.role === meta.role && m.name === meta.name) {
|
|
235
|
+
exact.push({ ref: r, meta: m });
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
if (exact.length === 1) {
|
|
239
|
+
const newRef = exact[0].ref;
|
|
240
|
+
const newMeta = exact[0].meta;
|
|
241
|
+
return {
|
|
242
|
+
ok: true,
|
|
243
|
+
locator: page.locator(`aria-ref=${newRef}`),
|
|
244
|
+
label: `${newMeta.role}: "${newMeta.name}" (recovered via role+exact-name, ref ${ref}→${newRef})`,
|
|
245
|
+
refUsed: newRef,
|
|
246
|
+
selectorUsed: newMeta.stableSelector,
|
|
247
|
+
recoveredVia: "roleExactName",
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
// Recovery 3: role + fuzzy name (skipped for destructive actions).
|
|
251
|
+
if (!opts.destructive) {
|
|
252
|
+
const wanted = meta.name.toLowerCase().trim();
|
|
253
|
+
if (wanted) {
|
|
254
|
+
const fuzzy = [];
|
|
255
|
+
for (const [r, m] of fresh) {
|
|
256
|
+
if (m.role !== meta.role)
|
|
257
|
+
continue;
|
|
258
|
+
const cand = m.name.toLowerCase().trim();
|
|
259
|
+
if (cand === wanted)
|
|
260
|
+
continue;
|
|
261
|
+
if (cand.includes(wanted) || wanted.includes(cand)) {
|
|
262
|
+
fuzzy.push({ ref: r, meta: m });
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
if (fuzzy.length === 1) {
|
|
266
|
+
const newRef = fuzzy[0].ref;
|
|
267
|
+
const newMeta = fuzzy[0].meta;
|
|
268
|
+
return {
|
|
269
|
+
ok: true,
|
|
270
|
+
locator: page.locator(`aria-ref=${newRef}`),
|
|
271
|
+
label: `${newMeta.role}: "${newMeta.name}" (recovered via role+fuzzy-name, ref ${ref}→${newRef})`,
|
|
272
|
+
refUsed: newRef,
|
|
273
|
+
selectorUsed: newMeta.stableSelector,
|
|
274
|
+
recoveredVia: "roleFuzzyName",
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
// No high-confidence recovery — return candidates so the LLM can choose.
|
|
280
|
+
const allCandidates = [];
|
|
281
|
+
for (const [r, m] of fresh) {
|
|
282
|
+
if (m.role === meta.role)
|
|
283
|
+
allCandidates.push({ ref: r, meta: m });
|
|
284
|
+
}
|
|
285
|
+
const top = allCandidates.slice(0, 8);
|
|
286
|
+
const candidatesText = top.length
|
|
287
|
+
? top
|
|
288
|
+
.map((c) => ` - ${c.meta.role} "${c.meta.name}" [ref=${c.ref}]${c.meta.stableSelector ? ` [selector=${c.meta.stableSelector}]` : ""}`)
|
|
289
|
+
.join("\n")
|
|
290
|
+
: " (no same-role candidates in fresh snapshot)";
|
|
291
|
+
const destructiveNote = opts.destructive
|
|
292
|
+
? `\nNote: this action is destructive — fuzzy-name auto-recovery was skipped to avoid clicking the wrong submit/post/delete button.`
|
|
293
|
+
: "";
|
|
294
|
+
return {
|
|
295
|
+
ok: false,
|
|
296
|
+
message: refNotFoundMessage(ref, labelHint, selectorParam) +
|
|
297
|
+
`\nFresh snapshot has these ${meta.role}s — pick one and retry:\n` +
|
|
298
|
+
candidatesText +
|
|
299
|
+
destructiveNote,
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
//# sourceMappingURL=locator-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locator-resolver.js","sourceRoot":"","sources":["../../src/browser/locator-resolver.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EACL,YAAY,EACZ,aAAa,EACb,qBAAqB,G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,CAAC;IAEP,OAAO;QACL,EAAE,EAAE,KAAK;QACT,OAAO,EACL,kBAAkB,CAAC,GAAG,EAAE,SAAS,EAAE,aAAa,CAAC;YACjD,8BAA8B,IAAI,CAAC,IAAI,2BAA2B;YAClE,cAAc;YACd,eAAe;KAClB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { type Page } from "playwright";
|
|
2
|
+
import { type DipclawConfig } from "../config/types.js";
|
|
3
|
+
export declare class BrowserManager {
|
|
4
|
+
private browser;
|
|
5
|
+
private context;
|
|
6
|
+
private chromeProcess;
|
|
7
|
+
private config;
|
|
8
|
+
private proxyAuth;
|
|
9
|
+
private workspaceLock;
|
|
10
|
+
private launchedAtMs;
|
|
11
|
+
/**
|
|
12
|
+
* Wall-clock of the last browser-touching call (launch, page access,
|
|
13
|
+
* resetTabs). Used by the idle-close watchdog to decide when to tear
|
|
14
|
+
* Chrome down while keeping workspace ownership. Null while Chrome is
|
|
15
|
+
* not launched.
|
|
16
|
+
*/
|
|
17
|
+
private lastActivityMs;
|
|
18
|
+
/**
|
|
19
|
+
* In-flight setup promises keyed by Page. Both the `context.on("page")`
|
|
20
|
+
* listener and explicit callers (resetTabs, future openTab fixes) route
|
|
21
|
+
* through `setupPage`; this map ensures they share one promise so an
|
|
22
|
+
* explicit `await setupPage(p)` actually waits for the listener-spawned
|
|
23
|
+
* work to finish, instead of starting a redundant second setup that
|
|
24
|
+
* would attach duplicate Fetch listeners and CDP sessions.
|
|
25
|
+
*/
|
|
26
|
+
private setupPromises;
|
|
27
|
+
constructor(config: DipclawConfig);
|
|
28
|
+
/**
|
|
29
|
+
* Claim workspace ownership and clean up orphan Chrome from a previous
|
|
30
|
+
* run. Idempotent. Lets startup fail-fast on workspace conflicts without
|
|
31
|
+
* paying the cost of actually spawning Chrome — Chrome itself is launched
|
|
32
|
+
* lazily by getActivePage/newPage when a browser action is needed, and
|
|
33
|
+
* may also be torn down + relaunched by the idle-close watchdog while
|
|
34
|
+
* this workspace lock stays held.
|
|
35
|
+
*/
|
|
36
|
+
prepareWorkspace(): Promise<void>;
|
|
37
|
+
launch(): Promise<void>;
|
|
38
|
+
private spawnAndConnect;
|
|
39
|
+
getActivePage(): Promise<Page>;
|
|
40
|
+
getPages(): Promise<Page[]>;
|
|
41
|
+
newPage(): Promise<Page>;
|
|
42
|
+
/**
|
|
43
|
+
* Close every open tab and leave a single fresh about:blank.
|
|
44
|
+
*
|
|
45
|
+
* Each Chrome tab runs in its own renderer process; closing the tab is
|
|
46
|
+
* what releases that renderer's anonymous memory (V8 heap, decoded
|
|
47
|
+
* images, DOM). Long-running scheduled tasks accumulate this growth
|
|
48
|
+
* over hours, so we call this at the start of every scheduled task to
|
|
49
|
+
* return renderers to a clean slate.
|
|
50
|
+
*
|
|
51
|
+
* Order matters: open the fresh page first, then close the old ones.
|
|
52
|
+
* If we did it the other way around, Chrome could see "zero pages" for
|
|
53
|
+
* a moment and decide to exit (it doesn't always, but the behavior is
|
|
54
|
+
* version-dependent — opening first sidesteps the question).
|
|
55
|
+
*
|
|
56
|
+
* Safe to call when no tabs are open: returns immediately.
|
|
57
|
+
*/
|
|
58
|
+
resetTabs(): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Tear down Chrome + Playwright handle while retaining workspace
|
|
61
|
+
* ownership. Used by the idle-close watchdog: a later getActivePage()
|
|
62
|
+
* re-spawns Chrome in-place without re-claiming the lock or rescanning
|
|
63
|
+
* for orphans (this process is still the owner).
|
|
64
|
+
*
|
|
65
|
+
* Safe to call when Chrome was never launched: returns immediately.
|
|
66
|
+
* Page references the caller may still hold become detached and any
|
|
67
|
+
* subsequent operation on them will throw — element refs (`[ref=eN]`)
|
|
68
|
+
* are also invalidated.
|
|
69
|
+
*/
|
|
70
|
+
closeKeepLock(): Promise<void>;
|
|
71
|
+
close(): Promise<void>;
|
|
72
|
+
restart(): Promise<void>;
|
|
73
|
+
getUptimeMs(): number | null;
|
|
74
|
+
/**
|
|
75
|
+
* Ms since the last browser-touching operation, or null if Chrome is
|
|
76
|
+
* not currently launched. Used by the idle-close watchdog.
|
|
77
|
+
*/
|
|
78
|
+
getIdleMs(): number | null;
|
|
79
|
+
/**
|
|
80
|
+
* Idempotent per-page setup entry point.
|
|
81
|
+
*
|
|
82
|
+
* The context "page" event listener fires synchronously on emit, but its
|
|
83
|
+
* setup work (CDP session, Fetch.enable, timezone override) is async and
|
|
84
|
+
* not awaited by the emitter. Without coordination, an explicit caller
|
|
85
|
+
* that awaits `newPage()` and then navigates can race against that
|
|
86
|
+
* listener-spawned work — proxy auth or timezone may not be live yet.
|
|
87
|
+
*
|
|
88
|
+
* We coalesce by Page: the first call (whichever wins the race) starts
|
|
89
|
+
* the real setup and stashes the Promise; subsequent calls return the
|
|
90
|
+
* same Promise, so awaiting it produces correct happens-before.
|
|
91
|
+
*/
|
|
92
|
+
private setupPage;
|
|
93
|
+
private doSetupPage;
|
|
94
|
+
isLaunched(): boolean;
|
|
95
|
+
}
|