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,704 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { ExecutionLogger } from "../logging/logger.js";
|
|
5
|
+
import { safeSliceHead } from "../utils/safe-slice.js";
|
|
6
|
+
import { hasStorageIntent } from "./storage-policy.js";
|
|
7
|
+
export const SKILL_CONTENT_LIMITS = {
|
|
8
|
+
fileMaxChars: 128 * 1024,
|
|
9
|
+
readMaxChars: 32 * 1024,
|
|
10
|
+
autoLoadMaxSkills: 4,
|
|
11
|
+
autoLoadPerSkillMaxChars: 12 * 1024,
|
|
12
|
+
autoLoadTotalMaxChars: 24 * 1024,
|
|
13
|
+
listMaxSkills: 200,
|
|
14
|
+
listMaxChars: 16 * 1024,
|
|
15
|
+
};
|
|
16
|
+
const BUILTIN_SKILLS_DIR = fileURLToPath(new URL("../../builtin-skills/", import.meta.url));
|
|
17
|
+
const X_TASK_RE = /(?:https?:\/\/)?(?:www\.)?(?:x|twitter)\.com\b|\btwitter\b|\btweets?\b|\bretweets?\b|\bquote\s*tweet\b|tweetTextarea_|tweetButton|SearchBox_Search_Input|cellInnerDiv|推特|转推|quote\s*转发|X\.com|X上|X搜索|X账号|X主页|X\s+Web3/i;
|
|
18
|
+
const SOURCEPOOL_TASK_RE = /(?:https?:\/\/)?pool\.btcdev\.me\b|\bsourcepool\b|\bsource\s*pool\b|\bmaterial(?:s)?\s+library\b|素材库|素材池|素材检索|素材搜索/i;
|
|
19
|
+
const BUILTIN_SKILLS = [
|
|
20
|
+
{
|
|
21
|
+
name: "x",
|
|
22
|
+
description: "X.com/Twitter browser automation operating notes.",
|
|
23
|
+
filePath: path.join(BUILTIN_SKILLS_DIR, "x.md"),
|
|
24
|
+
aliases: ["twitter", "x-com", "x_com"],
|
|
25
|
+
matches: (text) => X_TASK_RE.test(text),
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "sourcepool",
|
|
29
|
+
description: "Read materials (news articles, videos, social posts) from the sourcepool aggregated content library.",
|
|
30
|
+
filePath: path.join(BUILTIN_SKILLS_DIR, "sourcepool.md"),
|
|
31
|
+
aliases: ["source-pool", "source_pool", "materials", "material-library"],
|
|
32
|
+
matches: (text) => SOURCEPOOL_TASK_RE.test(text),
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
function safeSkillName(raw) {
|
|
36
|
+
return raw.replace(/\.md$/, "").replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
37
|
+
}
|
|
38
|
+
function isExplicitBuiltinRef(raw) {
|
|
39
|
+
return raw.trim().toLowerCase().startsWith("builtin:");
|
|
40
|
+
}
|
|
41
|
+
function stripBuiltinPrefix(raw) {
|
|
42
|
+
return raw.trim().replace(/^builtin:/i, "");
|
|
43
|
+
}
|
|
44
|
+
function truncateWithNote(content, maxChars, note, force = false) {
|
|
45
|
+
if (!force && content.length <= maxChars) {
|
|
46
|
+
return { content, truncated: false };
|
|
47
|
+
}
|
|
48
|
+
const suffix = `\n\n...[truncated: ${note}; original ${content.length} chars]`;
|
|
49
|
+
const headBudget = Math.max(0, maxChars - suffix.length);
|
|
50
|
+
return {
|
|
51
|
+
content: `${safeSliceHead(content, headBudget)}${safeSliceHead(suffix, maxChars)}`,
|
|
52
|
+
truncated: true,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function parseFrontmatter(content) {
|
|
56
|
+
const fmMatch = content.match(/^---\n([\s\S]*?)\n---/);
|
|
57
|
+
if (!fmMatch)
|
|
58
|
+
return {};
|
|
59
|
+
const fields = {};
|
|
60
|
+
for (const line of fmMatch[1].split("\n")) {
|
|
61
|
+
const match = line.match(/^([A-Za-z0-9_-]+):\s*(.*)$/);
|
|
62
|
+
if (match)
|
|
63
|
+
fields[match[1]] = match[2].trim();
|
|
64
|
+
}
|
|
65
|
+
return fields;
|
|
66
|
+
}
|
|
67
|
+
function upsertFrontmatter(content, fields) {
|
|
68
|
+
const fmMatch = content.match(/^---\n([\s\S]*?)\n---/);
|
|
69
|
+
if (!fmMatch) {
|
|
70
|
+
const fm = Object.entries(fields)
|
|
71
|
+
.map(([k, v]) => `${k}: ${v}`)
|
|
72
|
+
.join("\n");
|
|
73
|
+
return `---\n${fm}\n---\n\n${content}`;
|
|
74
|
+
}
|
|
75
|
+
const existing = fmMatch[1];
|
|
76
|
+
const additions = Object.entries(fields)
|
|
77
|
+
.filter(([k]) => !new RegExp(`^${k}:`, "m").test(existing))
|
|
78
|
+
.map(([k, v]) => `${k}: ${v}`)
|
|
79
|
+
.join("\n");
|
|
80
|
+
if (!additions)
|
|
81
|
+
return content;
|
|
82
|
+
return content.replace(/^---\n([\s\S]*?)\n---/, `---\n${existing}\n${additions}\n---`);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Validate that `steps` is a non-empty array of {action: string, params: object, ...}.
|
|
86
|
+
* Returns null on success, or a human-readable error string.
|
|
87
|
+
*
|
|
88
|
+
* Used at every skill load / save / install entry point to keep malformed
|
|
89
|
+
* steps from reaching ScriptRunner (where `resolveVariables` on a missing
|
|
90
|
+
* params object throws before step-level fallback can recover) AND to
|
|
91
|
+
* disambiguate "this JSON array is actually steps" from "this JSON array
|
|
92
|
+
* is just an example payload in an instruction skill" in extractStepsJson.
|
|
93
|
+
*/
|
|
94
|
+
export function validateSkillSteps(steps) {
|
|
95
|
+
if (!Array.isArray(steps) || steps.length === 0) {
|
|
96
|
+
return "'steps' must be a non-empty array.";
|
|
97
|
+
}
|
|
98
|
+
for (let i = 0; i < steps.length; i++) {
|
|
99
|
+
const s = steps[i];
|
|
100
|
+
if (!s || typeof s !== "object" || Array.isArray(s)) {
|
|
101
|
+
return `step[${i}] must be an object.`;
|
|
102
|
+
}
|
|
103
|
+
const action = s.action;
|
|
104
|
+
if (typeof action !== "string" || !action.trim()) {
|
|
105
|
+
return `step[${i}].action must be a non-empty string.`;
|
|
106
|
+
}
|
|
107
|
+
const params = s.params;
|
|
108
|
+
if (!params || typeof params !== "object" || Array.isArray(params)) {
|
|
109
|
+
return `step[${i}].params must be an object.`;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
export function extractStepsJson(content) {
|
|
115
|
+
const explicit = content.match(/## Steps\s*\n+```json\s*\n([\s\S]*?)\n```/i);
|
|
116
|
+
if (explicit)
|
|
117
|
+
return explicit[1];
|
|
118
|
+
// Fallback for skills authored without an explicit `## Steps` header:
|
|
119
|
+
// accept the first JSON array block that ALSO shape-checks as steps.
|
|
120
|
+
// Without the shape check, any instruction skill embedding a JSON array
|
|
121
|
+
// example (API responses, sample payloads, plain lists) gets misdetected
|
|
122
|
+
// and fails installation with "Invalid skill steps: ..." instead of
|
|
123
|
+
// landing in the instruction-skill path.
|
|
124
|
+
const blocks = [...content.matchAll(/```json\s*\n([\s\S]*?)\n```/g)];
|
|
125
|
+
for (const block of blocks) {
|
|
126
|
+
try {
|
|
127
|
+
const parsed = JSON.parse(block[1]);
|
|
128
|
+
if (Array.isArray(parsed) && validateSkillSteps(parsed) === null) {
|
|
129
|
+
return block[1];
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
// Ignore non-JSON or invalid JSON examples in instruction skills.
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
export class SkillGenerator {
|
|
139
|
+
skillsDir;
|
|
140
|
+
llmClient;
|
|
141
|
+
constructor(workspace, llmClient) {
|
|
142
|
+
this.skillsDir = path.join(workspace, "skills");
|
|
143
|
+
this.llmClient = llmClient;
|
|
144
|
+
fs.mkdirSync(this.skillsDir, { recursive: true });
|
|
145
|
+
}
|
|
146
|
+
resolveBuiltinSkill(skillRef, opts = {}) {
|
|
147
|
+
const explicit = isExplicitBuiltinRef(skillRef);
|
|
148
|
+
if (!explicit && opts.allowUnqualified === false)
|
|
149
|
+
return null;
|
|
150
|
+
const safeName = safeSkillName(explicit ? stripBuiltinPrefix(skillRef) : skillRef);
|
|
151
|
+
return (BUILTIN_SKILLS.find((s) => s.name === safeName || s.aliases.includes(safeName)) ?? null);
|
|
152
|
+
}
|
|
153
|
+
isBuiltinSkill(skillRef) {
|
|
154
|
+
const builtin = this.resolveBuiltinSkill(skillRef, {
|
|
155
|
+
allowUnqualified: this.resolveSkillPath(skillRef) === null,
|
|
156
|
+
});
|
|
157
|
+
return builtin !== null;
|
|
158
|
+
}
|
|
159
|
+
getAutoLoadedInstructionSkills(text) {
|
|
160
|
+
let remainingTotal = SKILL_CONTENT_LIMITS.autoLoadTotalMaxChars;
|
|
161
|
+
return BUILTIN_SKILLS.filter((skill) => skill.matches(text))
|
|
162
|
+
.filter((skill) => fs.existsSync(skill.filePath))
|
|
163
|
+
.slice(0, SKILL_CONTENT_LIMITS.autoLoadMaxSkills)
|
|
164
|
+
.map((skill) => {
|
|
165
|
+
const loaded = this.readSkillFileContent(skill.filePath, {
|
|
166
|
+
maxChars: SKILL_CONTENT_LIMITS.autoLoadPerSkillMaxChars,
|
|
167
|
+
truncate: true,
|
|
168
|
+
});
|
|
169
|
+
return loaded
|
|
170
|
+
? { skill, rawContent: loaded.content, wasTruncated: loaded.truncated }
|
|
171
|
+
: null;
|
|
172
|
+
})
|
|
173
|
+
.filter((item) => item !== null)
|
|
174
|
+
.map(({ skill, rawContent, wasTruncated }) => {
|
|
175
|
+
const perSkillMax = Math.min(SKILL_CONTENT_LIMITS.autoLoadPerSkillMaxChars, Math.max(0, remainingTotal));
|
|
176
|
+
const capped = truncateWithNote(rawContent, perSkillMax, `auto-loaded built-in skill '${skill.name}' exceeded prompt cap`);
|
|
177
|
+
remainingTotal = Math.max(0, remainingTotal - capped.content.length);
|
|
178
|
+
return {
|
|
179
|
+
name: skill.name,
|
|
180
|
+
description: skill.description,
|
|
181
|
+
content: capped.content,
|
|
182
|
+
builtin: true,
|
|
183
|
+
readonly: true,
|
|
184
|
+
truncated: wasTruncated || capped.truncated,
|
|
185
|
+
...(wasTruncated || capped.truncated
|
|
186
|
+
? { originalChars: rawContent.length }
|
|
187
|
+
: {}),
|
|
188
|
+
};
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
renderLoadedInstructionSkillSection(skills) {
|
|
192
|
+
if (skills.length === 0)
|
|
193
|
+
return "";
|
|
194
|
+
let remainingTotal = SKILL_CONTENT_LIMITS.autoLoadTotalMaxChars;
|
|
195
|
+
return skills
|
|
196
|
+
.slice(0, SKILL_CONTENT_LIMITS.autoLoadMaxSkills)
|
|
197
|
+
.map((skill) => {
|
|
198
|
+
const perSkillMax = Math.min(SKILL_CONTENT_LIMITS.autoLoadPerSkillMaxChars, Math.max(0, remainingTotal));
|
|
199
|
+
const capped = truncateWithNote(skill.content, perSkillMax, `loaded instruction skill '${skill.name}' exceeded prompt cap`);
|
|
200
|
+
remainingTotal = Math.max(0, remainingTotal - capped.content.length);
|
|
201
|
+
const flags = skill.builtin ? " (built-in, read-only)" : "";
|
|
202
|
+
return (`## Loaded Instruction Skill: ${skill.name}${flags}\n` +
|
|
203
|
+
`${capped.content.trim()}\n`);
|
|
204
|
+
})
|
|
205
|
+
.join("\n");
|
|
206
|
+
}
|
|
207
|
+
renderAutoLoadedInstructionSkillSection(text) {
|
|
208
|
+
return this.renderLoadedInstructionSkillSection(this.getAutoLoadedInstructionSkills(text));
|
|
209
|
+
}
|
|
210
|
+
/** Generate a skill from an execution log file */
|
|
211
|
+
async generate(logFilePath) {
|
|
212
|
+
const entries = ExecutionLogger.readLog(logFilePath);
|
|
213
|
+
if (entries.length === 0) {
|
|
214
|
+
return "Error: log file is empty.";
|
|
215
|
+
}
|
|
216
|
+
// Filter to actionable steps (exclude snapshots used for reading)
|
|
217
|
+
const actionEntries = entries.filter((e) => e.success && e.action !== "snapshot" && e.action !== "screenshot");
|
|
218
|
+
const logSummary = entries
|
|
219
|
+
.map((e) => `Step ${e.step}: ${e.action} ${JSON.stringify(Object.fromEntries(Object.entries(e).filter(([k]) => !["step", "action", "timestamp", "success"].includes(k))))} (${e.success ? "ok" : "FAILED"})`)
|
|
220
|
+
.join("\n");
|
|
221
|
+
// Ask LLM to generate a structured skill
|
|
222
|
+
const response = await this.llmClient.chat([
|
|
223
|
+
{
|
|
224
|
+
role: "user",
|
|
225
|
+
content: `Based on this browser automation execution log, generate a reusable skill definition.
|
|
226
|
+
|
|
227
|
+
The skill should capture the essential steps that can be replayed later.
|
|
228
|
+
|
|
229
|
+
Selector picking:
|
|
230
|
+
- Element references like e1, e2 are EPHEMERAL — they will not exist on replay.
|
|
231
|
+
- Prefer stable CSS selectors in the "ref" field. The execution log will mark "selectorUsed" / "stableSelector" when one is known — copy that selector into the step.
|
|
232
|
+
- Order of preference: data-testid > unique #id > [name=] > [aria-label=] > [placeholder=] > role+text combinations.
|
|
233
|
+
- Examples: "[data-testid='submit']", "#search", "input[name='q']".
|
|
234
|
+
|
|
235
|
+
Verification (CRITICAL for submit/search/upload steps):
|
|
236
|
+
- For any action that is supposed to change page state (click on a Post/Send/Submit/Search button, type with submit:true, file upload), include an "expect" object in the params. Replay should fail loudly when the resulting state isn't visible.
|
|
237
|
+
- Examples:
|
|
238
|
+
- Submit: { "action": "act", "params": { "kind": "click", "ref": "[data-testid='submit']", "expect": { "selectorGone": "[data-testid='submit']", "timeoutMs": 10000 } } }
|
|
239
|
+
- Search: { "action": "act", "params": { "kind": "type", "ref": "input[name='q']", "text": "{{query}}", "submit": true, "expect": { "urlContains": "q=", "selectorVisible": "[data-testid='result']" } } }
|
|
240
|
+
|
|
241
|
+
For data-extraction steps prefer the high-level helpers over evaluate:
|
|
242
|
+
extractVisibleText / queryByText / findClickableNearText / extractLinks.
|
|
243
|
+
|
|
244
|
+
Execution log:
|
|
245
|
+
${logSummary}
|
|
246
|
+
|
|
247
|
+
Please respond with a JSON object in this exact format:
|
|
248
|
+
{
|
|
249
|
+
"name": "skill-name",
|
|
250
|
+
"description": "What this skill does",
|
|
251
|
+
"steps": [
|
|
252
|
+
{ "action": "navigate", "params": { "url": "..." }, "description": "..." },
|
|
253
|
+
{ "action": "act", "params": { "kind": "click", "ref": "button[data-testid='submit']", "expect": { "urlContains": "..." } }, "description": "..." },
|
|
254
|
+
{ "action": "act", "params": { "kind": "type", "ref": "input.search-box", "text": "{{query}}" }, "description": "..." }
|
|
255
|
+
],
|
|
256
|
+
"notes": ["any important notes about this skill"]
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
Use {{variable_name}} for parts that should be parameterized (e.g., search terms).
|
|
260
|
+
Only include the JSON, no other text.`,
|
|
261
|
+
},
|
|
262
|
+
], undefined, "You are an expert at analyzing browser automation logs and creating reusable scripts. Output only valid JSON.");
|
|
263
|
+
try {
|
|
264
|
+
// Extract JSON from response
|
|
265
|
+
const jsonMatch = response.content.match(/\{[\s\S]*\}/);
|
|
266
|
+
if (!jsonMatch) {
|
|
267
|
+
return "Error: LLM did not return valid JSON.";
|
|
268
|
+
}
|
|
269
|
+
const skill = JSON.parse(jsonMatch[0]);
|
|
270
|
+
return this.saveSkill(skill);
|
|
271
|
+
}
|
|
272
|
+
catch (err) {
|
|
273
|
+
return `Error parsing skill: ${err instanceof Error ? err.message : String(err)}`;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
/** Save a skill to a markdown file with metadata */
|
|
277
|
+
saveSkill(skill, meta) {
|
|
278
|
+
if (isExplicitBuiltinRef(skill.name)) {
|
|
279
|
+
return `Error: built-in skill '${stripBuiltinPrefix(skill.name)}' is read-only and cannot be overwritten.`;
|
|
280
|
+
}
|
|
281
|
+
const safeName = safeSkillName(skill.name);
|
|
282
|
+
const filePath = path.join(this.skillsDir, `${safeName}.md`);
|
|
283
|
+
const stepsJson = JSON.stringify(skill.steps, null, 2);
|
|
284
|
+
const notes = skill.notes?.map((n) => `- ${n}`).join("\n") || "";
|
|
285
|
+
const usageCount = meta?.usageCount ?? 0;
|
|
286
|
+
const successRate = meta?.successRate ?? 100;
|
|
287
|
+
const lastImproved = meta?.lastImproved ?? "";
|
|
288
|
+
const content = `---
|
|
289
|
+
name: ${skill.name}
|
|
290
|
+
description: ${skill.description}
|
|
291
|
+
created: ${new Date().toISOString()}
|
|
292
|
+
usageCount: ${usageCount}
|
|
293
|
+
successRate: ${successRate}
|
|
294
|
+
lastImproved: ${lastImproved}
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Steps
|
|
298
|
+
|
|
299
|
+
\`\`\`json
|
|
300
|
+
${stepsJson}
|
|
301
|
+
\`\`\`
|
|
302
|
+
|
|
303
|
+
## Notes
|
|
304
|
+
${notes}
|
|
305
|
+
`;
|
|
306
|
+
if (content.length > SKILL_CONTENT_LIMITS.fileMaxChars) {
|
|
307
|
+
return `Error: skill '${safeName}' is too large (${content.length} chars; max ${SKILL_CONTENT_LIMITS.fileMaxChars}).`;
|
|
308
|
+
}
|
|
309
|
+
fs.writeFileSync(filePath, content, "utf-8");
|
|
310
|
+
return `Skill saved: ${filePath}`;
|
|
311
|
+
}
|
|
312
|
+
/** Save a markdown instruction skill exactly as authored, adding dipclaw metadata if missing. */
|
|
313
|
+
saveInstructionSkill(name, content, meta) {
|
|
314
|
+
if (isExplicitBuiltinRef(name)) {
|
|
315
|
+
return `Error: built-in skill '${stripBuiltinPrefix(name)}' is read-only and cannot be overwritten.`;
|
|
316
|
+
}
|
|
317
|
+
const safeName = safeSkillName(name);
|
|
318
|
+
if (content.length > SKILL_CONTENT_LIMITS.fileMaxChars) {
|
|
319
|
+
return `Error: instruction skill '${safeName}' is too large (${content.length} chars; max ${SKILL_CONTENT_LIMITS.fileMaxChars}).`;
|
|
320
|
+
}
|
|
321
|
+
const filePath = path.join(this.skillsDir, `${safeName}.md`);
|
|
322
|
+
const fm = parseFrontmatter(content);
|
|
323
|
+
const enriched = upsertFrontmatter(content, {
|
|
324
|
+
name: fm.name || safeName,
|
|
325
|
+
description: fm.description || "(instruction skill)",
|
|
326
|
+
type: "instruction",
|
|
327
|
+
created: new Date().toISOString(),
|
|
328
|
+
usageCount: String(meta?.usageCount ?? 0),
|
|
329
|
+
successRate: String(meta?.successRate ?? 100),
|
|
330
|
+
lastImproved: meta?.lastImproved ?? "",
|
|
331
|
+
});
|
|
332
|
+
if (enriched.length > SKILL_CONTENT_LIMITS.fileMaxChars) {
|
|
333
|
+
return `Error: instruction skill '${safeName}' is too large (${enriched.length} chars; max ${SKILL_CONTENT_LIMITS.fileMaxChars}).`;
|
|
334
|
+
}
|
|
335
|
+
fs.writeFileSync(filePath, enriched, "utf-8");
|
|
336
|
+
return `Instruction skill saved: ${filePath}`;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Resolve a skill reference to an absolute file path, or null if not found.
|
|
340
|
+
* Strips a trailing ".md" before sanitizing so callers can pass either
|
|
341
|
+
* "foo" or "foo.md". Falls back to the raw ref iff it's a safe single-
|
|
342
|
+
* segment basename — no path traversal.
|
|
343
|
+
*/
|
|
344
|
+
resolveSkillPath(skillRef) {
|
|
345
|
+
if (isExplicitBuiltinRef(skillRef))
|
|
346
|
+
return null;
|
|
347
|
+
const safeName = safeSkillName(skillRef);
|
|
348
|
+
const primary = path.join(this.skillsDir, `${safeName}.md`);
|
|
349
|
+
if (fs.existsSync(primary))
|
|
350
|
+
return primary;
|
|
351
|
+
if (/^[A-Za-z0-9_.-]+\.md$/.test(skillRef)) {
|
|
352
|
+
const fallback = path.join(this.skillsDir, skillRef);
|
|
353
|
+
if (fs.existsSync(fallback))
|
|
354
|
+
return fallback;
|
|
355
|
+
}
|
|
356
|
+
return null;
|
|
357
|
+
}
|
|
358
|
+
/** True if a user-installed workspace skill exists for this reference/name. */
|
|
359
|
+
workspaceSkillExists(skillRef) {
|
|
360
|
+
return this.resolveSkillPath(skillRef) !== null;
|
|
361
|
+
}
|
|
362
|
+
resolveSkillFile(skillRef) {
|
|
363
|
+
const explicitBuiltin = this.resolveBuiltinSkill(skillRef, {
|
|
364
|
+
allowUnqualified: false,
|
|
365
|
+
});
|
|
366
|
+
if (explicitBuiltin) {
|
|
367
|
+
return { filePath: explicitBuiltin.filePath, builtin: explicitBuiltin };
|
|
368
|
+
}
|
|
369
|
+
const workspacePath = this.resolveSkillPath(skillRef);
|
|
370
|
+
if (workspacePath)
|
|
371
|
+
return { filePath: workspacePath, builtin: null };
|
|
372
|
+
const builtin = this.resolveBuiltinSkill(skillRef);
|
|
373
|
+
if (builtin)
|
|
374
|
+
return { filePath: builtin.filePath, builtin };
|
|
375
|
+
return null;
|
|
376
|
+
}
|
|
377
|
+
readSkillFileContent(filePath, opts = {}) {
|
|
378
|
+
if (!fs.existsSync(filePath))
|
|
379
|
+
return null;
|
|
380
|
+
const maxChars = opts.maxChars ?? SKILL_CONTENT_LIMITS.fileMaxChars;
|
|
381
|
+
const stat = fs.statSync(filePath);
|
|
382
|
+
const maxPrefixBytes = Math.max(1, maxChars * 4);
|
|
383
|
+
if (stat.size > maxPrefixBytes) {
|
|
384
|
+
if (!opts.truncate)
|
|
385
|
+
return null;
|
|
386
|
+
const fd = fs.openSync(filePath, "r");
|
|
387
|
+
try {
|
|
388
|
+
const buf = Buffer.allocUnsafe(maxPrefixBytes);
|
|
389
|
+
const bytesRead = fs.readSync(fd, buf, 0, maxPrefixBytes, 0);
|
|
390
|
+
const prefix = buf.subarray(0, bytesRead).toString("utf-8");
|
|
391
|
+
return truncateWithNote(prefix, maxChars, `skill file exceeded ${maxChars} char read cap; original ${stat.size} bytes`, true);
|
|
392
|
+
}
|
|
393
|
+
finally {
|
|
394
|
+
fs.closeSync(fd);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
const raw = fs.readFileSync(filePath, "utf-8");
|
|
398
|
+
if (raw.length <= maxChars)
|
|
399
|
+
return { content: raw, truncated: false };
|
|
400
|
+
if (opts.truncate) {
|
|
401
|
+
return truncateWithNote(raw, maxChars, `skill file exceeded ${maxChars} char read cap`);
|
|
402
|
+
}
|
|
403
|
+
return null;
|
|
404
|
+
}
|
|
405
|
+
/** True if a skill file already exists for this reference/name. */
|
|
406
|
+
skillExists(skillRef) {
|
|
407
|
+
return this.resolveSkillFile(skillRef) !== null;
|
|
408
|
+
}
|
|
409
|
+
/** Load a skill from a markdown file */
|
|
410
|
+
loadSkill(skillRef) {
|
|
411
|
+
const target = this.resolveSkillFile(skillRef);
|
|
412
|
+
if (!target)
|
|
413
|
+
return null;
|
|
414
|
+
const loaded = this.readSkillFileContent(target.filePath);
|
|
415
|
+
if (!loaded)
|
|
416
|
+
return null;
|
|
417
|
+
const content = loaded.content;
|
|
418
|
+
// Parse frontmatter
|
|
419
|
+
const fmMatch = content.match(/^---\n([\s\S]*?)\n---/);
|
|
420
|
+
const name = fmMatch?.[1].match(/name:\s*(.+)/)?.[1] || skillRef;
|
|
421
|
+
const description = fmMatch?.[1].match(/description:\s*(.+)/)?.[1] || "";
|
|
422
|
+
// Parse steps JSON
|
|
423
|
+
const stepsJson = extractStepsJson(content);
|
|
424
|
+
if (!stepsJson)
|
|
425
|
+
return null;
|
|
426
|
+
try {
|
|
427
|
+
const steps = JSON.parse(stepsJson);
|
|
428
|
+
// Parse notes
|
|
429
|
+
const notesSection = content.split("## Notes")[1];
|
|
430
|
+
const notes = notesSection
|
|
431
|
+
? notesSection
|
|
432
|
+
.trim()
|
|
433
|
+
.split("\n")
|
|
434
|
+
.filter((l) => l.startsWith("- "))
|
|
435
|
+
.map((l) => l.slice(2))
|
|
436
|
+
: [];
|
|
437
|
+
return { name, description, steps, notes };
|
|
438
|
+
}
|
|
439
|
+
catch {
|
|
440
|
+
return null;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
/** Read capped markdown content of a skill file, or null if missing. */
|
|
444
|
+
readSkillFile(skillRef) {
|
|
445
|
+
const target = this.resolveSkillFile(skillRef);
|
|
446
|
+
if (!target)
|
|
447
|
+
return null;
|
|
448
|
+
return this.readSkillFileContent(target.filePath, {
|
|
449
|
+
maxChars: SKILL_CONTENT_LIMITS.readMaxChars,
|
|
450
|
+
truncate: true,
|
|
451
|
+
})?.content ?? null;
|
|
452
|
+
}
|
|
453
|
+
/** Return lightweight metadata for both executable scripts and instruction skills. */
|
|
454
|
+
getSkillInfo(skillRef) {
|
|
455
|
+
const target = this.resolveSkillFile(skillRef);
|
|
456
|
+
if (!target)
|
|
457
|
+
return null;
|
|
458
|
+
const loaded = this.readSkillFileContent(target.filePath);
|
|
459
|
+
if (!loaded) {
|
|
460
|
+
return {
|
|
461
|
+
name: path.basename(target.filePath, ".md"),
|
|
462
|
+
description: "(skill file exceeds load limit)",
|
|
463
|
+
kind: "invalid",
|
|
464
|
+
...(target.builtin ? { builtin: true, readonly: true } : {}),
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
const content = loaded.content;
|
|
468
|
+
const fallbackName = path.basename(target.filePath, ".md");
|
|
469
|
+
const fm = parseFrontmatter(content);
|
|
470
|
+
const name = fm.name || fallbackName;
|
|
471
|
+
const description = fm.description || "";
|
|
472
|
+
const stepsJson = extractStepsJson(content);
|
|
473
|
+
if (stepsJson) {
|
|
474
|
+
try {
|
|
475
|
+
const steps = JSON.parse(stepsJson);
|
|
476
|
+
if (Array.isArray(steps)) {
|
|
477
|
+
return {
|
|
478
|
+
name,
|
|
479
|
+
description,
|
|
480
|
+
kind: "script",
|
|
481
|
+
stepsCount: steps.length,
|
|
482
|
+
...(target.builtin ? { builtin: true, readonly: true } : {}),
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
return {
|
|
486
|
+
name,
|
|
487
|
+
description,
|
|
488
|
+
kind: "invalid",
|
|
489
|
+
...(target.builtin ? { builtin: true, readonly: true } : {}),
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
catch {
|
|
493
|
+
return {
|
|
494
|
+
name,
|
|
495
|
+
description,
|
|
496
|
+
kind: "invalid",
|
|
497
|
+
...(target.builtin ? { builtin: true, readonly: true } : {}),
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
if (Object.keys(fm).length > 0) {
|
|
502
|
+
return {
|
|
503
|
+
name,
|
|
504
|
+
description,
|
|
505
|
+
kind: "instruction",
|
|
506
|
+
...(target.builtin ? { builtin: true, readonly: true } : {}),
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
return {
|
|
510
|
+
name,
|
|
511
|
+
description,
|
|
512
|
+
kind: "invalid",
|
|
513
|
+
...(target.builtin ? { builtin: true, readonly: true } : {}),
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
/** Delete a skill file. Returns true if removed, false if not found. */
|
|
517
|
+
deleteSkill(skillRef) {
|
|
518
|
+
const filePath = this.resolveSkillPath(skillRef);
|
|
519
|
+
if (!filePath)
|
|
520
|
+
return false;
|
|
521
|
+
fs.unlinkSync(filePath);
|
|
522
|
+
return true;
|
|
523
|
+
}
|
|
524
|
+
/** List all available skills */
|
|
525
|
+
listSkills() {
|
|
526
|
+
const workspaceFiles = fs
|
|
527
|
+
.readdirSync(this.skillsDir)
|
|
528
|
+
.filter((f) => f.endsWith(".md"));
|
|
529
|
+
const files = [
|
|
530
|
+
...BUILTIN_SKILLS.map((s) => `builtin:${s.name}`),
|
|
531
|
+
...workspaceFiles,
|
|
532
|
+
];
|
|
533
|
+
if (files.length === 0)
|
|
534
|
+
return "(no skills available)";
|
|
535
|
+
const lines = files
|
|
536
|
+
.slice(0, SKILL_CONTENT_LIMITS.listMaxSkills)
|
|
537
|
+
.map((f) => {
|
|
538
|
+
const skill = this.getSkillInfo(f);
|
|
539
|
+
if (!skill || skill.kind === "invalid")
|
|
540
|
+
return `- ${f} (invalid)`;
|
|
541
|
+
const meta = this.loadSkillMeta(f);
|
|
542
|
+
const stats = meta.usageCount > 0
|
|
543
|
+
? ` [used ${meta.usageCount}x, ${meta.successRate}% ok]`
|
|
544
|
+
: "";
|
|
545
|
+
const kind = skill.kind === "script"
|
|
546
|
+
? `${skill.stepsCount ?? 0} steps`
|
|
547
|
+
: "instruction";
|
|
548
|
+
const flags = skill.builtin ? " [built-in, read-only]" : "";
|
|
549
|
+
const displayName = skill.builtin ? `builtin:${skill.name}` : skill.name;
|
|
550
|
+
return `- ${displayName}: ${skill.description} (${kind})${flags}${stats}`;
|
|
551
|
+
})
|
|
552
|
+
.join("\n");
|
|
553
|
+
const capped = truncateWithNote(lines, SKILL_CONTENT_LIMITS.listMaxChars, "skill list exceeded display cap").content;
|
|
554
|
+
if (files.length > SKILL_CONTENT_LIMITS.listMaxSkills) {
|
|
555
|
+
return `${capped}\n... (${files.length - SKILL_CONTENT_LIMITS.listMaxSkills} more skills omitted)`;
|
|
556
|
+
}
|
|
557
|
+
return capped;
|
|
558
|
+
}
|
|
559
|
+
/** Load metadata from a skill file */
|
|
560
|
+
loadSkillMeta(skillRef) {
|
|
561
|
+
const defaults = { usageCount: 0, successRate: 100, lastImproved: "" };
|
|
562
|
+
const target = this.resolveSkillFile(skillRef);
|
|
563
|
+
if (!target)
|
|
564
|
+
return defaults;
|
|
565
|
+
const loaded = this.readSkillFileContent(target.filePath);
|
|
566
|
+
if (!loaded)
|
|
567
|
+
return defaults;
|
|
568
|
+
const content = loaded.content;
|
|
569
|
+
const fmMatch = content.match(/^---\n([\s\S]*?)\n---/);
|
|
570
|
+
if (!fmMatch)
|
|
571
|
+
return defaults;
|
|
572
|
+
const fm = fmMatch[1];
|
|
573
|
+
return {
|
|
574
|
+
usageCount: Number(fm.match(/usageCount:\s*(\d+)/)?.[1] ?? 0),
|
|
575
|
+
successRate: Number(fm.match(/successRate:\s*([\d.]+)/)?.[1] ?? 100),
|
|
576
|
+
lastImproved: fm.match(/lastImproved:\s*(.+)/)?.[1]?.trim() ?? "",
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
/** Update usage stats for a skill after execution */
|
|
580
|
+
updateSkillMeta(skillRef, success) {
|
|
581
|
+
const target = this.resolveSkillFile(skillRef);
|
|
582
|
+
if (!target || target.builtin)
|
|
583
|
+
return;
|
|
584
|
+
const skill = this.loadSkill(skillRef);
|
|
585
|
+
if (!skill)
|
|
586
|
+
return;
|
|
587
|
+
const meta = this.loadSkillMeta(skillRef);
|
|
588
|
+
meta.usageCount++;
|
|
589
|
+
const total = meta.usageCount;
|
|
590
|
+
// Rolling success rate
|
|
591
|
+
meta.successRate = Math.round(((meta.successRate * (total - 1)) / 100 + (success ? 1 : 0)) / total * 100);
|
|
592
|
+
this.saveSkill(skill, meta);
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Determine if an execution log is worth auto-generating a skill from.
|
|
596
|
+
* Criteria: enough meaningful browser actions, all successful, not trivially short.
|
|
597
|
+
*/
|
|
598
|
+
shouldAutoGenerate(logFilePath) {
|
|
599
|
+
const entries = ExecutionLogger.readLog(logFilePath);
|
|
600
|
+
if (entries.length === 0)
|
|
601
|
+
return false;
|
|
602
|
+
// Refuse to auto-generate skills for tasks that depend on structured
|
|
603
|
+
// storage. The current script schema is linear — no branching, no
|
|
604
|
+
// page-state variable extraction — which means a generated skill can
|
|
605
|
+
// write store entries after success but cannot reliably run the required
|
|
606
|
+
// read/compare step before acting on a candidate. Until the schema gains
|
|
607
|
+
// guards + variables, keep these tasks LLM-driven.
|
|
608
|
+
const taskStart = entries.find((e) => e.action === "task_start");
|
|
609
|
+
const prompt = typeof taskStart?.prompt === "string" ? taskStart.prompt : "";
|
|
610
|
+
const storagePolicies = Array.isArray(taskStart?.storagePolicies)
|
|
611
|
+
? taskStart.storagePolicies
|
|
612
|
+
: [];
|
|
613
|
+
if (storagePolicies.length > 0 || SkillGenerator.isStorageSensitivePrompt(prompt)) {
|
|
614
|
+
console.log(` Skipping skill auto-gen: task depends on structured storage. Linear scripts cannot safely enforce storage policies yet.`);
|
|
615
|
+
return false;
|
|
616
|
+
}
|
|
617
|
+
const actionEntries = entries.filter((e) => e.action !== "snapshot" && e.action !== "screenshot" && e.action !== "script_start" && e.action !== "script_end");
|
|
618
|
+
// Need at least 3 meaningful actions
|
|
619
|
+
if (actionEntries.length < 3)
|
|
620
|
+
return false;
|
|
621
|
+
// Must have a navigate action (needs a real workflow, not just clicks)
|
|
622
|
+
const hasNavigate = actionEntries.some((e) => e.action === "navigate");
|
|
623
|
+
if (!hasNavigate)
|
|
624
|
+
return false;
|
|
625
|
+
// Failure rate must be under 30%
|
|
626
|
+
const failures = actionEntries.filter((e) => !e.success);
|
|
627
|
+
if (failures.length / actionEntries.length > 0.3)
|
|
628
|
+
return false;
|
|
629
|
+
return true;
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Heuristic: does the task prompt request structured cross-run state?
|
|
633
|
+
* If so, a linear script can't enforce that correctly (see comment in
|
|
634
|
+
* shouldAutoGenerate). Match is intentionally broad — false positives
|
|
635
|
+
* (keep something LLM-driven that could have been a script) are cheap;
|
|
636
|
+
* false negatives can produce visible repeated or stale work.
|
|
637
|
+
*
|
|
638
|
+
* Exported as a static helper so tests / future call sites can reuse it
|
|
639
|
+
* without instantiating SkillGenerator.
|
|
640
|
+
*/
|
|
641
|
+
static isStorageSensitivePrompt(prompt) {
|
|
642
|
+
return hasStorageIntent(prompt);
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Improve a skill based on its execution report.
|
|
646
|
+
* When steps used LLM fallback, ask the LLM to revise those steps.
|
|
647
|
+
*/
|
|
648
|
+
async improveSkill(skill, report) {
|
|
649
|
+
// Only improve if there were fallbacks but the skill overall completed
|
|
650
|
+
if (report.fallbackCount === 0 || !report.completed)
|
|
651
|
+
return null;
|
|
652
|
+
const fallbackSteps = report.steps
|
|
653
|
+
.filter((s) => s.usedFallback)
|
|
654
|
+
.map((s) => ({
|
|
655
|
+
index: s.index,
|
|
656
|
+
originalAction: skill.steps[s.index]?.action,
|
|
657
|
+
originalParams: skill.steps[s.index]?.params,
|
|
658
|
+
originalDescription: skill.steps[s.index]?.description,
|
|
659
|
+
fallbackAction: s.fallbackAction,
|
|
660
|
+
error: s.error,
|
|
661
|
+
}));
|
|
662
|
+
const response = await this.llmClient.chat([
|
|
663
|
+
{
|
|
664
|
+
role: "user",
|
|
665
|
+
content: `A browser automation skill "${skill.name}" was executed but some steps needed LLM fallback because the original steps failed. Please revise the skill to fix these problematic steps.
|
|
666
|
+
|
|
667
|
+
Current skill steps:
|
|
668
|
+
${JSON.stringify(skill.steps, null, 2)}
|
|
669
|
+
|
|
670
|
+
Steps that needed fallback:
|
|
671
|
+
${JSON.stringify(fallbackSteps, null, 2)}
|
|
672
|
+
|
|
673
|
+
Return the COMPLETE revised steps array as JSON. Keep steps that worked unchanged. Fix the steps that failed based on what the fallback actually did. Use {{variable_name}} for parameterized parts.
|
|
674
|
+
|
|
675
|
+
Return ONLY the JSON array of steps, no other text.`,
|
|
676
|
+
},
|
|
677
|
+
], undefined, "You are an expert at improving browser automation scripts. Output only valid JSON.");
|
|
678
|
+
try {
|
|
679
|
+
const jsonMatch = response.content.match(/\[[\s\S]*\]/);
|
|
680
|
+
if (!jsonMatch)
|
|
681
|
+
return null;
|
|
682
|
+
const improvedSteps = JSON.parse(jsonMatch[0]);
|
|
683
|
+
// Update the skill
|
|
684
|
+
const improvedSkill = {
|
|
685
|
+
...skill,
|
|
686
|
+
steps: improvedSteps,
|
|
687
|
+
notes: [
|
|
688
|
+
...(skill.notes || []),
|
|
689
|
+
`Auto-improved on ${new Date().toISOString().slice(0, 10)}: fixed ${fallbackSteps.length} step(s)`,
|
|
690
|
+
],
|
|
691
|
+
};
|
|
692
|
+
const meta = this.loadSkillMeta(skill.name);
|
|
693
|
+
meta.lastImproved = new Date().toISOString();
|
|
694
|
+
const result = this.saveSkill(improvedSkill, meta);
|
|
695
|
+
console.log(`🧠 Skill "${skill.name}" auto-improved: ${fallbackSteps.length} step(s) revised`);
|
|
696
|
+
return result;
|
|
697
|
+
}
|
|
698
|
+
catch (err) {
|
|
699
|
+
console.error("Failed to improve skill:", err);
|
|
700
|
+
return null;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
//# sourceMappingURL=skill-generator.js.map
|