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,280 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
/**
|
|
4
|
+
* 组织管理器 (OrgManager)
|
|
5
|
+
* 负责处理跨 Agent 的通信、任务派发、状态汇报。
|
|
6
|
+
* 它采用“信箱模式”(Mailbox Pattern),通过在共享目录读写 JSON 文件实现解耦和高可靠的通信。
|
|
7
|
+
*/
|
|
8
|
+
export class OrgManager {
|
|
9
|
+
config;
|
|
10
|
+
heartbeatInterval = null;
|
|
11
|
+
constructor(config) {
|
|
12
|
+
this.config = config;
|
|
13
|
+
}
|
|
14
|
+
/** Get the primary department for this agent (used for registry/inbox) */
|
|
15
|
+
getPrimaryDepartment() {
|
|
16
|
+
const dept = this.config.org?.department;
|
|
17
|
+
if (Array.isArray(dept))
|
|
18
|
+
return dept[0] || "default";
|
|
19
|
+
if (dept === "*")
|
|
20
|
+
return "admin"; // Super boss's home
|
|
21
|
+
return dept || "default";
|
|
22
|
+
}
|
|
23
|
+
/** Get all departments this agent can manage/view */
|
|
24
|
+
getManagedDepartments() {
|
|
25
|
+
const dept = this.config.org?.department;
|
|
26
|
+
const root = this.config.org?.root;
|
|
27
|
+
if (!root)
|
|
28
|
+
return [];
|
|
29
|
+
if (dept === "*") {
|
|
30
|
+
const registryDir = path.join(root, "registry");
|
|
31
|
+
if (!fs.existsSync(registryDir))
|
|
32
|
+
return [];
|
|
33
|
+
return fs.readdirSync(registryDir).filter(d => fs.statSync(path.join(registryDir, d)).isDirectory());
|
|
34
|
+
}
|
|
35
|
+
if (Array.isArray(dept))
|
|
36
|
+
return dept;
|
|
37
|
+
return [dept || "default"];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 初始化组织环境
|
|
41
|
+
* - 如果尚未注册,会在 registry 目录下创建该 Agent 的心跳文件。
|
|
42
|
+
* - 如果是员工,会为其建立专属的收件箱文件夹。
|
|
43
|
+
* - 启动定时器,定期更新自己的心跳状态(在线时间、忙闲状态),并清理过期历史任务。
|
|
44
|
+
*/
|
|
45
|
+
async init() {
|
|
46
|
+
if (!this.config.org)
|
|
47
|
+
return;
|
|
48
|
+
const { root } = this.config.org;
|
|
49
|
+
const primaryDept = this.getPrimaryDepartment();
|
|
50
|
+
const dirs = [
|
|
51
|
+
path.join(root, "registry", primaryDept),
|
|
52
|
+
path.join(root, "inbox", primaryDept, this.config.name),
|
|
53
|
+
];
|
|
54
|
+
for (const dir of dirs) {
|
|
55
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
56
|
+
}
|
|
57
|
+
this.updateStatus("idle");
|
|
58
|
+
// Start heartbeat
|
|
59
|
+
this.heartbeatInterval = setInterval(() => {
|
|
60
|
+
this.updateStatus();
|
|
61
|
+
this.cleanup();
|
|
62
|
+
}, 60000); // Every 1m
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* 定期清理和归档逻辑
|
|
66
|
+
* 1. 将收件箱里超过 24 小时的已完成/已失败任务转移到历史库 (history) 目录。
|
|
67
|
+
* 2. 将卡在 running 状态超过 24 小时的死锁任务强行标记为 failed(防止 Agent 崩溃导致的僵尸任务)。
|
|
68
|
+
* 3. 删除历史库中存放超过 7 天的文件,释放磁盘空间。
|
|
69
|
+
*/
|
|
70
|
+
cleanup() {
|
|
71
|
+
if (!this.config.org)
|
|
72
|
+
return;
|
|
73
|
+
const { root } = this.config.org;
|
|
74
|
+
const primaryDept = this.getPrimaryDepartment();
|
|
75
|
+
const inboxDir = path.join(root, "inbox", primaryDept, this.config.name);
|
|
76
|
+
const historyDir = path.join(root, "history", primaryDept, this.config.name);
|
|
77
|
+
if (!fs.existsSync(inboxDir))
|
|
78
|
+
return;
|
|
79
|
+
if (!fs.existsSync(historyDir))
|
|
80
|
+
fs.mkdirSync(historyDir, { recursive: true });
|
|
81
|
+
const now = Date.now();
|
|
82
|
+
const ONE_DAY = 24 * 60 * 60 * 1000;
|
|
83
|
+
const SEVEN_DAYS = 7 * ONE_DAY;
|
|
84
|
+
// 1. Archive completed/failed tasks older than 24h, and fail stuck running tasks
|
|
85
|
+
const files = fs.readdirSync(inboxDir).filter(f => f.endsWith(".json"));
|
|
86
|
+
for (const f of files) {
|
|
87
|
+
const p = path.join(inboxDir, f);
|
|
88
|
+
try {
|
|
89
|
+
const stats = fs.statSync(p);
|
|
90
|
+
if (now - stats.mtimeMs > ONE_DAY) {
|
|
91
|
+
const task = JSON.parse(fs.readFileSync(p, "utf-8"));
|
|
92
|
+
if (task.status === "completed" || task.status === "failed") {
|
|
93
|
+
fs.renameSync(p, path.join(historyDir, f));
|
|
94
|
+
}
|
|
95
|
+
else if (task.status === "running") {
|
|
96
|
+
// Task has been running for > 24h, assume agent crashed
|
|
97
|
+
task.status = "failed";
|
|
98
|
+
task.result = "Task timed out (stuck in running state for > 24h).";
|
|
99
|
+
fs.writeFileSync(p, JSON.stringify(task, null, 2));
|
|
100
|
+
// It will be archived on the next cleanup run 24h later
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch { }
|
|
105
|
+
}
|
|
106
|
+
// 2. Delete history older than 7 days
|
|
107
|
+
if (fs.existsSync(historyDir)) {
|
|
108
|
+
const historyFiles = fs.readdirSync(historyDir).filter(f => f.endsWith(".json"));
|
|
109
|
+
for (const f of historyFiles) {
|
|
110
|
+
const p = path.join(historyDir, f);
|
|
111
|
+
try {
|
|
112
|
+
const stats = fs.statSync(p);
|
|
113
|
+
if (now - stats.mtimeMs > SEVEN_DAYS) {
|
|
114
|
+
fs.unlinkSync(p);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
catch { }
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
updateStatus(status) {
|
|
122
|
+
if (!this.config.org)
|
|
123
|
+
return;
|
|
124
|
+
const { root, role } = this.config.org;
|
|
125
|
+
const primaryDept = this.getPrimaryDepartment();
|
|
126
|
+
const registryPath = path.join(root, "registry", primaryDept, `${this.config.name}.json`);
|
|
127
|
+
let currentStatus = status || "idle";
|
|
128
|
+
try {
|
|
129
|
+
if (fs.existsSync(registryPath) && !status) {
|
|
130
|
+
const existing = JSON.parse(fs.readFileSync(registryPath, "utf-8"));
|
|
131
|
+
currentStatus = existing.status;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
catch { }
|
|
135
|
+
const agentStatus = {
|
|
136
|
+
name: this.config.name,
|
|
137
|
+
role,
|
|
138
|
+
department: primaryDept,
|
|
139
|
+
lastSeen: new Date().toISOString(),
|
|
140
|
+
status: currentStatus,
|
|
141
|
+
};
|
|
142
|
+
fs.writeFileSync(registryPath, JSON.stringify(agentStatus, null, 2));
|
|
143
|
+
}
|
|
144
|
+
setStatus(status) {
|
|
145
|
+
this.updateStatus(status);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* 获取团队名单 (仅老板常用)
|
|
149
|
+
* 老板会扫描自己所管辖的部门注册表,读取所有员工的心跳文件。
|
|
150
|
+
*/
|
|
151
|
+
listTeam() {
|
|
152
|
+
if (!this.config.org)
|
|
153
|
+
return [];
|
|
154
|
+
const { root } = this.config.org;
|
|
155
|
+
const depts = this.getManagedDepartments();
|
|
156
|
+
const allMembers = [];
|
|
157
|
+
for (const dept of depts) {
|
|
158
|
+
const registryDir = path.join(root, "registry", dept);
|
|
159
|
+
if (!fs.existsSync(registryDir))
|
|
160
|
+
continue;
|
|
161
|
+
const members = fs.readdirSync(registryDir)
|
|
162
|
+
.filter(f => f.endsWith(".json"))
|
|
163
|
+
.map(f => {
|
|
164
|
+
try {
|
|
165
|
+
return JSON.parse(fs.readFileSync(path.join(registryDir, f), "utf-8"));
|
|
166
|
+
}
|
|
167
|
+
catch {
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
})
|
|
171
|
+
.filter((s) => s !== null);
|
|
172
|
+
allMembers.push(...members);
|
|
173
|
+
}
|
|
174
|
+
return allMembers;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* 指派任务 (核心方法)
|
|
178
|
+
* @param target 目标员工名称,可以带前缀如 "dept:推广部",或者填 "all" 广播全员。
|
|
179
|
+
* @param instruction 具体的操作指令文本。
|
|
180
|
+
* @returns 分发成功的任务 ID 列表。
|
|
181
|
+
*/
|
|
182
|
+
assignTask(target, instruction) {
|
|
183
|
+
if (!this.config.org || this.config.org.role !== "boss") {
|
|
184
|
+
throw new Error("Only bosses can assign tasks.");
|
|
185
|
+
}
|
|
186
|
+
const { root } = this.config.org;
|
|
187
|
+
const depts = this.getManagedDepartments();
|
|
188
|
+
const targets = [];
|
|
189
|
+
const allMembers = this.listTeam();
|
|
190
|
+
if (target === "all") {
|
|
191
|
+
targets.push(...allMembers.filter(m => m.role === "worker").map(m => ({ name: m.name, dept: m.department })));
|
|
192
|
+
}
|
|
193
|
+
else if (target.startsWith("dept:")) {
|
|
194
|
+
const targetDept = target.replace("dept:", "");
|
|
195
|
+
targets.push(...allMembers.filter(m => m.role === "worker" && m.department === targetDept).map(m => ({ name: m.name, dept: m.department })));
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
// Find specific worker across managed depts
|
|
199
|
+
const worker = allMembers.find(m => m.name === target && m.role === "worker");
|
|
200
|
+
if (worker) {
|
|
201
|
+
targets.push({ name: worker.name, dept: worker.department });
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
throw new Error(`Worker '${target}' not found in your managed departments.`);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
const assignedTasks = [];
|
|
208
|
+
for (const { name, dept } of targets) {
|
|
209
|
+
const inboxDir = path.join(root, "inbox", dept, name);
|
|
210
|
+
fs.mkdirSync(inboxDir, { recursive: true });
|
|
211
|
+
const taskId = `task_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
|
|
212
|
+
const task = {
|
|
213
|
+
id: taskId,
|
|
214
|
+
instruction,
|
|
215
|
+
assignedBy: this.config.name,
|
|
216
|
+
assignedAt: new Date().toISOString(),
|
|
217
|
+
status: "pending",
|
|
218
|
+
targetDepartment: dept
|
|
219
|
+
};
|
|
220
|
+
fs.writeFileSync(path.join(inboxDir, `${taskId}.json`), JSON.stringify(task, null, 2));
|
|
221
|
+
assignedTasks.push(`${dept}/${name}:${taskId}`);
|
|
222
|
+
}
|
|
223
|
+
return assignedTasks;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* 轮询查收新任务 (仅员工常用)
|
|
227
|
+
* 员工读取自己收件箱下的所有 JSON 文件,筛选出状态为 pending 的任务。
|
|
228
|
+
*/
|
|
229
|
+
pollTasks() {
|
|
230
|
+
if (!this.config.org)
|
|
231
|
+
return [];
|
|
232
|
+
const { root } = this.config.org;
|
|
233
|
+
const primaryDept = this.getPrimaryDepartment();
|
|
234
|
+
const inboxDir = path.join(root, "inbox", primaryDept, this.config.name);
|
|
235
|
+
if (!fs.existsSync(inboxDir))
|
|
236
|
+
return [];
|
|
237
|
+
const tasks = fs.readdirSync(inboxDir)
|
|
238
|
+
.filter(f => f.endsWith(".json"))
|
|
239
|
+
.map(f => {
|
|
240
|
+
try {
|
|
241
|
+
const p = path.join(inboxDir, f);
|
|
242
|
+
const task = JSON.parse(fs.readFileSync(p, "utf-8"));
|
|
243
|
+
if (task.status === "pending") {
|
|
244
|
+
return task;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
catch { }
|
|
248
|
+
return null;
|
|
249
|
+
})
|
|
250
|
+
.filter((t) => t !== null);
|
|
251
|
+
return tasks;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* 更新任务状态与回传结果
|
|
255
|
+
* 员工在接单、完成、报错时,都会调用此方法覆盖修改收件箱里的同一个 JSON 文件。
|
|
256
|
+
*/
|
|
257
|
+
updateTask(taskId, status, result) {
|
|
258
|
+
if (!this.config.org)
|
|
259
|
+
return;
|
|
260
|
+
const { root } = this.config.org;
|
|
261
|
+
const primaryDept = this.getPrimaryDepartment();
|
|
262
|
+
const taskPath = path.join(root, "inbox", primaryDept, this.config.name, `${taskId}.json`);
|
|
263
|
+
if (!fs.existsSync(taskPath))
|
|
264
|
+
return;
|
|
265
|
+
try {
|
|
266
|
+
const task = JSON.parse(fs.readFileSync(taskPath, "utf-8"));
|
|
267
|
+
task.status = status;
|
|
268
|
+
if (result !== undefined)
|
|
269
|
+
task.result = result;
|
|
270
|
+
fs.writeFileSync(taskPath, JSON.stringify(task, null, 2));
|
|
271
|
+
}
|
|
272
|
+
catch { }
|
|
273
|
+
}
|
|
274
|
+
stop() {
|
|
275
|
+
if (this.heartbeatInterval) {
|
|
276
|
+
clearInterval(this.heartbeatInterval);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
//# sourceMappingURL=org-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"org-manager.js","sourceRoot":"","sources":["../../src/agent/org-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAqB7B;;;;GAIG;AACH,MAAM,OAAO,UAAU;IACb,MAAM,CAAgB;IACtB,iBAAiB,GAA0B,IAAI,CAAC;IAExD,YAAY,MAAqB;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,0EAA0E;IAC1E,oBAAoB;QAClB,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC;QACzC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC;QACrD,IAAI,IAAI,KAAK,GAAG;YAAE,OAAO,OAAO,CAAC,CAAC,oBAAoB;QACtD,OAAO,IAAI,IAAI,SAAS,CAAC;IAC3B,CAAC;IAED,qDAAqD;IACrD,qBAAqB;QACnB,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC;QACzC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC;QACnC,IAAI,CAAC,IAAI;YAAE,OAAO,EAAE,CAAC;QAErB,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;YACjB,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;YAChD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC;gBAAE,OAAO,EAAE,CAAC;YAC3C,OAAO,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,E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,GAAG;YAAE,OAAO;QAC7B,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;QACjC,MAAM,WAAW,GAAG,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAChD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,MAAM,OAAO,CAAC,CAAC;QAE3F,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;YAAE,OAAO;QAErC,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAY,CAAC;YACvE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YACrB,IAAI,MAAM,KAAK,SAAS;gBAAE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YAC/C,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC5D,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;IACZ,CAAC;IAED,IAAI;QACF,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC3B,aAAa,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type StoragePolicy } from "./storage-policy.js";
|
|
2
|
+
export interface ScheduledTask {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
cron: string;
|
|
6
|
+
prompt: string;
|
|
7
|
+
storagePolicies?: StoragePolicy[];
|
|
8
|
+
storagePolicyMode?: "auto" | "off";
|
|
9
|
+
skillRef?: string;
|
|
10
|
+
/** IANA timezone for this task's cron (e.g. "UTC", "Asia/Shanghai"). Falls back to scheduler default. */
|
|
11
|
+
timezone?: string;
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
lastRun?: string;
|
|
14
|
+
lastStatus?: "ok" | "error";
|
|
15
|
+
/** Total number of runs */
|
|
16
|
+
runCount?: number;
|
|
17
|
+
/** Number of successful runs */
|
|
18
|
+
successCount?: number;
|
|
19
|
+
}
|
|
20
|
+
export type TaskHandler = (task: ScheduledTask) => Promise<void>;
|
|
21
|
+
export declare class Scheduler {
|
|
22
|
+
private tasksFile;
|
|
23
|
+
private jobs;
|
|
24
|
+
private handler;
|
|
25
|
+
private startedAt;
|
|
26
|
+
private defaultTimezone?;
|
|
27
|
+
constructor(workspace: string, defaultTimezone?: string);
|
|
28
|
+
setHandler(handler: TaskHandler): void;
|
|
29
|
+
/** Load tasks from disk and start enabled cron jobs */
|
|
30
|
+
start(): void;
|
|
31
|
+
stop(): void;
|
|
32
|
+
loadTasks(): ScheduledTask[];
|
|
33
|
+
private saveTasks;
|
|
34
|
+
addTask(name: string, cronExpr: string, prompt: string, timezone?: string): ScheduledTask;
|
|
35
|
+
removeTask(id: string): boolean;
|
|
36
|
+
updateTask(id: string, patch: {
|
|
37
|
+
name?: string;
|
|
38
|
+
cron?: string;
|
|
39
|
+
prompt?: string;
|
|
40
|
+
timezone?: string;
|
|
41
|
+
enabled?: boolean;
|
|
42
|
+
storagePolicyMode?: "auto" | "off";
|
|
43
|
+
}): ScheduledTask | null;
|
|
44
|
+
toggleTask(id: string, enabled: boolean): ScheduledTask | null;
|
|
45
|
+
updateTaskStatus(id: string, status: "ok" | "error"): void;
|
|
46
|
+
linkSkill(taskId: string, skillRef: string): boolean;
|
|
47
|
+
getTask(id: string): ScheduledTask | undefined;
|
|
48
|
+
getNextRun(): Date | null;
|
|
49
|
+
formatTaskList(): string;
|
|
50
|
+
private scheduleJob;
|
|
51
|
+
}
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import cron from "node-cron";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import crypto from "node:crypto";
|
|
5
|
+
import { isValidTimezone } from "../config/types.js";
|
|
6
|
+
import { mergeAutoStoragePolicies, normalizeStoragePolicies, } from "./storage-policy.js";
|
|
7
|
+
export class Scheduler {
|
|
8
|
+
tasksFile;
|
|
9
|
+
jobs = new Map();
|
|
10
|
+
handler = null;
|
|
11
|
+
startedAt = 0;
|
|
12
|
+
defaultTimezone;
|
|
13
|
+
constructor(workspace, defaultTimezone) {
|
|
14
|
+
this.tasksFile = path.join(workspace, "tasks", "tasks.json");
|
|
15
|
+
this.defaultTimezone = defaultTimezone;
|
|
16
|
+
}
|
|
17
|
+
setHandler(handler) {
|
|
18
|
+
this.handler = handler;
|
|
19
|
+
}
|
|
20
|
+
/** Load tasks from disk and start enabled cron jobs */
|
|
21
|
+
start() {
|
|
22
|
+
this.startedAt = Date.now();
|
|
23
|
+
const tasks = this.loadTasks();
|
|
24
|
+
let scheduled = 0;
|
|
25
|
+
let failed = 0;
|
|
26
|
+
for (const task of tasks) {
|
|
27
|
+
if (!task.enabled)
|
|
28
|
+
continue;
|
|
29
|
+
try {
|
|
30
|
+
this.scheduleJob(task);
|
|
31
|
+
scheduled++;
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
failed++;
|
|
35
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
36
|
+
console.error(` Failed to schedule task "${task.name}" [${task.id}]: ${msg}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const tzNote = this.defaultTimezone
|
|
40
|
+
? ` (default tz: ${this.defaultTimezone})`
|
|
41
|
+
: "";
|
|
42
|
+
const failNote = failed ? `, ${failed} failed` : "";
|
|
43
|
+
console.log(`⏰ Scheduler started: ${scheduled}/${tasks.length} tasks active${failNote}${tzNote}`);
|
|
44
|
+
}
|
|
45
|
+
stop() {
|
|
46
|
+
for (const job of this.jobs.values()) {
|
|
47
|
+
job.stop();
|
|
48
|
+
}
|
|
49
|
+
this.jobs.clear();
|
|
50
|
+
}
|
|
51
|
+
loadTasks() {
|
|
52
|
+
if (!fs.existsSync(this.tasksFile))
|
|
53
|
+
return [];
|
|
54
|
+
const content = fs.readFileSync(this.tasksFile, "utf-8");
|
|
55
|
+
return JSON.parse(content).map((task) => {
|
|
56
|
+
if (task.storagePolicyMode === "off") {
|
|
57
|
+
const rest = { ...task };
|
|
58
|
+
delete rest.storagePolicies;
|
|
59
|
+
return rest;
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
...task,
|
|
63
|
+
storagePolicies: normalizeStoragePolicies(task.storagePolicies, task.id),
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
saveTasks(tasks) {
|
|
68
|
+
fs.mkdirSync(path.dirname(this.tasksFile), { recursive: true });
|
|
69
|
+
fs.writeFileSync(this.tasksFile, JSON.stringify(tasks, null, 2), "utf-8");
|
|
70
|
+
}
|
|
71
|
+
addTask(name, cronExpr, prompt, timezone) {
|
|
72
|
+
if (!cron.validate(cronExpr)) {
|
|
73
|
+
throw new Error(`Invalid cron expression: ${cronExpr}`);
|
|
74
|
+
}
|
|
75
|
+
if (timezone && !isValidTimezone(timezone)) {
|
|
76
|
+
throw new Error(`Invalid IANA timezone: ${timezone}`);
|
|
77
|
+
}
|
|
78
|
+
const tasks = this.loadTasks();
|
|
79
|
+
const task = {
|
|
80
|
+
id: crypto.randomUUID().slice(0, 8),
|
|
81
|
+
name,
|
|
82
|
+
cron: cronExpr,
|
|
83
|
+
prompt,
|
|
84
|
+
enabled: true,
|
|
85
|
+
};
|
|
86
|
+
const storagePolicies = mergeAutoStoragePolicies(task);
|
|
87
|
+
if (storagePolicies.length) {
|
|
88
|
+
task.storagePolicyMode = "auto";
|
|
89
|
+
task.storagePolicies = storagePolicies;
|
|
90
|
+
}
|
|
91
|
+
if (timezone)
|
|
92
|
+
task.timezone = timezone;
|
|
93
|
+
tasks.push(task);
|
|
94
|
+
this.saveTasks(tasks);
|
|
95
|
+
this.scheduleJob(task);
|
|
96
|
+
return task;
|
|
97
|
+
}
|
|
98
|
+
removeTask(id) {
|
|
99
|
+
const tasks = this.loadTasks();
|
|
100
|
+
const idx = tasks.findIndex((t) => t.id === id);
|
|
101
|
+
if (idx < 0)
|
|
102
|
+
return false;
|
|
103
|
+
tasks.splice(idx, 1);
|
|
104
|
+
this.saveTasks(tasks);
|
|
105
|
+
const job = this.jobs.get(id);
|
|
106
|
+
if (job) {
|
|
107
|
+
job.stop();
|
|
108
|
+
this.jobs.delete(id);
|
|
109
|
+
}
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
updateTask(id, patch) {
|
|
113
|
+
const tasks = this.loadTasks();
|
|
114
|
+
const task = tasks.find((t) => t.id === id);
|
|
115
|
+
if (!task)
|
|
116
|
+
return null;
|
|
117
|
+
if (patch.cron !== undefined && !cron.validate(patch.cron)) {
|
|
118
|
+
throw new Error(`Invalid cron expression: ${patch.cron}`);
|
|
119
|
+
}
|
|
120
|
+
if (patch.timezone && !isValidTimezone(patch.timezone)) {
|
|
121
|
+
throw new Error(`Invalid IANA timezone: ${patch.timezone}`);
|
|
122
|
+
}
|
|
123
|
+
if (patch.name !== undefined)
|
|
124
|
+
task.name = patch.name;
|
|
125
|
+
if (patch.cron !== undefined)
|
|
126
|
+
task.cron = patch.cron;
|
|
127
|
+
if (patch.prompt !== undefined)
|
|
128
|
+
task.prompt = patch.prompt;
|
|
129
|
+
if (patch.storagePolicyMode !== undefined)
|
|
130
|
+
task.storagePolicyMode = patch.storagePolicyMode;
|
|
131
|
+
if (patch.timezone !== undefined) {
|
|
132
|
+
if (patch.timezone === "")
|
|
133
|
+
delete task.timezone;
|
|
134
|
+
else
|
|
135
|
+
task.timezone = patch.timezone;
|
|
136
|
+
}
|
|
137
|
+
if (patch.enabled !== undefined)
|
|
138
|
+
task.enabled = patch.enabled;
|
|
139
|
+
if (patch.name !== undefined ||
|
|
140
|
+
patch.prompt !== undefined ||
|
|
141
|
+
patch.storagePolicyMode !== undefined) {
|
|
142
|
+
const storagePolicies = mergeAutoStoragePolicies(task);
|
|
143
|
+
if (storagePolicies.length) {
|
|
144
|
+
task.storagePolicyMode = task.storagePolicyMode ?? "auto";
|
|
145
|
+
task.storagePolicies = storagePolicies;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
delete task.storagePolicies;
|
|
149
|
+
if (task.storagePolicyMode === "auto")
|
|
150
|
+
delete task.storagePolicyMode;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
task.storagePolicies = normalizeStoragePolicies(task.storagePolicies, task.id);
|
|
155
|
+
if (!task.storagePolicies.length)
|
|
156
|
+
delete task.storagePolicies;
|
|
157
|
+
}
|
|
158
|
+
this.saveTasks(tasks);
|
|
159
|
+
// Always rebuild the job when the task is (now) enabled: scheduleJob's
|
|
160
|
+
// callback closes over `task`, so even prompt/name changes must re-capture
|
|
161
|
+
// the fresh object or the running handler will keep seeing stale fields.
|
|
162
|
+
const existing = this.jobs.get(id);
|
|
163
|
+
if (existing) {
|
|
164
|
+
existing.stop();
|
|
165
|
+
this.jobs.delete(id);
|
|
166
|
+
}
|
|
167
|
+
if (task.enabled) {
|
|
168
|
+
this.scheduleJob(task);
|
|
169
|
+
}
|
|
170
|
+
return task;
|
|
171
|
+
}
|
|
172
|
+
toggleTask(id, enabled) {
|
|
173
|
+
const tasks = this.loadTasks();
|
|
174
|
+
const task = tasks.find((t) => t.id === id);
|
|
175
|
+
if (!task)
|
|
176
|
+
return null;
|
|
177
|
+
if (enabled && task.timezone && !isValidTimezone(task.timezone)) {
|
|
178
|
+
throw new Error(`Cannot enable task ${id}: invalid IANA timezone "${task.timezone}"`);
|
|
179
|
+
}
|
|
180
|
+
task.enabled = enabled;
|
|
181
|
+
this.saveTasks(tasks);
|
|
182
|
+
if (enabled) {
|
|
183
|
+
this.scheduleJob(task);
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
const job = this.jobs.get(id);
|
|
187
|
+
if (job) {
|
|
188
|
+
job.stop();
|
|
189
|
+
this.jobs.delete(id);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return task;
|
|
193
|
+
}
|
|
194
|
+
updateTaskStatus(id, status) {
|
|
195
|
+
const tasks = this.loadTasks();
|
|
196
|
+
const task = tasks.find((t) => t.id === id);
|
|
197
|
+
if (task) {
|
|
198
|
+
task.lastRun = new Date().toISOString();
|
|
199
|
+
task.lastStatus = status;
|
|
200
|
+
task.runCount = (task.runCount || 0) + 1;
|
|
201
|
+
if (status === "ok") {
|
|
202
|
+
task.successCount = (task.successCount || 0) + 1;
|
|
203
|
+
}
|
|
204
|
+
this.saveTasks(tasks);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
linkSkill(taskId, skillRef) {
|
|
208
|
+
const tasks = this.loadTasks();
|
|
209
|
+
const task = tasks.find((t) => t.id === taskId);
|
|
210
|
+
if (!task)
|
|
211
|
+
return false;
|
|
212
|
+
task.skillRef = skillRef;
|
|
213
|
+
this.saveTasks(tasks);
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
getTask(id) {
|
|
217
|
+
return this.loadTasks().find((t) => t.id === id);
|
|
218
|
+
}
|
|
219
|
+
getNextRun() {
|
|
220
|
+
let next = null;
|
|
221
|
+
for (const job of this.jobs.values()) {
|
|
222
|
+
const runAt = job.getNextRun();
|
|
223
|
+
if (!runAt)
|
|
224
|
+
continue;
|
|
225
|
+
if (!next || runAt.getTime() < next.getTime()) {
|
|
226
|
+
next = runAt;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return next;
|
|
230
|
+
}
|
|
231
|
+
formatTaskList() {
|
|
232
|
+
const tasks = this.loadTasks();
|
|
233
|
+
if (tasks.length === 0)
|
|
234
|
+
return "(no scheduled tasks)";
|
|
235
|
+
return tasks
|
|
236
|
+
.map((t) => {
|
|
237
|
+
const status = t.enabled ? "✓" : "✗";
|
|
238
|
+
const lastRun = t.lastRun
|
|
239
|
+
? ` (last: ${t.lastRun.slice(0, 16)} ${t.lastStatus || ""})`
|
|
240
|
+
: "";
|
|
241
|
+
const skill = t.skillRef ? ` [skill: ${t.skillRef}]` : "";
|
|
242
|
+
const storage = t.storagePolicies?.length
|
|
243
|
+
? ` [storage: ${t.storagePolicies.length}]`
|
|
244
|
+
: "";
|
|
245
|
+
const runs = t.runCount
|
|
246
|
+
? ` [${t.successCount || 0}/${t.runCount} ok]`
|
|
247
|
+
: "";
|
|
248
|
+
const tz = t.timezone
|
|
249
|
+
? ` ${t.timezone}`
|
|
250
|
+
: this.defaultTimezone
|
|
251
|
+
? ` ${this.defaultTimezone} (default)`
|
|
252
|
+
: "";
|
|
253
|
+
return `${status} [${t.id}] ${t.name} | ${t.cron}${tz}${skill}${storage}${runs}${lastRun}\n → ${t.prompt}`;
|
|
254
|
+
})
|
|
255
|
+
.join("\n\n");
|
|
256
|
+
}
|
|
257
|
+
scheduleJob(task) {
|
|
258
|
+
// Stop existing job if any
|
|
259
|
+
const existing = this.jobs.get(task.id);
|
|
260
|
+
if (existing)
|
|
261
|
+
existing.stop();
|
|
262
|
+
const timezone = task.timezone ?? this.defaultTimezone;
|
|
263
|
+
const options = timezone ? { timezone } : undefined;
|
|
264
|
+
const job = cron.schedule(task.cron, async () => {
|
|
265
|
+
if (!this.handler)
|
|
266
|
+
return;
|
|
267
|
+
// Guard: node-cron fires immediately when cron matches the current second at
|
|
268
|
+
// startup (getDelay returns 0). Only skip triggers within 2s of start to
|
|
269
|
+
// catch this edge case without blocking legitimate cron fires.
|
|
270
|
+
if (Date.now() - this.startedAt < 2_000) {
|
|
271
|
+
console.log(` Skipping startup-instant trigger for "${task.name}"`);
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
// Re-load task from disk on every trigger so live edits to tasks.json
|
|
275
|
+
// (TG /update, direct file edit, future API) take effect on the next
|
|
276
|
+
// tick instead of requiring a process restart. The closure still owns
|
|
277
|
+
// the original `cron` expression — if the cron string itself is edited
|
|
278
|
+
// externally the underlying schedule isn't rebuilt until restart or an
|
|
279
|
+
// updateTask call. Prompt / enabled / timezone edits ARE live.
|
|
280
|
+
const fresh = this.getTask(task.id);
|
|
281
|
+
if (!fresh) {
|
|
282
|
+
console.log(` Task "${task.name}" [${task.id}] no longer in tasks.json; ignoring trigger`);
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
if (!fresh.enabled) {
|
|
286
|
+
console.log(` Task "${fresh.name}" [${fresh.id}] is disabled; ignoring trigger`);
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
console.log(`\n⏰ Running scheduled task: ${fresh.name} [${fresh.id}]`);
|
|
290
|
+
try {
|
|
291
|
+
await this.handler(fresh);
|
|
292
|
+
this.updateTaskStatus(fresh.id, "ok");
|
|
293
|
+
}
|
|
294
|
+
catch (err) {
|
|
295
|
+
console.error(`Task ${fresh.id} failed:`, err);
|
|
296
|
+
this.updateTaskStatus(fresh.id, "error");
|
|
297
|
+
}
|
|
298
|
+
}, options);
|
|
299
|
+
this.jobs.set(task.id, job);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
//# sourceMappingURL=scheduler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler.js","sourceRoot":"","sources":["../../src/agent/scheduler.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACL,wBAAwB,EACxB,wBAAwB,GAEzB,MAAM,qBAAqB,CAAC;AAuB7B,MAAM,OAAO,SAAS;IACZ,SAAS,CAAS;IAClB,IAAI,GAAG,IAAI,GAAG,EAA8B,CAAC;IAC7C,OAAO,GAAuB,IAAI,CAAC;IACnC,SA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