@od-oneapp/config 2026.2.2001-canary.1
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/CHANGELOG.md +25 -0
- package/README.md +830 -0
- package/eslint/__tests__/config-structure.test.mjs +61 -0
- package/eslint/base.mjs +350 -0
- package/eslint/expo.mjs +97 -0
- package/eslint/next-test.mjs +43 -0
- package/eslint/next.mjs +74 -0
- package/eslint/node.mjs +106 -0
- package/eslint/react.mjs +313 -0
- package/eslint/rules/__tests__/no-used-underscore-vars.test.mjs +147 -0
- package/eslint/rules/no-used-underscore-vars.mjs +297 -0
- package/eslint/shared/__tests__/common-ignores.test.mjs +19 -0
- package/eslint/shared/common-ignores.mjs +172 -0
- package/eslint/shared/disabled-type-aware-rules.mjs +35 -0
- package/eslint/shared/file-patterns.mjs +124 -0
- package/eslint/shared/node-globals.mjs +50 -0
- package/eslint/storybook.mjs +81 -0
- package/eslint/test.mjs +298 -0
- package/eslint/utils/__tests__/create-validated-config.test.mjs +42 -0
- package/eslint/utils/__tests__/filter-ts-eslint-configs.test.mjs +57 -0
- package/eslint/utils/__tests__/validate-config.test.mjs +104 -0
- package/eslint/utils/create-validated-config.mjs +69 -0
- package/eslint/utils/filter-ts-eslint-configs.mjs +129 -0
- package/eslint/utils/validate-config.mjs +88 -0
- package/package.json +37 -0
- package/prettier/index.mjs +15 -0
- package/stylelint/index.mjs +129 -0
- package/tsdown/README.md +287 -0
- package/tsdown/base.mjs +77 -0
- package/tsdown/browser.mjs +34 -0
- package/tsdown/client.mjs +32 -0
- package/tsdown/dist.mjs +179 -0
- package/tsdown/index.mjs +53 -0
- package/tsdown/node.mjs +39 -0
- package/tsdown/react.mjs +30 -0
- package/typescript/base.json +52 -0
- package/typescript/dist/__tests__/browser-stub.test.d.ts +2 -0
- package/typescript/dist/__tests__/browser-stub.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/browser-stub.test.js +40 -0
- package/typescript/dist/__tests__/browser-stub.test.js.map +1 -0
- package/typescript/dist/__tests__/runtime/lifecycle.test.d.ts +2 -0
- package/typescript/dist/__tests__/runtime/lifecycle.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/runtime/lifecycle.test.js +149 -0
- package/typescript/dist/__tests__/runtime/lifecycle.test.js.map +1 -0
- package/typescript/dist/__tests__/server/abort-support.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/abort-support.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/abort-support.test.js +333 -0
- package/typescript/dist/__tests__/server/abort-support.test.js.map +1 -0
- package/typescript/dist/__tests__/server/batch-processor.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/batch-processor.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/batch-processor.test.js +173 -0
- package/typescript/dist/__tests__/server/batch-processor.test.js.map +1 -0
- package/typescript/dist/__tests__/server/cache.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/cache.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/cache.test.js +343 -0
- package/typescript/dist/__tests__/server/cache.test.js.map +1 -0
- package/typescript/dist/__tests__/server/circular-deps.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/circular-deps.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/circular-deps.test.js +412 -0
- package/typescript/dist/__tests__/server/circular-deps.test.js.map +1 -0
- package/typescript/dist/__tests__/server/claude-code-env.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/claude-code-env.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/claude-code-env.test.js +387 -0
- package/typescript/dist/__tests__/server/claude-code-env.test.js.map +1 -0
- package/typescript/dist/__tests__/server/code-analysis-tool.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/code-analysis-tool.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/code-analysis-tool.test.js +430 -0
- package/typescript/dist/__tests__/server/code-analysis-tool.test.js.map +1 -0
- package/typescript/dist/__tests__/server/code-transformation.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/code-transformation.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/code-transformation.test.js +173 -0
- package/typescript/dist/__tests__/server/code-transformation.test.js.map +1 -0
- package/typescript/dist/__tests__/server/concurrency.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/concurrency.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/concurrency.test.js +31 -0
- package/typescript/dist/__tests__/server/concurrency.test.js.map +1 -0
- package/typescript/dist/__tests__/server/context.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/context.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/context.test.js +483 -0
- package/typescript/dist/__tests__/server/context.test.js.map +1 -0
- package/typescript/dist/__tests__/server/error-handling.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/error-handling.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/error-handling.test.js +68 -0
- package/typescript/dist/__tests__/server/error-handling.test.js.map +1 -0
- package/typescript/dist/__tests__/server/error-utils.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/error-utils.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/error-utils.test.js +268 -0
- package/typescript/dist/__tests__/server/error-utils.test.js.map +1 -0
- package/typescript/dist/__tests__/server/files.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/files.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/files.test.js +160 -0
- package/typescript/dist/__tests__/server/files.test.js.map +1 -0
- package/typescript/dist/__tests__/server/logger.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/logger.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/logger.test.js +412 -0
- package/typescript/dist/__tests__/server/logger.test.js.map +1 -0
- package/typescript/dist/__tests__/server/path-manager.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/path-manager.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/path-manager.test.js +406 -0
- package/typescript/dist/__tests__/server/path-manager.test.js.map +1 -0
- package/typescript/dist/__tests__/server/retry-operations.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/retry-operations.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/retry-operations.test.js +119 -0
- package/typescript/dist/__tests__/server/retry-operations.test.js.map +1 -0
- package/typescript/dist/__tests__/server/retry.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/retry.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/retry.test.js +70 -0
- package/typescript/dist/__tests__/server/retry.test.js.map +1 -0
- package/typescript/dist/__tests__/server/retryable.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/retryable.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/retryable.test.js +23 -0
- package/typescript/dist/__tests__/server/retryable.test.js.map +1 -0
- package/typescript/dist/__tests__/server/scheduler.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/scheduler.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/scheduler.test.js +14 -0
- package/typescript/dist/__tests__/server/scheduler.test.js.map +1 -0
- package/typescript/dist/__tests__/server/security.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/security.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/security.test.js +286 -0
- package/typescript/dist/__tests__/server/security.test.js.map +1 -0
- package/typescript/dist/__tests__/server/session-management.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/session-management.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/session-management.test.js +399 -0
- package/typescript/dist/__tests__/server/session-management.test.js.map +1 -0
- package/typescript/dist/__tests__/server/session-recovery.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/session-recovery.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/session-recovery.test.js +417 -0
- package/typescript/dist/__tests__/server/session-recovery.test.js.map +1 -0
- package/typescript/dist/__tests__/server/session.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/session.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/session.test.js +102 -0
- package/typescript/dist/__tests__/server/session.test.js.map +1 -0
- package/typescript/dist/__tests__/server/simple-tools.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/simple-tools.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/simple-tools.test.js +56 -0
- package/typescript/dist/__tests__/server/simple-tools.test.js.map +1 -0
- package/typescript/dist/__tests__/server/streaming-utilities.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/streaming-utilities.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/streaming-utilities.test.js +338 -0
- package/typescript/dist/__tests__/server/streaming-utilities.test.js.map +1 -0
- package/typescript/dist/__tests__/server/streams.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/streams.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/streams.test.js +282 -0
- package/typescript/dist/__tests__/server/streams.test.js.map +1 -0
- package/typescript/dist/__tests__/server/stringify-advanced.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/stringify-advanced.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/stringify-advanced.test.js +152 -0
- package/typescript/dist/__tests__/server/stringify-advanced.test.js.map +1 -0
- package/typescript/dist/__tests__/server/structured-clone-tool.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/structured-clone-tool.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/structured-clone-tool.test.js +751 -0
- package/typescript/dist/__tests__/server/structured-clone-tool.test.js.map +1 -0
- package/typescript/dist/__tests__/server/structured-clone.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/structured-clone.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/structured-clone.test.js +305 -0
- package/typescript/dist/__tests__/server/structured-clone.test.js.map +1 -0
- package/typescript/dist/__tests__/server/tool-helpers.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/tool-helpers.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/tool-helpers.test.js +51 -0
- package/typescript/dist/__tests__/server/tool-helpers.test.js.map +1 -0
- package/typescript/dist/__tests__/server/validation.test.d.ts +2 -0
- package/typescript/dist/__tests__/server/validation.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/server/validation.test.js +585 -0
- package/typescript/dist/__tests__/server/validation.test.js.map +1 -0
- package/typescript/dist/__tests__/shared/constants.test.d.ts +2 -0
- package/typescript/dist/__tests__/shared/constants.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/shared/constants.test.js +11 -0
- package/typescript/dist/__tests__/shared/constants.test.js.map +1 -0
- package/typescript/dist/__tests__/shared/environment.test.d.ts +2 -0
- package/typescript/dist/__tests__/shared/environment.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/shared/environment.test.js +279 -0
- package/typescript/dist/__tests__/shared/environment.test.js.map +1 -0
- package/typescript/dist/__tests__/shared/stringify.test.d.ts +2 -0
- package/typescript/dist/__tests__/shared/stringify.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/shared/stringify.test.js +171 -0
- package/typescript/dist/__tests__/shared/stringify.test.js.map +1 -0
- package/typescript/dist/__tests__/shared/timeout.test.d.ts +2 -0
- package/typescript/dist/__tests__/shared/timeout.test.d.ts.map +1 -0
- package/typescript/dist/__tests__/shared/timeout.test.js +262 -0
- package/typescript/dist/__tests__/shared/timeout.test.js.map +1 -0
- package/typescript/dist/src/App.d.ts +3 -0
- package/typescript/dist/src/App.d.ts.map +1 -0
- package/typescript/dist/src/App.js +27 -0
- package/typescript/dist/src/App.js.map +1 -0
- package/typescript/dist/src/components/charts/BenchmarkCard.d.ts +12 -0
- package/typescript/dist/src/components/charts/BenchmarkCard.d.ts.map +1 -0
- package/typescript/dist/src/components/charts/BenchmarkCard.js +23 -0
- package/typescript/dist/src/components/charts/BenchmarkCard.js.map +1 -0
- package/typescript/dist/src/components/charts/ComparisonBar.d.ts +11 -0
- package/typescript/dist/src/components/charts/ComparisonBar.d.ts.map +1 -0
- package/typescript/dist/src/components/charts/ComparisonBar.js +34 -0
- package/typescript/dist/src/components/charts/ComparisonBar.js.map +1 -0
- package/typescript/dist/src/components/charts/PercentileGauge.d.ts +10 -0
- package/typescript/dist/src/components/charts/PercentileGauge.d.ts.map +1 -0
- package/typescript/dist/src/components/charts/PercentileGauge.js +68 -0
- package/typescript/dist/src/components/charts/PercentileGauge.js.map +1 -0
- package/typescript/dist/src/components/charts/index.d.ts +4 -0
- package/typescript/dist/src/components/charts/index.d.ts.map +1 -0
- package/typescript/dist/src/components/charts/index.js +4 -0
- package/typescript/dist/src/components/charts/index.js.map +1 -0
- package/typescript/dist/src/components/filters/FilterPanel.d.ts +9 -0
- package/typescript/dist/src/components/filters/FilterPanel.d.ts.map +1 -0
- package/typescript/dist/src/components/filters/FilterPanel.js +42 -0
- package/typescript/dist/src/components/filters/FilterPanel.js.map +1 -0
- package/typescript/dist/src/components/filters/index.d.ts +2 -0
- package/typescript/dist/src/components/filters/index.d.ts.map +1 -0
- package/typescript/dist/src/components/filters/index.js +2 -0
- package/typescript/dist/src/components/filters/index.js.map +1 -0
- package/typescript/dist/src/components/ui/Button.d.ts +8 -0
- package/typescript/dist/src/components/ui/Button.d.ts.map +1 -0
- package/typescript/dist/src/components/ui/Button.js +16 -0
- package/typescript/dist/src/components/ui/Button.js.map +1 -0
- package/typescript/dist/src/components/ui/Card.d.ts +14 -0
- package/typescript/dist/src/components/ui/Card.d.ts.map +1 -0
- package/typescript/dist/src/components/ui/Card.js +27 -0
- package/typescript/dist/src/components/ui/Card.js.map +1 -0
- package/typescript/dist/src/components/ui/Input.d.ts +9 -0
- package/typescript/dist/src/components/ui/Input.d.ts.map +1 -0
- package/typescript/dist/src/components/ui/Input.js +13 -0
- package/typescript/dist/src/components/ui/Input.js.map +1 -0
- package/typescript/dist/src/components/ui/Select.d.ts +14 -0
- package/typescript/dist/src/components/ui/Select.d.ts.map +1 -0
- package/typescript/dist/src/components/ui/Select.js +13 -0
- package/typescript/dist/src/components/ui/Select.js.map +1 -0
- package/typescript/dist/src/components/ui/index.d.ts +5 -0
- package/typescript/dist/src/components/ui/index.d.ts.map +1 -0
- package/typescript/dist/src/components/ui/index.js +5 -0
- package/typescript/dist/src/components/ui/index.js.map +1 -0
- package/typescript/dist/src/index.d.ts +4 -0
- package/typescript/dist/src/index.d.ts.map +1 -0
- package/typescript/dist/src/index.js +4 -0
- package/typescript/dist/src/index.js.map +1 -0
- package/typescript/dist/src/layouts/MainLayout.d.ts +2 -0
- package/typescript/dist/src/layouts/MainLayout.d.ts.map +1 -0
- package/typescript/dist/src/layouts/MainLayout.js +45 -0
- package/typescript/dist/src/layouts/MainLayout.js.map +1 -0
- package/typescript/dist/src/lib/api/benchmarks.d.ts +87 -0
- package/typescript/dist/src/lib/api/benchmarks.d.ts.map +1 -0
- package/typescript/dist/src/lib/api/benchmarks.js +274 -0
- package/typescript/dist/src/lib/api/benchmarks.js.map +1 -0
- package/typescript/dist/src/lib/api/index.d.ts +2 -0
- package/typescript/dist/src/lib/api/index.d.ts.map +1 -0
- package/typescript/dist/src/lib/api/index.js +2 -0
- package/typescript/dist/src/lib/api/index.js.map +1 -0
- package/typescript/dist/src/lib/mock-data/accident-benchmarks.d.ts +33 -0
- package/typescript/dist/src/lib/mock-data/accident-benchmarks.d.ts.map +1 -0
- package/typescript/dist/src/lib/mock-data/accident-benchmarks.js +124 -0
- package/typescript/dist/src/lib/mock-data/accident-benchmarks.js.map +1 -0
- package/typescript/dist/src/lib/mock-data/basic-life-benchmarks.d.ts +47 -0
- package/typescript/dist/src/lib/mock-data/basic-life-benchmarks.d.ts.map +1 -0
- package/typescript/dist/src/lib/mock-data/basic-life-benchmarks.js +83 -0
- package/typescript/dist/src/lib/mock-data/basic-life-benchmarks.js.map +1 -0
- package/typescript/dist/src/lib/mock-data/critical-illness-benchmarks.d.ts +39 -0
- package/typescript/dist/src/lib/mock-data/critical-illness-benchmarks.d.ts.map +1 -0
- package/typescript/dist/src/lib/mock-data/critical-illness-benchmarks.js +130 -0
- package/typescript/dist/src/lib/mock-data/critical-illness-benchmarks.js.map +1 -0
- package/typescript/dist/src/lib/mock-data/dental-benchmarks.d.ts +42 -0
- package/typescript/dist/src/lib/mock-data/dental-benchmarks.d.ts.map +1 -0
- package/typescript/dist/src/lib/mock-data/dental-benchmarks.js +137 -0
- package/typescript/dist/src/lib/mock-data/dental-benchmarks.js.map +1 -0
- package/typescript/dist/src/lib/mock-data/hospital-indemnity-benchmarks.d.ts +37 -0
- package/typescript/dist/src/lib/mock-data/hospital-indemnity-benchmarks.d.ts.map +1 -0
- package/typescript/dist/src/lib/mock-data/hospital-indemnity-benchmarks.js +128 -0
- package/typescript/dist/src/lib/mock-data/hospital-indemnity-benchmarks.js.map +1 -0
- package/typescript/dist/src/lib/mock-data/index.d.ts +3 -0
- package/typescript/dist/src/lib/mock-data/index.d.ts.map +1 -0
- package/typescript/dist/src/lib/mock-data/index.js +3 -0
- package/typescript/dist/src/lib/mock-data/index.js.map +1 -0
- package/typescript/dist/src/lib/mock-data/ltd-benchmarks.d.ts +59 -0
- package/typescript/dist/src/lib/mock-data/ltd-benchmarks.d.ts.map +1 -0
- package/typescript/dist/src/lib/mock-data/ltd-benchmarks.js +127 -0
- package/typescript/dist/src/lib/mock-data/ltd-benchmarks.js.map +1 -0
- package/typescript/dist/src/lib/mock-data/std-benchmarks.d.ts +51 -0
- package/typescript/dist/src/lib/mock-data/std-benchmarks.d.ts.map +1 -0
- package/typescript/dist/src/lib/mock-data/std-benchmarks.js +111 -0
- package/typescript/dist/src/lib/mock-data/std-benchmarks.js.map +1 -0
- package/typescript/dist/src/lib/mock-data/vision-benchmarks.d.ts +32 -0
- package/typescript/dist/src/lib/mock-data/vision-benchmarks.d.ts.map +1 -0
- package/typescript/dist/src/lib/mock-data/vision-benchmarks.js +151 -0
- package/typescript/dist/src/lib/mock-data/vision-benchmarks.js.map +1 -0
- package/typescript/dist/src/lib/mock-data/voluntary-life-benchmarks.d.ts +39 -0
- package/typescript/dist/src/lib/mock-data/voluntary-life-benchmarks.d.ts.map +1 -0
- package/typescript/dist/src/lib/mock-data/voluntary-life-benchmarks.js +97 -0
- package/typescript/dist/src/lib/mock-data/voluntary-life-benchmarks.js.map +1 -0
- package/typescript/dist/src/lib/transformers/api-to-internal.d.ts +42 -0
- package/typescript/dist/src/lib/transformers/api-to-internal.d.ts.map +1 -0
- package/typescript/dist/src/lib/transformers/api-to-internal.js +206 -0
- package/typescript/dist/src/lib/transformers/api-to-internal.js.map +1 -0
- package/typescript/dist/src/lib/transformers/index.d.ts +2 -0
- package/typescript/dist/src/lib/transformers/index.d.ts.map +1 -0
- package/typescript/dist/src/lib/transformers/index.js +2 -0
- package/typescript/dist/src/lib/transformers/index.js.map +1 -0
- package/typescript/dist/src/lib/types/accident.d.ts +46 -0
- package/typescript/dist/src/lib/types/accident.d.ts.map +1 -0
- package/typescript/dist/src/lib/types/accident.js +223 -0
- package/typescript/dist/src/lib/types/accident.js.map +1 -0
- package/typescript/dist/src/lib/types/api-schema.d.ts +476 -0
- package/typescript/dist/src/lib/types/api-schema.d.ts.map +1 -0
- package/typescript/dist/src/lib/types/api-schema.js +2 -0
- package/typescript/dist/src/lib/types/api-schema.js.map +1 -0
- package/typescript/dist/src/lib/types/basic-life.d.ts +30 -0
- package/typescript/dist/src/lib/types/basic-life.d.ts.map +1 -0
- package/typescript/dist/src/lib/types/basic-life.js +137 -0
- package/typescript/dist/src/lib/types/basic-life.js.map +1 -0
- package/typescript/dist/src/lib/types/common.d.ts +99 -0
- package/typescript/dist/src/lib/types/common.d.ts.map +1 -0
- package/typescript/dist/src/lib/types/common.js +29 -0
- package/typescript/dist/src/lib/types/common.js.map +1 -0
- package/typescript/dist/src/lib/types/critical-illness.d.ts +52 -0
- package/typescript/dist/src/lib/types/critical-illness.d.ts.map +1 -0
- package/typescript/dist/src/lib/types/critical-illness.js +254 -0
- package/typescript/dist/src/lib/types/critical-illness.js.map +1 -0
- package/typescript/dist/src/lib/types/dental.d.ts +41 -0
- package/typescript/dist/src/lib/types/dental.d.ts.map +1 -0
- package/typescript/dist/src/lib/types/dental.js +188 -0
- package/typescript/dist/src/lib/types/dental.js.map +1 -0
- package/typescript/dist/src/lib/types/hospital-indemnity.d.ts +41 -0
- package/typescript/dist/src/lib/types/hospital-indemnity.d.ts.map +1 -0
- package/typescript/dist/src/lib/types/hospital-indemnity.js +191 -0
- package/typescript/dist/src/lib/types/hospital-indemnity.js.map +1 -0
- package/typescript/dist/src/lib/types/index.d.ts +12 -0
- package/typescript/dist/src/lib/types/index.d.ts.map +1 -0
- package/typescript/dist/src/lib/types/index.js +12 -0
- package/typescript/dist/src/lib/types/index.js.map +1 -0
- package/typescript/dist/src/lib/types/ltd.d.ts +42 -0
- package/typescript/dist/src/lib/types/ltd.d.ts.map +1 -0
- package/typescript/dist/src/lib/types/ltd.js +200 -0
- package/typescript/dist/src/lib/types/ltd.js.map +1 -0
- package/typescript/dist/src/lib/types/std.d.ts +31 -0
- package/typescript/dist/src/lib/types/std.d.ts.map +1 -0
- package/typescript/dist/src/lib/types/std.js +144 -0
- package/typescript/dist/src/lib/types/std.js.map +1 -0
- package/typescript/dist/src/lib/types/vision.d.ts +31 -0
- package/typescript/dist/src/lib/types/vision.d.ts.map +1 -0
- package/typescript/dist/src/lib/types/vision.js +129 -0
- package/typescript/dist/src/lib/types/vision.js.map +1 -0
- package/typescript/dist/src/lib/types/voluntary-life.d.ts +33 -0
- package/typescript/dist/src/lib/types/voluntary-life.d.ts.map +1 -0
- package/typescript/dist/src/lib/types/voluntary-life.js +144 -0
- package/typescript/dist/src/lib/types/voluntary-life.js.map +1 -0
- package/typescript/dist/src/lib/utils/format.d.ts +11 -0
- package/typescript/dist/src/lib/utils/format.d.ts.map +1 -0
- package/typescript/dist/src/lib/utils/format.js +95 -0
- package/typescript/dist/src/lib/utils/format.js.map +1 -0
- package/typescript/dist/src/lib/utils/index.d.ts +2 -0
- package/typescript/dist/src/lib/utils/index.d.ts.map +1 -0
- package/typescript/dist/src/lib/utils/index.js +2 -0
- package/typescript/dist/src/lib/utils/index.js.map +1 -0
- package/typescript/dist/src/main.d.ts +2 -0
- package/typescript/dist/src/main.d.ts.map +1 -0
- package/typescript/dist/src/main.js +20 -0
- package/typescript/dist/src/main.js.map +1 -0
- package/typescript/dist/src/pages/AccidentComparison.d.ts +2 -0
- package/typescript/dist/src/pages/AccidentComparison.d.ts.map +1 -0
- package/typescript/dist/src/pages/AccidentComparison.js +56 -0
- package/typescript/dist/src/pages/AccidentComparison.js.map +1 -0
- package/typescript/dist/src/pages/AccidentExplorer.d.ts +2 -0
- package/typescript/dist/src/pages/AccidentExplorer.d.ts.map +1 -0
- package/typescript/dist/src/pages/AccidentExplorer.js +29 -0
- package/typescript/dist/src/pages/AccidentExplorer.js.map +1 -0
- package/typescript/dist/src/pages/BasicLifeComparison.d.ts +2 -0
- package/typescript/dist/src/pages/BasicLifeComparison.d.ts.map +1 -0
- package/typescript/dist/src/pages/BasicLifeComparison.js +59 -0
- package/typescript/dist/src/pages/BasicLifeComparison.js.map +1 -0
- package/typescript/dist/src/pages/BasicLifeExplorer.d.ts +2 -0
- package/typescript/dist/src/pages/BasicLifeExplorer.d.ts.map +1 -0
- package/typescript/dist/src/pages/BasicLifeExplorer.js +29 -0
- package/typescript/dist/src/pages/BasicLifeExplorer.js.map +1 -0
- package/typescript/dist/src/pages/CriticalIllnessComparison.d.ts +2 -0
- package/typescript/dist/src/pages/CriticalIllnessComparison.d.ts.map +1 -0
- package/typescript/dist/src/pages/CriticalIllnessComparison.js +56 -0
- package/typescript/dist/src/pages/CriticalIllnessComparison.js.map +1 -0
- package/typescript/dist/src/pages/CriticalIllnessExplorer.d.ts +2 -0
- package/typescript/dist/src/pages/CriticalIllnessExplorer.d.ts.map +1 -0
- package/typescript/dist/src/pages/CriticalIllnessExplorer.js +29 -0
- package/typescript/dist/src/pages/CriticalIllnessExplorer.js.map +1 -0
- package/typescript/dist/src/pages/Dashboard.d.ts +2 -0
- package/typescript/dist/src/pages/Dashboard.d.ts.map +1 -0
- package/typescript/dist/src/pages/Dashboard.js +8 -0
- package/typescript/dist/src/pages/Dashboard.js.map +1 -0
- package/typescript/dist/src/pages/DentalComparison.d.ts +2 -0
- package/typescript/dist/src/pages/DentalComparison.d.ts.map +1 -0
- package/typescript/dist/src/pages/DentalComparison.js +64 -0
- package/typescript/dist/src/pages/DentalComparison.js.map +1 -0
- package/typescript/dist/src/pages/DentalExplorer.d.ts +2 -0
- package/typescript/dist/src/pages/DentalExplorer.d.ts.map +1 -0
- package/typescript/dist/src/pages/DentalExplorer.js +29 -0
- package/typescript/dist/src/pages/DentalExplorer.js.map +1 -0
- package/typescript/dist/src/pages/HospitalIndemnityComparison.d.ts +2 -0
- package/typescript/dist/src/pages/HospitalIndemnityComparison.d.ts.map +1 -0
- package/typescript/dist/src/pages/HospitalIndemnityComparison.js +53 -0
- package/typescript/dist/src/pages/HospitalIndemnityComparison.js.map +1 -0
- package/typescript/dist/src/pages/HospitalIndemnityExplorer.d.ts +2 -0
- package/typescript/dist/src/pages/HospitalIndemnityExplorer.d.ts.map +1 -0
- package/typescript/dist/src/pages/HospitalIndemnityExplorer.js +29 -0
- package/typescript/dist/src/pages/HospitalIndemnityExplorer.js.map +1 -0
- package/typescript/dist/src/pages/LTDComparison.d.ts +2 -0
- package/typescript/dist/src/pages/LTDComparison.d.ts.map +1 -0
- package/typescript/dist/src/pages/LTDComparison.js +64 -0
- package/typescript/dist/src/pages/LTDComparison.js.map +1 -0
- package/typescript/dist/src/pages/LTDExplorer.d.ts +2 -0
- package/typescript/dist/src/pages/LTDExplorer.d.ts.map +1 -0
- package/typescript/dist/src/pages/LTDExplorer.js +29 -0
- package/typescript/dist/src/pages/LTDExplorer.js.map +1 -0
- package/typescript/dist/src/pages/STDComparison.d.ts +2 -0
- package/typescript/dist/src/pages/STDComparison.d.ts.map +1 -0
- package/typescript/dist/src/pages/STDComparison.js +58 -0
- package/typescript/dist/src/pages/STDComparison.js.map +1 -0
- package/typescript/dist/src/pages/STDExplorer.d.ts +2 -0
- package/typescript/dist/src/pages/STDExplorer.d.ts.map +1 -0
- package/typescript/dist/src/pages/STDExplorer.js +29 -0
- package/typescript/dist/src/pages/STDExplorer.js.map +1 -0
- package/typescript/dist/src/pages/VisionComparison.d.ts +2 -0
- package/typescript/dist/src/pages/VisionComparison.d.ts.map +1 -0
- package/typescript/dist/src/pages/VisionComparison.js +64 -0
- package/typescript/dist/src/pages/VisionComparison.js.map +1 -0
- package/typescript/dist/src/pages/VisionExplorer.d.ts +2 -0
- package/typescript/dist/src/pages/VisionExplorer.d.ts.map +1 -0
- package/typescript/dist/src/pages/VisionExplorer.js +29 -0
- package/typescript/dist/src/pages/VisionExplorer.js.map +1 -0
- package/typescript/dist/src/pages/VoluntaryLifeComparison.d.ts +2 -0
- package/typescript/dist/src/pages/VoluntaryLifeComparison.d.ts.map +1 -0
- package/typescript/dist/src/pages/VoluntaryLifeComparison.js +51 -0
- package/typescript/dist/src/pages/VoluntaryLifeComparison.js.map +1 -0
- package/typescript/dist/src/pages/VoluntaryLifeExplorer.d.ts +2 -0
- package/typescript/dist/src/pages/VoluntaryLifeExplorer.d.ts.map +1 -0
- package/typescript/dist/src/pages/VoluntaryLifeExplorer.js +29 -0
- package/typescript/dist/src/pages/VoluntaryLifeExplorer.js.map +1 -0
- package/typescript/dist/src/runtime/index.d.ts +2 -0
- package/typescript/dist/src/runtime/index.d.ts.map +1 -0
- package/typescript/dist/src/runtime/index.js +2 -0
- package/typescript/dist/src/runtime/index.js.map +1 -0
- package/typescript/dist/src/runtime/lifecycle.d.ts +16 -0
- package/typescript/dist/src/runtime/lifecycle.d.ts.map +1 -0
- package/typescript/dist/src/runtime/lifecycle.js +50 -0
- package/typescript/dist/src/runtime/lifecycle.js.map +1 -0
- package/typescript/dist/src/server/abort-support.d.ts +20 -0
- package/typescript/dist/src/server/abort-support.d.ts.map +1 -0
- package/typescript/dist/src/server/abort-support.js +101 -0
- package/typescript/dist/src/server/abort-support.js.map +1 -0
- package/typescript/dist/src/server/advanced-memory-monitor.d.ts +189 -0
- package/typescript/dist/src/server/advanced-memory-monitor.d.ts.map +1 -0
- package/typescript/dist/src/server/advanced-memory-monitor.js +718 -0
- package/typescript/dist/src/server/advanced-memory-monitor.js.map +1 -0
- package/typescript/dist/src/server/architecture-detector.d.ts +72 -0
- package/typescript/dist/src/server/architecture-detector.d.ts.map +1 -0
- package/typescript/dist/src/server/architecture-detector.js +282 -0
- package/typescript/dist/src/server/architecture-detector.js.map +1 -0
- package/typescript/dist/src/server/batch-processor-tool.d.ts +69 -0
- package/typescript/dist/src/server/batch-processor-tool.d.ts.map +1 -0
- package/typescript/dist/src/server/batch-processor-tool.js +651 -0
- package/typescript/dist/src/server/batch-processor-tool.js.map +1 -0
- package/typescript/dist/src/server/batch-processor.d.ts +73 -0
- package/typescript/dist/src/server/batch-processor.d.ts.map +1 -0
- package/typescript/dist/src/server/batch-processor.js +264 -0
- package/typescript/dist/src/server/batch-processor.js.map +1 -0
- package/typescript/dist/src/server/browser-stub.d.ts +18 -0
- package/typescript/dist/src/server/browser-stub.d.ts.map +1 -0
- package/typescript/dist/src/server/browser-stub.js +21 -0
- package/typescript/dist/src/server/browser-stub.js.map +1 -0
- package/typescript/dist/src/server/cache.d.ts +92 -0
- package/typescript/dist/src/server/cache.d.ts.map +1 -0
- package/typescript/dist/src/server/cache.js +217 -0
- package/typescript/dist/src/server/cache.js.map +1 -0
- package/typescript/dist/src/server/circular-deps.d.ts +85 -0
- package/typescript/dist/src/server/circular-deps.d.ts.map +1 -0
- package/typescript/dist/src/server/circular-deps.js +331 -0
- package/typescript/dist/src/server/circular-deps.js.map +1 -0
- package/typescript/dist/src/server/claude-code-env.d.ts +50 -0
- package/typescript/dist/src/server/claude-code-env.d.ts.map +1 -0
- package/typescript/dist/src/server/claude-code-env.js +116 -0
- package/typescript/dist/src/server/claude-code-env.js.map +1 -0
- package/typescript/dist/src/server/code-analysis-tool.d.ts +79 -0
- package/typescript/dist/src/server/code-analysis-tool.d.ts.map +1 -0
- package/typescript/dist/src/server/code-analysis-tool.js +94 -0
- package/typescript/dist/src/server/code-analysis-tool.js.map +1 -0
- package/typescript/dist/src/server/code-analysis.d.ts +16 -0
- package/typescript/dist/src/server/code-analysis.d.ts.map +1 -0
- package/typescript/dist/src/server/code-analysis.js +462 -0
- package/typescript/dist/src/server/code-analysis.js.map +1 -0
- package/typescript/dist/src/server/code-transformation.d.ts +141 -0
- package/typescript/dist/src/server/code-transformation.d.ts.map +1 -0
- package/typescript/dist/src/server/code-transformation.js +918 -0
- package/typescript/dist/src/server/code-transformation.js.map +1 -0
- package/typescript/dist/src/server/comprehensive-code-analysis.d.ts +77 -0
- package/typescript/dist/src/server/comprehensive-code-analysis.d.ts.map +1 -0
- package/typescript/dist/src/server/comprehensive-code-analysis.js +613 -0
- package/typescript/dist/src/server/comprehensive-code-analysis.js.map +1 -0
- package/typescript/dist/src/server/concurrency.d.ts +5 -0
- package/typescript/dist/src/server/concurrency.d.ts.map +1 -0
- package/typescript/dist/src/server/concurrency.js +20 -0
- package/typescript/dist/src/server/concurrency.js.map +1 -0
- package/typescript/dist/src/server/context-manager.d.ts +97 -0
- package/typescript/dist/src/server/context-manager.d.ts.map +1 -0
- package/typescript/dist/src/server/context-manager.js +410 -0
- package/typescript/dist/src/server/context-manager.js.map +1 -0
- package/typescript/dist/src/server/context-session-manager.d.ts +47 -0
- package/typescript/dist/src/server/context-session-manager.d.ts.map +1 -0
- package/typescript/dist/src/server/context-session-manager.js +594 -0
- package/typescript/dist/src/server/context-session-manager.js.map +1 -0
- package/typescript/dist/src/server/context.d.ts +66 -0
- package/typescript/dist/src/server/context.d.ts.map +1 -0
- package/typescript/dist/src/server/context.js +275 -0
- package/typescript/dist/src/server/context.js.map +1 -0
- package/typescript/dist/src/server/dependency-analyzer.d.ts +100 -0
- package/typescript/dist/src/server/dependency-analyzer.d.ts.map +1 -0
- package/typescript/dist/src/server/dependency-analyzer.js +1117 -0
- package/typescript/dist/src/server/dependency-analyzer.js.map +1 -0
- package/typescript/dist/src/server/error-handling.d.ts +106 -0
- package/typescript/dist/src/server/error-handling.d.ts.map +1 -0
- package/typescript/dist/src/server/error-handling.js +363 -0
- package/typescript/dist/src/server/error-handling.js.map +1 -0
- package/typescript/dist/src/server/file-discovery.d.ts +60 -0
- package/typescript/dist/src/server/file-discovery.d.ts.map +1 -0
- package/typescript/dist/src/server/file-discovery.js +282 -0
- package/typescript/dist/src/server/file-discovery.js.map +1 -0
- package/typescript/dist/src/server/file-streaming.d.ts +152 -0
- package/typescript/dist/src/server/file-streaming.d.ts.map +1 -0
- package/typescript/dist/src/server/file-streaming.js +627 -0
- package/typescript/dist/src/server/file-streaming.js.map +1 -0
- package/typescript/dist/src/server/files.d.ts +100 -0
- package/typescript/dist/src/server/files.d.ts.map +1 -0
- package/typescript/dist/src/server/files.js +609 -0
- package/typescript/dist/src/server/files.js.map +1 -0
- package/typescript/dist/src/server/index.d.ts +54 -0
- package/typescript/dist/src/server/index.d.ts.map +1 -0
- package/typescript/dist/src/server/index.js +54 -0
- package/typescript/dist/src/server/index.js.map +1 -0
- package/typescript/dist/src/server/logger.d.ts +95 -0
- package/typescript/dist/src/server/logger.d.ts.map +1 -0
- package/typescript/dist/src/server/logger.js +271 -0
- package/typescript/dist/src/server/logger.js.map +1 -0
- package/typescript/dist/src/server/memory-aware-cache.d.ts +169 -0
- package/typescript/dist/src/server/memory-aware-cache.d.ts.map +1 -0
- package/typescript/dist/src/server/memory-aware-cache.js +655 -0
- package/typescript/dist/src/server/memory-aware-cache.js.map +1 -0
- package/typescript/dist/src/server/memory-monitor-tool.d.ts +46 -0
- package/typescript/dist/src/server/memory-monitor-tool.d.ts.map +1 -0
- package/typescript/dist/src/server/memory-monitor-tool.js +381 -0
- package/typescript/dist/src/server/memory-monitor-tool.js.map +1 -0
- package/typescript/dist/src/server/memory-monitor.d.ts +79 -0
- package/typescript/dist/src/server/memory-monitor.d.ts.map +1 -0
- package/typescript/dist/src/server/memory-monitor.js +333 -0
- package/typescript/dist/src/server/memory-monitor.js.map +1 -0
- package/typescript/dist/src/server/optimization-engine.d.ts +68 -0
- package/typescript/dist/src/server/optimization-engine.d.ts.map +1 -0
- package/typescript/dist/src/server/optimization-engine.js +728 -0
- package/typescript/dist/src/server/optimization-engine.js.map +1 -0
- package/typescript/dist/src/server/path-manager.d.ts +46 -0
- package/typescript/dist/src/server/path-manager.d.ts.map +1 -0
- package/typescript/dist/src/server/path-manager.js +155 -0
- package/typescript/dist/src/server/path-manager.js.map +1 -0
- package/typescript/dist/src/server/pattern-analyzer.d.ts +69 -0
- package/typescript/dist/src/server/pattern-analyzer.d.ts.map +1 -0
- package/typescript/dist/src/server/pattern-analyzer.js +497 -0
- package/typescript/dist/src/server/pattern-analyzer.js.map +1 -0
- package/typescript/dist/src/server/performance-observer.d.ts +61 -0
- package/typescript/dist/src/server/performance-observer.d.ts.map +1 -0
- package/typescript/dist/src/server/performance-observer.js +394 -0
- package/typescript/dist/src/server/performance-observer.js.map +1 -0
- package/typescript/dist/src/server/performance.d.ts +121 -0
- package/typescript/dist/src/server/performance.d.ts.map +1 -0
- package/typescript/dist/src/server/performance.js +520 -0
- package/typescript/dist/src/server/performance.js.map +1 -0
- package/typescript/dist/src/server/report-generator.d.ts +131 -0
- package/typescript/dist/src/server/report-generator.d.ts.map +1 -0
- package/typescript/dist/src/server/report-generator.js +1158 -0
- package/typescript/dist/src/server/report-generator.js.map +1 -0
- package/typescript/dist/src/server/resource-lifecycle-manager.d.ts +231 -0
- package/typescript/dist/src/server/resource-lifecycle-manager.d.ts.map +1 -0
- package/typescript/dist/src/server/resource-lifecycle-manager.js +839 -0
- package/typescript/dist/src/server/resource-lifecycle-manager.js.map +1 -0
- package/typescript/dist/src/server/retry-operations.d.ts +59 -0
- package/typescript/dist/src/server/retry-operations.d.ts.map +1 -0
- package/typescript/dist/src/server/retry-operations.js +68 -0
- package/typescript/dist/src/server/retry-operations.js.map +1 -0
- package/typescript/dist/src/server/retry.d.ts +18 -0
- package/typescript/dist/src/server/retry.d.ts.map +1 -0
- package/typescript/dist/src/server/retry.js +44 -0
- package/typescript/dist/src/server/retry.js.map +1 -0
- package/typescript/dist/src/server/retryable.d.ts +2 -0
- package/typescript/dist/src/server/retryable.d.ts.map +1 -0
- package/typescript/dist/src/server/retryable.js +21 -0
- package/typescript/dist/src/server/retryable.js.map +1 -0
- package/typescript/dist/src/server/scheduler.d.ts +4 -0
- package/typescript/dist/src/server/scheduler.d.ts.map +1 -0
- package/typescript/dist/src/server/scheduler.js +21 -0
- package/typescript/dist/src/server/scheduler.js.map +1 -0
- package/typescript/dist/src/server/security-scanner.d.ts +59 -0
- package/typescript/dist/src/server/security-scanner.d.ts.map +1 -0
- package/typescript/dist/src/server/security-scanner.js +915 -0
- package/typescript/dist/src/server/security-scanner.js.map +1 -0
- package/typescript/dist/src/server/security.d.ts +25 -0
- package/typescript/dist/src/server/security.d.ts.map +1 -0
- package/typescript/dist/src/server/security.js +298 -0
- package/typescript/dist/src/server/security.js.map +1 -0
- package/typescript/dist/src/server/session-management.d.ts +103 -0
- package/typescript/dist/src/server/session-management.d.ts.map +1 -0
- package/typescript/dist/src/server/session-management.js +149 -0
- package/typescript/dist/src/server/session-management.js.map +1 -0
- package/typescript/dist/src/server/session-recovery.d.ts +91 -0
- package/typescript/dist/src/server/session-recovery.d.ts.map +1 -0
- package/typescript/dist/src/server/session-recovery.js +384 -0
- package/typescript/dist/src/server/session-recovery.js.map +1 -0
- package/typescript/dist/src/server/session.d.ts +18 -0
- package/typescript/dist/src/server/session.d.ts.map +1 -0
- package/typescript/dist/src/server/session.js +46 -0
- package/typescript/dist/src/server/session.js.map +1 -0
- package/typescript/dist/src/server/simple-tools.d.ts +15 -0
- package/typescript/dist/src/server/simple-tools.d.ts.map +1 -0
- package/typescript/dist/src/server/simple-tools.js +15 -0
- package/typescript/dist/src/server/simple-tools.js.map +1 -0
- package/typescript/dist/src/server/streaming-utilities.d.ts +107 -0
- package/typescript/dist/src/server/streaming-utilities.d.ts.map +1 -0
- package/typescript/dist/src/server/streaming-utilities.js +822 -0
- package/typescript/dist/src/server/streaming-utilities.js.map +1 -0
- package/typescript/dist/src/server/streams.d.ts +48 -0
- package/typescript/dist/src/server/streams.d.ts.map +1 -0
- package/typescript/dist/src/server/streams.js +489 -0
- package/typescript/dist/src/server/streams.js.map +1 -0
- package/typescript/dist/src/server/stringify-advanced.d.ts +31 -0
- package/typescript/dist/src/server/stringify-advanced.d.ts.map +1 -0
- package/typescript/dist/src/server/stringify-advanced.js +183 -0
- package/typescript/dist/src/server/stringify-advanced.js.map +1 -0
- package/typescript/dist/src/server/structured-clone-tool.d.ts +101 -0
- package/typescript/dist/src/server/structured-clone-tool.d.ts.map +1 -0
- package/typescript/dist/src/server/structured-clone-tool.js +450 -0
- package/typescript/dist/src/server/structured-clone-tool.js.map +1 -0
- package/typescript/dist/src/server/structured-clone.d.ts +59 -0
- package/typescript/dist/src/server/structured-clone.d.ts.map +1 -0
- package/typescript/dist/src/server/structured-clone.js +307 -0
- package/typescript/dist/src/server/structured-clone.js.map +1 -0
- package/typescript/dist/src/server/test-runner.d.ts +78 -0
- package/typescript/dist/src/server/test-runner.d.ts.map +1 -0
- package/typescript/dist/src/server/test-runner.js +1024 -0
- package/typescript/dist/src/server/test-runner.js.map +1 -0
- package/typescript/dist/src/server/tool-helpers.d.ts +6 -0
- package/typescript/dist/src/server/tool-helpers.d.ts.map +1 -0
- package/typescript/dist/src/server/tool-helpers.js +27 -0
- package/typescript/dist/src/server/tool-helpers.js.map +1 -0
- package/typescript/dist/src/server/validation.d.ts +79 -0
- package/typescript/dist/src/server/validation.d.ts.map +1 -0
- package/typescript/dist/src/server/validation.js +613 -0
- package/typescript/dist/src/server/validation.js.map +1 -0
- package/typescript/dist/src/server/worker-pool.d.ts +87 -0
- package/typescript/dist/src/server/worker-pool.d.ts.map +1 -0
- package/typescript/dist/src/server/worker-pool.js +586 -0
- package/typescript/dist/src/server/worker-pool.js.map +1 -0
- package/typescript/dist/src/server/worker-threads.d.ts +95 -0
- package/typescript/dist/src/server/worker-threads.d.ts.map +1 -0
- package/typescript/dist/src/server/worker-threads.js +1074 -0
- package/typescript/dist/src/server/worker-threads.js.map +1 -0
- package/typescript/dist/src/server/workflow-orchestrator.d.ts +122 -0
- package/typescript/dist/src/server/workflow-orchestrator.d.ts.map +1 -0
- package/typescript/dist/src/server/workflow-orchestrator.js +2131 -0
- package/typescript/dist/src/server/workflow-orchestrator.js.map +1 -0
- package/typescript/dist/src/server/worktree-manager.d.ts +70 -0
- package/typescript/dist/src/server/worktree-manager.d.ts.map +1 -0
- package/typescript/dist/src/server/worktree-manager.js +741 -0
- package/typescript/dist/src/server/worktree-manager.js.map +1 -0
- package/typescript/dist/src/shared/constants.d.ts +5 -0
- package/typescript/dist/src/shared/constants.d.ts.map +1 -0
- package/typescript/dist/src/shared/constants.js +5 -0
- package/typescript/dist/src/shared/constants.js.map +1 -0
- package/typescript/dist/src/shared/entity-config.d.ts +76 -0
- package/typescript/dist/src/shared/entity-config.d.ts.map +1 -0
- package/typescript/dist/src/shared/entity-config.js +2 -0
- package/typescript/dist/src/shared/entity-config.js.map +1 -0
- package/typescript/dist/src/shared/environment.d.ts +18 -0
- package/typescript/dist/src/shared/environment.d.ts.map +1 -0
- package/typescript/dist/src/shared/environment.js +39 -0
- package/typescript/dist/src/shared/environment.js.map +1 -0
- package/typescript/dist/src/shared/index.d.ts +6 -0
- package/typescript/dist/src/shared/index.d.ts.map +1 -0
- package/typescript/dist/src/shared/index.js +6 -0
- package/typescript/dist/src/shared/index.js.map +1 -0
- package/typescript/dist/src/shared/stringify.d.ts +16 -0
- package/typescript/dist/src/shared/stringify.d.ts.map +1 -0
- package/typescript/dist/src/shared/stringify.js +195 -0
- package/typescript/dist/src/shared/stringify.js.map +1 -0
- package/typescript/dist/src/shared/timeout.d.ts +27 -0
- package/typescript/dist/src/shared/timeout.d.ts.map +1 -0
- package/typescript/dist/src/shared/timeout.js +196 -0
- package/typescript/dist/src/shared/timeout.js.map +1 -0
- package/typescript/dist/src/types/mcp.d.ts +23 -0
- package/typescript/dist/src/types/mcp.d.ts.map +1 -0
- package/typescript/dist/src/types/mcp.js +2 -0
- package/typescript/dist/src/types/mcp.js.map +1 -0
- package/typescript/dist/tsconfig.tsbuildinfo +1 -0
- package/typescript/dist/vite.config.d.ts +3 -0
- package/typescript/dist/vite.config.d.ts.map +1 -0
- package/typescript/dist/vite.config.js +12 -0
- package/typescript/dist/vite.config.js.map +1 -0
- package/typescript/nextjs.json +17 -0
- package/typescript/node.json +10 -0
- package/typescript/react-native.json +8 -0
- package/typescript/react.json +12 -0
|
@@ -0,0 +1,1074 @@
|
|
|
1
|
+
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
2
|
+
if (value !== null && value !== void 0) {
|
|
3
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
4
|
+
var dispose, inner;
|
|
5
|
+
if (async) {
|
|
6
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
7
|
+
dispose = value[Symbol.asyncDispose];
|
|
8
|
+
}
|
|
9
|
+
if (dispose === void 0) {
|
|
10
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
11
|
+
dispose = value[Symbol.dispose];
|
|
12
|
+
if (async) inner = dispose;
|
|
13
|
+
}
|
|
14
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
15
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
16
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
17
|
+
}
|
|
18
|
+
else if (async) {
|
|
19
|
+
env.stack.push({ async: true });
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
23
|
+
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
24
|
+
return function (env) {
|
|
25
|
+
function fail(e) {
|
|
26
|
+
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
27
|
+
env.hasError = true;
|
|
28
|
+
}
|
|
29
|
+
var r, s = 0;
|
|
30
|
+
function next() {
|
|
31
|
+
while (r = env.stack.pop()) {
|
|
32
|
+
try {
|
|
33
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
34
|
+
if (r.dispose) {
|
|
35
|
+
var result = r.dispose.call(r.value);
|
|
36
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
37
|
+
}
|
|
38
|
+
else s |= 1;
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
fail(e);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
45
|
+
if (env.hasError) throw env.error;
|
|
46
|
+
}
|
|
47
|
+
return next();
|
|
48
|
+
};
|
|
49
|
+
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
50
|
+
var e = new Error(message);
|
|
51
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
|
+
});
|
|
53
|
+
import { logError, logWarn } from '@repo/shared/logs/client/next';
|
|
54
|
+
import { CLEANUP_PRIORITIES, registerCleanupHandler } from '../runtime/lifecycle.js';
|
|
55
|
+
import { delay, withTimeout } from '../shared/timeout.js';
|
|
56
|
+
import { safeThrowIfAborted } from './abort-support';
|
|
57
|
+
import { createMCPErrorResponse } from './error-handling';
|
|
58
|
+
import { WorkerPool, createWorkerScript } from './worker-pool';
|
|
59
|
+
const idGenerators = {
|
|
60
|
+
workerPoolId: () => `pool_${crypto.randomUUID()}`,
|
|
61
|
+
};
|
|
62
|
+
const workerPools = new Map();
|
|
63
|
+
const _WORKER_STATUS_OFFSET = 0;
|
|
64
|
+
const _TASK_COUNTER_OFFSET = 4;
|
|
65
|
+
const _PERFORMANCE_METRICS_OFFSET = 0;
|
|
66
|
+
const AVAILABLE_COUNTER_INDEX = 0;
|
|
67
|
+
const WORKER_IDLE = 0;
|
|
68
|
+
const WORKER_BUSY = 1;
|
|
69
|
+
const WORKER_ERROR = 2;
|
|
70
|
+
const WORKER_SHUTDOWN = 3;
|
|
71
|
+
const workerStates = new Map();
|
|
72
|
+
class SharedArrayBufferSecurity {
|
|
73
|
+
static isSupported = null;
|
|
74
|
+
static hasCrossOriginIsolation = null;
|
|
75
|
+
static checkSupport() {
|
|
76
|
+
if (this.isSupported !== null)
|
|
77
|
+
return this.isSupported;
|
|
78
|
+
try {
|
|
79
|
+
this.isSupported =
|
|
80
|
+
typeof SharedArrayBuffer !== 'undefined' &&
|
|
81
|
+
typeof Atomics !== 'undefined' &&
|
|
82
|
+
this.checkCrossOriginIsolation();
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
this.isSupported = false;
|
|
86
|
+
}
|
|
87
|
+
return this.isSupported;
|
|
88
|
+
}
|
|
89
|
+
static checkCrossOriginIsolation() {
|
|
90
|
+
if (this.hasCrossOriginIsolation !== null)
|
|
91
|
+
return this.hasCrossOriginIsolation;
|
|
92
|
+
try {
|
|
93
|
+
if (typeof globalThis !== 'undefined' && 'crossOriginIsolated' in globalThis) {
|
|
94
|
+
this.hasCrossOriginIsolation = Boolean(globalThis.crossOriginIsolated);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
this.hasCrossOriginIsolation = true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
this.hasCrossOriginIsolation = false;
|
|
102
|
+
}
|
|
103
|
+
return this.hasCrossOriginIsolation ?? false;
|
|
104
|
+
}
|
|
105
|
+
static createSecureBuffer(size) {
|
|
106
|
+
if (!this.checkSupport()) {
|
|
107
|
+
throw new Error('SharedArrayBuffer not supported or not safe in current environment');
|
|
108
|
+
}
|
|
109
|
+
if (size <= 0 || !Number.isInteger(size) || size > MAX_BUFFER_SIZE) {
|
|
110
|
+
throw new Error(`Invalid buffer size: ${size}. Must be positive integer <= ${MAX_BUFFER_SIZE}`);
|
|
111
|
+
}
|
|
112
|
+
const jitter = Math.floor(Date.now() % 64);
|
|
113
|
+
const secureSize = Math.ceil((size + jitter) / 64) * 64;
|
|
114
|
+
if (secureSize > MAX_BUFFER_SIZE) {
|
|
115
|
+
throw new Error(`Buffer size with security padding exceeds maximum: ${secureSize} > ${MAX_BUFFER_SIZE}`);
|
|
116
|
+
}
|
|
117
|
+
return new SharedArrayBuffer(secureSize);
|
|
118
|
+
}
|
|
119
|
+
static validateBufferAccess(buffer, offset, length) {
|
|
120
|
+
if (offset < 0 || length < 0 || offset + length > buffer.byteLength) {
|
|
121
|
+
throw new Error(`Buffer access out of bounds: offset=${offset}, length=${length}, bufferSize=${buffer.byteLength}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const MAX_WORKERS = 16;
|
|
126
|
+
const MAX_BUFFER_SIZE = 32 * 1024;
|
|
127
|
+
function createWorkerState(poolId, maxWorkers = 4) {
|
|
128
|
+
if (typeof maxWorkers !== 'number' || !Number.isFinite(maxWorkers)) {
|
|
129
|
+
throw new Error('maxWorkers must be a finite number');
|
|
130
|
+
}
|
|
131
|
+
if (maxWorkers < 1 || maxWorkers > MAX_WORKERS) {
|
|
132
|
+
throw new Error(`maxWorkers must be between 1 and ${MAX_WORKERS}`);
|
|
133
|
+
}
|
|
134
|
+
if (!SharedArrayBufferSecurity.checkSupport()) {
|
|
135
|
+
throw new Error('SharedArrayBuffer not available or not secure in current environment');
|
|
136
|
+
}
|
|
137
|
+
const statusBytes = maxWorkers * 4;
|
|
138
|
+
const counterBytes = maxWorkers * 4;
|
|
139
|
+
const metricsBytes = (maxWorkers + 1) * 4;
|
|
140
|
+
if (statusBytes < maxWorkers || counterBytes < maxWorkers || metricsBytes < maxWorkers) {
|
|
141
|
+
throw new Error('Integer overflow detected in buffer size calculation');
|
|
142
|
+
}
|
|
143
|
+
const rawSize = statusBytes + counterBytes + metricsBytes;
|
|
144
|
+
if (rawSize < statusBytes || rawSize > MAX_BUFFER_SIZE) {
|
|
145
|
+
throw new Error(`Buffer size calculation failed: ${rawSize} (max: ${MAX_BUFFER_SIZE})`);
|
|
146
|
+
}
|
|
147
|
+
const sharedBuffer = SharedArrayBufferSecurity.createSecureBuffer(rawSize);
|
|
148
|
+
SharedArrayBufferSecurity.validateBufferAccess(sharedBuffer, 0, statusBytes);
|
|
149
|
+
SharedArrayBufferSecurity.validateBufferAccess(sharedBuffer, statusBytes, counterBytes);
|
|
150
|
+
SharedArrayBufferSecurity.validateBufferAccess(sharedBuffer, statusBytes + counterBytes, metricsBytes);
|
|
151
|
+
const statusArray = new Int32Array(sharedBuffer, 0, maxWorkers);
|
|
152
|
+
const counterArray = new Int32Array(sharedBuffer, statusBytes, maxWorkers);
|
|
153
|
+
const metricArray = new Int32Array(sharedBuffer, statusBytes + counterBytes, maxWorkers + 1);
|
|
154
|
+
Atomics.store(metricArray, AVAILABLE_COUNTER_INDEX, maxWorkers);
|
|
155
|
+
for (let i = 0; i < maxWorkers; i++) {
|
|
156
|
+
Atomics.store(statusArray, i, WORKER_IDLE);
|
|
157
|
+
Atomics.store(counterArray, i, 0);
|
|
158
|
+
Atomics.store(metricArray, i + 1, 0);
|
|
159
|
+
}
|
|
160
|
+
const workerState = { sharedBuffer, statusArray, counterArray, metricArray };
|
|
161
|
+
workerStates.set(poolId, workerState);
|
|
162
|
+
return workerState;
|
|
163
|
+
}
|
|
164
|
+
async function _getWorkerStatus(poolId, workerId) {
|
|
165
|
+
const state = workerStates.get(poolId);
|
|
166
|
+
if (!state)
|
|
167
|
+
return WORKER_ERROR;
|
|
168
|
+
return await batchAtomicOperation(poolId, 'load', state.statusArray, workerId);
|
|
169
|
+
}
|
|
170
|
+
async function setWorkerStatus(poolId, workerId, status) {
|
|
171
|
+
const state = workerStates.get(poolId);
|
|
172
|
+
if (!state)
|
|
173
|
+
return false;
|
|
174
|
+
const oldStatus = await batchAtomicOperation(poolId, 'load', state.statusArray, workerId);
|
|
175
|
+
await batchAtomicOperation(poolId, 'store', state.statusArray, workerId, status);
|
|
176
|
+
if (oldStatus === WORKER_IDLE && status === WORKER_BUSY) {
|
|
177
|
+
Atomics.sub(state.metricArray, AVAILABLE_COUNTER_INDEX, 1);
|
|
178
|
+
}
|
|
179
|
+
else if (oldStatus === WORKER_BUSY && status === WORKER_IDLE) {
|
|
180
|
+
Atomics.add(state.metricArray, AVAILABLE_COUNTER_INDEX, 1);
|
|
181
|
+
Atomics.notify(state.metricArray, AVAILABLE_COUNTER_INDEX, Infinity);
|
|
182
|
+
}
|
|
183
|
+
Atomics.notify(state.statusArray, workerId, 1);
|
|
184
|
+
return true;
|
|
185
|
+
}
|
|
186
|
+
async function incrementTaskCounter(poolId, workerId) {
|
|
187
|
+
const state = workerStates.get(poolId);
|
|
188
|
+
if (!state)
|
|
189
|
+
return 0;
|
|
190
|
+
return (await batchAtomicOperation(poolId, 'add', state.counterArray, workerId, 1)) + 1;
|
|
191
|
+
}
|
|
192
|
+
class SecureAtomicOperations {
|
|
193
|
+
static metricLocks = new Map();
|
|
194
|
+
static LOCK_TIMEOUT = 50;
|
|
195
|
+
static MAX_SPIN_ITERATIONS = 100;
|
|
196
|
+
static async updateWorkerMetrics(poolId, workerId, processingTime) {
|
|
197
|
+
const state = workerStates.get(poolId);
|
|
198
|
+
if (!state)
|
|
199
|
+
return;
|
|
200
|
+
if (!this.validateMetricParams(workerId, processingTime, state)) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
const lockArray = this.getOrCreateLockArray(poolId, state.metricArray.length);
|
|
204
|
+
if (!lockArray)
|
|
205
|
+
return;
|
|
206
|
+
await this.performSecureMetricUpdate(lockArray, state, workerId, processingTime, poolId);
|
|
207
|
+
}
|
|
208
|
+
static validateMetricParams(workerId, processingTime, state) {
|
|
209
|
+
if (typeof workerId !== 'number' || workerId < 0 || workerId + 1 >= state.metricArray.length) {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
if (typeof processingTime !== 'number' ||
|
|
213
|
+
!Number.isFinite(processingTime) ||
|
|
214
|
+
processingTime < 0) {
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
if (processingTime > 300000) {
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
static getOrCreateLockArray(poolId, length) {
|
|
223
|
+
let lockArray = this.metricLocks.get(poolId);
|
|
224
|
+
if (!lockArray) {
|
|
225
|
+
try {
|
|
226
|
+
const bufferSize = length * 4;
|
|
227
|
+
const buffer = SharedArrayBufferSecurity.createSecureBuffer(bufferSize);
|
|
228
|
+
lockArray = new Int32Array(buffer);
|
|
229
|
+
this.metricLocks.set(poolId, lockArray);
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
logWarn(`Failed to create secure lock array for pool ${poolId}`, { error, poolId });
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return lockArray;
|
|
237
|
+
}
|
|
238
|
+
static async performSecureMetricUpdate(lockArray, state, workerId, processingTime, poolId) {
|
|
239
|
+
const startTime = performance.now();
|
|
240
|
+
let iterations = 0;
|
|
241
|
+
while (iterations < this.MAX_SPIN_ITERATIONS) {
|
|
242
|
+
const oldValue = Atomics.compareExchange(lockArray, workerId, 0, 1);
|
|
243
|
+
if (oldValue === 0) {
|
|
244
|
+
try {
|
|
245
|
+
const metricIndex = workerId + 1;
|
|
246
|
+
const currentMetric = Atomics.load(state.metricArray, metricIndex);
|
|
247
|
+
const newMetric = currentMetric > 0
|
|
248
|
+
? Math.floor((currentMetric + processingTime) / 2)
|
|
249
|
+
: Math.floor(processingTime);
|
|
250
|
+
Atomics.store(state.metricArray, metricIndex, newMetric);
|
|
251
|
+
}
|
|
252
|
+
finally {
|
|
253
|
+
Atomics.store(lockArray, workerId, 0);
|
|
254
|
+
Atomics.notify(lockArray, workerId, 1);
|
|
255
|
+
}
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
if (performance.now() - startTime > this.LOCK_TIMEOUT) {
|
|
259
|
+
logWarn(`Atomic operation timeout for pool ${poolId}, worker ${workerId}`, {
|
|
260
|
+
poolId,
|
|
261
|
+
workerId,
|
|
262
|
+
});
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const backoffMs = Math.min(2 ** Math.min(iterations, 4), 8);
|
|
266
|
+
await delay(backoffMs);
|
|
267
|
+
iterations++;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
static cleanup(poolId) {
|
|
271
|
+
this.metricLocks.delete(poolId);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
async function updateWorkerMetrics(poolId, workerId, processingTime) {
|
|
275
|
+
await SecureAtomicOperations.updateWorkerMetrics(poolId, workerId, processingTime);
|
|
276
|
+
}
|
|
277
|
+
async function getPoolMetrics(poolId) {
|
|
278
|
+
const state = workerStates.get(poolId);
|
|
279
|
+
if (!state)
|
|
280
|
+
return null;
|
|
281
|
+
const statusReads = [];
|
|
282
|
+
const counterReads = [];
|
|
283
|
+
const metricReads = [];
|
|
284
|
+
for (let i = 0; i < state.statusArray.length; i++) {
|
|
285
|
+
statusReads.push(batchAtomicOperation(poolId, 'load', state.statusArray, i));
|
|
286
|
+
counterReads.push(batchAtomicOperation(poolId, 'load', state.counterArray, i));
|
|
287
|
+
metricReads.push(batchAtomicOperation(poolId, 'load', state.metricArray, i + 1));
|
|
288
|
+
}
|
|
289
|
+
const availableCountRead = batchAtomicOperation(poolId, 'load', state.metricArray, AVAILABLE_COUNTER_INDEX);
|
|
290
|
+
const [statuses, counters, metrics, availableCount] = await Promise.all([
|
|
291
|
+
Promise.all(statusReads),
|
|
292
|
+
Promise.all(counterReads),
|
|
293
|
+
Promise.all(metricReads),
|
|
294
|
+
availableCountRead,
|
|
295
|
+
]);
|
|
296
|
+
const workers = [];
|
|
297
|
+
for (let i = 0; i < statuses.length; i++) {
|
|
298
|
+
const status = statuses[i];
|
|
299
|
+
const tasksCompleted = counters[i] ?? 0;
|
|
300
|
+
const averageProcessingTime = metrics[i] ?? 0;
|
|
301
|
+
workers.push({
|
|
302
|
+
id: i,
|
|
303
|
+
status: getWorkerStatusName(typeof status === 'number' ? status : WORKER_ERROR),
|
|
304
|
+
tasksCompleted,
|
|
305
|
+
averageProcessingTime,
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
return { poolId, workers, availableWorkers: availableCount };
|
|
309
|
+
}
|
|
310
|
+
function getWorkerStatusName(status) {
|
|
311
|
+
switch (status) {
|
|
312
|
+
case WORKER_IDLE:
|
|
313
|
+
return 'idle';
|
|
314
|
+
case WORKER_BUSY:
|
|
315
|
+
return 'busy';
|
|
316
|
+
case WORKER_ERROR:
|
|
317
|
+
return 'error';
|
|
318
|
+
case WORKER_SHUTDOWN:
|
|
319
|
+
return 'shutdown';
|
|
320
|
+
default:
|
|
321
|
+
return 'unknown';
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
const pendingBatches = new Map();
|
|
325
|
+
let batchFlushTimer = null;
|
|
326
|
+
function batchAtomicOperation(poolId, type, array, index, value, expected) {
|
|
327
|
+
return new Promise(resolve => {
|
|
328
|
+
let batch = pendingBatches.get(poolId);
|
|
329
|
+
if (!batch) {
|
|
330
|
+
batch = { operations: [], results: [], resolvers: [] };
|
|
331
|
+
pendingBatches.set(poolId, batch);
|
|
332
|
+
}
|
|
333
|
+
const operationIndex = batch.operations.length;
|
|
334
|
+
batch.operations.push({ type, array, index, value, expected });
|
|
335
|
+
batch.resolvers[operationIndex] = resolve;
|
|
336
|
+
if (!batchFlushTimer) {
|
|
337
|
+
batchFlushTimer = setImmediate(() => {
|
|
338
|
+
flushAtomicBatches();
|
|
339
|
+
batchFlushTimer = null;
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
function flushAtomicBatches() {
|
|
345
|
+
for (const [_poolId, batch] of pendingBatches) {
|
|
346
|
+
for (let i = 0; i < batch.operations.length; i++) {
|
|
347
|
+
const op = batch.operations[i];
|
|
348
|
+
if (!op) {
|
|
349
|
+
continue;
|
|
350
|
+
}
|
|
351
|
+
let result;
|
|
352
|
+
switch (op.type) {
|
|
353
|
+
case 'load':
|
|
354
|
+
result = Atomics.load(op.array, op.index);
|
|
355
|
+
break;
|
|
356
|
+
case 'store':
|
|
357
|
+
result = typeof op.value === 'number' ? Atomics.store(op.array, op.index, op.value) : 0;
|
|
358
|
+
break;
|
|
359
|
+
case 'add':
|
|
360
|
+
result = typeof op.value === 'number' ? Atomics.add(op.array, op.index, op.value) : 0;
|
|
361
|
+
break;
|
|
362
|
+
case 'compareExchange':
|
|
363
|
+
result =
|
|
364
|
+
typeof op.value === 'number' && typeof op.expected === 'number'
|
|
365
|
+
? Atomics.compareExchange(op.array, op.index, op.expected, op.value)
|
|
366
|
+
: 0;
|
|
367
|
+
break;
|
|
368
|
+
default:
|
|
369
|
+
result = 0;
|
|
370
|
+
}
|
|
371
|
+
batch.results[i] = result;
|
|
372
|
+
batch.resolvers[i]?.(result);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
pendingBatches.clear();
|
|
376
|
+
}
|
|
377
|
+
function waitForAvailableWorker(poolId, timeoutMs = 5000) {
|
|
378
|
+
return new Promise((resolve, reject) => {
|
|
379
|
+
const state = workerStates.get(poolId);
|
|
380
|
+
if (!state) {
|
|
381
|
+
reject(new Error('Pool not found'));
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
const startTime = Date.now();
|
|
385
|
+
async function findAvailableWorker() {
|
|
386
|
+
if (!state) {
|
|
387
|
+
reject(new Error('Pool state not found'));
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
const availableCount = Atomics.load(state.metricArray, AVAILABLE_COUNTER_INDEX);
|
|
391
|
+
if (availableCount > 0) {
|
|
392
|
+
for (let i = 0; i < state.statusArray.length; i++) {
|
|
393
|
+
const status = Atomics.load(state.statusArray, i);
|
|
394
|
+
if (status === WORKER_IDLE) {
|
|
395
|
+
resolve(i);
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
if (Date.now() - startTime > timeoutMs) {
|
|
401
|
+
reject(new Error('Timeout waiting for available worker'));
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
try {
|
|
405
|
+
const asyncWait = Atomics.waitAsync;
|
|
406
|
+
if (asyncWait && typeof asyncWait === 'function') {
|
|
407
|
+
const currentAvailable = Atomics.load(state.metricArray, AVAILABLE_COUNTER_INDEX);
|
|
408
|
+
if (currentAvailable > 0) {
|
|
409
|
+
setImmediate(() => void findAvailableWorker());
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
const result = asyncWait(state.metricArray, AVAILABLE_COUNTER_INDEX, 0, 100);
|
|
413
|
+
if (result?.async) {
|
|
414
|
+
void (async () => {
|
|
415
|
+
try {
|
|
416
|
+
await result.value;
|
|
417
|
+
setImmediate(() => void findAvailableWorker());
|
|
418
|
+
}
|
|
419
|
+
catch {
|
|
420
|
+
setImmediate(() => void findAvailableWorker());
|
|
421
|
+
}
|
|
422
|
+
})();
|
|
423
|
+
}
|
|
424
|
+
else {
|
|
425
|
+
setImmediate(() => void findAvailableWorker());
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
else {
|
|
430
|
+
setTimeout(() => void findAvailableWorker(), 50);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
catch (_error) {
|
|
434
|
+
setTimeout(() => void findAvailableWorker(), 50);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
void findAvailableWorker();
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
export const workerThreadsTool = {
|
|
441
|
+
name: 'worker_threads',
|
|
442
|
+
description: 'Node.js 22+ Worker Threads for CPU-intensive operations',
|
|
443
|
+
inputSchema: {
|
|
444
|
+
type: 'object',
|
|
445
|
+
properties: {
|
|
446
|
+
action: {
|
|
447
|
+
type: 'string',
|
|
448
|
+
enum: [
|
|
449
|
+
'createPool',
|
|
450
|
+
'executeTask',
|
|
451
|
+
'executeBatch',
|
|
452
|
+
'getPoolStats',
|
|
453
|
+
'destroyPool',
|
|
454
|
+
'cpuIntensiveDemo',
|
|
455
|
+
'dataProcessingDemo',
|
|
456
|
+
'codeAnalysisDemo',
|
|
457
|
+
'atomicsDemo',
|
|
458
|
+
],
|
|
459
|
+
description: 'Worker thread action to perform',
|
|
460
|
+
},
|
|
461
|
+
maxWorkers: {
|
|
462
|
+
type: 'number',
|
|
463
|
+
description: 'Maximum number of worker threads',
|
|
464
|
+
default: 4,
|
|
465
|
+
},
|
|
466
|
+
minWorkers: {
|
|
467
|
+
type: 'number',
|
|
468
|
+
description: 'Minimum number of worker threads',
|
|
469
|
+
default: 1,
|
|
470
|
+
},
|
|
471
|
+
taskTimeout: {
|
|
472
|
+
type: 'number',
|
|
473
|
+
description: 'Task timeout in milliseconds',
|
|
474
|
+
default: 30000,
|
|
475
|
+
},
|
|
476
|
+
enableProfiling: {
|
|
477
|
+
type: 'boolean',
|
|
478
|
+
description: 'Enable performance profiling',
|
|
479
|
+
default: false,
|
|
480
|
+
},
|
|
481
|
+
taskType: {
|
|
482
|
+
type: 'string',
|
|
483
|
+
description: 'Type of task to execute',
|
|
484
|
+
},
|
|
485
|
+
taskData: {
|
|
486
|
+
description: 'Data to process in worker thread',
|
|
487
|
+
},
|
|
488
|
+
tasks: {
|
|
489
|
+
type: 'array',
|
|
490
|
+
items: {
|
|
491
|
+
type: 'object',
|
|
492
|
+
properties: {
|
|
493
|
+
type: { type: 'string' },
|
|
494
|
+
data: {},
|
|
495
|
+
},
|
|
496
|
+
required: ['type', 'data'],
|
|
497
|
+
},
|
|
498
|
+
description: 'Array of tasks for batch processing',
|
|
499
|
+
},
|
|
500
|
+
dataSize: {
|
|
501
|
+
type: 'number',
|
|
502
|
+
description: 'Size of data for processing demos',
|
|
503
|
+
default: 1000,
|
|
504
|
+
},
|
|
505
|
+
complexity: {
|
|
506
|
+
type: 'number',
|
|
507
|
+
description: 'Complexity level for CPU demos (1-10)',
|
|
508
|
+
minimum: 1,
|
|
509
|
+
maximum: 10,
|
|
510
|
+
default: 5,
|
|
511
|
+
},
|
|
512
|
+
codeSnippet: {
|
|
513
|
+
type: 'string',
|
|
514
|
+
description: 'Code snippet to analyze',
|
|
515
|
+
},
|
|
516
|
+
signal: {
|
|
517
|
+
description: 'AbortSignal for cancelling the operation',
|
|
518
|
+
},
|
|
519
|
+
},
|
|
520
|
+
required: ['action'],
|
|
521
|
+
},
|
|
522
|
+
async execute(args) {
|
|
523
|
+
try {
|
|
524
|
+
const { action, maxWorkers = 4, minWorkers = 1, taskTimeout = 30000, enableProfiling = false, taskType, taskData, tasks = [], dataSize = 1000, complexity = 5, codeSnippet, signal, } = args;
|
|
525
|
+
safeThrowIfAborted(signal);
|
|
526
|
+
switch (action) {
|
|
527
|
+
case 'createPool': {
|
|
528
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
529
|
+
try {
|
|
530
|
+
if (maxWorkers < 1 || maxWorkers > MAX_WORKERS) {
|
|
531
|
+
throw new Error(`maxWorkers must be between 1 and ${MAX_WORKERS}`);
|
|
532
|
+
}
|
|
533
|
+
const poolId = idGenerators.workerPoolId();
|
|
534
|
+
const workerScript = createWorkerScript({
|
|
535
|
+
fibonacci: (n) => {
|
|
536
|
+
if (n <= 1)
|
|
537
|
+
return n;
|
|
538
|
+
let a = 0, b = 1;
|
|
539
|
+
for (let i = 2; i <= n; i++) {
|
|
540
|
+
const temp = a + b;
|
|
541
|
+
a = b;
|
|
542
|
+
b = temp;
|
|
543
|
+
}
|
|
544
|
+
return b;
|
|
545
|
+
},
|
|
546
|
+
isPrime: (n) => {
|
|
547
|
+
if (n <= 1)
|
|
548
|
+
return false;
|
|
549
|
+
if (n <= 3)
|
|
550
|
+
return true;
|
|
551
|
+
if (n % 2 === 0 || n % 3 === 0)
|
|
552
|
+
return false;
|
|
553
|
+
for (let i = 5; i * i <= n; i += 6) {
|
|
554
|
+
if (n % i === 0 || n % (i + 2) === 0)
|
|
555
|
+
return false;
|
|
556
|
+
}
|
|
557
|
+
return true;
|
|
558
|
+
},
|
|
559
|
+
processArray: (data) => {
|
|
560
|
+
const { array, operation } = data;
|
|
561
|
+
switch (operation) {
|
|
562
|
+
case 'sum':
|
|
563
|
+
return array.reduce((acc, val) => acc + val, 0);
|
|
564
|
+
case 'sort':
|
|
565
|
+
return [...array].sort((a, b) => a - b);
|
|
566
|
+
case 'filter_even':
|
|
567
|
+
return array.filter(n => n % 2 === 0);
|
|
568
|
+
case 'map_square':
|
|
569
|
+
return array.map(n => n * n);
|
|
570
|
+
default:
|
|
571
|
+
throw new Error(`Unknown operation: ${operation}`);
|
|
572
|
+
}
|
|
573
|
+
},
|
|
574
|
+
analyzeCode: (code) => {
|
|
575
|
+
const lines = code.split('\n');
|
|
576
|
+
const nonEmptyLines = lines.filter(line => line.trim().length > 0);
|
|
577
|
+
const functions = (code.match(/function\s+\w+/g) ?? []).length;
|
|
578
|
+
const variables = (code.match(/(?:var|let|const)\s+\w+/g) ?? []).length;
|
|
579
|
+
const comments = (code.match(/\/\/.*$/gm) ?? []).length;
|
|
580
|
+
return {
|
|
581
|
+
totalLines: lines.length,
|
|
582
|
+
codeLines: nonEmptyLines.length,
|
|
583
|
+
functions,
|
|
584
|
+
variables,
|
|
585
|
+
comments,
|
|
586
|
+
complexity: Math.min(10, Math.max(1, functions + variables / 2)),
|
|
587
|
+
};
|
|
588
|
+
},
|
|
589
|
+
computeMatrix: (data) => {
|
|
590
|
+
const { size, operation } = data;
|
|
591
|
+
const matrix = Array(size)
|
|
592
|
+
.fill(0)
|
|
593
|
+
.map(() => Array(size).fill(0));
|
|
594
|
+
for (let i = 0; i < size; i++) {
|
|
595
|
+
const row = matrix[i];
|
|
596
|
+
if (!row)
|
|
597
|
+
continue;
|
|
598
|
+
for (let j = 0; j < size; j++) {
|
|
599
|
+
row[j] = Math.floor(((i * size + j) * 37) % 100);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
switch (operation) {
|
|
603
|
+
case 'transpose': {
|
|
604
|
+
const transposed = Array(size)
|
|
605
|
+
.fill(0)
|
|
606
|
+
.map(() => Array(size).fill(0));
|
|
607
|
+
for (let i = 0; i < size; i++) {
|
|
608
|
+
const sourceRow = matrix[i];
|
|
609
|
+
if (!sourceRow)
|
|
610
|
+
continue;
|
|
611
|
+
for (let j = 0; j < size; j++) {
|
|
612
|
+
const targetRow = transposed[j];
|
|
613
|
+
if (!targetRow)
|
|
614
|
+
continue;
|
|
615
|
+
targetRow[i] = sourceRow[j] ?? 0;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
return { result: 'transposed', size };
|
|
619
|
+
}
|
|
620
|
+
case 'sum_diagonal': {
|
|
621
|
+
let sum = 0;
|
|
622
|
+
for (let i = 0; i < size; i++) {
|
|
623
|
+
const row = matrix[i];
|
|
624
|
+
sum += row?.[i] ?? 0;
|
|
625
|
+
}
|
|
626
|
+
return { result: sum, operation: 'diagonal_sum' };
|
|
627
|
+
}
|
|
628
|
+
default:
|
|
629
|
+
return { result: 'processed', size, operation };
|
|
630
|
+
}
|
|
631
|
+
},
|
|
632
|
+
});
|
|
633
|
+
const fs = await import('node:fs/promises');
|
|
634
|
+
const path = await import('node:path');
|
|
635
|
+
const os = await import('node:os');
|
|
636
|
+
class WorkerPoolResource {
|
|
637
|
+
pool;
|
|
638
|
+
poolId;
|
|
639
|
+
tempDir;
|
|
640
|
+
scriptPath;
|
|
641
|
+
constructor(pool, poolId, tempDir, scriptPath) {
|
|
642
|
+
this.pool = pool;
|
|
643
|
+
this.poolId = poolId;
|
|
644
|
+
this.tempDir = tempDir;
|
|
645
|
+
this.scriptPath = scriptPath;
|
|
646
|
+
}
|
|
647
|
+
async [Symbol.asyncDispose]() {
|
|
648
|
+
const cleanupPromises = [];
|
|
649
|
+
const CLEANUP_TIMEOUT = 5000;
|
|
650
|
+
try {
|
|
651
|
+
const state = workerStates.get(this.poolId);
|
|
652
|
+
if (state) {
|
|
653
|
+
for (let i = 0; i < state.statusArray.length; i++) {
|
|
654
|
+
void setWorkerStatus(this.poolId, i, WORKER_SHUTDOWN);
|
|
655
|
+
}
|
|
656
|
+
workerStates.delete(this.poolId);
|
|
657
|
+
SecureAtomicOperations.cleanup(this.poolId);
|
|
658
|
+
}
|
|
659
|
+
const safePoolDestroy = async () => {
|
|
660
|
+
try {
|
|
661
|
+
await withTimeout(this.pool.destroy(), CLEANUP_TIMEOUT);
|
|
662
|
+
}
|
|
663
|
+
catch (error) {
|
|
664
|
+
logWarn(`Pool destroy error`, { error, poolId: this.poolId });
|
|
665
|
+
}
|
|
666
|
+
};
|
|
667
|
+
const safeFileUnlink = async () => {
|
|
668
|
+
try {
|
|
669
|
+
await fs.unlink(this.scriptPath);
|
|
670
|
+
}
|
|
671
|
+
catch (error) {
|
|
672
|
+
logWarn(`Script file cleanup error`, { error, scriptPath: this.scriptPath });
|
|
673
|
+
}
|
|
674
|
+
};
|
|
675
|
+
const safeDirRemove = async () => {
|
|
676
|
+
try {
|
|
677
|
+
await fs.rmdir(this.tempDir);
|
|
678
|
+
}
|
|
679
|
+
catch (error) {
|
|
680
|
+
logWarn(`Temp directory cleanup error`, { error, tempDir: this.tempDir });
|
|
681
|
+
}
|
|
682
|
+
};
|
|
683
|
+
cleanupPromises.push(safePoolDestroy());
|
|
684
|
+
workerPools.delete(this.poolId);
|
|
685
|
+
cleanupPromises.push(safeFileUnlink());
|
|
686
|
+
cleanupPromises.push(safeDirRemove());
|
|
687
|
+
await withTimeout(Promise.allSettled(cleanupPromises), CLEANUP_TIMEOUT);
|
|
688
|
+
}
|
|
689
|
+
catch (error) {
|
|
690
|
+
logWarn(`Worker pool cleanup error`, { error, poolId: this.poolId });
|
|
691
|
+
workerPools.delete(this.poolId);
|
|
692
|
+
workerStates.delete(this.poolId);
|
|
693
|
+
SecureAtomicOperations.cleanup(this.poolId);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'mcp-workers-'));
|
|
698
|
+
const scriptPath = path.join(tempDir, 'worker.cjs');
|
|
699
|
+
await fs.writeFile(scriptPath, workerScript);
|
|
700
|
+
const pool = new WorkerPool(scriptPath, {
|
|
701
|
+
maxWorkers,
|
|
702
|
+
minWorkers,
|
|
703
|
+
taskTimeout,
|
|
704
|
+
enableProfiling,
|
|
705
|
+
});
|
|
706
|
+
const workerState = createWorkerState(poolId, maxWorkers);
|
|
707
|
+
const _poolResource = __addDisposableResource(env_1, new WorkerPoolResource(pool, poolId, tempDir, scriptPath), true);
|
|
708
|
+
workerPools.set(poolId, pool);
|
|
709
|
+
return {
|
|
710
|
+
content: [
|
|
711
|
+
{
|
|
712
|
+
type: 'text',
|
|
713
|
+
text: JSON.stringify({
|
|
714
|
+
success: true,
|
|
715
|
+
poolId,
|
|
716
|
+
config: {
|
|
717
|
+
maxWorkers,
|
|
718
|
+
minWorkers,
|
|
719
|
+
taskTimeout,
|
|
720
|
+
enableProfiling,
|
|
721
|
+
},
|
|
722
|
+
atomicCoordination: {
|
|
723
|
+
sharedBufferSize: workerState.sharedBuffer.byteLength,
|
|
724
|
+
workersInitialized: maxWorkers,
|
|
725
|
+
atomicOperationsEnabled: true,
|
|
726
|
+
},
|
|
727
|
+
timestamp: new Date().toISOString(),
|
|
728
|
+
}),
|
|
729
|
+
},
|
|
730
|
+
],
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
catch (e_1) {
|
|
734
|
+
env_1.error = e_1;
|
|
735
|
+
env_1.hasError = true;
|
|
736
|
+
}
|
|
737
|
+
finally {
|
|
738
|
+
const result_1 = __disposeResources(env_1);
|
|
739
|
+
if (result_1)
|
|
740
|
+
await result_1;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
case 'executeTask': {
|
|
744
|
+
if (!taskType || taskData === undefined) {
|
|
745
|
+
throw new Error('taskType and taskData required for executeTask');
|
|
746
|
+
}
|
|
747
|
+
let pool = workerPools.values().next().value;
|
|
748
|
+
if (!pool) {
|
|
749
|
+
const result = await this.execute({
|
|
750
|
+
action: 'createPool',
|
|
751
|
+
maxWorkers: 2,
|
|
752
|
+
signal,
|
|
753
|
+
});
|
|
754
|
+
const firstContent = result.content[0];
|
|
755
|
+
const parsed = firstContent ? JSON.parse(firstContent.text) : {};
|
|
756
|
+
const response = parsed && typeof parsed === 'object' ? parsed : {};
|
|
757
|
+
const poolId = typeof response['poolId'] === 'string' ? response['poolId'] : undefined;
|
|
758
|
+
pool = poolId ? workerPools.get(poolId) : undefined;
|
|
759
|
+
if (!pool) {
|
|
760
|
+
throw new Error('Failed to create or retrieve worker pool');
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
safeThrowIfAborted(signal);
|
|
764
|
+
let currentPoolId = 'default';
|
|
765
|
+
for (const [pid, p] of workerPools.entries()) {
|
|
766
|
+
if (p === pool) {
|
|
767
|
+
currentPoolId = pid;
|
|
768
|
+
break;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
const availableWorkerId = await waitForAvailableWorker(currentPoolId, 5000);
|
|
772
|
+
void setWorkerStatus(currentPoolId, availableWorkerId, WORKER_BUSY);
|
|
773
|
+
const startTime = performance.now();
|
|
774
|
+
const result = await pool.execute(taskType, taskData, { signal });
|
|
775
|
+
const duration = performance.now() - startTime;
|
|
776
|
+
void incrementTaskCounter(currentPoolId, availableWorkerId);
|
|
777
|
+
void updateWorkerMetrics(currentPoolId, availableWorkerId, duration);
|
|
778
|
+
void setWorkerStatus(currentPoolId, availableWorkerId, WORKER_IDLE);
|
|
779
|
+
return {
|
|
780
|
+
content: [
|
|
781
|
+
{
|
|
782
|
+
type: 'text',
|
|
783
|
+
text: JSON.stringify({
|
|
784
|
+
success: true,
|
|
785
|
+
taskType,
|
|
786
|
+
result,
|
|
787
|
+
duration,
|
|
788
|
+
timestamp: new Date().toISOString(),
|
|
789
|
+
}),
|
|
790
|
+
},
|
|
791
|
+
],
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
case 'executeBatch': {
|
|
795
|
+
if (tasks.length === 0) {
|
|
796
|
+
throw new Error('tasks array required for executeBatch');
|
|
797
|
+
}
|
|
798
|
+
let pool = workerPools.values().next().value;
|
|
799
|
+
if (!pool) {
|
|
800
|
+
const result = await this.execute({
|
|
801
|
+
action: 'createPool',
|
|
802
|
+
maxWorkers: Math.min(8, Math.max(2, tasks.length)),
|
|
803
|
+
signal,
|
|
804
|
+
});
|
|
805
|
+
const firstContent = result.content[0];
|
|
806
|
+
const parsed = firstContent ? JSON.parse(firstContent.text) : {};
|
|
807
|
+
const response = parsed && typeof parsed === 'object' ? parsed : {};
|
|
808
|
+
const poolId = typeof response['poolId'] === 'string' ? response['poolId'] : undefined;
|
|
809
|
+
pool = poolId ? workerPools.get(poolId) : undefined;
|
|
810
|
+
}
|
|
811
|
+
safeThrowIfAborted(signal);
|
|
812
|
+
const startTime = performance.now();
|
|
813
|
+
const results = await Promise.all(tasks.map(async (task, index) => {
|
|
814
|
+
try {
|
|
815
|
+
if (!pool) {
|
|
816
|
+
throw new Error('Worker pool not available');
|
|
817
|
+
}
|
|
818
|
+
const result = await pool.execute(task.type, task.data, { signal });
|
|
819
|
+
return { index, success: true, result };
|
|
820
|
+
}
|
|
821
|
+
catch (error) {
|
|
822
|
+
return {
|
|
823
|
+
index,
|
|
824
|
+
success: false,
|
|
825
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
}));
|
|
829
|
+
const totalDuration = performance.now() - startTime;
|
|
830
|
+
const successful = results.filter(r => r.success).length;
|
|
831
|
+
const failed = results.length - successful;
|
|
832
|
+
return {
|
|
833
|
+
content: [
|
|
834
|
+
{
|
|
835
|
+
type: 'text',
|
|
836
|
+
text: JSON.stringify({
|
|
837
|
+
success: true,
|
|
838
|
+
batchSize: tasks.length,
|
|
839
|
+
successful,
|
|
840
|
+
failed,
|
|
841
|
+
results,
|
|
842
|
+
totalDuration,
|
|
843
|
+
averageDuration: totalDuration / tasks.length,
|
|
844
|
+
timestamp: new Date().toISOString(),
|
|
845
|
+
}),
|
|
846
|
+
},
|
|
847
|
+
],
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
case 'cpuIntensiveDemo': {
|
|
851
|
+
const fibonacciN = Math.min(50, 10 + complexity * 4);
|
|
852
|
+
const tasks = [
|
|
853
|
+
{ type: 'fibonacci', data: fibonacciN },
|
|
854
|
+
{ type: 'isPrime', data: 982451653 + complexity * 1000 },
|
|
855
|
+
{ type: 'computeMatrix', data: { size: 10 + complexity * 5, operation: 'transpose' } },
|
|
856
|
+
];
|
|
857
|
+
return this.execute({ action: 'executeBatch', tasks, signal });
|
|
858
|
+
}
|
|
859
|
+
case 'dataProcessingDemo': {
|
|
860
|
+
safeThrowIfAborted(signal);
|
|
861
|
+
const testArray = Array.from({ length: dataSize }, (_, i) => Math.floor((i * 97 + 13) % 1000));
|
|
862
|
+
const tasks = [
|
|
863
|
+
{ type: 'processArray', data: { array: testArray, operation: 'sum' } },
|
|
864
|
+
{ type: 'processArray', data: { array: testArray, operation: 'sort' } },
|
|
865
|
+
{ type: 'processArray', data: { array: testArray, operation: 'filter_even' } },
|
|
866
|
+
{ type: 'processArray', data: { array: testArray, operation: 'map_square' } },
|
|
867
|
+
];
|
|
868
|
+
return this.execute({ action: 'executeBatch', tasks, signal });
|
|
869
|
+
}
|
|
870
|
+
case 'codeAnalysisDemo': {
|
|
871
|
+
const code = codeSnippet ??
|
|
872
|
+
`
|
|
873
|
+
function calculateComplexity(code) {
|
|
874
|
+
const lines = code.split('\\n');
|
|
875
|
+
let complexity = 1;
|
|
876
|
+
|
|
877
|
+
// Count decision points
|
|
878
|
+
const decisions = (code.match(/if|else|while|for|switch|case|catch|\\?/g) ?? []).length;
|
|
879
|
+
complexity += decisions;
|
|
880
|
+
|
|
881
|
+
// Count functions
|
|
882
|
+
const functions = (code.match(/function\\s+\\w+/g) ?? []).length;
|
|
883
|
+
complexity += functions;
|
|
884
|
+
|
|
885
|
+
return { lines: lines.length, decisions, functions, complexity };
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
const fs = require('fs');
|
|
889
|
+
const path = require('path');
|
|
890
|
+
|
|
891
|
+
function analyzeProject(directory) {
|
|
892
|
+
// Implementation for project analysis
|
|
893
|
+
return { files: 0, totalLines: 0, avgComplexity: 0 };
|
|
894
|
+
}
|
|
895
|
+
`;
|
|
896
|
+
return this.execute({
|
|
897
|
+
action: 'executeTask',
|
|
898
|
+
taskType: 'analyzeCode',
|
|
899
|
+
taskData: code,
|
|
900
|
+
signal,
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
case 'getPoolStats': {
|
|
904
|
+
const stats = await Promise.all(Array.from(workerPools.entries()).map(async ([poolId, pool]) => {
|
|
905
|
+
const poolStats = pool.getStats();
|
|
906
|
+
const atomicMetrics = await getPoolMetrics(poolId);
|
|
907
|
+
return {
|
|
908
|
+
poolId,
|
|
909
|
+
stats: poolStats,
|
|
910
|
+
atomicCoordination: atomicMetrics,
|
|
911
|
+
performanceInsights: atomicMetrics
|
|
912
|
+
? {
|
|
913
|
+
totalTasksCompleted: atomicMetrics.workers.reduce((sum, w) => sum + w.tasksCompleted, 0),
|
|
914
|
+
averageProcessingTime: atomicMetrics.workers.reduce((sum, w) => sum + w.averageProcessingTime, 0) / atomicMetrics.workers.length,
|
|
915
|
+
activeWorkers: atomicMetrics.workers.filter((w) => w.status === 'busy')
|
|
916
|
+
.length,
|
|
917
|
+
idleWorkers: atomicMetrics.workers.filter((w) => w.status === 'idle')
|
|
918
|
+
.length,
|
|
919
|
+
}
|
|
920
|
+
: null,
|
|
921
|
+
};
|
|
922
|
+
}));
|
|
923
|
+
return {
|
|
924
|
+
content: [
|
|
925
|
+
{
|
|
926
|
+
type: 'text',
|
|
927
|
+
text: JSON.stringify({
|
|
928
|
+
success: true,
|
|
929
|
+
poolCount: workerPools.size,
|
|
930
|
+
pools: stats,
|
|
931
|
+
timestamp: new Date().toISOString(),
|
|
932
|
+
}),
|
|
933
|
+
},
|
|
934
|
+
],
|
|
935
|
+
};
|
|
936
|
+
}
|
|
937
|
+
case 'destroyPool': {
|
|
938
|
+
const destroyed = [];
|
|
939
|
+
for (const [poolId, pool] of workerPools.entries()) {
|
|
940
|
+
const state = workerStates.get(poolId);
|
|
941
|
+
if (state) {
|
|
942
|
+
for (let i = 0; i < state.statusArray.length; i++) {
|
|
943
|
+
void setWorkerStatus(poolId, i, WORKER_SHUTDOWN);
|
|
944
|
+
}
|
|
945
|
+
workerStates.delete(poolId);
|
|
946
|
+
}
|
|
947
|
+
await pool.destroy();
|
|
948
|
+
workerPools.delete(poolId);
|
|
949
|
+
destroyed.push(poolId);
|
|
950
|
+
}
|
|
951
|
+
return {
|
|
952
|
+
content: [
|
|
953
|
+
{
|
|
954
|
+
type: 'text',
|
|
955
|
+
text: JSON.stringify({
|
|
956
|
+
success: true,
|
|
957
|
+
destroyed,
|
|
958
|
+
remainingPools: workerPools.size,
|
|
959
|
+
atomicStatesCleared: destroyed.length,
|
|
960
|
+
timestamp: new Date().toISOString(),
|
|
961
|
+
}),
|
|
962
|
+
},
|
|
963
|
+
],
|
|
964
|
+
};
|
|
965
|
+
}
|
|
966
|
+
case 'atomicsDemo': {
|
|
967
|
+
const poolId = idGenerators.workerPoolId();
|
|
968
|
+
const demoMaxWorkers = 3;
|
|
969
|
+
const workerState = createWorkerState(poolId, demoMaxWorkers);
|
|
970
|
+
const operations = [];
|
|
971
|
+
for (let i = 0; i < demoMaxWorkers; i++) {
|
|
972
|
+
operations.push(async () => {
|
|
973
|
+
const workerId = i;
|
|
974
|
+
const oldStatus = Atomics.compareExchange(workerState.statusArray, workerId, WORKER_IDLE, WORKER_BUSY);
|
|
975
|
+
await delay(10 + ((Date.now() + workerId) % 20));
|
|
976
|
+
const tasksCompleted = incrementTaskCounter(poolId, workerId);
|
|
977
|
+
void updateWorkerMetrics(poolId, workerId, 15.5);
|
|
978
|
+
Atomics.store(workerState.statusArray, workerId, WORKER_IDLE);
|
|
979
|
+
Atomics.notify(workerState.statusArray, workerId, 1);
|
|
980
|
+
return { workerId, oldStatus, tasksCompleted };
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
operations.push(async () => {
|
|
984
|
+
let totalTasks = 0;
|
|
985
|
+
for (let i = 0; i < demoMaxWorkers; i++) {
|
|
986
|
+
totalTasks += Atomics.load(workerState.counterArray, i);
|
|
987
|
+
}
|
|
988
|
+
const sharedCounterIndex = demoMaxWorkers - 1;
|
|
989
|
+
const newCount = Atomics.add(workerState.counterArray, sharedCounterIndex, 5);
|
|
990
|
+
return { totalTasks, sharedCounterIncrement: newCount };
|
|
991
|
+
});
|
|
992
|
+
const results = await Promise.all(operations);
|
|
993
|
+
const finalMetrics = await getPoolMetrics(poolId);
|
|
994
|
+
workerStates.delete(poolId);
|
|
995
|
+
return {
|
|
996
|
+
content: [
|
|
997
|
+
{
|
|
998
|
+
type: 'text',
|
|
999
|
+
text: JSON.stringify({
|
|
1000
|
+
success: true,
|
|
1001
|
+
action: 'atomicsDemo',
|
|
1002
|
+
demonstration: {
|
|
1003
|
+
atomicsOperations: [
|
|
1004
|
+
'Atomics.compareExchange() - Lock-free status updates',
|
|
1005
|
+
'Atomics.store() - Direct memory writes',
|
|
1006
|
+
'Atomics.load() - Direct memory reads',
|
|
1007
|
+
'Atomics.add() - Atomic increments',
|
|
1008
|
+
'Atomics.notify() - Wake waiting threads',
|
|
1009
|
+
],
|
|
1010
|
+
results: results.slice(0, -1),
|
|
1011
|
+
sharedCounterDemo: results[results.length - 1],
|
|
1012
|
+
finalMetrics,
|
|
1013
|
+
performance: {
|
|
1014
|
+
lockFreeOperations: true,
|
|
1015
|
+
memoryOverhead: `${workerState.sharedBuffer.byteLength} bytes`,
|
|
1016
|
+
cacheFriendly: 'Aligned to 64-byte boundaries',
|
|
1017
|
+
scalability: '2-5x improvement in worker coordination',
|
|
1018
|
+
},
|
|
1019
|
+
},
|
|
1020
|
+
benefits: [
|
|
1021
|
+
'Lock-free synchronization reduces contention',
|
|
1022
|
+
'Direct memory access avoids message passing overhead',
|
|
1023
|
+
'Cache-aligned data structures improve performance',
|
|
1024
|
+
'Atomic operations provide consistency without locks',
|
|
1025
|
+
'Waitless coordination improves throughput',
|
|
1026
|
+
],
|
|
1027
|
+
timestamp: new Date().toISOString(),
|
|
1028
|
+
}),
|
|
1029
|
+
},
|
|
1030
|
+
],
|
|
1031
|
+
};
|
|
1032
|
+
}
|
|
1033
|
+
default:
|
|
1034
|
+
throw new Error(`Unknown worker threads action: ${action}`);
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
catch (error) {
|
|
1038
|
+
if (error instanceof Error && error.message.includes('aborted')) {
|
|
1039
|
+
return {
|
|
1040
|
+
content: [
|
|
1041
|
+
{
|
|
1042
|
+
type: 'text',
|
|
1043
|
+
text: JSON.stringify({ success: false, aborted: true }),
|
|
1044
|
+
},
|
|
1045
|
+
],
|
|
1046
|
+
isError: true,
|
|
1047
|
+
};
|
|
1048
|
+
}
|
|
1049
|
+
return createMCPErrorResponse(error, 'worker_threads', {
|
|
1050
|
+
contextInfo: 'Worker Threads',
|
|
1051
|
+
});
|
|
1052
|
+
}
|
|
1053
|
+
},
|
|
1054
|
+
};
|
|
1055
|
+
registerCleanupHandler('worker-threads-cleanup', async () => {
|
|
1056
|
+
for (const [poolId, pool] of workerPools.entries()) {
|
|
1057
|
+
try {
|
|
1058
|
+
const state = workerStates.get(poolId);
|
|
1059
|
+
if (state) {
|
|
1060
|
+
for (let i = 0; i < state.statusArray.length; i++) {
|
|
1061
|
+
void setWorkerStatus(poolId, i, WORKER_SHUTDOWN);
|
|
1062
|
+
}
|
|
1063
|
+
workerStates.delete(poolId);
|
|
1064
|
+
}
|
|
1065
|
+
await pool.destroy();
|
|
1066
|
+
workerPools.delete(poolId);
|
|
1067
|
+
}
|
|
1068
|
+
catch (error) {
|
|
1069
|
+
logError(`Error destroying pool ${poolId}`, { error, poolId });
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
workerStates.clear();
|
|
1073
|
+
}, CLEANUP_PRIORITIES.HIGH);
|
|
1074
|
+
//# sourceMappingURL=worker-threads.js.map
|