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,705 @@
|
|
|
1
|
+
import { getAllTools } from "../llm/tools.js";
|
|
2
|
+
import { BrowserActions } from "../browser/actions.js";
|
|
3
|
+
import { runBrowserTool, capToolResultText } from "./tool-runner.js";
|
|
4
|
+
import { ScriptRunner } from "../browser/script-runner.js";
|
|
5
|
+
import { ExecutionLogger } from "../logging/logger.js";
|
|
6
|
+
import { executeStoreAction } from "./executors/store-executor.js";
|
|
7
|
+
import { SkillGenerator, } from "./skill-generator.js";
|
|
8
|
+
import { ImageGenerator } from "./image-generator.js";
|
|
9
|
+
import { ToolLoopDetector, detectorOptionsForProtocol, } from "./tool-loop-detection.js";
|
|
10
|
+
import { executeWebFetchAction } from "./executors/web-fetch-executor.js";
|
|
11
|
+
import { normalizeStoragePolicies, renderStoragePolicySection, StoragePolicyRuntimeTracker, } from "./storage-policy.js";
|
|
12
|
+
import { buildLlmContext, compactMessagesWithState, CONTEXT_BUDGETS, ContextTranscript, createEmptyContextState, estimateMessagesChars, truncateContextSection, } from "./context.js";
|
|
13
|
+
import { executeReadOnlySkillAction } from "./executors/skill-executor.js";
|
|
14
|
+
import path from "node:path";
|
|
15
|
+
import { randomUUID } from "node:crypto";
|
|
16
|
+
function estimateCharCount(messages) {
|
|
17
|
+
return estimateMessagesChars(messages);
|
|
18
|
+
}
|
|
19
|
+
export class TaskRunner {
|
|
20
|
+
config;
|
|
21
|
+
llmClient;
|
|
22
|
+
browser;
|
|
23
|
+
browserActions;
|
|
24
|
+
memory;
|
|
25
|
+
store;
|
|
26
|
+
skillGenerator;
|
|
27
|
+
imageGenerator = null;
|
|
28
|
+
scheduler = null;
|
|
29
|
+
constructor(config, llmClient, browser, memory, store) {
|
|
30
|
+
this.config = config;
|
|
31
|
+
this.llmClient = llmClient;
|
|
32
|
+
this.browser = browser;
|
|
33
|
+
this.browserActions = new BrowserActions(browser, config.browser.actionDelay, path.join(config.workspace, "attachments"));
|
|
34
|
+
this.memory = memory;
|
|
35
|
+
this.store = store;
|
|
36
|
+
this.skillGenerator = new SkillGenerator(config.workspace, llmClient);
|
|
37
|
+
if (config.llm.imageGeneration) {
|
|
38
|
+
this.imageGenerator = new ImageGenerator(config.llm.imageGeneration, config.llm.baseUrl, config.workspace);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** Set scheduler reference for auto-linking skills to tasks */
|
|
42
|
+
setScheduler(scheduler) {
|
|
43
|
+
this.scheduler = scheduler;
|
|
44
|
+
}
|
|
45
|
+
/** Run a scheduled task with learning loop */
|
|
46
|
+
async runTask(task, signal) {
|
|
47
|
+
throwIfAborted(signal);
|
|
48
|
+
const logsDir = path.join(this.config.workspace, "logs");
|
|
49
|
+
const logger = new ExecutionLogger(logsDir, task.name);
|
|
50
|
+
this.browserActions.setLogger(logger);
|
|
51
|
+
const startedAt = Date.now();
|
|
52
|
+
const storagePolicies = task.storagePolicyMode === "off"
|
|
53
|
+
? []
|
|
54
|
+
: normalizeStoragePolicies(task.storagePolicies, task.id);
|
|
55
|
+
const canUseSkill = !!task.skillRef && storagePolicies.length === 0;
|
|
56
|
+
const mode = canUseSkill ? "skill" : "llm";
|
|
57
|
+
logger.log("task_start", {
|
|
58
|
+
taskId: task.id,
|
|
59
|
+
taskName: task.name,
|
|
60
|
+
mode,
|
|
61
|
+
prompt: task.prompt,
|
|
62
|
+
skillRef: task.skillRef,
|
|
63
|
+
storagePolicies,
|
|
64
|
+
cron: task.cron,
|
|
65
|
+
timezone: task.timezone,
|
|
66
|
+
});
|
|
67
|
+
try {
|
|
68
|
+
// Path A: Skill-based execution — run skill, then try to improve if needed
|
|
69
|
+
if (canUseSkill && task.skillRef) {
|
|
70
|
+
throwIfAborted(signal);
|
|
71
|
+
const skill = this.skillGenerator.loadSkill(task.skillRef);
|
|
72
|
+
if (skill) {
|
|
73
|
+
console.log(` Using skill: ${skill.name}`);
|
|
74
|
+
const fallbackInstructions = this.skillGenerator.renderLoadedInstructionSkillSection(this.skillGenerator.getAutoLoadedInstructionSkills(`${task.name}\n${task.prompt}\n${skill.name}\n${skill.description}`));
|
|
75
|
+
const runner = new ScriptRunner(this.browserActions, this.llmClient, logger, fallbackInstructions, this.store);
|
|
76
|
+
const report = await runner.run(skill);
|
|
77
|
+
throwIfAborted(signal);
|
|
78
|
+
// Update skill usage stats
|
|
79
|
+
this.skillGenerator.updateSkillMeta(task.skillRef, report.completed);
|
|
80
|
+
// Learning: if some steps used fallback, improve the skill
|
|
81
|
+
// TODO: temporarily disabled — re-enable when ready
|
|
82
|
+
// if (report.fallbackCount > 0 && report.completed) {
|
|
83
|
+
// console.log(`🧠 Learning: ${report.fallbackCount} step(s) used fallback, improving skill...`);
|
|
84
|
+
// await this.skillGenerator.improveSkill(skill, report);
|
|
85
|
+
// }
|
|
86
|
+
const reportText = this.formatReport(report);
|
|
87
|
+
// Propagate failure so callers (scheduler, /run) record correct status
|
|
88
|
+
if (!report.completed) {
|
|
89
|
+
logger.log("task_end", {
|
|
90
|
+
durationMs: Date.now() - startedAt,
|
|
91
|
+
mode,
|
|
92
|
+
completionStatus: "failed",
|
|
93
|
+
stopReason: "skill_failed",
|
|
94
|
+
successCount: report.successCount,
|
|
95
|
+
totalSteps: report.totalSteps,
|
|
96
|
+
fallbackCount: report.fallbackCount,
|
|
97
|
+
resultPreview: reportText.slice(0, 500),
|
|
98
|
+
}, false);
|
|
99
|
+
throw new Error(reportText);
|
|
100
|
+
}
|
|
101
|
+
logger.log("task_end", {
|
|
102
|
+
durationMs: Date.now() - startedAt,
|
|
103
|
+
mode,
|
|
104
|
+
completionStatus: "complete",
|
|
105
|
+
stopReason: "completed",
|
|
106
|
+
successCount: report.successCount,
|
|
107
|
+
totalSteps: report.totalSteps,
|
|
108
|
+
fallbackCount: report.fallbackCount,
|
|
109
|
+
resultPreview: reportText.slice(0, 500),
|
|
110
|
+
});
|
|
111
|
+
return reportText;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// Path B: LLM-driven execution — then auto-generate skill if worthwhile
|
|
115
|
+
const run = await this.runLlmDriven(task.prompt, logger, signal, `${task.name}\n${task.prompt}`, storagePolicies);
|
|
116
|
+
const result = run.content;
|
|
117
|
+
// Learning: auto-generate skill from successful LLM-driven execution
|
|
118
|
+
// TODO: temporarily disabled — re-enable when ready
|
|
119
|
+
// await this.tryAutoGenerateSkill(task, logger);
|
|
120
|
+
logger.log("task_end", {
|
|
121
|
+
durationMs: Date.now() - startedAt,
|
|
122
|
+
mode,
|
|
123
|
+
completionStatus: run.completionStatus,
|
|
124
|
+
stopReason: run.stopReason,
|
|
125
|
+
resultPreview: result.slice(0, 500),
|
|
126
|
+
});
|
|
127
|
+
return result;
|
|
128
|
+
}
|
|
129
|
+
catch (err) {
|
|
130
|
+
logger.log("task_end", {
|
|
131
|
+
durationMs: Date.now() - startedAt,
|
|
132
|
+
mode,
|
|
133
|
+
completionStatus: "failed",
|
|
134
|
+
stopReason: "error",
|
|
135
|
+
error: err instanceof Error ? err.message : String(err),
|
|
136
|
+
}, false);
|
|
137
|
+
throw err;
|
|
138
|
+
}
|
|
139
|
+
finally {
|
|
140
|
+
this.browserActions.clearLogger(logger);
|
|
141
|
+
console.log(` Log saved: ${logger.getLogFilePath()}`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/** Try to auto-generate a skill from a successful LLM-driven task and link it */
|
|
145
|
+
async tryAutoGenerateSkill(task, logger) {
|
|
146
|
+
const logPath = logger.getLogFilePath();
|
|
147
|
+
if (!this.skillGenerator.shouldAutoGenerate(logPath)) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
console.log(`🧠 Learning: auto-generating skill from task "${task.name}"...`);
|
|
151
|
+
try {
|
|
152
|
+
const saveResult = await this.skillGenerator.generate(logPath);
|
|
153
|
+
console.log(` ${saveResult}`);
|
|
154
|
+
// Auto-link the new skill to this scheduled task
|
|
155
|
+
if (this.scheduler && saveResult.startsWith("Skill saved:")) {
|
|
156
|
+
// Extract skill name from the saved file path
|
|
157
|
+
const match = saveResult.match(/\/([^/]+)\.md$/);
|
|
158
|
+
if (match) {
|
|
159
|
+
const skillRef = match[1];
|
|
160
|
+
this.scheduler.linkSkill(task.id, skillRef);
|
|
161
|
+
console.log(` Skill "${skillRef}" auto-linked to task "${task.name}"`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
catch (err) {
|
|
166
|
+
console.error(" Auto skill generation failed:", err);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/** Format an execution report as readable text */
|
|
170
|
+
formatReport(report) {
|
|
171
|
+
const lines = [`Skill "${report.skillName}": ${report.completed ? "completed" : "failed"}`];
|
|
172
|
+
lines.push(` ${report.successCount}/${report.totalSteps} steps ok, ${report.fallbackCount} fallback(s)`);
|
|
173
|
+
for (const step of report.steps) {
|
|
174
|
+
const status = step.success
|
|
175
|
+
? step.usedFallback ? "ok (fallback)" : "ok"
|
|
176
|
+
: `FAILED: ${step.error}`;
|
|
177
|
+
lines.push(` Step ${step.index + 1} [${step.action}]: ${status}`);
|
|
178
|
+
}
|
|
179
|
+
return lines.join("\n");
|
|
180
|
+
}
|
|
181
|
+
/** Run an ad-hoc prompt in LLM-driven mode */
|
|
182
|
+
async runPrompt(prompt, taskName = "adhoc") {
|
|
183
|
+
const logsDir = path.join(this.config.workspace, "logs");
|
|
184
|
+
const logger = new ExecutionLogger(logsDir, taskName);
|
|
185
|
+
this.browserActions.setLogger(logger);
|
|
186
|
+
const startedAt = Date.now();
|
|
187
|
+
logger.log("task_start", { taskName, mode: "adhoc", prompt });
|
|
188
|
+
try {
|
|
189
|
+
const run = await this.runLlmDriven(prompt, logger, undefined, `${taskName}\n${prompt}`);
|
|
190
|
+
const result = run.content;
|
|
191
|
+
logger.log("task_end", {
|
|
192
|
+
durationMs: Date.now() - startedAt,
|
|
193
|
+
mode: "adhoc",
|
|
194
|
+
completionStatus: run.completionStatus,
|
|
195
|
+
stopReason: run.stopReason,
|
|
196
|
+
resultPreview: result.slice(0, 500),
|
|
197
|
+
});
|
|
198
|
+
return result;
|
|
199
|
+
}
|
|
200
|
+
catch (err) {
|
|
201
|
+
logger.log("task_end", {
|
|
202
|
+
durationMs: Date.now() - startedAt,
|
|
203
|
+
mode: "adhoc",
|
|
204
|
+
completionStatus: "failed",
|
|
205
|
+
stopReason: "error",
|
|
206
|
+
error: err instanceof Error ? err.message : String(err),
|
|
207
|
+
}, false);
|
|
208
|
+
throw err;
|
|
209
|
+
}
|
|
210
|
+
finally {
|
|
211
|
+
this.browserActions.clearLogger(logger);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
async runLlmDriven(prompt, logger, signal, skillTriggerText = prompt, storagePolicies = []) {
|
|
215
|
+
throwIfAborted(signal);
|
|
216
|
+
// Fresh session id per task run; pins every iteration of this task to
|
|
217
|
+
// the same upstream account via the gateway's sticky-session router.
|
|
218
|
+
const sessionId = randomUUID();
|
|
219
|
+
// Build system prompt with memory context
|
|
220
|
+
const memoryIndex = this.memory.loadIndexCapped({
|
|
221
|
+
maxEntries: CONTEXT_BUDGETS.task.memoryIndexMaxEntries,
|
|
222
|
+
maxBytes: CONTEXT_BUDGETS.task.memoryIndexMaxBytes,
|
|
223
|
+
});
|
|
224
|
+
const relevantMemory = this.memory.loadRelevantMemories(prompt.split(/\s+/).filter((w) => w.length > 3), {
|
|
225
|
+
maxFiles: CONTEXT_BUDGETS.task.relevantMemoryMaxFiles,
|
|
226
|
+
maxTotalBytes: CONTEXT_BUDGETS.task.relevantMemoryMaxTotalBytes,
|
|
227
|
+
perFileBytes: CONTEXT_BUDGETS.task.relevantMemoryPerFileBytes,
|
|
228
|
+
});
|
|
229
|
+
const loadedInstructionSkills = this.skillGenerator.getAutoLoadedInstructionSkills(skillTriggerText);
|
|
230
|
+
let systemPrompt = this.buildSystemPrompt(memoryIndex, relevantMemory, loadedInstructionSkills, storagePolicies);
|
|
231
|
+
// Scheduled tasks run without a chat context, so attachment.send has no
|
|
232
|
+
// recipient and attachment handlers are only implemented in chat mode.
|
|
233
|
+
// Keep skill in task mode as read-only (list/read) so tasks can load
|
|
234
|
+
// installed instruction skills without being able to modify them.
|
|
235
|
+
const tools = getAllTools({
|
|
236
|
+
imageGeneration: !!this.imageGenerator,
|
|
237
|
+
taskMode: true,
|
|
238
|
+
}).filter((t) => t.name !== "attachment");
|
|
239
|
+
const loopDetector = new ToolLoopDetector(detectorOptionsForProtocol(this.config.llm.protocol));
|
|
240
|
+
const storageTracker = new StoragePolicyRuntimeTracker(storagePolicies);
|
|
241
|
+
let messages = [
|
|
242
|
+
{ role: "user", content: prompt },
|
|
243
|
+
];
|
|
244
|
+
const contextTranscript = new ContextTranscript(this.config.workspace, "task");
|
|
245
|
+
contextTranscript.append(messages[0], { source: "task_prompt" });
|
|
246
|
+
let contextState = createEmptyContextState();
|
|
247
|
+
const pushMessage = (message, meta) => {
|
|
248
|
+
messages.push(message);
|
|
249
|
+
contextTranscript.append(message, meta);
|
|
250
|
+
};
|
|
251
|
+
let iterations = 0;
|
|
252
|
+
let finalContent = "";
|
|
253
|
+
const maxIter = this.config.maxIterations;
|
|
254
|
+
let forceStop = false;
|
|
255
|
+
let completed = false;
|
|
256
|
+
let contextCompactionCooldown = 0;
|
|
257
|
+
const maybeCompactContext = async (purpose) => {
|
|
258
|
+
if (estimateMessagesChars(messages) <= CONTEXT_BUDGETS.task.compactionCharBudget) {
|
|
259
|
+
contextCompactionCooldown = 0;
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
if (contextCompactionCooldown > 0) {
|
|
263
|
+
contextCompactionCooldown--;
|
|
264
|
+
logger.log("context_compaction", {
|
|
265
|
+
iteration: iterations,
|
|
266
|
+
...(purpose ? { purpose } : {}),
|
|
267
|
+
reason: "cooldown",
|
|
268
|
+
retainedCount: messages.length,
|
|
269
|
+
}, false);
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
const compacted = await compactMessagesWithState({
|
|
273
|
+
messages,
|
|
274
|
+
state: contextState,
|
|
275
|
+
llmClient: this.llmClient,
|
|
276
|
+
charBudget: CONTEXT_BUDGETS.task.compactionCharBudget,
|
|
277
|
+
keepRatio: CONTEXT_BUDGETS.task.keepRatio,
|
|
278
|
+
preserveFirst: true,
|
|
279
|
+
transcript: contextTranscript,
|
|
280
|
+
sessionId,
|
|
281
|
+
});
|
|
282
|
+
throwIfAborted(signal);
|
|
283
|
+
if (compacted.changed) {
|
|
284
|
+
logger.log("context_compaction", {
|
|
285
|
+
iteration: iterations,
|
|
286
|
+
...(purpose ? { purpose } : {}),
|
|
287
|
+
summarizedCount: compacted.summarizedCount,
|
|
288
|
+
retainedCount: compacted.retainedCount,
|
|
289
|
+
stateChars: JSON.stringify(compacted.state).length,
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
else if (compacted.reason === "summarization_failed") {
|
|
293
|
+
contextCompactionCooldown = 3;
|
|
294
|
+
logger.log("context_compaction", {
|
|
295
|
+
iteration: iterations,
|
|
296
|
+
...(purpose ? { purpose } : {}),
|
|
297
|
+
reason: compacted.reason,
|
|
298
|
+
retainedCount: compacted.retainedCount,
|
|
299
|
+
}, false);
|
|
300
|
+
}
|
|
301
|
+
messages = compacted.messages;
|
|
302
|
+
contextState = compacted.state;
|
|
303
|
+
};
|
|
304
|
+
while (iterations < maxIter && !forceStop) {
|
|
305
|
+
throwIfAborted(signal);
|
|
306
|
+
iterations++;
|
|
307
|
+
// Summarize old messages when context grows large, instead of hard truncation.
|
|
308
|
+
// Write back to `messages` so we don't re-summarize the same content each round.
|
|
309
|
+
await maybeCompactContext();
|
|
310
|
+
const llmContext = buildLlmContext({
|
|
311
|
+
baseSystemPrompt: systemPrompt,
|
|
312
|
+
state: contextState,
|
|
313
|
+
messages,
|
|
314
|
+
optimizeOptions: { preserveFirst: true },
|
|
315
|
+
contextTitle: "Earlier Actions State",
|
|
316
|
+
transcript: contextTranscript,
|
|
317
|
+
});
|
|
318
|
+
const llmStart = Date.now();
|
|
319
|
+
logger.log("llm_call", {
|
|
320
|
+
iteration: iterations,
|
|
321
|
+
purpose: "main_loop",
|
|
322
|
+
messageCount: llmContext.messages.length,
|
|
323
|
+
charCount: estimateCharCount(llmContext.messages),
|
|
324
|
+
toolCount: tools.length,
|
|
325
|
+
systemPromptChars: llmContext.systemPrompt.length,
|
|
326
|
+
contextManifest: llmContext.manifest,
|
|
327
|
+
});
|
|
328
|
+
const response = await this.llmClient.chat(llmContext.messages, tools, llmContext.systemPrompt, {
|
|
329
|
+
systemStaticChars: llmContext.systemPromptStatic.length,
|
|
330
|
+
cacheTools: tools.length > 0,
|
|
331
|
+
cacheMessages: llmContext.messages.length > 0,
|
|
332
|
+
sessionId,
|
|
333
|
+
}, signal);
|
|
334
|
+
throwIfAborted(signal);
|
|
335
|
+
logger.log("llm_response", {
|
|
336
|
+
iteration: iterations,
|
|
337
|
+
purpose: "main_loop",
|
|
338
|
+
durationMs: Date.now() - llmStart,
|
|
339
|
+
stopReason: response.stopReason,
|
|
340
|
+
contentLen: response.content?.length ?? 0,
|
|
341
|
+
toolCallCount: response.toolCalls.length,
|
|
342
|
+
toolCalls: response.toolCalls.map((tc) => ({
|
|
343
|
+
name: tc.name,
|
|
344
|
+
action: tc.arguments?.action ?? null,
|
|
345
|
+
})),
|
|
346
|
+
usage: response.usage,
|
|
347
|
+
});
|
|
348
|
+
if (response.content) {
|
|
349
|
+
finalContent = response.content;
|
|
350
|
+
// Notify loop detector that LLM produced text
|
|
351
|
+
if (response.content.length > 100) {
|
|
352
|
+
loopDetector.notifySubstantiveResponse();
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
// If no tool calls, we're done
|
|
356
|
+
if (response.toolCalls.length === 0 || response.stopReason === "stop") {
|
|
357
|
+
const storageReminder = storageTracker.completionReminder();
|
|
358
|
+
if (storageReminder) {
|
|
359
|
+
pushMessage({ role: "user", content: storageReminder }, { source: "storage_policy" });
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
completed = true;
|
|
363
|
+
break;
|
|
364
|
+
}
|
|
365
|
+
// Add assistant message with tool calls
|
|
366
|
+
pushMessage({
|
|
367
|
+
role: "assistant",
|
|
368
|
+
content: response.content,
|
|
369
|
+
toolCalls: response.toolCalls,
|
|
370
|
+
}, { source: "llm" });
|
|
371
|
+
// Execute each tool call, checking for loops after each one
|
|
372
|
+
for (let ti = 0; ti < response.toolCalls.length; ti++) {
|
|
373
|
+
throwIfAborted(signal);
|
|
374
|
+
const tc = response.toolCalls[ti];
|
|
375
|
+
// Check for loops before executing (skip remaining calls if critical)
|
|
376
|
+
const preCheck = loopDetector.check();
|
|
377
|
+
if (preCheck.status === "critical") {
|
|
378
|
+
// Return a skip message for this and all remaining tool calls
|
|
379
|
+
for (let ri = ti; ri < response.toolCalls.length; ri++) {
|
|
380
|
+
pushMessage({
|
|
381
|
+
role: "tool",
|
|
382
|
+
content: `[Skipped: loop detected — ${preCheck.pattern}]`,
|
|
383
|
+
toolCallId: response.toolCalls[ri].id,
|
|
384
|
+
}, { source: "loop_detector", toolName: response.toolCalls[ri].name });
|
|
385
|
+
}
|
|
386
|
+
console.log(` Loop detected (${preCheck.pattern}): skipping ${response.toolCalls.length - ti} remaining tool call(s)`);
|
|
387
|
+
pushMessage({ role: "user", content: preCheck.message }, { source: "loop_detector" });
|
|
388
|
+
forceStop = true;
|
|
389
|
+
break;
|
|
390
|
+
}
|
|
391
|
+
const rawResult = await this.executeTool(tc, logger);
|
|
392
|
+
if (tc.name === "store") {
|
|
393
|
+
storageTracker.recordStoreCall(tc.arguments.action || "", tc.arguments.collection);
|
|
394
|
+
}
|
|
395
|
+
throwIfAborted(signal);
|
|
396
|
+
const result = capToolResultText(tc.name, rawResult, logger);
|
|
397
|
+
pushMessage({
|
|
398
|
+
role: "tool",
|
|
399
|
+
content: result,
|
|
400
|
+
toolCallId: tc.id,
|
|
401
|
+
}, { source: "tool", toolName: tc.name });
|
|
402
|
+
const action = tc.arguments.action || tc.name;
|
|
403
|
+
loopDetector.record(tc.name, action, tc.arguments, result);
|
|
404
|
+
}
|
|
405
|
+
// Post-batch loop check (handles warning + critical for the last call)
|
|
406
|
+
if (!forceStop) {
|
|
407
|
+
const loopCheck = loopDetector.check();
|
|
408
|
+
if (loopCheck.status === "critical") {
|
|
409
|
+
console.log(` Loop detected (${loopCheck.pattern}): forcing stop`);
|
|
410
|
+
pushMessage({ role: "user", content: loopCheck.message }, { source: "loop_detector" });
|
|
411
|
+
forceStop = true;
|
|
412
|
+
}
|
|
413
|
+
else if (loopCheck.status === "warning") {
|
|
414
|
+
console.log(` Loop warning (${loopCheck.pattern}): injecting hint`);
|
|
415
|
+
pushMessage({ role: "user", content: loopCheck.message }, { source: "loop_detector" });
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
// Reached iteration limit or forced stop — ask LLM for a final summary
|
|
420
|
+
if (!completed && (iterations >= maxIter || forceStop)) {
|
|
421
|
+
throwIfAborted(signal);
|
|
422
|
+
const stopReason = forceStop
|
|
423
|
+
? "A repetitive action loop was detected and stopped."
|
|
424
|
+
: "You've reached the maximum number of tool-calling iterations allowed.";
|
|
425
|
+
pushMessage({
|
|
426
|
+
role: "user",
|
|
427
|
+
content: `${stopReason} Please provide a final response summarizing what you've found and accomplished so far, without calling any more tools.`,
|
|
428
|
+
}, { source: "iteration_limit" });
|
|
429
|
+
await maybeCompactContext("final_summary");
|
|
430
|
+
const llmContext = buildLlmContext({
|
|
431
|
+
baseSystemPrompt: systemPrompt,
|
|
432
|
+
state: contextState,
|
|
433
|
+
messages,
|
|
434
|
+
optimizeOptions: { preserveFirst: true },
|
|
435
|
+
contextTitle: "Earlier Actions State",
|
|
436
|
+
transcript: contextTranscript,
|
|
437
|
+
});
|
|
438
|
+
const llmStart = Date.now();
|
|
439
|
+
logger.log("llm_call", {
|
|
440
|
+
iteration: iterations,
|
|
441
|
+
purpose: "final_summary",
|
|
442
|
+
messageCount: llmContext.messages.length,
|
|
443
|
+
charCount: estimateCharCount(llmContext.messages),
|
|
444
|
+
toolCount: 0,
|
|
445
|
+
systemPromptChars: llmContext.systemPrompt.length,
|
|
446
|
+
forceStop,
|
|
447
|
+
contextManifest: llmContext.manifest,
|
|
448
|
+
});
|
|
449
|
+
const summary = await this.llmClient.chat(llmContext.messages, undefined, llmContext.systemPrompt, {
|
|
450
|
+
systemStaticChars: llmContext.systemPromptStatic.length,
|
|
451
|
+
cacheMessages: llmContext.messages.length > 0,
|
|
452
|
+
sessionId,
|
|
453
|
+
}, signal);
|
|
454
|
+
throwIfAborted(signal);
|
|
455
|
+
logger.log("llm_response", {
|
|
456
|
+
iteration: iterations,
|
|
457
|
+
purpose: "final_summary",
|
|
458
|
+
durationMs: Date.now() - llmStart,
|
|
459
|
+
stopReason: summary.stopReason,
|
|
460
|
+
contentLen: summary.content?.length ?? 0,
|
|
461
|
+
toolCallCount: 0,
|
|
462
|
+
usage: summary.usage,
|
|
463
|
+
});
|
|
464
|
+
finalContent = summary.content;
|
|
465
|
+
}
|
|
466
|
+
const stopReason = completed ? "completed" : forceStop ? "loop_detected" : "max_iterations";
|
|
467
|
+
return {
|
|
468
|
+
content: finalContent,
|
|
469
|
+
completionStatus: stopReason === "completed" ? "complete" : "partial",
|
|
470
|
+
stopReason,
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
async executeTool(tc, logger) {
|
|
474
|
+
const args = tc.arguments;
|
|
475
|
+
const action = args.action;
|
|
476
|
+
// Browser tools log themselves inside BrowserActions; the shared runner
|
|
477
|
+
// adds the agent-level tool_call entry (ok bit + duration).
|
|
478
|
+
switch (tc.name) {
|
|
479
|
+
case "browser": {
|
|
480
|
+
const r = await runBrowserTool(this.browserActions, args, logger);
|
|
481
|
+
return r.text;
|
|
482
|
+
}
|
|
483
|
+
case "memory": {
|
|
484
|
+
const start = Date.now();
|
|
485
|
+
const result = this.executeMemoryAction(action, args);
|
|
486
|
+
logger?.log("memory", {
|
|
487
|
+
action,
|
|
488
|
+
key: args.key,
|
|
489
|
+
durationMs: Date.now() - start,
|
|
490
|
+
resultLen: result.length,
|
|
491
|
+
});
|
|
492
|
+
return result;
|
|
493
|
+
}
|
|
494
|
+
case "store": {
|
|
495
|
+
const start = Date.now();
|
|
496
|
+
const result = executeStoreAction(this.store, action, args);
|
|
497
|
+
logger?.log("store", {
|
|
498
|
+
action,
|
|
499
|
+
collection: args.collection,
|
|
500
|
+
id: args.id,
|
|
501
|
+
durationMs: Date.now() - start,
|
|
502
|
+
resultLen: result.length,
|
|
503
|
+
});
|
|
504
|
+
return result;
|
|
505
|
+
}
|
|
506
|
+
case "skill": {
|
|
507
|
+
const start = Date.now();
|
|
508
|
+
const result = executeReadOnlySkillAction(this.skillGenerator, action, args);
|
|
509
|
+
logger?.log("skill", {
|
|
510
|
+
action,
|
|
511
|
+
name: args.name,
|
|
512
|
+
durationMs: Date.now() - start,
|
|
513
|
+
resultLen: result.length,
|
|
514
|
+
readOnly: true,
|
|
515
|
+
}, !result.startsWith("Error:"));
|
|
516
|
+
return result;
|
|
517
|
+
}
|
|
518
|
+
case "web_fetch": {
|
|
519
|
+
const start = Date.now();
|
|
520
|
+
const result = await executeWebFetchAction(args);
|
|
521
|
+
logger?.log("web_fetch", {
|
|
522
|
+
url: args.url,
|
|
523
|
+
durationMs: Date.now() - start,
|
|
524
|
+
resultLen: result.length,
|
|
525
|
+
success: !result.startsWith("Error:"),
|
|
526
|
+
}, !result.startsWith("Error:"));
|
|
527
|
+
return result;
|
|
528
|
+
}
|
|
529
|
+
case "scheduler":
|
|
530
|
+
logger?.log("scheduler", { action, note: "managed via commands" });
|
|
531
|
+
return `(scheduler managed via commands)`;
|
|
532
|
+
case "image_generation": {
|
|
533
|
+
if (!this.imageGenerator) {
|
|
534
|
+
return "Error: image_generation is not configured (set config.imageGeneration in your config.json).";
|
|
535
|
+
}
|
|
536
|
+
if (action !== "generate" && action !== "edit") {
|
|
537
|
+
return `Unknown image_generation action: ${action}`;
|
|
538
|
+
}
|
|
539
|
+
const start = Date.now();
|
|
540
|
+
const result = action === "generate"
|
|
541
|
+
? await this.imageGenerator.generate(args, null)
|
|
542
|
+
: await this.imageGenerator.edit(args, null);
|
|
543
|
+
logger?.log("image_generation", {
|
|
544
|
+
action,
|
|
545
|
+
durationMs: Date.now() - start,
|
|
546
|
+
resultLen: result.length,
|
|
547
|
+
});
|
|
548
|
+
return result;
|
|
549
|
+
}
|
|
550
|
+
default:
|
|
551
|
+
logger?.log("tool_unknown", { name: tc.name }, false);
|
|
552
|
+
return `Unknown tool: ${tc.name}`;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
executeMemoryAction(action, args) {
|
|
556
|
+
switch (action) {
|
|
557
|
+
case "save":
|
|
558
|
+
return (`memory.save is disabled during scheduled tasks. ` +
|
|
559
|
+
`For structured cross-run state (processed ids, visited URLs, ` +
|
|
560
|
+
`tickets, observations, counters, cursors) use the store tool. ` +
|
|
561
|
+
`For freeform notes, wait for the user to request a save via chat.`);
|
|
562
|
+
case "read":
|
|
563
|
+
return this.memory.read(args.key);
|
|
564
|
+
case "list":
|
|
565
|
+
return this.memory.list();
|
|
566
|
+
default:
|
|
567
|
+
return `Unknown memory action: ${action}`;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
loadInstalledSkillsIndex() {
|
|
571
|
+
try {
|
|
572
|
+
const skills = this.skillGenerator.listSkills();
|
|
573
|
+
return truncateContextSection(skills, CONTEXT_BUDGETS.task.installedSkillsMaxChars, "installed skills list truncated");
|
|
574
|
+
}
|
|
575
|
+
catch (err) {
|
|
576
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
577
|
+
return `(could not load installed skills: ${msg})`;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
buildSystemPrompt(memoryIndex, relevantMemory, loadedInstructionSkills, storagePolicies = []) {
|
|
581
|
+
const installedSkills = this.loadInstalledSkillsIndex();
|
|
582
|
+
const autoLoadedSkills = this.skillGenerator.renderLoadedInstructionSkillSection(loadedInstructionSkills);
|
|
583
|
+
let prompt = `You are a browser automation assistant named "${this.config.name}". You help users accomplish tasks by controlling a web browser.
|
|
584
|
+
|
|
585
|
+
## Available Tools
|
|
586
|
+
- Use web_fetch for read-only HTTP(S) JSON/text/markdown endpoints and public REST APIs.
|
|
587
|
+
It is the safe replacement for instruction-skill examples that mention WebFetch or curl.
|
|
588
|
+
- Use skill.list / skill.read for read-only access to installed skills during
|
|
589
|
+
scheduled tasks. Skills are procedures or replay scripts stored in
|
|
590
|
+
workspace/skills/ plus packaged built-ins. Scheduled tasks cannot create,
|
|
591
|
+
overwrite, install, or delete skills.
|
|
592
|
+
|
|
593
|
+
## Installed Skills Routing
|
|
594
|
+
The installed skills list below is authoritative routing context. Before
|
|
595
|
+
guessing a website, endpoint, or source, check whether an installed skill
|
|
596
|
+
already matches the task. If it matches, read that skill with skill.read and
|
|
597
|
+
follow its instructions.
|
|
598
|
+
|
|
599
|
+
Installed skills:
|
|
600
|
+
${installedSkills}
|
|
601
|
+
|
|
602
|
+
You have a browser tool with two levels of actions:
|
|
603
|
+
- **Top-level actions**: navigate, snapshot, screenshot, tabs, open, focus, close, console, dialog, upload
|
|
604
|
+
- **Interactions via act**: action="act" with kind="click", "type", "press", "hover", "drag", "select", "fill", "resize", "wait", "evaluate", "close"
|
|
605
|
+
|
|
606
|
+
## How to use browser tool
|
|
607
|
+
1. Use browser action "navigate" to go to a URL
|
|
608
|
+
2. Use browser action "snapshot" to see the page (you'll get element refs like [e1], [e2])
|
|
609
|
+
3. Use browser action "act" with kind "click", "type", etc. using element refs or CSS selectors
|
|
610
|
+
4. After interactions, snapshot again to verify results
|
|
611
|
+
|
|
612
|
+
Example: to click element e5, use: { action: "act", kind: "click", ref: "e5" }
|
|
613
|
+
Example: to type text, use: { action: "act", kind: "type", ref: "e3", text: "hello" }
|
|
614
|
+
Example: to evaluate JS, use: { action: "act", kind: "evaluate", fn: "document.title" }
|
|
615
|
+
|
|
616
|
+
## Snapshot
|
|
617
|
+
- snapshot captures the **full page accessibility tree regardless of scroll position**.
|
|
618
|
+
- Use mode "interactive" when you only need clickable/typeable elements. Use "full" (default) to read page content.
|
|
619
|
+
- Use selector to scope snapshot to a CSS subtree (reduces output size).
|
|
620
|
+
- Use compact, depth, maxChars for further control.
|
|
621
|
+
|
|
622
|
+
## Efficiency Guidelines
|
|
623
|
+
- Minimize tool calls. Plan multiple steps ahead before acting.
|
|
624
|
+
- Do NOT repeat the same action if it produced no new results.
|
|
625
|
+
- When collecting data, decide what "enough" means before starting. 10 quality records > 100 duplicates.
|
|
626
|
+
- If you receive a loop warning, immediately change your approach or finalize your answer.
|
|
627
|
+
- **Random delays between actions are injected automatically. Do NOT add artificial delays.**
|
|
628
|
+
- **click, hover, and type auto-scroll the element into view.** No need to scroll first.
|
|
629
|
+
- For infinite-scroll pages, use act kind "evaluate" with \`window.scrollBy(0, 1000)\` to load more content, then snapshot to check.
|
|
630
|
+
|
|
631
|
+
## Hover
|
|
632
|
+
- Use act kind "hover" with "ref" to trigger tooltips, popups, or hover cards.
|
|
633
|
+
- Do NOT use evaluate to dispatch mouse/click events. Use act kind "hover" or "click". If a normal click with an expect block event-misses or fails verification for the same control and synthetic DOM click is semantically acceptable, retry click once with dispatch="dom". For final submit/post-style clicks where that fallback is appropriate, prefer a single click call with fallbackDispatch="dom" plus expect.
|
|
634
|
+
|
|
635
|
+
## New Actions
|
|
636
|
+
- **console**: Read browser console messages. Use level="error" to filter. Useful for debugging.
|
|
637
|
+
- **dialog**: Arm a handler for the next alert/confirm/prompt dialog. Call BEFORE the action that triggers it.
|
|
638
|
+
- **upload**: Upload files. With ref: sets files on input element. Without ref: arms next file chooser.
|
|
639
|
+
- **act kind "drag"**: Drag from startRef to endRef.
|
|
640
|
+
- **act kind "fill"**: Batch fill form fields. Each field: {ref, value, type?}. Use type "checkbox"/"radio" for toggles.
|
|
641
|
+
- **act kind "resize"**: Resize viewport (width, height).
|
|
642
|
+
|
|
643
|
+
## Evaluate (JavaScript) Guidelines
|
|
644
|
+
- Use evaluate primarily for data extraction from the DOM. Keep scripts concise and return only the data you need.
|
|
645
|
+
- Use bounded DOM-state writes only when a loaded skill or tool diagnostic
|
|
646
|
+
explicitly calls for that recovery path.
|
|
647
|
+
- NEVER use evaluate for setTimeout, delays, sleep, or waiting. Delays are handled automatically at the system level.
|
|
648
|
+
- NEVER use evaluate for mouse/click interactions — use "hover" / "click" instead. Use click dispatch="dom" instead of raw element.click() when a guarded DOM click is needed.
|
|
649
|
+
- If evaluate returns a large result, extract only the relevant fields in your script.
|
|
650
|
+
|
|
651
|
+
## Verifying actions actually worked
|
|
652
|
+
A successful click/type/submit is NOT proof the user-visible task happened —
|
|
653
|
+
many sites accept the click without sending the post, or accept text without
|
|
654
|
+
inserting it into the editor. After any submit/post/send/search/upload, you
|
|
655
|
+
MUST verify the resulting page state, ideally by passing an \`expect\` block
|
|
656
|
+
on the same act call. Examples:
|
|
657
|
+
|
|
658
|
+
- After clicking "Post"/"Send"/"Publish": expect a durable state change such
|
|
659
|
+
as urlMatches, selectorGone for the compose/dialog, a visible success
|
|
660
|
+
toast/new item, or inputValue.equals: "" on the submitted editor when a
|
|
661
|
+
cleared editor is the reliable success signal.
|
|
662
|
+
- After search: expect urlContains/urlMatches plus a result-list selector or result text.
|
|
663
|
+
- After upload: expect an attachment/file-list selector or text containing the filename.
|
|
664
|
+
|
|
665
|
+
If you forget expect, take a fresh snapshot or call action="verify" before
|
|
666
|
+
declaring the task done. Scheduled tasks should fail loudly when verification
|
|
667
|
+
fails — do not return success.
|
|
668
|
+
|
|
669
|
+
${autoLoadedSkills}
|
|
670
|
+
|
|
671
|
+
## Memory
|
|
672
|
+
Use memory.read / memory.list to recall freeform user-saved notes (site
|
|
673
|
+
quirks, login flows, authoritative rules the user has dictated). You CANNOT
|
|
674
|
+
save memories during scheduled tasks — memory.save will be rejected. memory
|
|
675
|
+
is for human-curated freeform content only.
|
|
676
|
+
|
|
677
|
+
## Store
|
|
678
|
+
For structured cross-run state — processed ids, visited URLs, tickets,
|
|
679
|
+
observations, counters, cursors, compact histories — use the store tool.
|
|
680
|
+
store.has(collection, id) is an O(1) existence check; store.get reads one
|
|
681
|
+
record; store.put(collection, id, value?, meta?) records or updates one
|
|
682
|
+
entry. Never use memory.read + grep for structured lookups — it bloats every
|
|
683
|
+
transcript iteration and makes state handling less reliable.`;
|
|
684
|
+
const storagePolicySection = renderStoragePolicySection(storagePolicies);
|
|
685
|
+
if (storagePolicySection) {
|
|
686
|
+
prompt += `\n\n${storagePolicySection}`;
|
|
687
|
+
}
|
|
688
|
+
if (memoryIndex.trim().length > 20) {
|
|
689
|
+
prompt += `\n\n## Saved Memories\n${memoryIndex}`;
|
|
690
|
+
}
|
|
691
|
+
if (relevantMemory.trim()) {
|
|
692
|
+
prompt += `\n\n## Relevant Memory Details\n${relevantMemory}`;
|
|
693
|
+
}
|
|
694
|
+
return prompt;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
function throwIfAborted(signal) {
|
|
698
|
+
if (!signal?.aborted)
|
|
699
|
+
return;
|
|
700
|
+
const reason = signal.reason;
|
|
701
|
+
if (reason instanceof Error)
|
|
702
|
+
throw reason;
|
|
703
|
+
throw new Error(reason ? String(reason) : "Task aborted");
|
|
704
|
+
}
|
|
705
|
+
//# sourceMappingURL=task-runner.js.map
|