@exaudeus/workrail 0.8.6 → 0.10.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 +45 -39
- 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 +1117 -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/ids/with-healthy-session-lock.d.ts +7 -0
- package/dist/v2/durable-core/ids/with-healthy-session-lock.js +2 -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 +332 -0
- package/dist/v2/durable-core/schemas/session/index.d.ts +3 -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/durable-core/schemas/session/session-health.d.ts +25 -0
- package/dist/v2/durable-core/schemas/session/session-health.js +2 -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 +23 -0
- package/dist/v2/infra/local/session-store/index.js +473 -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 +49 -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 +4 -0
- package/dist/v2/projections/session-health.js +12 -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/dist/v2/usecases/execution-session-gate.d.ts +53 -0
- package/dist/v2/usecases/execution-session-gate.js +167 -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/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/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
package/dist/mcp-server.js
CHANGED
|
@@ -1,429 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
this.httpServer = null;
|
|
44
|
-
this.container = container ?? (0, container_js_1.createAppContainer)();
|
|
45
|
-
this.featureFlags = this.container.featureFlags;
|
|
46
|
-
if (this.featureFlags.isEnabled('sessionTools')) {
|
|
47
|
-
this.sessionManager = new index_js_1.SessionManager();
|
|
48
|
-
this.httpServer = new index_js_1.HttpServer(this.sessionManager, { autoOpen: false });
|
|
49
|
-
this.sessionTools = (0, session_tools_js_1.createSessionTools)(this.sessionManager, this.httpServer);
|
|
50
|
-
console.error('[FeatureFlags] Session tools enabled');
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
this.sessionTools = [];
|
|
54
|
-
console.error('[FeatureFlags] Session tools disabled (enable with WORKRAIL_ENABLE_SESSION_TOOLS=true)');
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
async initialize() {
|
|
58
|
-
if (this.featureFlags.isEnabled('sessionTools') && this.httpServer) {
|
|
59
|
-
await this.httpServer.start();
|
|
60
|
-
console.error('[FeatureFlags] Dashboard server started');
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
getSessionTools() {
|
|
64
|
-
return this.sessionTools;
|
|
65
|
-
}
|
|
66
|
-
async handleSessionTool(name, args) {
|
|
67
|
-
if (!this.featureFlags.isEnabled('sessionTools') || !this.sessionManager || !this.httpServer) {
|
|
68
|
-
return {
|
|
69
|
-
content: [{
|
|
70
|
-
type: "text",
|
|
71
|
-
text: JSON.stringify({
|
|
72
|
-
error: 'Session tools are not enabled. Set WORKRAIL_ENABLE_SESSION_TOOLS=true to enable.',
|
|
73
|
-
tool: name
|
|
74
|
-
}, null, 2)
|
|
75
|
-
}],
|
|
76
|
-
isError: true
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
return (0, session_tools_js_1.handleSessionTool)(name, args, this.sessionManager, this.httpServer);
|
|
80
|
-
}
|
|
81
|
-
async callWorkflowMethod(method, params) {
|
|
82
|
-
try {
|
|
83
|
-
const { workflowService } = this.container;
|
|
84
|
-
let result;
|
|
85
|
-
switch (method) {
|
|
86
|
-
case 'workflow_list':
|
|
87
|
-
const workflows = await workflowService.listWorkflowSummaries();
|
|
88
|
-
result = { workflows };
|
|
89
|
-
break;
|
|
90
|
-
case 'workflow_get':
|
|
91
|
-
const { createGetWorkflow } = await Promise.resolve().then(() => __importStar(require('./application/use-cases/get-workflow.js')));
|
|
92
|
-
const getWorkflowUseCase = createGetWorkflow(workflowService);
|
|
93
|
-
result = await getWorkflowUseCase(params.id, params.mode);
|
|
94
|
-
break;
|
|
95
|
-
case 'workflow_next':
|
|
96
|
-
result = await workflowService.getNextStep(params.workflowId, params.completedSteps || [], params.context);
|
|
97
|
-
break;
|
|
98
|
-
case 'workflow_validate':
|
|
99
|
-
result = await workflowService.validateStepOutput(params.workflowId, params.stepId, params.output);
|
|
100
|
-
break;
|
|
101
|
-
default:
|
|
102
|
-
throw new Error(`Unknown method: ${method}`);
|
|
103
|
-
}
|
|
104
|
-
return {
|
|
105
|
-
content: [{
|
|
106
|
-
type: "text",
|
|
107
|
-
text: JSON.stringify(result, null, 2)
|
|
108
|
-
}]
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
catch (error) {
|
|
112
|
-
console.error(`Workflow method ${method} failed:`, error);
|
|
113
|
-
return {
|
|
114
|
-
content: [{
|
|
115
|
-
type: "text",
|
|
116
|
-
text: JSON.stringify({
|
|
117
|
-
error: error instanceof Error ? error.message : String(error),
|
|
118
|
-
method,
|
|
119
|
-
params
|
|
120
|
-
}, null, 2)
|
|
121
|
-
}],
|
|
122
|
-
isError: true
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
async listWorkflows() {
|
|
127
|
-
return this.callWorkflowMethod('workflow_list', {});
|
|
128
|
-
}
|
|
129
|
-
async getWorkflow(workflowId, mode) {
|
|
130
|
-
return this.callWorkflowMethod('workflow_get', { id: workflowId, mode });
|
|
131
|
-
}
|
|
132
|
-
async getNextStep(workflowId, completedSteps = [], context) {
|
|
133
|
-
return this.callWorkflowMethod('workflow_next', { workflowId, completedSteps, context });
|
|
134
|
-
}
|
|
135
|
-
async validateStep(workflowId, stepId, output) {
|
|
136
|
-
return this.callWorkflowMethod('workflow_validate', { workflowId, stepId, output });
|
|
137
|
-
}
|
|
138
|
-
async validateWorkflowJson(workflowJson) {
|
|
139
|
-
try {
|
|
140
|
-
const { createValidateWorkflowJson } = await Promise.resolve().then(() => __importStar(require('./application/use-cases/validate-workflow-json.js')));
|
|
141
|
-
const validateWorkflowJsonUseCase = createValidateWorkflowJson();
|
|
142
|
-
const result = await validateWorkflowJsonUseCase(workflowJson);
|
|
143
|
-
return {
|
|
144
|
-
content: [{
|
|
145
|
-
type: "text",
|
|
146
|
-
text: JSON.stringify(result, null, 2)
|
|
147
|
-
}]
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
catch (error) {
|
|
151
|
-
console.error(`Workflow JSON validation failed:`, error);
|
|
152
|
-
return {
|
|
153
|
-
content: [{
|
|
154
|
-
type: "text",
|
|
155
|
-
text: JSON.stringify({
|
|
156
|
-
error: error instanceof Error ? error.message : String(error),
|
|
157
|
-
method: 'workflow_validate_json',
|
|
158
|
-
workflowJson: workflowJson.substring(0, 100) + (workflowJson.length > 100 ? '...' : '')
|
|
159
|
-
}, null, 2)
|
|
160
|
-
}],
|
|
161
|
-
isError: true
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
async getWorkflowSchema() {
|
|
166
|
-
try {
|
|
167
|
-
const fs = await Promise.resolve().then(() => __importStar(require('fs')));
|
|
168
|
-
const path = await Promise.resolve().then(() => __importStar(require('path')));
|
|
169
|
-
const schemaPath = path.resolve(__dirname, '../spec/workflow.schema.json');
|
|
170
|
-
const schemaContent = fs.readFileSync(schemaPath, 'utf-8');
|
|
171
|
-
const schema = JSON.parse(schemaContent);
|
|
172
|
-
const result = {
|
|
173
|
-
schema,
|
|
174
|
-
metadata: {
|
|
175
|
-
version: '1.0.0',
|
|
176
|
-
description: 'Complete JSON schema for workflow files',
|
|
177
|
-
usage: 'This schema defines the structure, required fields, and validation rules for workflow JSON files',
|
|
178
|
-
lastUpdated: new Date().toISOString(),
|
|
179
|
-
schemaPath: 'spec/workflow.schema.json'
|
|
180
|
-
},
|
|
181
|
-
commonPatterns: {
|
|
182
|
-
basicWorkflow: {
|
|
183
|
-
id: 'string (required): Unique identifier using lowercase letters, numbers, and hyphens',
|
|
184
|
-
name: 'string (required): Human-readable workflow name',
|
|
185
|
-
description: 'string (required): Detailed description of the workflow purpose',
|
|
186
|
-
version: 'string (required): Semantic version (e.g., "1.0.0")',
|
|
187
|
-
steps: 'array (required): List of workflow steps, minimum 1 item'
|
|
188
|
-
},
|
|
189
|
-
stepStructure: {
|
|
190
|
-
id: 'string (required): Unique step identifier',
|
|
191
|
-
title: 'string (required): Human-readable step title',
|
|
192
|
-
prompt: 'string (required): Instructions for the step',
|
|
193
|
-
agentRole: 'string (required): Role description for the agent',
|
|
194
|
-
validationCriteria: 'array (optional): Validation rules for step output'
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
return {
|
|
199
|
-
content: [{
|
|
200
|
-
type: "text",
|
|
201
|
-
text: JSON.stringify(result, null, 2)
|
|
202
|
-
}]
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
catch (error) {
|
|
206
|
-
console.error(`Workflow schema retrieval failed:`, error);
|
|
207
|
-
return {
|
|
208
|
-
content: [{
|
|
209
|
-
type: "text",
|
|
210
|
-
text: JSON.stringify({
|
|
211
|
-
error: error instanceof Error ? error.message : String(error),
|
|
212
|
-
method: 'workflow_get_schema',
|
|
213
|
-
suggestion: 'Ensure the workflow schema file exists at spec/workflow.schema.json'
|
|
214
|
-
}, null, 2)
|
|
215
|
-
}],
|
|
216
|
-
isError: true
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
const WORKFLOW_LIST_TOOL = {
|
|
222
|
-
name: "workflow_list",
|
|
223
|
-
description: `Your primary tool for any complex or multi-step request. Call this FIRST to see if a reliable, pre-defined workflow exists, as this is the preferred method over improvisation.
|
|
224
|
-
|
|
225
|
-
Your process:
|
|
226
|
-
1. Call this tool to get a list of available workflows.
|
|
227
|
-
2. Analyze the returned descriptions to find a match for the user's goal.
|
|
228
|
-
3. If a good match is found, suggest it to the user and use \`workflow_get\` to start.
|
|
229
|
-
4. If NO match is found, inform the user and then attempt to solve the task using your general abilities.`,
|
|
230
|
-
inputSchema: {
|
|
231
|
-
type: "object",
|
|
232
|
-
properties: {},
|
|
233
|
-
additionalProperties: false
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
const WORKFLOW_GET_TOOL = {
|
|
237
|
-
name: "workflow_get",
|
|
238
|
-
description: `Retrieves workflow information with configurable detail level. Supports progressive disclosure to prevent "workflow spoiling" while providing necessary context for workflow selection and initiation.`,
|
|
239
|
-
inputSchema: {
|
|
240
|
-
type: "object",
|
|
241
|
-
properties: {
|
|
242
|
-
id: {
|
|
243
|
-
type: "string",
|
|
244
|
-
description: "The unique identifier of the workflow to retrieve",
|
|
245
|
-
pattern: "^[A-Za-z0-9_-]+$"
|
|
246
|
-
},
|
|
247
|
-
mode: {
|
|
248
|
-
type: "string",
|
|
249
|
-
enum: ["metadata", "preview"],
|
|
250
|
-
description: "The level of detail to return: 'metadata' returns workflow info without steps, 'preview' (default) returns metadata plus the first eligible step",
|
|
251
|
-
default: "preview"
|
|
252
|
-
}
|
|
253
|
-
},
|
|
254
|
-
required: ["id"],
|
|
255
|
-
additionalProperties: false
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
|
-
const WORKFLOW_NEXT_TOOL = {
|
|
259
|
-
name: "workflow_next",
|
|
260
|
-
description: `Executes a workflow by getting the next step. Use this tool in a loop to progress through a workflow. You must provide the \`workflowId\` and a list of \`completedSteps\`. For conditional workflows, provide \`context\` with variables that will be used to evaluate step conditions.`,
|
|
261
|
-
inputSchema: {
|
|
262
|
-
type: "object",
|
|
263
|
-
properties: {
|
|
264
|
-
workflowId: {
|
|
265
|
-
type: "string",
|
|
266
|
-
description: "The unique identifier of the workflow",
|
|
267
|
-
pattern: "^[A-Za-z0-9_-]+$"
|
|
268
|
-
},
|
|
269
|
-
completedSteps: {
|
|
270
|
-
type: "array",
|
|
271
|
-
items: {
|
|
272
|
-
type: "string",
|
|
273
|
-
pattern: "^[A-Za-z0-9_-]+$"
|
|
274
|
-
},
|
|
275
|
-
description: "Array of step IDs that have been completed",
|
|
276
|
-
default: []
|
|
277
|
-
},
|
|
278
|
-
context: {
|
|
279
|
-
type: "object",
|
|
280
|
-
description: "Optional context variables for conditional step execution",
|
|
281
|
-
additionalProperties: true
|
|
282
|
-
}
|
|
283
|
-
},
|
|
284
|
-
required: ["workflowId"],
|
|
285
|
-
additionalProperties: false
|
|
286
|
-
}
|
|
287
|
-
};
|
|
288
|
-
const WORKFLOW_VALIDATE_JSON_TOOL = {
|
|
289
|
-
name: "workflow_validate_json",
|
|
290
|
-
description: `Validates workflow JSON content directly without external tools. Use this tool when you need to verify that a workflow JSON file is syntactically correct and follows the proper schema.
|
|
291
|
-
|
|
292
|
-
This tool provides comprehensive validation including:
|
|
293
|
-
- JSON syntax validation with detailed error messages
|
|
294
|
-
- Workflow schema compliance checking
|
|
295
|
-
- User-friendly error reporting with actionable suggestions
|
|
296
|
-
- Support for all workflow features (steps, conditions, validation criteria, etc.)
|
|
297
|
-
|
|
298
|
-
Example usage:
|
|
299
|
-
- Validate a newly created workflow before saving
|
|
300
|
-
- Check workflow syntax when editing workflow files
|
|
301
|
-
- Verify workflow structure when troubleshooting issues
|
|
302
|
-
- Ensure workflow compliance before deployment`,
|
|
303
|
-
inputSchema: {
|
|
304
|
-
type: "object",
|
|
305
|
-
properties: {
|
|
306
|
-
workflowJson: {
|
|
307
|
-
type: "string",
|
|
308
|
-
description: "The complete workflow JSON content as a string to validate",
|
|
309
|
-
minLength: 1
|
|
310
|
-
}
|
|
311
|
-
},
|
|
312
|
-
required: ["workflowJson"],
|
|
313
|
-
additionalProperties: false
|
|
314
|
-
}
|
|
315
|
-
};
|
|
316
|
-
const WORKFLOW_GET_SCHEMA_TOOL = {
|
|
317
|
-
name: "workflow_get_schema",
|
|
318
|
-
description: `Retrieves the complete workflow JSON schema for reference and development purposes. Use this tool when you need to understand the structure, required fields, and validation rules for workflows.
|
|
319
|
-
|
|
320
|
-
This tool provides:
|
|
321
|
-
- Complete JSON schema definition with all properties and constraints
|
|
322
|
-
- Field descriptions and validation rules
|
|
323
|
-
- Examples of valid patterns and formats
|
|
324
|
-
- Schema version and metadata information
|
|
325
|
-
- Comprehensive reference for workflow structure
|
|
326
|
-
|
|
327
|
-
Example usage:
|
|
328
|
-
- Understanding workflow structure before creating new workflows
|
|
329
|
-
- Checking required fields and their types
|
|
330
|
-
- Verifying validation rules and constraints
|
|
331
|
-
- Reference during workflow development and debugging
|
|
332
|
-
- Learning about available workflow features and options`,
|
|
333
|
-
inputSchema: {
|
|
334
|
-
type: "object",
|
|
335
|
-
properties: {},
|
|
336
|
-
additionalProperties: false
|
|
337
|
-
}
|
|
338
|
-
};
|
|
339
|
-
async function runServer() {
|
|
340
|
-
const [sdkServer, sdkStdio, sdkTypes] = await Promise.all([
|
|
341
|
-
Promise.resolve().then(() => __importStar(require("@modelcontextprotocol/sdk/server/index.js"))),
|
|
342
|
-
Promise.resolve().then(() => __importStar(require("@modelcontextprotocol/sdk/server/stdio.js"))),
|
|
343
|
-
Promise.resolve().then(() => __importStar(require("@modelcontextprotocol/sdk/types.js"))),
|
|
344
|
-
]);
|
|
345
|
-
const { Server } = sdkServer;
|
|
346
|
-
const { StdioServerTransport } = sdkStdio;
|
|
347
|
-
const { CallToolRequestSchema, ListToolsRequestSchema, ListRootsRequestSchema } = sdkTypes;
|
|
348
|
-
const server = new Server({
|
|
349
|
-
name: "workrail-server",
|
|
350
|
-
version: "0.1.0",
|
|
351
|
-
}, {
|
|
352
|
-
capabilities: {
|
|
353
|
-
tools: {},
|
|
354
|
-
},
|
|
355
|
-
});
|
|
356
|
-
const workflowServer = new WorkflowOrchestrationServer();
|
|
357
|
-
await workflowServer.initialize();
|
|
358
|
-
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
359
|
-
tools: [
|
|
360
|
-
WORKFLOW_LIST_TOOL,
|
|
361
|
-
WORKFLOW_GET_TOOL,
|
|
362
|
-
WORKFLOW_NEXT_TOOL,
|
|
363
|
-
WORKFLOW_VALIDATE_JSON_TOOL,
|
|
364
|
-
WORKFLOW_GET_SCHEMA_TOOL,
|
|
365
|
-
...workflowServer.getSessionTools()
|
|
366
|
-
],
|
|
367
|
-
}));
|
|
368
|
-
server.setRequestHandler(ListRootsRequestSchema, async () => {
|
|
369
|
-
const path = await Promise.resolve().then(() => __importStar(require('path')));
|
|
370
|
-
const os = await Promise.resolve().then(() => __importStar(require('os')));
|
|
371
|
-
const toFileUri = (p) => {
|
|
372
|
-
const abs = path.resolve(p);
|
|
373
|
-
return `file://${abs}`;
|
|
374
|
-
};
|
|
375
|
-
const roots = [];
|
|
376
|
-
roots.push({ uri: toFileUri(process.cwd()), name: 'Current Project' });
|
|
377
|
-
roots.push({ uri: toFileUri(path.resolve(__dirname, '../workflows')), name: 'Bundled Workflows' });
|
|
378
|
-
roots.push({ uri: toFileUri(path.join(os.homedir(), '.workrail', 'workflows')), name: 'User Workflows' });
|
|
379
|
-
return { roots };
|
|
380
|
-
});
|
|
381
|
-
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
382
|
-
const { name, arguments: args } = request.params;
|
|
383
|
-
if (name.startsWith('workrail_')) {
|
|
384
|
-
return await workflowServer.handleSessionTool(name, args || {});
|
|
385
|
-
}
|
|
386
|
-
switch (name) {
|
|
387
|
-
case "workflow_list":
|
|
388
|
-
return await workflowServer.listWorkflows();
|
|
389
|
-
case "workflow_get":
|
|
390
|
-
if (!args?.['id']) {
|
|
391
|
-
return {
|
|
392
|
-
content: [{ type: "text", text: "Error: id parameter is required" }],
|
|
393
|
-
isError: true
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
return await workflowServer.getWorkflow(args['id'], args['mode']);
|
|
397
|
-
case "workflow_next":
|
|
398
|
-
if (!args?.['workflowId']) {
|
|
399
|
-
return {
|
|
400
|
-
content: [{ type: "text", text: "Error: workflowId parameter is required" }],
|
|
401
|
-
isError: true
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
return await workflowServer.getNextStep(args['workflowId'], args['completedSteps'] || [], args['context']);
|
|
405
|
-
case "workflow_validate_json":
|
|
406
|
-
if (!args?.['workflowJson']) {
|
|
407
|
-
return {
|
|
408
|
-
content: [{ type: "text", text: "Error: workflowJson parameter is required" }],
|
|
409
|
-
isError: true
|
|
410
|
-
};
|
|
411
|
-
}
|
|
412
|
-
return await workflowServer.validateWorkflowJson(args['workflowJson']);
|
|
413
|
-
case "workflow_get_schema":
|
|
414
|
-
return await workflowServer.getWorkflowSchema();
|
|
415
|
-
default:
|
|
416
|
-
return {
|
|
417
|
-
content: [{ type: "text", text: `Unknown tool: ${name}` }],
|
|
418
|
-
isError: true
|
|
419
|
-
};
|
|
420
|
-
}
|
|
421
|
-
});
|
|
422
|
-
const transport = new StdioServerTransport();
|
|
423
|
-
await server.connect(transport);
|
|
424
|
-
console.error("Workflow Orchestration MCP Server running on stdio");
|
|
425
|
-
}
|
|
426
|
-
runServer().catch((error) => {
|
|
427
|
-
console.error("Fatal error running server:", error);
|
|
4
|
+
exports.startServer = void 0;
|
|
5
|
+
var server_js_1 = require("./mcp/server.js");
|
|
6
|
+
Object.defineProperty(exports, "startServer", { enumerable: true, get: function () { return server_js_1.startServer; } });
|
|
7
|
+
const server_js_2 = require("./mcp/server.js");
|
|
8
|
+
(0, server_js_2.startServer)().catch((error) => {
|
|
9
|
+
console.error('Fatal error running server:', error);
|
|
428
10
|
process.exit(1);
|
|
429
11
|
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ShutdownEvent, ShutdownEvents, Unsubscribe } from '../ports/shutdown-events.js';
|
|
2
|
+
export declare class InMemoryShutdownEvents implements ShutdownEvents {
|
|
3
|
+
private readonly listeners;
|
|
4
|
+
onShutdown(listener: (event: ShutdownEvent) => void): Unsubscribe;
|
|
5
|
+
emit(event: ShutdownEvent): void;
|
|
6
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InMemoryShutdownEvents = void 0;
|
|
4
|
+
class InMemoryShutdownEvents {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.listeners = new Set();
|
|
7
|
+
}
|
|
8
|
+
onShutdown(listener) {
|
|
9
|
+
this.listeners.add(listener);
|
|
10
|
+
return () => {
|
|
11
|
+
this.listeners.delete(listener);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
emit(event) {
|
|
15
|
+
for (const listener of this.listeners) {
|
|
16
|
+
listener(event);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.InMemoryShutdownEvents = InMemoryShutdownEvents;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NodeProcessSignals = void 0;
|
|
4
|
+
class NodeProcessSignals {
|
|
5
|
+
on(signal, handler) {
|
|
6
|
+
process.on(signal, () => {
|
|
7
|
+
void handler();
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.NodeProcessSignals = NodeProcessSignals;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NodeProcessTerminator = void 0;
|
|
4
|
+
const assert_never_js_1 = require("../assert-never.js");
|
|
5
|
+
class NodeProcessTerminator {
|
|
6
|
+
terminate(code) {
|
|
7
|
+
switch (code.kind) {
|
|
8
|
+
case 'success':
|
|
9
|
+
process.exit(0);
|
|
10
|
+
case 'failure':
|
|
11
|
+
process.exit(1);
|
|
12
|
+
default:
|
|
13
|
+
return (0, assert_never_js_1.assertNever)(code);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.NodeProcessTerminator = NodeProcessTerminator;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ThrowingProcessTerminator = void 0;
|
|
4
|
+
class ThrowingProcessTerminator {
|
|
5
|
+
terminate(code) {
|
|
6
|
+
throw new Error(`[ProcessTerminator] terminate(${code.kind})`);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.ThrowingProcessTerminator = ThrowingProcessTerminator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function assertNever(x: never): never;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ProcessSignal } from './process-signals.js';
|
|
2
|
+
export type ShutdownSignal = Exclude<ProcessSignal, 'exit'>;
|
|
3
|
+
export type ShutdownEvent = {
|
|
4
|
+
kind: 'shutdown_requested';
|
|
5
|
+
signal: ShutdownSignal;
|
|
6
|
+
};
|
|
7
|
+
export type Unsubscribe = () => void;
|
|
8
|
+
export interface ShutdownEvents {
|
|
9
|
+
onShutdown(listener: (event: ShutdownEvent) => void): Unsubscribe;
|
|
10
|
+
emit(event: ShutdownEvent): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type Ok<T> = {
|
|
2
|
+
readonly kind: 'ok';
|
|
3
|
+
readonly value: T;
|
|
4
|
+
};
|
|
5
|
+
export type Err<E> = {
|
|
6
|
+
readonly kind: 'err';
|
|
7
|
+
readonly error: E;
|
|
8
|
+
};
|
|
9
|
+
export type Result<T, E> = Ok<T> | Err<E>;
|
|
10
|
+
export declare const ok: <T>(value: T) => Result<T, never>;
|
|
11
|
+
export declare const err: <E>(error: E) => Result<never, E>;
|
|
12
|
+
export declare function isOk<T, E>(result: Result<T, E>): result is Ok<T>;
|
|
13
|
+
export declare function isErr<T, E>(result: Result<T, E>): result is Err<E>;
|
|
14
|
+
export declare function map<T, E, U>(result: Result<T, E>, fn: (value: T) => U): Result<U, E>;
|
|
15
|
+
export declare function mapErr<T, E, F>(result: Result<T, E>, fn: (error: E) => F): Result<T, F>;
|
|
16
|
+
export declare function andThen<T, E, U>(result: Result<T, E>, fn: (value: T) => Result<U, E>): Result<U, E>;
|
|
17
|
+
export declare function match<T, E, R>(result: Result<T, E>, onOk: (value: T) => R, onErr: (error: E) => R): R;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.err = exports.ok = void 0;
|
|
4
|
+
exports.isOk = isOk;
|
|
5
|
+
exports.isErr = isErr;
|
|
6
|
+
exports.map = map;
|
|
7
|
+
exports.mapErr = mapErr;
|
|
8
|
+
exports.andThen = andThen;
|
|
9
|
+
exports.match = match;
|
|
10
|
+
const ok = (value) => ({ kind: 'ok', value });
|
|
11
|
+
exports.ok = ok;
|
|
12
|
+
const err = (error) => ({ kind: 'err', error });
|
|
13
|
+
exports.err = err;
|
|
14
|
+
function isOk(result) {
|
|
15
|
+
return result.kind === 'ok';
|
|
16
|
+
}
|
|
17
|
+
function isErr(result) {
|
|
18
|
+
return result.kind === 'err';
|
|
19
|
+
}
|
|
20
|
+
function map(result, fn) {
|
|
21
|
+
return result.kind === 'ok' ? (0, exports.ok)(fn(result.value)) : result;
|
|
22
|
+
}
|
|
23
|
+
function mapErr(result, fn) {
|
|
24
|
+
return result.kind === 'err' ? (0, exports.err)(fn(result.error)) : result;
|
|
25
|
+
}
|
|
26
|
+
function andThen(result, fn) {
|
|
27
|
+
return result.kind === 'ok' ? fn(result.value) : result;
|
|
28
|
+
}
|
|
29
|
+
function match(result, onOk, onErr) {
|
|
30
|
+
return result.kind === 'ok' ? onOk(result.value) : onErr(result.error);
|
|
31
|
+
}
|