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,305 @@
|
|
|
1
|
+
import { dispatchBrowserActionDetailed, isFailureText, } from "./dispatch.js";
|
|
2
|
+
import { browserTool, storeTool } from "../llm/tools.js";
|
|
3
|
+
import { executeStoreAction } from "../agent/executors/store-executor.js";
|
|
4
|
+
/** Actions that only observe page state — never count as "step goal achieved" in fallback. */
|
|
5
|
+
const OBSERVATION_ACTIONS = new Set(["snapshot", "screenshot", "console"]);
|
|
6
|
+
/**
|
|
7
|
+
* Wrap a string result from the CSS-selector replay path into a
|
|
8
|
+
* BrowserActionResult. These calls bypass dispatch (and therefore can't
|
|
9
|
+
* run an `expect` block), so the leading-prefix isFailureText check is
|
|
10
|
+
* exact — `[verification failed]` cannot appear in their output.
|
|
11
|
+
*/
|
|
12
|
+
function wrapDirect(text, action) {
|
|
13
|
+
return { ok: !isFailureText(text), text, action };
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Runs a skill script step-by-step.
|
|
17
|
+
* Each step tries direct execution first; on failure, falls back to LLM.
|
|
18
|
+
*/
|
|
19
|
+
export class ScriptRunner {
|
|
20
|
+
fallbackInstructions;
|
|
21
|
+
store;
|
|
22
|
+
actions;
|
|
23
|
+
llmClient;
|
|
24
|
+
logger;
|
|
25
|
+
constructor(actions, llmClient, logger, fallbackInstructions = "",
|
|
26
|
+
/**
|
|
27
|
+
* Optional store handle. When present, the fallback LLM gets the
|
|
28
|
+
* `storeTool` exposed so it can read and record structured cross-run
|
|
29
|
+
* state while recovering a failed step. Tasks
|
|
30
|
+
* that don't go through TaskRunner (e.g. legacy callers) can leave it
|
|
31
|
+
* undefined; fallback then runs browser-only as before.
|
|
32
|
+
*
|
|
33
|
+
* Note: this only helps the *fallback* path. The deterministic script
|
|
34
|
+
* step loop (executeStepInner) still routes everything through the
|
|
35
|
+
* browser dispatch — adding native `store.*` step types is a separate
|
|
36
|
+
* change that needs skill-generator support and isn't required until
|
|
37
|
+
* skill auto-generation is re-enabled (currently TODO'd in task-runner).
|
|
38
|
+
*/
|
|
39
|
+
store) {
|
|
40
|
+
this.fallbackInstructions = fallbackInstructions;
|
|
41
|
+
this.store = store;
|
|
42
|
+
this.actions = actions;
|
|
43
|
+
this.llmClient = llmClient;
|
|
44
|
+
this.logger = logger;
|
|
45
|
+
}
|
|
46
|
+
async run(script, variables = {}) {
|
|
47
|
+
const stepResults = [];
|
|
48
|
+
this.logger.log("script_start", {
|
|
49
|
+
skill: script.name,
|
|
50
|
+
totalSteps: script.steps.length,
|
|
51
|
+
});
|
|
52
|
+
let failedCount = 0;
|
|
53
|
+
for (let i = 0; i < script.steps.length; i++) {
|
|
54
|
+
const step = script.steps[i];
|
|
55
|
+
const resolvedParams = this.resolveVariables(step.params, variables);
|
|
56
|
+
console.log(` Step ${i + 1}/${script.steps.length}: ${step.action} ${step.description || ""}`);
|
|
57
|
+
try {
|
|
58
|
+
await this.executeStep(step.action, resolvedParams);
|
|
59
|
+
stepResults.push({
|
|
60
|
+
index: i,
|
|
61
|
+
action: step.action,
|
|
62
|
+
success: true,
|
|
63
|
+
usedFallback: false,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
68
|
+
console.log(` Step ${i + 1} failed, falling back to LLM: ${msg}`);
|
|
69
|
+
try {
|
|
70
|
+
const fallbackResult = await this.llmFallback(step, resolvedParams, msg);
|
|
71
|
+
stepResults.push({
|
|
72
|
+
index: i,
|
|
73
|
+
action: step.action,
|
|
74
|
+
success: true,
|
|
75
|
+
usedFallback: true,
|
|
76
|
+
fallbackAction: fallbackResult,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
catch (fallbackErr) {
|
|
80
|
+
failedCount++;
|
|
81
|
+
stepResults.push({
|
|
82
|
+
index: i,
|
|
83
|
+
action: step.action,
|
|
84
|
+
success: false,
|
|
85
|
+
usedFallback: true,
|
|
86
|
+
error: fallbackErr instanceof Error ? fallbackErr.message : String(fallbackErr),
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const report = {
|
|
92
|
+
skillName: script.name,
|
|
93
|
+
totalSteps: script.steps.length,
|
|
94
|
+
successCount: stepResults.filter((s) => s.success).length,
|
|
95
|
+
fallbackCount: stepResults.filter((s) => s.usedFallback).length,
|
|
96
|
+
failedCount,
|
|
97
|
+
steps: stepResults,
|
|
98
|
+
completed: failedCount === 0,
|
|
99
|
+
};
|
|
100
|
+
this.logger.log("script_end", {
|
|
101
|
+
skill: script.name,
|
|
102
|
+
completed: report.completed,
|
|
103
|
+
fallbackCount: report.fallbackCount,
|
|
104
|
+
failedCount: report.failedCount,
|
|
105
|
+
});
|
|
106
|
+
return report;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Detect BrowserActions failure strings via the centralized predicate
|
|
110
|
+
* shared with dispatch.ts so prefix changes never drift between modules.
|
|
111
|
+
* Used only for the CSS-selector replay path that calls BrowserActions
|
|
112
|
+
* methods directly (no dispatch, so no `expect` block can run, so the
|
|
113
|
+
* leading-prefix predicate is sufficient there).
|
|
114
|
+
*/
|
|
115
|
+
isFailureResult(result) {
|
|
116
|
+
return isFailureText(result);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Execute a step and throw on failure.
|
|
120
|
+
*
|
|
121
|
+
* Failure detection runs against the structured `BrowserActionResult.ok`
|
|
122
|
+
* so post-action `expect` mismatches (which appear as
|
|
123
|
+
* "[verification failed]" mid-string, NOT as a leading "Error:" prefix)
|
|
124
|
+
* are surfaced. Otherwise a click that succeeded at the Playwright level
|
|
125
|
+
* but failed its expectation would be miscounted as success and pollute
|
|
126
|
+
* skill stats.
|
|
127
|
+
*/
|
|
128
|
+
async executeStep(action, params) {
|
|
129
|
+
const r = await this.executeStepInner(action, params);
|
|
130
|
+
if (!r.ok)
|
|
131
|
+
throw new Error(r.text);
|
|
132
|
+
return r.text;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Inner dispatch. Routes through `dispatchBrowserActionDetailed` for
|
|
136
|
+
* everything except the skill-only `sleep` action, so:
|
|
137
|
+
* - CSS-shaped refs persisted in `ref` are auto-routed to the
|
|
138
|
+
* selector slot by dispatch's splitRefOrSelector.
|
|
139
|
+
* - `expect` blocks attached to step params are honored via
|
|
140
|
+
* dispatchActKind's verification step (covers both modern
|
|
141
|
+
* {action:"act", kind:"click"} and legacy {action:"click"} shapes).
|
|
142
|
+
*
|
|
143
|
+
* Earlier versions of this file kept hand-written CSS-replay wrappers
|
|
144
|
+
* (clickBySelector et al.) that called BrowserActions directly. That
|
|
145
|
+
* path bypassed the `expect` machinery, so old skills with mid-step
|
|
146
|
+
* verification were silently unverified. Removed in favor of the
|
|
147
|
+
* unified dispatch path.
|
|
148
|
+
*/
|
|
149
|
+
async executeStepInner(action, params) {
|
|
150
|
+
if (action === "sleep") {
|
|
151
|
+
const text = await this.actions.sleep(params.ms);
|
|
152
|
+
return wrapDirect(text, action);
|
|
153
|
+
}
|
|
154
|
+
if (action === "store") {
|
|
155
|
+
// Native store step: lets a deterministic skill record cross-run state
|
|
156
|
+
// (typically a `store.put` after a successful action). The step shape
|
|
157
|
+
// mirrors the LLM tool call: action: "store", params: { action: "put",
|
|
158
|
+
// collection, id, value?, meta? }.
|
|
159
|
+
//
|
|
160
|
+
// KNOWN GAP (acknowledged): pre-action storage reads via store.has/get
|
|
161
|
+
// would need (a) branching ("if has == yes, terminate script with
|
|
162
|
+
// success") and (b) variables extracted from page state (e.g. the
|
|
163
|
+
// candidate's stable id). Neither exists in the current script schema.
|
|
164
|
+
// Today this is enforced indirectly by the storage-sensitive guard in
|
|
165
|
+
// skill-generator: tasks whose prompts require structured storage stay
|
|
166
|
+
// LLM-driven. If skill auto-gen is ever re-enabled for those tasks,
|
|
167
|
+
// that guard must be strengthened or the script schema extended for
|
|
168
|
+
// guards/variables.
|
|
169
|
+
if (!this.store) {
|
|
170
|
+
return {
|
|
171
|
+
ok: false,
|
|
172
|
+
text: `Error: store step requested but no StoreManager wired into ` +
|
|
173
|
+
`ScriptRunner. This is an internal wiring bug — task-runner ` +
|
|
174
|
+
`should always pass store. Action ignored.`,
|
|
175
|
+
action: "store",
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
const subAction = params.action;
|
|
179
|
+
const text = executeStoreAction(this.store, subAction, params);
|
|
180
|
+
const isMutationSuccess = (subAction === "put" && (text === "ok" || text === "updated")) ||
|
|
181
|
+
(subAction === "delete" && text === "ok");
|
|
182
|
+
// Observations (has/get/list/count) are not "successful steps" in the
|
|
183
|
+
// executeStep sense; they don't change page state and they don't fail
|
|
184
|
+
// the script either. Mark ok=true so the linear script keeps going.
|
|
185
|
+
const isObservation = subAction === "has" ||
|
|
186
|
+
subAction === "get" ||
|
|
187
|
+
subAction === "list" ||
|
|
188
|
+
subAction === "count";
|
|
189
|
+
const isError = text.startsWith("store rejected") ||
|
|
190
|
+
text.startsWith("store.put rejected") ||
|
|
191
|
+
text.startsWith("store error:") ||
|
|
192
|
+
text.startsWith("Unknown store action");
|
|
193
|
+
return {
|
|
194
|
+
ok: !isError && (isMutationSuccess || isObservation),
|
|
195
|
+
text,
|
|
196
|
+
action: "store",
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
return dispatchBrowserActionDetailed(this.actions, action, params);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* LLM fallback: ask LLM to accomplish the step goal, then actually execute
|
|
203
|
+
* the tool calls it returns.
|
|
204
|
+
*/
|
|
205
|
+
async llmFallback(step, params, error) {
|
|
206
|
+
// Get current page state for LLM context
|
|
207
|
+
const snapshot = await this.actions.snapshot("full");
|
|
208
|
+
const messages = [
|
|
209
|
+
{
|
|
210
|
+
role: "user",
|
|
211
|
+
content: `I'm executing a script step that failed. Here's the context:
|
|
212
|
+
|
|
213
|
+
Step: ${step.action} with params: ${JSON.stringify(params)}
|
|
214
|
+
Description: ${step.description || "N/A"}
|
|
215
|
+
Error: ${error}
|
|
216
|
+
|
|
217
|
+
Current page state:
|
|
218
|
+
${snapshot}
|
|
219
|
+
|
|
220
|
+
Please use the browser tool to accomplish what this step was trying to do.`,
|
|
221
|
+
},
|
|
222
|
+
];
|
|
223
|
+
const systemPrompt = "You are a browser automation assistant. A script step failed and you need to accomplish the same goal using the browser tool. Be concise." +
|
|
224
|
+
(this.fallbackInstructions.trim()
|
|
225
|
+
? `\n\n${this.fallbackInstructions.trim()}`
|
|
226
|
+
: "");
|
|
227
|
+
// Mini chat loop: execute tool calls until LLM is done
|
|
228
|
+
const maxIterations = 10;
|
|
229
|
+
let lastSuccessAction = "";
|
|
230
|
+
const fallbackTools = this.store
|
|
231
|
+
? [browserTool, storeTool]
|
|
232
|
+
: [browserTool];
|
|
233
|
+
for (let i = 0; i < maxIterations; i++) {
|
|
234
|
+
const response = await this.llmClient.chat(messages, fallbackTools, systemPrompt, {
|
|
235
|
+
systemStaticChars: systemPrompt.length,
|
|
236
|
+
cacheTools: true,
|
|
237
|
+
cacheMessages: messages.length > 0,
|
|
238
|
+
});
|
|
239
|
+
// No tool calls — LLM is done
|
|
240
|
+
if (response.toolCalls.length === 0 || response.stopReason === "stop") {
|
|
241
|
+
if (lastSuccessAction)
|
|
242
|
+
return lastSuccessAction;
|
|
243
|
+
// LLM gave up without any successful action
|
|
244
|
+
throw new Error(`LLM fallback failed: ${response.content || "no browser action succeeded"}`);
|
|
245
|
+
}
|
|
246
|
+
// Record assistant message
|
|
247
|
+
messages.push({
|
|
248
|
+
role: "assistant",
|
|
249
|
+
content: response.content,
|
|
250
|
+
toolCalls: response.toolCalls,
|
|
251
|
+
});
|
|
252
|
+
// Execute each tool call via the detailed dispatch — we read `ok`
|
|
253
|
+
// directly instead of re-parsing the result string for failure
|
|
254
|
+
// prefixes.
|
|
255
|
+
for (const tc of response.toolCalls) {
|
|
256
|
+
const args = tc.arguments;
|
|
257
|
+
const action = args.action;
|
|
258
|
+
let resultText;
|
|
259
|
+
let tcAction;
|
|
260
|
+
if (tc.name === "store" && this.store) {
|
|
261
|
+
resultText = executeStoreAction(this.store, action, args);
|
|
262
|
+
tcAction = `store.${action}`;
|
|
263
|
+
// Only mutations advance lastSuccessAction. store.put returns
|
|
264
|
+
// exactly "ok" (insert) or "updated" (overwrite); store.delete
|
|
265
|
+
// returns "ok" on actual deletion. Everything else (including
|
|
266
|
+
// delete no-op, rejection, unknown action) does not advance.
|
|
267
|
+
const isStoreSuccess = (action === "put" && (resultText === "ok" || resultText === "updated")) ||
|
|
268
|
+
(action === "delete" && resultText === "ok");
|
|
269
|
+
if (isStoreSuccess) {
|
|
270
|
+
lastSuccessAction = `${tcAction}: ${resultText}`;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
const r = await dispatchBrowserActionDetailed(this.actions, action, args);
|
|
275
|
+
resultText = r.text;
|
|
276
|
+
tcAction = args.kind || action;
|
|
277
|
+
if (r.ok && !OBSERVATION_ACTIONS.has(tcAction)) {
|
|
278
|
+
lastSuccessAction = `${tcAction}: ${r.text.slice(0, 100)}`;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
messages.push({
|
|
282
|
+
role: "tool",
|
|
283
|
+
content: resultText,
|
|
284
|
+
toolCallId: tc.id,
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
if (lastSuccessAction)
|
|
289
|
+
return lastSuccessAction;
|
|
290
|
+
throw new Error("LLM fallback failed: max iterations with no successful action");
|
|
291
|
+
}
|
|
292
|
+
resolveVariables(params, variables) {
|
|
293
|
+
const resolved = {};
|
|
294
|
+
for (const [key, value] of Object.entries(params)) {
|
|
295
|
+
if (typeof value === "string") {
|
|
296
|
+
resolved[key] = value.replace(/\{\{(\w+)\}\}/g, (_, varName) => variables[varName] || `{{${varName}}}`);
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
resolved[key] = value;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
return resolved;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
//# sourceMappingURL=script-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script-runner.js","sourceRoot":"","sources":["../../src/browser/script-runner.ts"],"names":[],"mappings":"AACA,OAAO,EACL,6BAA6B,EAC7B,aAAa,GAEd,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE1E,8FAA8F;AAC9F,MAAM,mBAAmB,GAAG,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CAAC,MAAM,CAAC,EAAE,CAAC;YAClD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,QAAQ,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,OAAO,CAC3B,gBAAgB,EAChB,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,KAAK,OAAO,IAAI,CACvD,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,QAAQ,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YACxB,CAAC;QACH,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selector normalization & preflight validation.
|
|
3
|
+
*
|
|
4
|
+
* Production logs showed three recurring selector failures:
|
|
5
|
+
* 1. Over-escaped quotes from JSON tool calls — e.g. a[href=\\\"/User\\\"].
|
|
6
|
+
* 2. Empty / whitespace-only strings.
|
|
7
|
+
* 3. Unmatched brackets/quotes that crash the CSS parser.
|
|
8
|
+
*
|
|
9
|
+
* This module catches those before they reach Playwright, so the LLM gets
|
|
10
|
+
* an actionable repair candidate instead of a generic locator timeout.
|
|
11
|
+
*
|
|
12
|
+
* It is purposely conservative: only obviously-broken selectors are repaired
|
|
13
|
+
* or rejected. A selector that looks weird but parses cleanly is left alone —
|
|
14
|
+
* the truth is in `document.querySelector`.
|
|
15
|
+
*/
|
|
16
|
+
export interface NormalizeResult {
|
|
17
|
+
/** True if the selector is safe to pass to page.locator(). */
|
|
18
|
+
ok: boolean;
|
|
19
|
+
/** The cleaned selector. Only meaningful when ok=true. */
|
|
20
|
+
selector: string;
|
|
21
|
+
/** The original, before normalization. */
|
|
22
|
+
original: string;
|
|
23
|
+
/** Human-readable repair note when normalization changed something. */
|
|
24
|
+
note?: string;
|
|
25
|
+
/** Reason the selector was rejected when ok=false. */
|
|
26
|
+
error?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare function normalizeSelector(raw: unknown): NormalizeResult;
|
|
29
|
+
/**
|
|
30
|
+
* Returns true if the selector is too broad to be safely auto-resolved for a
|
|
31
|
+
* destructive action. The caller still gets to override (e.g. when the user
|
|
32
|
+
* explicitly passes such a selector), but stale-ref auto-recovery and
|
|
33
|
+
* fuzzy-match paths should refuse to use these.
|
|
34
|
+
*/
|
|
35
|
+
export declare function isSelectorBroad(selector: string): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Build a Playwright-safe attribute selector. Used when emitting stable
|
|
38
|
+
* selector hints from snapshot enrichment so we never produce malformed
|
|
39
|
+
* attribute literals from values that contain quotes.
|
|
40
|
+
*/
|
|
41
|
+
export declare function attrSelector(attr: string, value: string): string;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selector normalization & preflight validation.
|
|
3
|
+
*
|
|
4
|
+
* Production logs showed three recurring selector failures:
|
|
5
|
+
* 1. Over-escaped quotes from JSON tool calls — e.g. a[href=\\\"/User\\\"].
|
|
6
|
+
* 2. Empty / whitespace-only strings.
|
|
7
|
+
* 3. Unmatched brackets/quotes that crash the CSS parser.
|
|
8
|
+
*
|
|
9
|
+
* This module catches those before they reach Playwright, so the LLM gets
|
|
10
|
+
* an actionable repair candidate instead of a generic locator timeout.
|
|
11
|
+
*
|
|
12
|
+
* It is purposely conservative: only obviously-broken selectors are repaired
|
|
13
|
+
* or rejected. A selector that looks weird but parses cleanly is left alone —
|
|
14
|
+
* the truth is in `document.querySelector`.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* The set of selectors a destructive action (click on submit/post/delete-like
|
|
18
|
+
* controls, type into a non-editable wrapper, etc.) should refuse to use
|
|
19
|
+
* without an explicit user-provided ref. They match too many elements on a
|
|
20
|
+
* typical page and are almost always a sign of a bad LLM guess.
|
|
21
|
+
*/
|
|
22
|
+
const DANGEROUSLY_BROAD = new Set([
|
|
23
|
+
"*",
|
|
24
|
+
"body",
|
|
25
|
+
"html",
|
|
26
|
+
"div",
|
|
27
|
+
"span",
|
|
28
|
+
"a",
|
|
29
|
+
"button",
|
|
30
|
+
"input",
|
|
31
|
+
]);
|
|
32
|
+
export function normalizeSelector(raw) {
|
|
33
|
+
if (typeof raw !== "string") {
|
|
34
|
+
return {
|
|
35
|
+
ok: false,
|
|
36
|
+
selector: "",
|
|
37
|
+
original: String(raw ?? ""),
|
|
38
|
+
error: "selector must be a string",
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const original = raw;
|
|
42
|
+
let s = raw.trim();
|
|
43
|
+
if (s === "") {
|
|
44
|
+
return { ok: false, selector: "", original, error: "selector is empty" };
|
|
45
|
+
}
|
|
46
|
+
let note;
|
|
47
|
+
// JSON tool calls sometimes double-escape quotes: \\\" → ".
|
|
48
|
+
// We unescape conservatively: only when the selector contains \" but no
|
|
49
|
+
// already-correct ", since `[name="foo"]` is the canonical form and
|
|
50
|
+
// `[name=\"foo\"]` is almost certainly an artifact of bad JSON encoding.
|
|
51
|
+
if (s.includes('\\"')) {
|
|
52
|
+
const unescaped = s.replace(/\\"/g, '"');
|
|
53
|
+
note = `unescaped \\\" → \"`;
|
|
54
|
+
s = unescaped;
|
|
55
|
+
}
|
|
56
|
+
// Same pattern, single-quote variant.
|
|
57
|
+
if (s.includes("\\'")) {
|
|
58
|
+
s = s.replace(/\\'/g, "'");
|
|
59
|
+
note = note ? `${note}; unescaped \\' → '` : `unescaped \\' → '`;
|
|
60
|
+
}
|
|
61
|
+
// Reject unmatched quotes inside the string (excluding escaped pairs which
|
|
62
|
+
// we just removed). Count plain " and ' — if either is odd, the parser
|
|
63
|
+
// will throw.
|
|
64
|
+
const dq = (s.match(/"/g) ?? []).length;
|
|
65
|
+
const sq = (s.match(/'/g) ?? []).length;
|
|
66
|
+
if (dq % 2 !== 0) {
|
|
67
|
+
return {
|
|
68
|
+
ok: false,
|
|
69
|
+
selector: "",
|
|
70
|
+
original,
|
|
71
|
+
error: `unmatched double quote in selector: ${s}`,
|
|
72
|
+
note,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
if (sq % 2 !== 0) {
|
|
76
|
+
return {
|
|
77
|
+
ok: false,
|
|
78
|
+
selector: "",
|
|
79
|
+
original,
|
|
80
|
+
error: `unmatched single quote in selector: ${s}`,
|
|
81
|
+
note,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
// Reject unmatched brackets. We do a depth-aware scan that ignores
|
|
85
|
+
// characters inside string literals so `[name="]"]` doesn't false-flag.
|
|
86
|
+
const depth = scanBracketDepth(s);
|
|
87
|
+
if (depth !== 0) {
|
|
88
|
+
return {
|
|
89
|
+
ok: false,
|
|
90
|
+
selector: "",
|
|
91
|
+
original,
|
|
92
|
+
error: `unmatched brackets in selector: ${s}`,
|
|
93
|
+
note,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
return { ok: true, selector: s, original, note };
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Returns true if the selector is too broad to be safely auto-resolved for a
|
|
100
|
+
* destructive action. The caller still gets to override (e.g. when the user
|
|
101
|
+
* explicitly passes such a selector), but stale-ref auto-recovery and
|
|
102
|
+
* fuzzy-match paths should refuse to use these.
|
|
103
|
+
*/
|
|
104
|
+
export function isSelectorBroad(selector) {
|
|
105
|
+
const trimmed = selector.trim();
|
|
106
|
+
if (DANGEROUSLY_BROAD.has(trimmed.toLowerCase()))
|
|
107
|
+
return true;
|
|
108
|
+
// Bare tag name with no attribute/class/id qualifier.
|
|
109
|
+
if (/^[a-zA-Z]+$/.test(trimmed))
|
|
110
|
+
return true;
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Build a Playwright-safe attribute selector. Used when emitting stable
|
|
115
|
+
* selector hints from snapshot enrichment so we never produce malformed
|
|
116
|
+
* attribute literals from values that contain quotes.
|
|
117
|
+
*/
|
|
118
|
+
export function attrSelector(attr, value) {
|
|
119
|
+
// CSS attribute selectors only need to escape the chosen quote and
|
|
120
|
+
// backslash. We pick the quote variant that minimizes escaping.
|
|
121
|
+
const hasDouble = value.includes('"');
|
|
122
|
+
const hasSingle = value.includes("'");
|
|
123
|
+
if (!hasDouble) {
|
|
124
|
+
return `[${attr}="${value.replace(/\\/g, "\\\\")}"]`;
|
|
125
|
+
}
|
|
126
|
+
if (!hasSingle) {
|
|
127
|
+
return `[${attr}='${value.replace(/\\/g, "\\\\")}']`;
|
|
128
|
+
}
|
|
129
|
+
// Both quote types present — escape the double-quote variant.
|
|
130
|
+
const escaped = value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
131
|
+
return `[${attr}="${escaped}"]`;
|
|
132
|
+
}
|
|
133
|
+
function scanBracketDepth(s) {
|
|
134
|
+
let depth = 0;
|
|
135
|
+
let parenDepth = 0;
|
|
136
|
+
let i = 0;
|
|
137
|
+
while (i < s.length) {
|
|
138
|
+
const c = s[i];
|
|
139
|
+
// Skip over string literals.
|
|
140
|
+
if (c === '"' || c === "'") {
|
|
141
|
+
const quote = c;
|
|
142
|
+
i++;
|
|
143
|
+
while (i < s.length && s[i] !== quote) {
|
|
144
|
+
if (s[i] === "\\")
|
|
145
|
+
i++; // skip the escape
|
|
146
|
+
i++;
|
|
147
|
+
}
|
|
148
|
+
i++; // skip closing quote
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
if (c === "[")
|
|
152
|
+
depth++;
|
|
153
|
+
else if (c === "]")
|
|
154
|
+
depth--;
|
|
155
|
+
else if (c === "(")
|
|
156
|
+
parenDepth++;
|
|
157
|
+
else if (c === ")")
|
|
158
|
+
parenDepth--;
|
|
159
|
+
if (depth < 0 || parenDepth < 0)
|
|
160
|
+
return depth + parenDepth;
|
|
161
|
+
i++;
|
|
162
|
+
}
|
|
163
|
+
return depth + parenDepth;
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=selectors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.js","sourceRoot":"","sources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AC;YAChB,CAAC,EAAE,CAAC;YACJ,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC;gBACtC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI;oBAAE,CAAC,EAAE,CAAC,CAAC,kBAAkB;gBAC1C,CAAC,EAAE,CAAC;YACN,CAAC;YACD,CAAC,EAAE,CAAC,CAAC,qBAAqB;YAC1B,SAAS;QACX,CAAC;QACD,IAAI,CAAC,KAAK,GAAG;YAAE,KAAK,EAAE,CAAC;aAClB,IAAI,CAAC,KAAK,GAAG;YAAE,KAAK,EAAE,CAAC;aACvB,IAAI,CAAC,KAAK,GAAG;YAAE,UAAU,EAAE,CAAC;aAC5B,IAAI,CAAC,KAAK,GAAG;YAAE,UAAU,EAAE,CAAC;QACjC,IAAI,KAAK,GAAG,CAAC,IAAI,UAAU,GAAG,CAAC;YAAE,OAAO,KAAK,GAAG,UAAU,CAAC;QAC3D,CAAC,EAAE,CAAC;IACN,CAAC;IACD,OAAO,KAAK,GAAG,UAAU,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { Page } from "playwright";
|
|
2
|
+
/**
|
|
3
|
+
* Stable element metadata captured during the post-snapshot enrichment pass.
|
|
4
|
+
* The Playwright AI snapshot only gives us role/name/ref; this struct carries
|
|
5
|
+
* the DOM-level facts we need for selector picking, editable detection, and
|
|
6
|
+
* stale-ref recovery without re-querying the page on every action.
|
|
7
|
+
*/
|
|
8
|
+
export interface ElementRef {
|
|
9
|
+
ref: string;
|
|
10
|
+
role: string;
|
|
11
|
+
name: string;
|
|
12
|
+
/** Lower-case tag, e.g. "input", "div", "a". */
|
|
13
|
+
tag?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Best-effort stable CSS selector for this element, picked in priority:
|
|
16
|
+
* data-testid → unique id → unique [name] → unique [aria-label] →
|
|
17
|
+
* unique [placeholder]. Undefined if none qualify as unique on the page.
|
|
18
|
+
*/
|
|
19
|
+
stableSelector?: string;
|
|
20
|
+
/** True if input/textarea/[contenteditable]/aria-textbox-with-editable-host. */
|
|
21
|
+
editable?: boolean;
|
|
22
|
+
/** Current value for input/textarea (truncated). */
|
|
23
|
+
value?: string;
|
|
24
|
+
/** href for anchors. */
|
|
25
|
+
href?: string;
|
|
26
|
+
/**
|
|
27
|
+
* If this element has a `data-testid` but the testid is NOT unique on the
|
|
28
|
+
* page (typical of repeated feed/list action buttons),
|
|
29
|
+
* we record the global count instead of emitting a stable selector. The
|
|
30
|
+
* annotation surfaces this so the LLM doesn't blindly trust the testid.
|
|
31
|
+
*/
|
|
32
|
+
testidSelectorCount?: number;
|
|
33
|
+
/** Raw attributes, useful for stale-ref recovery candidate scoring. */
|
|
34
|
+
attrs?: {
|
|
35
|
+
testid?: string;
|
|
36
|
+
id?: string;
|
|
37
|
+
name?: string;
|
|
38
|
+
ariaLabel?: string;
|
|
39
|
+
placeholder?: string;
|
|
40
|
+
type?: string;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
interface SnapshotResult {
|
|
44
|
+
text: string;
|
|
45
|
+
elementRefs: Map<string, ElementRef>;
|
|
46
|
+
}
|
|
47
|
+
export type SnapshotMode = "full" | "interactive";
|
|
48
|
+
/**
|
|
49
|
+
* "ai" produces Playwright's compact AI snapshot (default — best for LLM
|
|
50
|
+
* summarization). "aria" produces the verbose accessibility tree output —
|
|
51
|
+
* not currently used by the agent itself but exposed so external tooling
|
|
52
|
+
* can request it.
|
|
53
|
+
*/
|
|
54
|
+
export type SnapshotFormat = "ai" | "aria";
|
|
55
|
+
/**
|
|
56
|
+
* "aria" refs are the existing eN style — short and good for the *next*
|
|
57
|
+
* action. "role" refs are role+name handles that the resolver re-resolves
|
|
58
|
+
* on each use; safer across rerenders but only act-safe when unique.
|
|
59
|
+
*/
|
|
60
|
+
export type RefStyle = "aria" | "role";
|
|
61
|
+
export interface SnapshotOptions {
|
|
62
|
+
mode?: SnapshotMode;
|
|
63
|
+
/** CSS selector to scope snapshot to a subtree. */
|
|
64
|
+
selector?: string;
|
|
65
|
+
/** Strip consecutive blank lines and trailing whitespace. */
|
|
66
|
+
compact?: boolean;
|
|
67
|
+
/** Max nesting depth (by 2-space indentation). */
|
|
68
|
+
depth?: number;
|
|
69
|
+
/** Override the default char cap. */
|
|
70
|
+
maxChars?: number;
|
|
71
|
+
/**
|
|
72
|
+
* Enable post-snapshot DOM enrichment (stable selectors + editable hints).
|
|
73
|
+
* Default true. Disable for cheap snapshots where the cost of N parallel
|
|
74
|
+
* evaluates per ref is not worth it.
|
|
75
|
+
*/
|
|
76
|
+
enrich?: boolean;
|
|
77
|
+
/** Output format. Default "ai". */
|
|
78
|
+
snapshotFormat?: SnapshotFormat;
|
|
79
|
+
/**
|
|
80
|
+
* Ref style appended to interactive lines. Default "aria" (Playwright's
|
|
81
|
+
* eN format). With "role", we additionally annotate each line with a
|
|
82
|
+
* role+name handle: `[role-ref="button|Post"]`. The resolver supports
|
|
83
|
+
* both — pass either as `ref` to actions like click/type.
|
|
84
|
+
*/
|
|
85
|
+
refs?: RefStyle;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Wipe all ref metadata. Called when the page identity changes
|
|
89
|
+
* (navigation, tab switch, page close) — both the live and historical
|
|
90
|
+
* caches refer to a page we no longer have.
|
|
91
|
+
*/
|
|
92
|
+
export declare function resetRefs(): void;
|
|
93
|
+
export declare function getElementRef(ref: string): ElementRef | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Look up a ref's metadata in the previous-snapshot cache only. Used by
|
|
96
|
+
* stale-ref recovery to locate the role/name/stableSelector of a ref the
|
|
97
|
+
* LLM is acting on AFTER taking a fresh snapshot that invalidated it.
|
|
98
|
+
*
|
|
99
|
+
* The recovery code will NOT use this metadata to re-query via aria-ref —
|
|
100
|
+
* that would point at the wrong DOM. It uses the stable attributes
|
|
101
|
+
* (data-testid, etc.) and role+name pair to find the equivalent element
|
|
102
|
+
* in the current snapshot.
|
|
103
|
+
*/
|
|
104
|
+
export declare function getPreviousElementRef(ref: string): ElementRef | undefined;
|
|
105
|
+
export declare function getAllRefs(): Map<string, ElementRef>;
|
|
106
|
+
/**
|
|
107
|
+
* Take a snapshot of the page accessibility tree.
|
|
108
|
+
*
|
|
109
|
+
* Accepts either a SnapshotMode string (backward compat) or SnapshotOptions object.
|
|
110
|
+
*/
|
|
111
|
+
export declare function takeSnapshot(page: Page, modeOrOptions?: SnapshotMode | SnapshotOptions, maxCharsOverride?: number): Promise<SnapshotResult>;
|
|
112
|
+
/**
|
|
113
|
+
* Parse element refs from snapshot text into the currentRefs map.
|
|
114
|
+
*
|
|
115
|
+
* Three passes, richest first. Each pass uses `currentRefs.has` as a
|
|
116
|
+
* "don't overwrite" guard so a later, looser pattern can never replace
|
|
117
|
+
* a name we already captured.
|
|
118
|
+
*
|
|
119
|
+
* Pass C (role-only) exists because Playwright's ai-mode emits refs on
|
|
120
|
+
* structural nodes that have no accessible name — `- generic [ref=e1]:`,
|
|
121
|
+
* `- link [ref=e5]:` when a site wraps several visual elements in a single
|
|
122
|
+
* link with empty aria-name. Without this pass those refs appear in
|
|
123
|
+
* the snapshot text the LLM reads but never enter currentRefs, so any
|
|
124
|
+
* action against them returns "ref not found or stale" *before*
|
|
125
|
+
* stale-ref recovery has any metadata to work with. Exported so unit
|
|
126
|
+
* tests can drive it directly without spinning up a browser.
|
|
127
|
+
*/
|
|
128
|
+
export declare function parseRefs(snapshot: string): void;
|
|
129
|
+
export {};
|