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,459 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
|
+
import { NoChatContext } from "../agent/agent-types.js";
|
|
4
|
+
export class CenterFrontend {
|
|
5
|
+
agent;
|
|
6
|
+
client;
|
|
7
|
+
workerId;
|
|
8
|
+
version;
|
|
9
|
+
logger;
|
|
10
|
+
/**
|
|
11
|
+
* AsyncLocalStorage that carries the active chat scope. Sender/notifier
|
|
12
|
+
* inspect `getStore()` and throw NoChatContext when absent — this lets
|
|
13
|
+
* the Agent multiplexer skip our frontend for non-chat invocations
|
|
14
|
+
* (e.g. scheduled task scope before/after M3, attachment.send from a
|
|
15
|
+
* Telegram chat that hasn't routed through us).
|
|
16
|
+
*/
|
|
17
|
+
chatScope = new AsyncLocalStorage();
|
|
18
|
+
inFlight = null;
|
|
19
|
+
configDirty = false;
|
|
20
|
+
/**
|
|
21
|
+
* Session-specific dirty flag (set on `config_invalidate { which:
|
|
22
|
+
* includes "session" }`). Separate from `configDirty` so the
|
|
23
|
+
* session swap path (re-bootstrap + Agent.swapSession) doesn't fire
|
|
24
|
+
* for unrelated config changes like LLM key rotation.
|
|
25
|
+
*/
|
|
26
|
+
sessionDirty = false;
|
|
27
|
+
/** Single-flight guard so two task_dispatches don't race the swap. */
|
|
28
|
+
swapInFlight = null;
|
|
29
|
+
detachers = [];
|
|
30
|
+
heartbeatTimer = null;
|
|
31
|
+
currentStatus = "idle";
|
|
32
|
+
currentTaskId = null;
|
|
33
|
+
constructor(opts) {
|
|
34
|
+
this.agent = opts.agent;
|
|
35
|
+
this.client = opts.client;
|
|
36
|
+
this.workerId = opts.workerId;
|
|
37
|
+
this.version = opts.version ?? "unknown";
|
|
38
|
+
this.logger = opts.logger ?? {
|
|
39
|
+
info: (m) => console.log(m),
|
|
40
|
+
warn: (m) => console.warn(m),
|
|
41
|
+
error: (m) => console.error(m),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/** Wire up Agent registration + center-client message routing. */
|
|
45
|
+
async start() {
|
|
46
|
+
this.agent.registerFrontend("center", {
|
|
47
|
+
sender: async (_payload) => {
|
|
48
|
+
const store = this.chatScope.getStore();
|
|
49
|
+
if (!store) {
|
|
50
|
+
throw new NoChatContext("center sender called outside a chat scope (M6 will deliver via R2 + task_run.attachments)");
|
|
51
|
+
}
|
|
52
|
+
// M6: presign R2 upload, push attachment_upload event over WS. For
|
|
53
|
+
// M3 we hard-error to surface "chat called too early".
|
|
54
|
+
throw new Error("center attachment delivery not implemented yet (M6); attachment was generated but not sent.");
|
|
55
|
+
},
|
|
56
|
+
notifier: async (_text) => {
|
|
57
|
+
const store = this.chatScope.getStore();
|
|
58
|
+
if (!store) {
|
|
59
|
+
throw new NoChatContext("center notifier called outside a chat scope");
|
|
60
|
+
}
|
|
61
|
+
// M6: emit chat_message_chunk via center-client.send().
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
const onMessage = (msg) => {
|
|
65
|
+
// Fire-and-forget; we don't want a slow agent.chat() to block message
|
|
66
|
+
// parsing. Errors inside the handler get logged but never break the
|
|
67
|
+
// socket.
|
|
68
|
+
this.handleIncoming(msg).catch((err) => {
|
|
69
|
+
this.logger.error(`CenterFrontend handler crashed for ${msg.type}: ${err instanceof Error ? err.message : err}`);
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
this.client.on("message", onMessage);
|
|
73
|
+
this.detachers.push(() => {
|
|
74
|
+
this.client.off("message", onMessage);
|
|
75
|
+
});
|
|
76
|
+
const onOpen = () => {
|
|
77
|
+
this.sendHello().catch((err) => {
|
|
78
|
+
this.logger.warn(`CenterFrontend hello send failed: ${err instanceof Error ? err.message : err}`);
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
this.client.on("open", onOpen);
|
|
82
|
+
this.detachers.push(() => {
|
|
83
|
+
this.client.off("open", onOpen);
|
|
84
|
+
});
|
|
85
|
+
// 30s liveness ping — matches dp-director's cadence. Empty payload; the
|
|
86
|
+
// envelope's arrival is the signal.
|
|
87
|
+
this.heartbeatTimer = setInterval(() => {
|
|
88
|
+
this.client
|
|
89
|
+
.send({
|
|
90
|
+
type: "worker_heartbeat",
|
|
91
|
+
payload: {},
|
|
92
|
+
})
|
|
93
|
+
.catch((err) => console.warn(`[CenterFrontend] heartbeat send failed: ${err instanceof Error ? err.message : err}`));
|
|
94
|
+
}, 30_000);
|
|
95
|
+
}
|
|
96
|
+
/** Tear down: deregister listeners and unhook from Agent. */
|
|
97
|
+
async stop() {
|
|
98
|
+
if (this.heartbeatTimer) {
|
|
99
|
+
clearInterval(this.heartbeatTimer);
|
|
100
|
+
this.heartbeatTimer = null;
|
|
101
|
+
}
|
|
102
|
+
for (const d of this.detachers)
|
|
103
|
+
d();
|
|
104
|
+
this.detachers = [];
|
|
105
|
+
this.agent.unregisterFrontend("center");
|
|
106
|
+
if (this.inFlight) {
|
|
107
|
+
this.inFlight.controller.abort();
|
|
108
|
+
this.inFlight = null;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/** True when center has signalled a config change and we should re-bootstrap before the next task. */
|
|
112
|
+
isConfigDirty() {
|
|
113
|
+
return this.configDirty;
|
|
114
|
+
}
|
|
115
|
+
/** Clear the dirty flag once the caller has performed a fresh bootstrap. */
|
|
116
|
+
clearConfigDirty() {
|
|
117
|
+
this.configDirty = false;
|
|
118
|
+
}
|
|
119
|
+
async sendHello() {
|
|
120
|
+
const extras = this.client.getExtras();
|
|
121
|
+
await this.client.send({
|
|
122
|
+
type: "hello",
|
|
123
|
+
payload: {
|
|
124
|
+
worker_id: this.workerId,
|
|
125
|
+
version: this.version,
|
|
126
|
+
config_etag: extras?.configEtag ?? "unknown",
|
|
127
|
+
current_status: this.currentStatus,
|
|
128
|
+
...(this.currentTaskId ? { current_task_id: this.currentTaskId } : {}),
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
async reportRuntimeStatus(status, currentTaskId, reason) {
|
|
133
|
+
this.currentStatus = status;
|
|
134
|
+
this.currentTaskId = currentTaskId;
|
|
135
|
+
await this.client
|
|
136
|
+
.send({
|
|
137
|
+
type: "status_change",
|
|
138
|
+
payload: {
|
|
139
|
+
status,
|
|
140
|
+
...(currentTaskId ? { current_task_id: currentTaskId } : {}),
|
|
141
|
+
reason,
|
|
142
|
+
},
|
|
143
|
+
})
|
|
144
|
+
.catch((err) => {
|
|
145
|
+
this.logger.warn(`CenterFrontend status_change(${status}) send failed: ${err instanceof Error ? err.message : err}`);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
/** True when a session-class config_invalidate has been received and not yet applied. */
|
|
149
|
+
isSessionDirty() {
|
|
150
|
+
return this.sessionDirty;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Re-bootstrap from center and apply the new session_blob via
|
|
154
|
+
* Agent.swapSession. No-op if sessionDirty is false. Single-flighted
|
|
155
|
+
* so a burst of dispatches doesn't fire concurrent swaps.
|
|
156
|
+
*
|
|
157
|
+
* Called inline from handleTaskDispatch / handleChatUserMessage
|
|
158
|
+
* BEFORE the task or chat actually runs — that way the freshest
|
|
159
|
+
* session is in place for the new work. The BrowserLock inside
|
|
160
|
+
* Agent.swapSession serializes against the task that's about to
|
|
161
|
+
* acquire it, so any contention resolves naturally.
|
|
162
|
+
*/
|
|
163
|
+
async swapSessionIfDirty() {
|
|
164
|
+
if (!this.sessionDirty)
|
|
165
|
+
return;
|
|
166
|
+
if (this.swapInFlight) {
|
|
167
|
+
await this.swapInFlight;
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const work = (async () => {
|
|
171
|
+
try {
|
|
172
|
+
const fresh = await this.client.bootstrap();
|
|
173
|
+
const blob = fresh.extras.sessionBlob;
|
|
174
|
+
if (!blob) {
|
|
175
|
+
// center has no session_blob (worker has no session_content_hash, or
|
|
176
|
+
// R2 isn't configured). Nothing to apply; clear the flag so
|
|
177
|
+
// we don't keep retrying.
|
|
178
|
+
this.sessionDirty = false;
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
await this.agent.swapSession(blob);
|
|
182
|
+
this.sessionDirty = false;
|
|
183
|
+
}
|
|
184
|
+
catch (err) {
|
|
185
|
+
this.logger.warn(`CenterFrontend session swap failed: ${err instanceof Error ? err.message : err}`);
|
|
186
|
+
// Leave sessionDirty set so the next dispatch retries.
|
|
187
|
+
}
|
|
188
|
+
})();
|
|
189
|
+
this.swapInFlight = work;
|
|
190
|
+
try {
|
|
191
|
+
await work;
|
|
192
|
+
}
|
|
193
|
+
finally {
|
|
194
|
+
this.swapInFlight = null;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
async handleIncoming(msg) {
|
|
198
|
+
// zod's inferred discriminated union narrows `msg.type` but doesn't
|
|
199
|
+
// co-narrow `msg.payload` (the payload becomes a union of every
|
|
200
|
+
// variant's payload regardless of the type). Values are still
|
|
201
|
+
// runtime-validated via dp-shared's .safeParse before we get here, so
|
|
202
|
+
// the casts below are sound — they just patch the TS-side ergonomics.
|
|
203
|
+
switch (msg.type) {
|
|
204
|
+
case "task_dispatch":
|
|
205
|
+
await this.handleTaskDispatch(msg.payload);
|
|
206
|
+
return;
|
|
207
|
+
case "chat_user_message":
|
|
208
|
+
await this.handleChatUserMessage(msg.payload);
|
|
209
|
+
return;
|
|
210
|
+
case "config_invalidate": {
|
|
211
|
+
const p = msg.payload;
|
|
212
|
+
this.configDirty = true;
|
|
213
|
+
if (p.which.includes("session")) {
|
|
214
|
+
this.sessionDirty = true;
|
|
215
|
+
}
|
|
216
|
+
this.logger.info(`CenterFrontend marked config_dirty (which=${p.which.join(",")}, new_etag=${p.new_config_etag})`);
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
case "cancel_task":
|
|
220
|
+
this.handleCancelTask(msg.payload);
|
|
221
|
+
return;
|
|
222
|
+
case "ping_request": {
|
|
223
|
+
const p = msg.payload;
|
|
224
|
+
await this.client.send({
|
|
225
|
+
type: "pong",
|
|
226
|
+
payload: {
|
|
227
|
+
ref_id: p.ref_id,
|
|
228
|
+
},
|
|
229
|
+
});
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
default:
|
|
233
|
+
// Ack-only messages and worker→center echoes (shouldn't arrive here) are
|
|
234
|
+
// ignored. Real wire never delivers those from center; this branch
|
|
235
|
+
// keeps the switch exhaustive in case the union grows.
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
async handleTaskDispatch(payload) {
|
|
240
|
+
// Ack immediately so center marks dispatched.
|
|
241
|
+
await this.client
|
|
242
|
+
.send({
|
|
243
|
+
type: "task_event",
|
|
244
|
+
payload: {
|
|
245
|
+
task_run_id: payload.task_run_id,
|
|
246
|
+
event: "dispatched_ack",
|
|
247
|
+
},
|
|
248
|
+
})
|
|
249
|
+
.catch((err) => {
|
|
250
|
+
this.logger.warn(`CenterFrontend dispatched_ack send failed: ${err instanceof Error ? err.message : err}`);
|
|
251
|
+
});
|
|
252
|
+
// Pre-task hook: if center has pushed a new session, swap it in before
|
|
253
|
+
// we run. Inside swapSession the BrowserLock serializes us against
|
|
254
|
+
// anything already running.
|
|
255
|
+
await this.swapSessionIfDirty();
|
|
256
|
+
const controller = new AbortController();
|
|
257
|
+
this.inFlight = { taskRunId: payload.task_run_id, controller };
|
|
258
|
+
await this.reportRuntimeStatus("busy", payload.task_run_id, "task_dispatch_started");
|
|
259
|
+
// Tell center we're running.
|
|
260
|
+
await this.client
|
|
261
|
+
.send({
|
|
262
|
+
type: "task_event",
|
|
263
|
+
payload: {
|
|
264
|
+
task_run_id: payload.task_run_id,
|
|
265
|
+
event: "started",
|
|
266
|
+
},
|
|
267
|
+
})
|
|
268
|
+
.catch((err) => {
|
|
269
|
+
this.logger.warn(`CenterFrontend started send failed: ${err instanceof Error ? err.message : err}`);
|
|
270
|
+
});
|
|
271
|
+
let outcome;
|
|
272
|
+
try {
|
|
273
|
+
outcome = await this.agent.enqueueTaskFromCenter(payload.task_run_id, payload.prompt, { signal: controller.signal });
|
|
274
|
+
}
|
|
275
|
+
catch (err) {
|
|
276
|
+
outcome = {
|
|
277
|
+
status: "failed",
|
|
278
|
+
error: err instanceof Error ? err.message : String(err),
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
finally {
|
|
282
|
+
this.inFlight = null;
|
|
283
|
+
}
|
|
284
|
+
await this.client
|
|
285
|
+
.send({
|
|
286
|
+
type: "task_event",
|
|
287
|
+
payload: {
|
|
288
|
+
task_run_id: payload.task_run_id,
|
|
289
|
+
event: "finished",
|
|
290
|
+
status: outcome.status === "success"
|
|
291
|
+
? "success"
|
|
292
|
+
: outcome.status === "cancelled"
|
|
293
|
+
? "cancelled"
|
|
294
|
+
: "failed",
|
|
295
|
+
...(outcome.result ? { result_summary: outcome.result } : {}),
|
|
296
|
+
...(outcome.error ? { error: outcome.error } : {}),
|
|
297
|
+
},
|
|
298
|
+
})
|
|
299
|
+
.catch((err) => {
|
|
300
|
+
this.logger.error(`CenterFrontend finished send failed (task ${payload.task_run_id} done but center may not know): ${err instanceof Error ? err.message : err}`);
|
|
301
|
+
});
|
|
302
|
+
await this.reportRuntimeStatus("idle", null, "task_dispatch_finished");
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Run the user's chat through the Agent streaming path and emit the
|
|
306
|
+
* full M6 event sequence:
|
|
307
|
+
*
|
|
308
|
+
* 1. (optional) `chat_message_queued` if the BrowserLock is held —
|
|
309
|
+
* tells the UI "worker busy, waiting in line".
|
|
310
|
+
* 2. `chat_message_chunk` per text delta, in order.
|
|
311
|
+
* 3. A terminal `chat_message_chunk` with done=true (empty delta) so
|
|
312
|
+
* the UI knows streaming is over before the persisted row lands.
|
|
313
|
+
* 4. `chat_message_finalized` with the full collected content — center
|
|
314
|
+
* persists this in chat_messages with the assistant's UUID.
|
|
315
|
+
*
|
|
316
|
+
* The assistant message gets its own UUID (`assistantMessageId`); the
|
|
317
|
+
* user's `payload.message_id` is the row center already persisted on
|
|
318
|
+
* /chat/send and is NOT reused.
|
|
319
|
+
*/
|
|
320
|
+
async handleChatUserMessage(payload) {
|
|
321
|
+
const chatId = payload.chat_id;
|
|
322
|
+
const assistantMessageId = randomUUID();
|
|
323
|
+
const content = await this.materializeChatContent(payload.content);
|
|
324
|
+
// Pre-chat hook: same idea as task_dispatch — if center has pushed a
|
|
325
|
+
// new session, swap it in before we start the turn.
|
|
326
|
+
await this.swapSessionIfDirty();
|
|
327
|
+
// Surface queued state if the lock is held. We can't see the real
|
|
328
|
+
// queue depth from outside BrowserLock, so position=1 is a
|
|
329
|
+
// best-effort hint; the UI just uses it to render "queued".
|
|
330
|
+
if (this.agent.isBusy()) {
|
|
331
|
+
await this.client
|
|
332
|
+
.send({
|
|
333
|
+
type: "chat_message_queued",
|
|
334
|
+
payload: {
|
|
335
|
+
chat_id: chatId,
|
|
336
|
+
message_id: assistantMessageId,
|
|
337
|
+
queue_position: 1,
|
|
338
|
+
},
|
|
339
|
+
})
|
|
340
|
+
.catch((err) => {
|
|
341
|
+
this.logger.warn(`CenterFrontend chat_message_queued send failed: ${err instanceof Error ? err.message : err}`);
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
let collected = "";
|
|
345
|
+
let errored = null;
|
|
346
|
+
await this.chatScope.run({ chatId }, async () => {
|
|
347
|
+
try {
|
|
348
|
+
for await (const delta of this.agent.chatStream(content)) {
|
|
349
|
+
collected += delta;
|
|
350
|
+
// Sequential await preserves chunk order; center-client buffers if
|
|
351
|
+
// the WS is mid-flight.
|
|
352
|
+
await this.client
|
|
353
|
+
.send({
|
|
354
|
+
type: "chat_message_chunk",
|
|
355
|
+
payload: {
|
|
356
|
+
chat_id: chatId,
|
|
357
|
+
message_id: assistantMessageId,
|
|
358
|
+
delta,
|
|
359
|
+
done: false,
|
|
360
|
+
},
|
|
361
|
+
})
|
|
362
|
+
.catch((err) => {
|
|
363
|
+
this.logger.warn(`CenterFrontend chunk send failed: ${err instanceof Error ? err.message : err}`);
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
catch (err) {
|
|
368
|
+
errored = err instanceof Error ? err : new Error(String(err));
|
|
369
|
+
this.logger.error(`CenterFrontend chatStream errored: ${errored.message}`);
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
// Terminal chunk so the UI can flip its "streaming" indicator off
|
|
373
|
+
// before the finalized row lands. Empty delta + done=true signals EOF.
|
|
374
|
+
await this.client
|
|
375
|
+
.send({
|
|
376
|
+
type: "chat_message_chunk",
|
|
377
|
+
payload: {
|
|
378
|
+
chat_id: chatId,
|
|
379
|
+
message_id: assistantMessageId,
|
|
380
|
+
delta: "",
|
|
381
|
+
done: true,
|
|
382
|
+
},
|
|
383
|
+
})
|
|
384
|
+
.catch((err) => {
|
|
385
|
+
this.logger.warn(`CenterFrontend terminal chunk send failed: ${err instanceof Error ? err.message : err}`);
|
|
386
|
+
});
|
|
387
|
+
// Persist via finalized. center's upsertAssistantMessage uses this
|
|
388
|
+
// assistantMessageId as the chat_messages.id, so the UI's
|
|
389
|
+
// streaming-rendered message and the eventual DB row share an id.
|
|
390
|
+
const finalContent = errored
|
|
391
|
+
? `${collected}${collected ? "\n\n" : ""}[error: ${errored.message}]`
|
|
392
|
+
: collected;
|
|
393
|
+
await this.client
|
|
394
|
+
.send({
|
|
395
|
+
type: "chat_message_finalized",
|
|
396
|
+
payload: {
|
|
397
|
+
chat_id: chatId,
|
|
398
|
+
message_id: assistantMessageId,
|
|
399
|
+
role: "assistant",
|
|
400
|
+
content: finalContent,
|
|
401
|
+
},
|
|
402
|
+
})
|
|
403
|
+
.catch((err) => {
|
|
404
|
+
this.logger.warn(`CenterFrontend chat_message_finalized send failed: ${err instanceof Error ? err.message : err}`);
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
async materializeChatContent(content) {
|
|
408
|
+
if (typeof content === "string")
|
|
409
|
+
return content;
|
|
410
|
+
const blocks = [];
|
|
411
|
+
for (const part of content) {
|
|
412
|
+
if (part.type === "text") {
|
|
413
|
+
if (part.text?.trim())
|
|
414
|
+
blocks.push({ type: "text", text: part.text });
|
|
415
|
+
continue;
|
|
416
|
+
}
|
|
417
|
+
const descriptor = [
|
|
418
|
+
part.text,
|
|
419
|
+
part.filename ? `filename: ${part.filename}` : undefined,
|
|
420
|
+
part.mime ? `mime: ${part.mime}` : undefined,
|
|
421
|
+
part.size_bytes ? `size: ${part.size_bytes} bytes` : undefined,
|
|
422
|
+
part.url ? `download_url: ${part.url}` : undefined,
|
|
423
|
+
]
|
|
424
|
+
.filter(Boolean)
|
|
425
|
+
.join("\n");
|
|
426
|
+
if (part.type === "image" &&
|
|
427
|
+
part.url &&
|
|
428
|
+
part.mime?.startsWith("image/")) {
|
|
429
|
+
try {
|
|
430
|
+
const res = await fetch(part.url);
|
|
431
|
+
if (!res.ok)
|
|
432
|
+
throw new Error(`HTTP ${res.status}`);
|
|
433
|
+
const buf = Buffer.from(await res.arrayBuffer());
|
|
434
|
+
blocks.push({
|
|
435
|
+
type: "image",
|
|
436
|
+
imageData: buf.toString("base64"),
|
|
437
|
+
mediaType: part.mime,
|
|
438
|
+
});
|
|
439
|
+
if (descriptor)
|
|
440
|
+
blocks.push({ type: "text", text: descriptor });
|
|
441
|
+
continue;
|
|
442
|
+
}
|
|
443
|
+
catch (err) {
|
|
444
|
+
this.logger.warn(`CenterFrontend failed to load image attachment ${part.filename ?? part.attachment_id ?? "(unknown)"}: ${err instanceof Error ? err.message : err}`);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
if (descriptor)
|
|
448
|
+
blocks.push({ type: "text", text: descriptor });
|
|
449
|
+
}
|
|
450
|
+
return blocks.length > 0 ? blocks : "";
|
|
451
|
+
}
|
|
452
|
+
handleCancelTask(payload) {
|
|
453
|
+
if (this.inFlight && this.inFlight.taskRunId === payload.task_run_id) {
|
|
454
|
+
this.inFlight.controller.abort();
|
|
455
|
+
this.logger.info(`CenterFrontend aborting in-flight task ${payload.task_run_id}: ${payload.reason ?? "(no reason given)"}`);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
//# sourceMappingURL=center-frontend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"center-frontend.js","sourceRoot":"","sources":["../../src/center/center-frontend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAWzC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AA2CxD,M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AAC,MAAM,CAAC,IAAI,CACd,kDAAkD,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,aAAa,IAAI,WAAW,KAClG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GACvC,EAAE,CACH,CAAC;gBACJ,CAAC;YACH,CAAC;YAED,IAAI,UAAU;gBAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;QAClE,CAAC;QAED,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACzC,CAAC;IAEO,gBAAgB,CAAC,OAA0B;QACjD,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,KAAK,OAAO,CAAC,WAAW,EAAE,CAAC;YACrE,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;YACjC,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,0CAA0C,OAAO,CAAC,WAAW,KAAK,OAAO,CAAC,MAAM,IAAI,mBAAmB,EAAE,CAC1G,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { SessionBlob } from "dp-shared";
|
|
2
|
+
export interface SessionFileListing {
|
|
3
|
+
/** Absolute paths of files that should be packaged. */
|
|
4
|
+
include: string[];
|
|
5
|
+
/**
|
|
6
|
+
* Absolute paths of files that were considered but skipped. Returned to
|
|
7
|
+
* callers (and tests) so the exclusion contract is observable.
|
|
8
|
+
*/
|
|
9
|
+
excluded: string[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Walks a Chrome user-data-dir and returns the inclusion list per §worker-session.
|
|
13
|
+
* Symlinks are followed; deep dirs are walked depth-first. Returns sorted
|
|
14
|
+
* absolute paths so callers building a zip get deterministic ordering for
|
|
15
|
+
* stable content hashes.
|
|
16
|
+
*/
|
|
17
|
+
export declare function buildSessionFileList(browserDataDir: string): Promise<SessionFileListing>;
|
|
18
|
+
export interface PackagedSession {
|
|
19
|
+
buf: Uint8Array;
|
|
20
|
+
content_hash: string;
|
|
21
|
+
size_bytes: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Build the session zip for `<workspace>/browser-data`. Returns the zip
|
|
25
|
+
* buffer plus its sha256-hex digest and byte length. Caller is expected to
|
|
26
|
+
* have stopped Chrome before reading the profile (open Cookies/IndexedDB
|
|
27
|
+
* files give torn reads on macOS/Windows).
|
|
28
|
+
*/
|
|
29
|
+
export declare function packageSessionToZip(workspace: string): Promise<PackagedSession>;
|
|
30
|
+
export interface SessionMeta {
|
|
31
|
+
/** sha256 hash of the canonical zip currently applied locally. */
|
|
32
|
+
content_hash: string;
|
|
33
|
+
/** ISO timestamp — when the local profile was last considered authoritative. */
|
|
34
|
+
last_local_modified_at: string;
|
|
35
|
+
/** ISO timestamp — when this content_hash was pulled from center. */
|
|
36
|
+
synced_at: string;
|
|
37
|
+
}
|
|
38
|
+
export declare function sessionMetaPath(workspace: string): string;
|
|
39
|
+
export declare function readLocalSessionMeta(workspace: string): Promise<SessionMeta | null>;
|
|
40
|
+
export declare function writeLocalSessionMeta(workspace: string, meta: SessionMeta): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Decide whether to pull this center-published session blob over the local
|
|
43
|
+
* browser-data, or leave the local copy alone. Returns null when a pull
|
|
44
|
+
* should proceed, or a short reason string when it should be skipped.
|
|
45
|
+
*
|
|
46
|
+
* Skip conditions:
|
|
47
|
+
* - "hash-match": local hash equals server hash — no work to do
|
|
48
|
+
* - "local-newer": local has changed since the server's copy was uploaded
|
|
49
|
+
* (probably the worker logged into a new account during a task; that login
|
|
50
|
+
* state would be lost if we overwrote it with the older server copy)
|
|
51
|
+
*/
|
|
52
|
+
export declare function shouldSkipSessionSwap(workspace: string, blob: SessionBlob): Promise<string | null>;
|
|
53
|
+
export interface ApplySessionDeps {
|
|
54
|
+
fetchUrlToBuffer: (url: string) => Promise<Uint8Array>;
|
|
55
|
+
extractZipToDir: (buf: Uint8Array, destDir: string) => Promise<void>;
|
|
56
|
+
now?: () => number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Extract a zip buffer onto a destination directory. Designed for the
|
|
60
|
+
* Chrome user-data-dir overwrite case:
|
|
61
|
+
*
|
|
62
|
+
* - **No purge first**: we don't wipe destDir. Files in the zip
|
|
63
|
+
* overwrite their counterparts; files NOT in the zip stay put. This
|
|
64
|
+
* keeps any worker-local state that wasn't packaged (logs, transient
|
|
65
|
+
* dirs the §C exclude list dropped) untouched.
|
|
66
|
+
* - **Path traversal guard**: every entry's resolved absolute path
|
|
67
|
+
* must stay inside `destDir`. A malicious "../../etc/passwd" entry
|
|
68
|
+
* gets rejected loudly instead of silently writing outside.
|
|
69
|
+
* - **Mkdir parents**: zip entries don't always include their parent
|
|
70
|
+
* directories explicitly; we resolve each file's dir and recursive-
|
|
71
|
+
* mkdir before writing.
|
|
72
|
+
*
|
|
73
|
+
* Exposed as a named export so callers / tests can plug it directly
|
|
74
|
+
* into ApplySessionDeps.extractZipToDir.
|
|
75
|
+
*/
|
|
76
|
+
export declare function extractZipBufferToDir(buf: Uint8Array, destDir: string): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Pull a center session zip onto the local browser-data dir. Caller MUST hold
|
|
79
|
+
* the BrowserLock and have closed Chrome before invoking this — overwriting
|
|
80
|
+
* `Default/Cookies` etc. while Chrome holds them is undefined-behavior on
|
|
81
|
+
* macOS / Windows.
|
|
82
|
+
*
|
|
83
|
+
* On success, the .session-meta.json is rewritten to record the new hash.
|
|
84
|
+
*/
|
|
85
|
+
export declare function applySessionBlob(workspace: string, blob: SessionBlob, depsOverride?: Partial<ApplySessionDeps>): Promise<void>;
|