@exaudeus/workrail 0.8.5 → 0.9.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/README.md +157 -403
- package/dist/application/services/enhanced-loop-validator.d.ts +2 -2
- package/dist/application/services/enhanced-loop-validator.js +12 -2
- package/dist/application/services/validation-engine.d.ts +8 -29
- package/dist/application/services/validation-engine.js +38 -21
- package/dist/application/services/workflow-compiler.d.ts +18 -0
- package/dist/application/services/workflow-compiler.js +79 -0
- package/dist/application/services/workflow-interpreter.d.ts +31 -0
- package/dist/application/services/workflow-interpreter.js +280 -0
- package/dist/application/services/workflow-service.d.ts +34 -32
- package/dist/application/services/workflow-service.js +93 -425
- package/dist/application/use-cases/get-next-step.d.ts +6 -10
- package/dist/application/use-cases/get-next-step.js +2 -6
- package/dist/application/use-cases/get-workflow.d.ts +8 -6
- package/dist/application/use-cases/get-workflow.js +42 -33
- package/dist/application/use-cases/list-workflows.d.ts +3 -3
- package/dist/application/use-cases/validate-step-output.d.ts +4 -4
- package/dist/application/use-cases/validate-workflow-file.d.ts +46 -0
- package/dist/application/use-cases/validate-workflow-file.js +57 -0
- package/dist/cli/commands/cleanup.d.ts +8 -0
- package/dist/cli/commands/cleanup.js +20 -0
- package/dist/cli/commands/index.d.ts +7 -0
- package/dist/cli/commands/index.js +21 -0
- package/dist/cli/commands/init.d.ts +11 -0
- package/dist/cli/commands/init.js +49 -0
- package/dist/cli/commands/list.d.ts +9 -0
- package/dist/cli/commands/list.js +34 -0
- package/dist/cli/commands/migrate.d.ts +78 -0
- package/dist/cli/commands/migrate.js +248 -0
- package/dist/cli/commands/sources.d.ts +21 -0
- package/dist/cli/commands/sources.js +87 -0
- package/dist/cli/commands/start.d.ts +8 -0
- package/dist/cli/commands/start.js +16 -0
- package/dist/cli/commands/validate.d.ts +6 -0
- package/dist/cli/commands/validate.js +55 -0
- package/dist/cli/interpret-result.d.ts +4 -0
- package/dist/cli/interpret-result.js +24 -0
- package/dist/cli/output-formatter.d.ts +10 -0
- package/dist/cli/output-formatter.js +97 -0
- package/dist/cli/types/cli-result.d.ts +23 -0
- package/dist/cli/types/cli-result.js +30 -0
- package/dist/cli/types/exit-code.d.ts +13 -0
- package/dist/cli/types/exit-code.js +23 -0
- package/dist/cli/types/index.d.ts +4 -0
- package/dist/cli/types/index.js +11 -0
- package/dist/cli.js +84 -278
- package/dist/config/app-config.d.ts +40 -0
- package/dist/config/app-config.js +58 -0
- package/dist/config/feature-flags.d.ts +10 -2
- package/dist/config/feature-flags.js +74 -12
- package/dist/core/error-handler.d.ts +18 -27
- package/dist/core/error-handler.js +24 -218
- package/dist/di/container.d.ts +12 -0
- package/dist/di/container.js +244 -0
- package/dist/di/tokens.d.ts +40 -0
- package/dist/di/tokens.js +42 -0
- package/dist/domain/execution/error.d.ts +32 -0
- package/dist/domain/execution/error.js +24 -0
- package/dist/domain/execution/event.d.ts +7 -0
- package/dist/domain/execution/event.js +11 -0
- package/dist/domain/execution/ids.d.ts +9 -0
- package/dist/domain/execution/ids.js +9 -0
- package/dist/domain/execution/result.d.ts +3 -0
- package/dist/domain/execution/result.js +10 -0
- package/dist/domain/execution/state.d.ts +57 -0
- package/dist/domain/execution/state.js +28 -0
- package/dist/errors/app-error.d.ts +23 -0
- package/dist/errors/factories.d.ts +6 -0
- package/dist/errors/factories.js +21 -0
- package/dist/errors/formatter.d.ts +2 -0
- package/dist/errors/formatter.js +32 -0
- package/dist/errors/index.d.ts +3 -0
- package/dist/errors/index.js +7 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +10 -25
- package/dist/infrastructure/index.d.ts +0 -1
- package/dist/infrastructure/index.js +0 -1
- package/dist/infrastructure/session/DashboardHeartbeat.d.ts +8 -0
- package/dist/infrastructure/session/DashboardHeartbeat.js +39 -0
- package/dist/infrastructure/session/DashboardLockRelease.d.ts +2 -0
- package/dist/infrastructure/session/DashboardLockRelease.js +29 -0
- package/dist/infrastructure/session/HttpServer.d.ts +25 -6
- package/dist/infrastructure/session/HttpServer.js +245 -90
- package/dist/infrastructure/session/SessionDataNormalizer.js +12 -2
- package/dist/infrastructure/session/SessionDataValidator.js +12 -2
- package/dist/infrastructure/session/SessionManager.d.ts +5 -3
- package/dist/infrastructure/session/SessionManager.js +52 -6
- package/dist/infrastructure/storage/caching-workflow-storage.d.ts +30 -6
- package/dist/infrastructure/storage/caching-workflow-storage.js +105 -23
- package/dist/infrastructure/storage/enhanced-multi-source-workflow-storage.d.ts +13 -9
- package/dist/infrastructure/storage/enhanced-multi-source-workflow-storage.js +80 -54
- package/dist/infrastructure/storage/file-workflow-storage.d.ts +10 -8
- package/dist/infrastructure/storage/file-workflow-storage.js +48 -56
- package/dist/infrastructure/storage/git-workflow-storage.d.ts +7 -22
- package/dist/infrastructure/storage/git-workflow-storage.js +48 -103
- package/dist/infrastructure/storage/in-memory-storage.d.ts +10 -6
- package/dist/infrastructure/storage/in-memory-storage.js +18 -13
- package/dist/infrastructure/storage/plugin-workflow-storage.d.ts +6 -18
- package/dist/infrastructure/storage/plugin-workflow-storage.js +29 -51
- package/dist/infrastructure/storage/remote-workflow-storage.d.ts +8 -17
- package/dist/infrastructure/storage/remote-workflow-storage.js +33 -156
- package/dist/infrastructure/storage/schema-validating-workflow-storage.d.ts +21 -13
- package/dist/infrastructure/storage/schema-validating-workflow-storage.js +86 -24
- package/dist/infrastructure/storage/storage.d.ts +7 -5
- package/dist/infrastructure/storage/storage.js +7 -6
- package/dist/manifest.json +1093 -0
- package/dist/mcp/error-mapper.d.ts +9 -0
- package/dist/mcp/error-mapper.js +66 -0
- package/dist/mcp/handlers/session.d.ts +34 -0
- package/dist/mcp/handlers/session.js +135 -0
- package/dist/mcp/handlers/v2-workflow.d.ts +4 -0
- package/dist/mcp/handlers/v2-workflow.js +112 -0
- package/dist/mcp/handlers/workflow.d.ts +45 -0
- package/dist/mcp/handlers/workflow.js +167 -0
- package/dist/mcp/index.d.ts +16 -0
- package/dist/mcp/index.js +51 -0
- package/dist/mcp/output-schemas.d.ts +317 -0
- package/dist/mcp/output-schemas.js +91 -0
- package/dist/mcp/server.d.ts +3 -0
- package/dist/mcp/server.js +258 -0
- package/dist/mcp/tool-description-provider.d.ts +16 -0
- package/dist/mcp/tool-description-provider.js +43 -0
- package/dist/mcp/tool-descriptions.d.ts +2 -0
- package/dist/mcp/tool-descriptions.js +109 -0
- package/dist/mcp/tool-factory.d.ts +23 -0
- package/dist/mcp/tool-factory.js +14 -0
- package/dist/mcp/tools.d.ts +156 -0
- package/dist/mcp/tools.js +196 -0
- package/dist/mcp/types/tool-description-types.d.ts +8 -0
- package/dist/mcp/types/tool-description-types.js +24 -0
- package/dist/mcp/types.d.ts +25 -0
- package/dist/mcp/types.js +15 -0
- package/dist/mcp/v2/tool-registry.d.ts +11 -0
- package/dist/mcp/v2/tool-registry.js +26 -0
- package/dist/mcp/v2/tools.d.ts +20 -0
- package/dist/mcp/v2/tools.js +17 -0
- package/dist/mcp/validation/bounded-json.d.ts +3 -0
- package/dist/mcp/validation/bounded-json.js +22 -0
- package/dist/mcp/validation/workflow-next-prevalidate.d.ts +9 -0
- package/dist/mcp/validation/workflow-next-prevalidate.js +83 -0
- package/dist/mcp/zod-to-json-schema.d.ts +17 -0
- package/dist/mcp/zod-to-json-schema.js +134 -0
- package/dist/mcp-server.d.ts +1 -1
- package/dist/mcp-server.js +6 -424
- package/dist/runtime/adapters/in-memory-shutdown-events.d.ts +6 -0
- package/dist/runtime/adapters/in-memory-shutdown-events.js +20 -0
- package/dist/runtime/adapters/node-process-signals.d.ts +4 -0
- package/dist/runtime/adapters/node-process-signals.js +11 -0
- package/dist/runtime/adapters/node-process-terminator.d.ts +4 -0
- package/dist/runtime/adapters/node-process-terminator.js +17 -0
- package/dist/runtime/adapters/noop-process-signals.d.ts +4 -0
- package/dist/runtime/adapters/noop-process-signals.js +8 -0
- package/dist/runtime/adapters/throwing-process-terminator.d.ts +4 -0
- package/dist/runtime/adapters/throwing-process-terminator.js +9 -0
- package/dist/runtime/assert-never.d.ts +1 -0
- package/dist/runtime/assert-never.js +6 -0
- package/dist/runtime/brand.d.ts +5 -0
- package/dist/runtime/ports/process-signals.d.ts +4 -0
- package/dist/runtime/ports/process-signals.js +2 -0
- package/dist/runtime/ports/process-terminator.d.ts +8 -0
- package/dist/runtime/ports/process-terminator.js +2 -0
- package/dist/runtime/ports/shutdown-events.d.ts +11 -0
- package/dist/runtime/ports/shutdown-events.js +2 -0
- package/dist/runtime/process-lifecycle-policy.d.ts +5 -0
- package/dist/runtime/process-lifecycle-policy.js +2 -0
- package/dist/runtime/result.d.ts +17 -0
- package/dist/runtime/result.js +31 -0
- package/dist/runtime/runtime-mode.d.ts +9 -0
- package/dist/runtime/runtime-mode.js +2 -0
- package/dist/types/storage.d.ts +16 -5
- package/dist/types/storage.js +8 -0
- package/dist/types/validation.d.ts +27 -0
- package/dist/types/validation.js +10 -0
- package/dist/types/workflow-definition.d.ts +63 -0
- package/dist/types/workflow-definition.js +33 -0
- package/dist/types/workflow-source.d.ts +51 -0
- package/dist/types/workflow-source.js +128 -0
- package/dist/types/workflow.d.ts +28 -0
- package/dist/types/workflow.js +96 -0
- package/dist/utils/workflow-init.d.ts +1 -0
- package/dist/utils/workflow-init.js +38 -0
- package/dist/v2/durable-core/canonical/hashing.d.ts +11 -0
- package/dist/v2/durable-core/canonical/hashing.js +13 -0
- package/dist/v2/durable-core/canonical/jcs.d.ts +11 -0
- package/dist/v2/durable-core/canonical/jcs.js +65 -0
- package/dist/v2/durable-core/canonical/json-types.d.ts +6 -0
- package/dist/v2/durable-core/canonical/json-types.js +2 -0
- package/dist/v2/durable-core/canonical/json-zod.d.ts +2 -0
- package/dist/v2/durable-core/canonical/json-zod.js +7 -0
- package/dist/v2/durable-core/canonical/jsonl.d.ts +4 -0
- package/dist/v2/durable-core/canonical/jsonl.js +13 -0
- package/dist/v2/durable-core/ids/index.d.ts +23 -0
- package/dist/v2/durable-core/ids/index.js +46 -0
- package/dist/v2/durable-core/schemas/compiled-workflow/index.d.ts +47 -0
- package/dist/v2/durable-core/schemas/compiled-workflow/index.js +17 -0
- package/dist/v2/durable-core/schemas/session/events.d.ts +1812 -0
- package/dist/v2/durable-core/schemas/session/events.js +328 -0
- package/dist/v2/durable-core/schemas/session/index.d.ts +2 -0
- package/dist/v2/durable-core/schemas/session/index.js +8 -0
- package/dist/v2/durable-core/schemas/session/manifest.d.ts +57 -0
- package/dist/v2/durable-core/schemas/session/manifest.js +30 -0
- package/dist/v2/infra/local/crypto/index.d.ts +5 -0
- package/dist/v2/infra/local/crypto/index.js +12 -0
- package/dist/v2/infra/local/data-dir/index.d.ts +13 -0
- package/dist/v2/infra/local/data-dir/index.js +69 -0
- package/dist/v2/infra/local/fs/index.d.ts +26 -0
- package/dist/v2/infra/local/fs/index.js +156 -0
- package/dist/v2/infra/local/pinned-workflow-store/index.d.ts +11 -0
- package/dist/v2/infra/local/pinned-workflow-store/index.js +85 -0
- package/dist/v2/infra/local/session-lock/index.d.ts +12 -0
- package/dist/v2/infra/local/session-lock/index.js +44 -0
- package/dist/v2/infra/local/session-store/index.d.ts +22 -0
- package/dist/v2/infra/local/session-store/index.js +358 -0
- package/dist/v2/infra/local/sha256/index.d.ts +5 -0
- package/dist/v2/infra/local/sha256/index.js +12 -0
- package/dist/v2/ports/data-dir.port.d.ts +9 -0
- package/dist/v2/ports/data-dir.port.js +2 -0
- package/dist/v2/ports/fs.port.d.ts +41 -0
- package/dist/v2/ports/fs.port.js +2 -0
- package/dist/v2/ports/pinned-workflow-store.port.d.ts +11 -0
- package/dist/v2/ports/pinned-workflow-store.port.js +2 -0
- package/dist/v2/ports/session-event-log-store.port.d.ts +37 -0
- package/dist/v2/ports/session-event-log-store.port.js +2 -0
- package/dist/v2/ports/session-lock.port.d.ts +23 -0
- package/dist/v2/ports/session-lock.port.js +2 -0
- package/dist/v2/ports/sha256.port.d.ts +4 -0
- package/dist/v2/ports/sha256.port.js +2 -0
- package/dist/v2/projections/advance-outcomes.d.ts +23 -0
- package/dist/v2/projections/advance-outcomes.js +23 -0
- package/dist/v2/projections/capabilities.d.ts +27 -0
- package/dist/v2/projections/capabilities.js +33 -0
- package/dist/v2/projections/gaps.d.ts +29 -0
- package/dist/v2/projections/gaps.js +49 -0
- package/dist/v2/projections/node-outputs.d.ts +34 -0
- package/dist/v2/projections/node-outputs.js +73 -0
- package/dist/v2/projections/preferences.d.ts +28 -0
- package/dist/v2/projections/preferences.js +50 -0
- package/dist/v2/projections/run-dag.d.ts +42 -0
- package/dist/v2/projections/run-dag.js +186 -0
- package/dist/v2/projections/run-status-signals.d.ts +26 -0
- package/dist/v2/projections/run-status-signals.js +49 -0
- package/dist/v2/projections/session-health.d.ts +18 -0
- package/dist/v2/projections/session-health.js +15 -0
- package/dist/v2/read-only/v1-to-v2-shim.d.ts +3 -0
- package/dist/v2/read-only/v1-to-v2-shim.js +38 -0
- package/package.json +35 -10
- package/spec/mcp-api-v1.0.md +5 -5
- package/web/assets/services/data-normalizer.js +17 -2
- package/web/assets/services/pattern-recognizer.js +3 -1
- package/web/assets/services/session-data.js +13 -8
- package/web/assets/utils/formatters.js +34 -23
- package/workflows/CHANGELOG-bug-investigation.md +4 -4
- package/workflows/bug-investigation.agentic.json +156 -56
- package/workflows/coding-task-workflow-agentic.json +262 -0
- package/workflows/design-thinking-workflow-autonomous.agentic.json +215 -0
- package/workflows/design-thinking-workflow.json +198 -0
- package/workflows/mr-review-workflow.agentic.json +538 -0
- package/workflows/routines/context-gathering.json +0 -4
- package/workflows/routines/ideation.json +73 -0
- package/dist/application/app.d.ts +0 -29
- package/dist/application/app.d.ts.map +0 -1
- package/dist/application/app.js +0 -114
- package/dist/application/app.js.map +0 -1
- package/dist/application/decorators/simple-output-decorator.d.ts +0 -8
- package/dist/application/decorators/simple-output-decorator.js +0 -89
- package/dist/application/services/classification-engine.d.ts +0 -33
- package/dist/application/services/classification-engine.js +0 -258
- package/dist/application/services/compression-service.d.ts +0 -20
- package/dist/application/services/compression-service.js +0 -312
- package/dist/application/services/context-management-service.d.ts +0 -38
- package/dist/application/services/context-management-service.js +0 -301
- package/dist/application/services/context-optimizer.d.ts +0 -11
- package/dist/application/services/context-optimizer.js +0 -62
- package/dist/application/services/context-persistence-service.d.ts +0 -45
- package/dist/application/services/context-persistence-service.js +0 -273
- package/dist/application/services/documentation-service.d.ts +0 -20
- package/dist/application/services/documentation-service.js +0 -155
- package/dist/application/services/enhanced-error-service.d.ts.map +0 -1
- package/dist/application/services/enhanced-error-service.js.map +0 -1
- package/dist/application/services/loop-context-optimizer.d.ts +0 -8
- package/dist/application/services/loop-context-optimizer.js +0 -114
- package/dist/application/services/loop-execution-context.d.ts +0 -23
- package/dist/application/services/loop-execution-context.js +0 -188
- package/dist/application/services/loop-step-resolver.d.ts +0 -11
- package/dist/application/services/loop-step-resolver.js +0 -70
- package/dist/application/services/validation-engine.d.ts.map +0 -1
- package/dist/application/services/validation-engine.js.map +0 -1
- package/dist/application/services/workflow-service.d.ts.map +0 -1
- package/dist/application/services/workflow-service.js.map +0 -1
- package/dist/application/use-cases/get-next-step.d.ts.map +0 -1
- package/dist/application/use-cases/get-next-step.js.map +0 -1
- package/dist/application/use-cases/get-workflow-docs.d.ts +0 -4
- package/dist/application/use-cases/get-workflow-docs.js +0 -12
- package/dist/application/use-cases/get-workflow.d.ts.map +0 -1
- package/dist/application/use-cases/get-workflow.js.map +0 -1
- package/dist/application/use-cases/get-workrail-help.d.ts +0 -4
- package/dist/application/use-cases/get-workrail-help.js +0 -12
- package/dist/application/use-cases/list-workflows.d.ts.map +0 -1
- package/dist/application/use-cases/list-workflows.js.map +0 -1
- package/dist/application/use-cases/validate-step-output.d.ts.map +0 -1
- package/dist/application/use-cases/validate-step-output.js.map +0 -1
- package/dist/application/use-cases/validate-workflow-json.d.ts.map +0 -1
- package/dist/application/use-cases/validate-workflow-json.js.map +0 -1
- package/dist/application/validation.d.ts.map +0 -1
- package/dist/application/validation.js.map +0 -1
- package/dist/cli/migrate-workflow.d.ts +0 -22
- package/dist/cli/migrate-workflow.js +0 -196
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/container.d.ts +0 -15
- package/dist/container.d.ts.map +0 -1
- package/dist/container.js +0 -25
- package/dist/container.js.map +0 -1
- package/dist/core/error-handler.d.ts.map +0 -1
- package/dist/core/error-handler.js.map +0 -1
- package/dist/domain/index.d.ts +0 -2
- package/dist/domain/index.d.ts.map +0 -1
- package/dist/domain/index.js +0 -18
- package/dist/domain/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/infrastructure/index.d.ts.map +0 -1
- package/dist/infrastructure/index.js.map +0 -1
- package/dist/infrastructure/rpc/handler.d.ts +0 -17
- package/dist/infrastructure/rpc/handler.d.ts.map +0 -1
- package/dist/infrastructure/rpc/handler.js +0 -78
- package/dist/infrastructure/rpc/handler.js.map +0 -1
- package/dist/infrastructure/rpc/index.d.ts +0 -1
- package/dist/infrastructure/rpc/index.d.ts.map +0 -1
- package/dist/infrastructure/rpc/index.js +0 -17
- package/dist/infrastructure/rpc/index.js.map +0 -1
- package/dist/infrastructure/rpc/server.d.ts +0 -3
- package/dist/infrastructure/rpc/server.d.ts.map +0 -1
- package/dist/infrastructure/rpc/server.js +0 -37
- package/dist/infrastructure/rpc/server.js.map +0 -1
- package/dist/infrastructure/storage/caching-workflow-storage.d.ts.map +0 -1
- package/dist/infrastructure/storage/caching-workflow-storage.js.map +0 -1
- package/dist/infrastructure/storage/context-storage.d.ts +0 -150
- package/dist/infrastructure/storage/context-storage.js +0 -40
- package/dist/infrastructure/storage/file-workflow-storage.d.ts.map +0 -1
- package/dist/infrastructure/storage/file-workflow-storage.js.map +0 -1
- package/dist/infrastructure/storage/filesystem-blob-storage.d.ts +0 -27
- package/dist/infrastructure/storage/filesystem-blob-storage.js +0 -363
- package/dist/infrastructure/storage/git-workflow-storage.d.ts.map +0 -1
- package/dist/infrastructure/storage/git-workflow-storage.js.map +0 -1
- package/dist/infrastructure/storage/hybrid-context-storage.d.ts +0 -29
- package/dist/infrastructure/storage/hybrid-context-storage.js +0 -400
- package/dist/infrastructure/storage/in-memory-storage.d.ts.map +0 -1
- package/dist/infrastructure/storage/in-memory-storage.js.map +0 -1
- package/dist/infrastructure/storage/index.d.ts.map +0 -1
- package/dist/infrastructure/storage/index.js.map +0 -1
- package/dist/infrastructure/storage/migrations/001_initial_schema.sql +0 -38
- package/dist/infrastructure/storage/migrations/002_context_concurrency_enhancements.sql +0 -234
- package/dist/infrastructure/storage/migrations/003_classification_overrides.sql +0 -20
- package/dist/infrastructure/storage/multi-directory-workflow-storage.d.ts +0 -32
- package/dist/infrastructure/storage/multi-directory-workflow-storage.d.ts.map +0 -1
- package/dist/infrastructure/storage/multi-directory-workflow-storage.js +0 -184
- package/dist/infrastructure/storage/multi-directory-workflow-storage.js.map +0 -1
- package/dist/infrastructure/storage/plugin-workflow-storage.d.ts.map +0 -1
- package/dist/infrastructure/storage/plugin-workflow-storage.js.map +0 -1
- package/dist/infrastructure/storage/remote-workflow-storage.d.ts.map +0 -1
- package/dist/infrastructure/storage/remote-workflow-storage.js.map +0 -1
- package/dist/infrastructure/storage/schema-validating-workflow-storage.d.ts.map +0 -1
- package/dist/infrastructure/storage/schema-validating-workflow-storage.js.map +0 -1
- package/dist/infrastructure/storage/sqlite-metadata-storage.d.ts +0 -35
- package/dist/infrastructure/storage/sqlite-metadata-storage.js +0 -410
- package/dist/infrastructure/storage/sqlite-migrator.d.ts +0 -46
- package/dist/infrastructure/storage/sqlite-migrator.js +0 -293
- package/dist/infrastructure/storage/storage.d.ts.map +0 -1
- package/dist/infrastructure/storage/storage.js.map +0 -1
- package/dist/mcp-server.d.ts.map +0 -1
- package/dist/mcp-server.js.map +0 -1
- package/dist/tools/mcp_initialize.d.ts +0 -2
- package/dist/tools/mcp_initialize.d.ts.map +0 -1
- package/dist/tools/mcp_initialize.js +0 -45
- package/dist/tools/mcp_initialize.js.map +0 -1
- package/dist/tools/mcp_shutdown.d.ts +0 -2
- package/dist/tools/mcp_shutdown.d.ts.map +0 -1
- package/dist/tools/mcp_shutdown.js +0 -10
- package/dist/tools/mcp_shutdown.js.map +0 -1
- package/dist/tools/mcp_tools_list.d.ts +0 -2
- package/dist/tools/mcp_tools_list.d.ts.map +0 -1
- package/dist/tools/mcp_tools_list.js +0 -60
- package/dist/tools/mcp_tools_list.js.map +0 -1
- package/dist/tools/session-tools.d.ts +0 -5
- package/dist/tools/session-tools.js +0 -270
- package/dist/types/context-types.d.ts +0 -236
- package/dist/types/context-types.js +0 -10
- package/dist/types/documentation-types.d.ts +0 -37
- package/dist/types/loop-context-optimizer.d.ts +0 -7
- package/dist/types/mcp-types.d.ts +0 -273
- package/dist/types/mcp-types.d.ts.map +0 -1
- package/dist/types/mcp-types.js +0 -19
- package/dist/types/mcp-types.js.map +0 -1
- package/dist/types/server.d.ts.map +0 -1
- package/dist/types/server.js.map +0 -1
- package/dist/types/storage.d.ts.map +0 -1
- package/dist/types/storage.js.map +0 -1
- package/dist/types/workflow-types.d.ts +0 -336
- package/dist/types/workflow-types.d.ts.map +0 -1
- package/dist/types/workflow-types.js +0 -20
- package/dist/types/workflow-types.js.map +0 -1
- package/dist/utils/condition-evaluator.d.ts.map +0 -1
- package/dist/utils/condition-evaluator.js.map +0 -1
- package/dist/utils/config.d.ts +0 -149
- package/dist/utils/config.d.ts.map +0 -1
- package/dist/utils/config.js +0 -251
- package/dist/utils/config.js.map +0 -1
- package/dist/utils/storage-security.d.ts.map +0 -1
- package/dist/utils/storage-security.js.map +0 -1
- package/dist/validation/request-validator.d.ts +0 -8
- package/dist/validation/request-validator.d.ts.map +0 -1
- package/dist/validation/request-validator.js +0 -32
- package/dist/validation/request-validator.js.map +0 -1
- package/dist/validation/response-validator.d.ts +0 -8
- package/dist/validation/response-validator.d.ts.map +0 -1
- package/dist/validation/response-validator.js +0 -110
- package/dist/validation/response-validator.js.map +0 -1
- package/dist/validation/schemas.d.ts +0 -1
- package/dist/validation/schemas.d.ts.map +0 -1
- package/dist/validation/schemas.js +0 -53
- package/dist/validation/schemas.js.map +0 -1
- /package/dist/{types/documentation-types.js → errors/app-error.js} +0 -0
- /package/dist/{types/loop-context-optimizer.js → runtime/brand.js} +0 -0
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StaticFeatureFlagProvider = exports.EnvironmentFeatureFlagProvider = exports.FEATURE_FLAG_DEFINITIONS = void 0;
|
|
12
|
+
exports.StaticFeatureFlagProvider = exports.CustomEnvFeatureFlagProvider = exports.EnvironmentFeatureFlagProvider = exports.FEATURE_FLAG_DEFINITIONS = void 0;
|
|
4
13
|
exports.createFeatureFlagProvider = createFeatureFlagProvider;
|
|
14
|
+
const tsyringe_1 = require("tsyringe");
|
|
5
15
|
exports.FEATURE_FLAG_DEFINITIONS = [
|
|
6
16
|
{
|
|
7
17
|
key: 'sessionTools',
|
|
@@ -35,6 +45,22 @@ exports.FEATURE_FLAG_DEFINITIONS = [
|
|
|
35
45
|
since: '0.8.3',
|
|
36
46
|
stable: false,
|
|
37
47
|
},
|
|
48
|
+
{
|
|
49
|
+
key: 'authoritativeDescriptions',
|
|
50
|
+
envVar: 'WORKRAIL_AUTHORITATIVE_DESCRIPTIONS',
|
|
51
|
+
defaultValue: false,
|
|
52
|
+
description: 'Use imperative/mandatory language in tool descriptions to improve agent workflow compliance',
|
|
53
|
+
since: '0.9.0',
|
|
54
|
+
stable: false,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
key: 'v2Tools',
|
|
58
|
+
envVar: 'WORKRAIL_ENABLE_V2_TOOLS',
|
|
59
|
+
defaultValue: false,
|
|
60
|
+
description: 'Enable WorkRail v2 MCP tools (Slice 1: list_workflows, inspect_workflow) behind an explicit opt-in flag',
|
|
61
|
+
since: '0.9.0',
|
|
62
|
+
stable: false,
|
|
63
|
+
},
|
|
38
64
|
];
|
|
39
65
|
function parseBoolean(value, defaultValue) {
|
|
40
66
|
if (value === undefined) {
|
|
@@ -54,14 +80,17 @@ function parseBoolean(value, defaultValue) {
|
|
|
54
80
|
`Using default: ${defaultValue}`);
|
|
55
81
|
return defaultValue;
|
|
56
82
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
83
|
+
function buildFlags(envSource) {
|
|
84
|
+
const flags = {};
|
|
85
|
+
for (const definition of exports.FEATURE_FLAG_DEFINITIONS) {
|
|
86
|
+
const envValue = envSource[definition.envVar];
|
|
87
|
+
flags[definition.key] = parseBoolean(envValue, definition.defaultValue);
|
|
88
|
+
}
|
|
89
|
+
return flags;
|
|
90
|
+
}
|
|
91
|
+
let EnvironmentFeatureFlagProvider = class EnvironmentFeatureFlagProvider {
|
|
92
|
+
constructor() {
|
|
93
|
+
this.flags = buildFlags(process.env);
|
|
65
94
|
const enabledExperimental = exports.FEATURE_FLAG_DEFINITIONS
|
|
66
95
|
.filter(def => !def.stable && this.flags[def.key])
|
|
67
96
|
.map(def => def.key);
|
|
@@ -69,6 +98,9 @@ class EnvironmentFeatureFlagProvider {
|
|
|
69
98
|
console.error(`[FeatureFlags] Experimental features enabled: ${enabledExperimental.join(', ')}`);
|
|
70
99
|
}
|
|
71
100
|
}
|
|
101
|
+
static withEnv(env) {
|
|
102
|
+
return new CustomEnvFeatureFlagProvider(env);
|
|
103
|
+
}
|
|
72
104
|
isEnabled(key) {
|
|
73
105
|
return this.flags[key] ?? false;
|
|
74
106
|
}
|
|
@@ -87,8 +119,36 @@ class EnvironmentFeatureFlagProvider {
|
|
|
87
119
|
}
|
|
88
120
|
return lines.join('\n');
|
|
89
121
|
}
|
|
90
|
-
}
|
|
122
|
+
};
|
|
91
123
|
exports.EnvironmentFeatureFlagProvider = EnvironmentFeatureFlagProvider;
|
|
124
|
+
exports.EnvironmentFeatureFlagProvider = EnvironmentFeatureFlagProvider = __decorate([
|
|
125
|
+
(0, tsyringe_1.singleton)(),
|
|
126
|
+
__metadata("design:paramtypes", [])
|
|
127
|
+
], EnvironmentFeatureFlagProvider);
|
|
128
|
+
class CustomEnvFeatureFlagProvider {
|
|
129
|
+
constructor(env) {
|
|
130
|
+
this.flags = buildFlags(env);
|
|
131
|
+
}
|
|
132
|
+
isEnabled(key) {
|
|
133
|
+
return this.flags[key] ?? false;
|
|
134
|
+
}
|
|
135
|
+
getAll() {
|
|
136
|
+
return { ...this.flags };
|
|
137
|
+
}
|
|
138
|
+
getSummary() {
|
|
139
|
+
const lines = ['Feature Flags:'];
|
|
140
|
+
for (const definition of exports.FEATURE_FLAG_DEFINITIONS) {
|
|
141
|
+
const enabled = this.flags[definition.key];
|
|
142
|
+
const status = enabled ? '✓ ENABLED' : '✗ DISABLED';
|
|
143
|
+
const stability = definition.stable ? '[STABLE]' : '[EXPERIMENTAL]';
|
|
144
|
+
lines.push(` ${status} ${stability} ${definition.key}`);
|
|
145
|
+
lines.push(` ${definition.description}`);
|
|
146
|
+
lines.push(` env: ${definition.envVar}`);
|
|
147
|
+
}
|
|
148
|
+
return lines.join('\n');
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
exports.CustomEnvFeatureFlagProvider = CustomEnvFeatureFlagProvider;
|
|
92
152
|
class StaticFeatureFlagProvider {
|
|
93
153
|
constructor(flags = {}) {
|
|
94
154
|
this.flags = flags;
|
|
@@ -109,6 +169,8 @@ class StaticFeatureFlagProvider {
|
|
|
109
169
|
}
|
|
110
170
|
}
|
|
111
171
|
exports.StaticFeatureFlagProvider = StaticFeatureFlagProvider;
|
|
112
|
-
function createFeatureFlagProvider(
|
|
113
|
-
|
|
172
|
+
function createFeatureFlagProvider() {
|
|
173
|
+
throw new Error('createFeatureFlagProvider() is removed. ' +
|
|
174
|
+
'Use DI: container.resolve(DI.Infra.FeatureFlags). ' +
|
|
175
|
+
'For tests: EnvironmentFeatureFlagProvider.withEnv(customEnv)');
|
|
114
176
|
}
|
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
export declare enum MCPErrorCodes {
|
|
2
|
+
PARSE_ERROR = -32700,
|
|
3
|
+
INVALID_REQUEST = -32600,
|
|
4
|
+
METHOD_NOT_FOUND = -32601,
|
|
5
|
+
INVALID_PARAMS = -32602,
|
|
6
|
+
INTERNAL_ERROR = -32603,
|
|
7
|
+
SERVER_ERROR = -32000,
|
|
8
|
+
WORKFLOW_NOT_FOUND = -32001,
|
|
9
|
+
INVALID_WORKFLOW = -32002,
|
|
10
|
+
STEP_NOT_FOUND = -32003,
|
|
11
|
+
VALIDATION_ERROR = -32004,
|
|
12
|
+
STATE_ERROR = -32005,
|
|
13
|
+
STORAGE_ERROR = -32006,
|
|
14
|
+
SECURITY_ERROR = -32007
|
|
15
|
+
}
|
|
2
16
|
export declare class MCPError extends Error {
|
|
3
17
|
readonly code: number;
|
|
4
|
-
readonly data?:
|
|
5
|
-
constructor(code: number, message: string, data?:
|
|
18
|
+
readonly data?: unknown;
|
|
19
|
+
constructor(code: number, message: string, data?: unknown);
|
|
6
20
|
}
|
|
7
21
|
export declare class WorkflowNotFoundError extends MCPError {
|
|
8
22
|
constructor(workflowId: string);
|
|
@@ -14,7 +28,7 @@ export declare class StepNotFoundError extends MCPError {
|
|
|
14
28
|
constructor(stepId: string, workflowId?: string);
|
|
15
29
|
}
|
|
16
30
|
export declare class ValidationError extends MCPError {
|
|
17
|
-
constructor(message: string, field?: string, details?:
|
|
31
|
+
constructor(message: string, field?: string, details?: unknown);
|
|
18
32
|
}
|
|
19
33
|
export declare class StateError extends MCPError {
|
|
20
34
|
constructor(message: string, executionId?: string);
|
|
@@ -25,26 +39,3 @@ export declare class StorageError extends MCPError {
|
|
|
25
39
|
export declare class SecurityError extends MCPError {
|
|
26
40
|
constructor(message: string, action?: string);
|
|
27
41
|
}
|
|
28
|
-
export declare class ErrorHandler {
|
|
29
|
-
private static instance;
|
|
30
|
-
private constructor();
|
|
31
|
-
static getInstance(): ErrorHandler;
|
|
32
|
-
handleError(error: Error, requestId: string | number | null): JSONRPCResponse;
|
|
33
|
-
private convertToMCPError;
|
|
34
|
-
private logError;
|
|
35
|
-
createParseError(): JSONRPCResponse;
|
|
36
|
-
createInvalidRequestError(requestId: string | number | null): JSONRPCResponse;
|
|
37
|
-
createMethodNotFoundError(method: string, requestId: string | number | null): JSONRPCResponse;
|
|
38
|
-
createInvalidParamsError(details: string, requestId: string | number | null): JSONRPCResponse;
|
|
39
|
-
sanitizeErrorData(data: any): any;
|
|
40
|
-
getErrorRecoverySuggestions(error: MCPError): string[];
|
|
41
|
-
isRecoverableError(error: MCPError): boolean;
|
|
42
|
-
getErrorSeverity(error: MCPError): 'low' | 'medium' | 'high' | 'critical';
|
|
43
|
-
}
|
|
44
|
-
export declare const errorHandler: ErrorHandler;
|
|
45
|
-
export declare function createErrorResponse(code: number, message: string, requestId: string | number | null, data?: any): JSONRPCResponse;
|
|
46
|
-
export declare function withErrorHandling<T extends any[], R>(fn: (...args: T) => Promise<R>, requestId: string | number | null): (...args: T) => Promise<R | JSONRPCResponse>;
|
|
47
|
-
export declare function validateRequest(request: any): {
|
|
48
|
-
valid: boolean;
|
|
49
|
-
error?: JSONRPCResponse;
|
|
50
|
-
};
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
exports.SecurityError = exports.StorageError = exports.StateError = exports.ValidationError = exports.StepNotFoundError = exports.InvalidWorkflowError = exports.WorkflowNotFoundError = exports.MCPError = exports.MCPErrorCodes = void 0;
|
|
4
|
+
var MCPErrorCodes;
|
|
5
|
+
(function (MCPErrorCodes) {
|
|
6
|
+
MCPErrorCodes[MCPErrorCodes["PARSE_ERROR"] = -32700] = "PARSE_ERROR";
|
|
7
|
+
MCPErrorCodes[MCPErrorCodes["INVALID_REQUEST"] = -32600] = "INVALID_REQUEST";
|
|
8
|
+
MCPErrorCodes[MCPErrorCodes["METHOD_NOT_FOUND"] = -32601] = "METHOD_NOT_FOUND";
|
|
9
|
+
MCPErrorCodes[MCPErrorCodes["INVALID_PARAMS"] = -32602] = "INVALID_PARAMS";
|
|
10
|
+
MCPErrorCodes[MCPErrorCodes["INTERNAL_ERROR"] = -32603] = "INTERNAL_ERROR";
|
|
11
|
+
MCPErrorCodes[MCPErrorCodes["SERVER_ERROR"] = -32000] = "SERVER_ERROR";
|
|
12
|
+
MCPErrorCodes[MCPErrorCodes["WORKFLOW_NOT_FOUND"] = -32001] = "WORKFLOW_NOT_FOUND";
|
|
13
|
+
MCPErrorCodes[MCPErrorCodes["INVALID_WORKFLOW"] = -32002] = "INVALID_WORKFLOW";
|
|
14
|
+
MCPErrorCodes[MCPErrorCodes["STEP_NOT_FOUND"] = -32003] = "STEP_NOT_FOUND";
|
|
15
|
+
MCPErrorCodes[MCPErrorCodes["VALIDATION_ERROR"] = -32004] = "VALIDATION_ERROR";
|
|
16
|
+
MCPErrorCodes[MCPErrorCodes["STATE_ERROR"] = -32005] = "STATE_ERROR";
|
|
17
|
+
MCPErrorCodes[MCPErrorCodes["STORAGE_ERROR"] = -32006] = "STORAGE_ERROR";
|
|
18
|
+
MCPErrorCodes[MCPErrorCodes["SECURITY_ERROR"] = -32007] = "SECURITY_ERROR";
|
|
19
|
+
})(MCPErrorCodes || (exports.MCPErrorCodes = MCPErrorCodes = {}));
|
|
8
20
|
class MCPError extends Error {
|
|
9
21
|
constructor(code, message, data) {
|
|
10
22
|
super(message);
|
|
@@ -16,256 +28,50 @@ class MCPError extends Error {
|
|
|
16
28
|
exports.MCPError = MCPError;
|
|
17
29
|
class WorkflowNotFoundError extends MCPError {
|
|
18
30
|
constructor(workflowId) {
|
|
19
|
-
super(
|
|
31
|
+
super(MCPErrorCodes.WORKFLOW_NOT_FOUND, `Workflow with id '${workflowId}' not found`, { workflowId });
|
|
20
32
|
this.name = 'WorkflowNotFoundError';
|
|
21
33
|
}
|
|
22
34
|
}
|
|
23
35
|
exports.WorkflowNotFoundError = WorkflowNotFoundError;
|
|
24
36
|
class InvalidWorkflowError extends MCPError {
|
|
25
37
|
constructor(workflowId, details) {
|
|
26
|
-
super(
|
|
38
|
+
super(MCPErrorCodes.INVALID_WORKFLOW, `Invalid workflow: ${workflowId}`, { workflowId, details });
|
|
27
39
|
this.name = 'InvalidWorkflowError';
|
|
28
40
|
}
|
|
29
41
|
}
|
|
30
42
|
exports.InvalidWorkflowError = InvalidWorkflowError;
|
|
31
43
|
class StepNotFoundError extends MCPError {
|
|
32
44
|
constructor(stepId, workflowId) {
|
|
33
|
-
super(
|
|
45
|
+
super(MCPErrorCodes.STEP_NOT_FOUND, `Step with id '${stepId}' not found in workflow`, { stepId, workflowId });
|
|
34
46
|
this.name = 'StepNotFoundError';
|
|
35
47
|
}
|
|
36
48
|
}
|
|
37
49
|
exports.StepNotFoundError = StepNotFoundError;
|
|
38
50
|
class ValidationError extends MCPError {
|
|
39
51
|
constructor(message, field, details) {
|
|
40
|
-
super(
|
|
52
|
+
super(MCPErrorCodes.VALIDATION_ERROR, message, { field, details });
|
|
41
53
|
this.name = 'ValidationError';
|
|
42
54
|
}
|
|
43
55
|
}
|
|
44
56
|
exports.ValidationError = ValidationError;
|
|
45
57
|
class StateError extends MCPError {
|
|
46
58
|
constructor(message, executionId) {
|
|
47
|
-
super(
|
|
59
|
+
super(MCPErrorCodes.STATE_ERROR, message, { executionId });
|
|
48
60
|
this.name = 'StateError';
|
|
49
61
|
}
|
|
50
62
|
}
|
|
51
63
|
exports.StateError = StateError;
|
|
52
64
|
class StorageError extends MCPError {
|
|
53
65
|
constructor(message, operation) {
|
|
54
|
-
super(
|
|
66
|
+
super(MCPErrorCodes.STORAGE_ERROR, message, { operation });
|
|
55
67
|
this.name = 'StorageError';
|
|
56
68
|
}
|
|
57
69
|
}
|
|
58
70
|
exports.StorageError = StorageError;
|
|
59
71
|
class SecurityError extends MCPError {
|
|
60
72
|
constructor(message, action) {
|
|
61
|
-
super(
|
|
73
|
+
super(MCPErrorCodes.SECURITY_ERROR, message, { action });
|
|
62
74
|
this.name = 'SecurityError';
|
|
63
75
|
}
|
|
64
76
|
}
|
|
65
77
|
exports.SecurityError = SecurityError;
|
|
66
|
-
class ErrorHandler {
|
|
67
|
-
constructor() {
|
|
68
|
-
}
|
|
69
|
-
static getInstance() {
|
|
70
|
-
if (!ErrorHandler.instance) {
|
|
71
|
-
ErrorHandler.instance = new ErrorHandler();
|
|
72
|
-
}
|
|
73
|
-
return ErrorHandler.instance;
|
|
74
|
-
}
|
|
75
|
-
handleError(error, requestId) {
|
|
76
|
-
let mcpError;
|
|
77
|
-
if (error instanceof MCPError) {
|
|
78
|
-
mcpError = error;
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
mcpError = this.convertToMCPError(error);
|
|
82
|
-
}
|
|
83
|
-
this.logError(mcpError);
|
|
84
|
-
const errorResponse = {
|
|
85
|
-
jsonrpc: "2.0",
|
|
86
|
-
id: requestId,
|
|
87
|
-
error: {
|
|
88
|
-
code: mcpError.code,
|
|
89
|
-
message: mcpError.message,
|
|
90
|
-
data: mcpError.data
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
return errorResponse;
|
|
94
|
-
}
|
|
95
|
-
convertToMCPError(error) {
|
|
96
|
-
return new MCPError(mcp_types_1.MCPErrorCodes.INTERNAL_ERROR, error.message || 'Internal server error', { originalError: error.name });
|
|
97
|
-
}
|
|
98
|
-
logError(error) {
|
|
99
|
-
const logEntry = {
|
|
100
|
-
timestamp: new Date(),
|
|
101
|
-
level: 'error',
|
|
102
|
-
error: {
|
|
103
|
-
name: error.name,
|
|
104
|
-
code: error.code,
|
|
105
|
-
message: error.message,
|
|
106
|
-
data: error.data,
|
|
107
|
-
stack: error.stack
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
console.error('MCP Error:', logEntry);
|
|
111
|
-
}
|
|
112
|
-
createParseError() {
|
|
113
|
-
return {
|
|
114
|
-
jsonrpc: "2.0",
|
|
115
|
-
id: null,
|
|
116
|
-
error: {
|
|
117
|
-
code: mcp_types_1.MCPErrorCodes.PARSE_ERROR,
|
|
118
|
-
message: "Parse error",
|
|
119
|
-
data: { details: "Invalid JSON was received" }
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
createInvalidRequestError(requestId) {
|
|
124
|
-
return {
|
|
125
|
-
jsonrpc: "2.0",
|
|
126
|
-
id: requestId,
|
|
127
|
-
error: {
|
|
128
|
-
code: mcp_types_1.MCPErrorCodes.INVALID_REQUEST,
|
|
129
|
-
message: "Invalid Request",
|
|
130
|
-
data: { details: "The JSON sent is not a valid Request object" }
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
createMethodNotFoundError(method, requestId) {
|
|
135
|
-
return {
|
|
136
|
-
jsonrpc: "2.0",
|
|
137
|
-
id: requestId,
|
|
138
|
-
error: {
|
|
139
|
-
code: mcp_types_1.MCPErrorCodes.METHOD_NOT_FOUND,
|
|
140
|
-
message: "Method not found",
|
|
141
|
-
data: { method }
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
createInvalidParamsError(details, requestId) {
|
|
146
|
-
return {
|
|
147
|
-
jsonrpc: "2.0",
|
|
148
|
-
id: requestId,
|
|
149
|
-
error: {
|
|
150
|
-
code: mcp_types_1.MCPErrorCodes.INVALID_PARAMS,
|
|
151
|
-
message: "Invalid params",
|
|
152
|
-
data: { details }
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
sanitizeErrorData(data) {
|
|
157
|
-
if (!data)
|
|
158
|
-
return undefined;
|
|
159
|
-
const sanitized = { ...data };
|
|
160
|
-
const sensitiveKeys = ['password', 'token', 'secret', 'key', 'authorization'];
|
|
161
|
-
for (const key of sensitiveKeys) {
|
|
162
|
-
if (sanitized[key]) {
|
|
163
|
-
sanitized[key] = '[REDACTED]';
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
return sanitized;
|
|
167
|
-
}
|
|
168
|
-
getErrorRecoverySuggestions(error) {
|
|
169
|
-
const suggestions = [];
|
|
170
|
-
switch (error.code) {
|
|
171
|
-
case mcp_types_1.MCPErrorCodes.WORKFLOW_NOT_FOUND:
|
|
172
|
-
suggestions.push("Check if the workflow ID is correct", "Verify the workflow exists in the storage", "Try listing available workflows first");
|
|
173
|
-
break;
|
|
174
|
-
case mcp_types_1.MCPErrorCodes.INVALID_WORKFLOW:
|
|
175
|
-
suggestions.push("Validate the workflow JSON against the schema", "Check for required fields and proper formatting", "Ensure all step IDs are unique");
|
|
176
|
-
break;
|
|
177
|
-
case mcp_types_1.MCPErrorCodes.STEP_NOT_FOUND:
|
|
178
|
-
suggestions.push("Verify the step ID exists in the workflow", "Check the workflow definition for the correct step ID", "Ensure the workflow is properly loaded");
|
|
179
|
-
break;
|
|
180
|
-
case mcp_types_1.MCPErrorCodes.VALIDATION_ERROR:
|
|
181
|
-
suggestions.push("Check the input parameters against the schema", "Verify all required fields are provided", "Ensure data types match the expected format");
|
|
182
|
-
break;
|
|
183
|
-
case mcp_types_1.MCPErrorCodes.STATE_ERROR:
|
|
184
|
-
suggestions.push("Check if the workflow execution exists", "Verify the execution state is valid", "Try restarting the workflow execution");
|
|
185
|
-
break;
|
|
186
|
-
case mcp_types_1.MCPErrorCodes.STORAGE_ERROR:
|
|
187
|
-
suggestions.push("Check file system permissions", "Verify storage path is accessible", "Ensure sufficient disk space");
|
|
188
|
-
break;
|
|
189
|
-
case mcp_types_1.MCPErrorCodes.SECURITY_ERROR:
|
|
190
|
-
suggestions.push("Verify authentication credentials", "Check API key permissions", "Ensure proper authorization");
|
|
191
|
-
break;
|
|
192
|
-
default:
|
|
193
|
-
suggestions.push("Check the server logs for more details", "Verify the request format is correct", "Try the request again");
|
|
194
|
-
}
|
|
195
|
-
return suggestions;
|
|
196
|
-
}
|
|
197
|
-
isRecoverableError(error) {
|
|
198
|
-
const recoverableCodes = [
|
|
199
|
-
mcp_types_1.MCPErrorCodes.WORKFLOW_NOT_FOUND,
|
|
200
|
-
mcp_types_1.MCPErrorCodes.STEP_NOT_FOUND,
|
|
201
|
-
mcp_types_1.MCPErrorCodes.VALIDATION_ERROR,
|
|
202
|
-
mcp_types_1.MCPErrorCodes.INVALID_PARAMS
|
|
203
|
-
];
|
|
204
|
-
return recoverableCodes.includes(error.code);
|
|
205
|
-
}
|
|
206
|
-
getErrorSeverity(error) {
|
|
207
|
-
switch (error.code) {
|
|
208
|
-
case mcp_types_1.MCPErrorCodes.PARSE_ERROR:
|
|
209
|
-
case mcp_types_1.MCPErrorCodes.INVALID_REQUEST:
|
|
210
|
-
return 'low';
|
|
211
|
-
case mcp_types_1.MCPErrorCodes.METHOD_NOT_FOUND:
|
|
212
|
-
case mcp_types_1.MCPErrorCodes.INVALID_PARAMS:
|
|
213
|
-
case mcp_types_1.MCPErrorCodes.WORKFLOW_NOT_FOUND:
|
|
214
|
-
case mcp_types_1.MCPErrorCodes.STEP_NOT_FOUND:
|
|
215
|
-
case mcp_types_1.MCPErrorCodes.VALIDATION_ERROR:
|
|
216
|
-
return 'medium';
|
|
217
|
-
case mcp_types_1.MCPErrorCodes.STATE_ERROR:
|
|
218
|
-
case mcp_types_1.MCPErrorCodes.STORAGE_ERROR:
|
|
219
|
-
return 'high';
|
|
220
|
-
case mcp_types_1.MCPErrorCodes.INTERNAL_ERROR:
|
|
221
|
-
case mcp_types_1.MCPErrorCodes.SECURITY_ERROR:
|
|
222
|
-
return 'critical';
|
|
223
|
-
default:
|
|
224
|
-
return 'medium';
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
exports.ErrorHandler = ErrorHandler;
|
|
229
|
-
exports.errorHandler = ErrorHandler.getInstance();
|
|
230
|
-
function createErrorResponse(code, message, requestId, data) {
|
|
231
|
-
return {
|
|
232
|
-
jsonrpc: "2.0",
|
|
233
|
-
id: requestId,
|
|
234
|
-
error: {
|
|
235
|
-
code,
|
|
236
|
-
message,
|
|
237
|
-
data: exports.errorHandler.sanitizeErrorData(data)
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
function withErrorHandling(fn, requestId) {
|
|
242
|
-
return async (...args) => {
|
|
243
|
-
try {
|
|
244
|
-
return await fn(...args);
|
|
245
|
-
}
|
|
246
|
-
catch (error) {
|
|
247
|
-
return exports.errorHandler.handleError(error, requestId);
|
|
248
|
-
}
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
function validateRequest(request) {
|
|
252
|
-
if (!request || typeof request !== 'object') {
|
|
253
|
-
return {
|
|
254
|
-
valid: false,
|
|
255
|
-
error: exports.errorHandler.createInvalidRequestError(null)
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
if (request.jsonrpc !== "2.0") {
|
|
259
|
-
return {
|
|
260
|
-
valid: false,
|
|
261
|
-
error: exports.errorHandler.createInvalidRequestError(request.id)
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
if (!request.method || typeof request.method !== 'string') {
|
|
265
|
-
return {
|
|
266
|
-
valid: false,
|
|
267
|
-
error: exports.errorHandler.createInvalidRequestError(request.id)
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
return { valid: true };
|
|
271
|
-
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { container } from 'tsyringe';
|
|
3
|
+
import type { RuntimeMode } from '../runtime/runtime-mode.js';
|
|
4
|
+
export interface ContainerInitOptions {
|
|
5
|
+
readonly runtimeMode?: RuntimeMode;
|
|
6
|
+
}
|
|
7
|
+
export declare function initializeContainer(options?: ContainerInitOptions): Promise<void>;
|
|
8
|
+
export declare function startAsyncServices(): Promise<void>;
|
|
9
|
+
export declare function bootstrap(options?: ContainerInitOptions): Promise<void>;
|
|
10
|
+
export declare function resetContainer(): void;
|
|
11
|
+
export declare function isInitialized(): boolean;
|
|
12
|
+
export { container };
|