@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
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.container = void 0;
|
|
37
|
+
exports.initializeContainer = initializeContainer;
|
|
38
|
+
exports.startAsyncServices = startAsyncServices;
|
|
39
|
+
exports.bootstrap = bootstrap;
|
|
40
|
+
exports.resetContainer = resetContainer;
|
|
41
|
+
exports.isInitialized = isInitialized;
|
|
42
|
+
require("reflect-metadata");
|
|
43
|
+
const tsyringe_1 = require("tsyringe");
|
|
44
|
+
Object.defineProperty(exports, "container", { enumerable: true, get: function () { return tsyringe_1.container; } });
|
|
45
|
+
const tokens_js_1 = require("./tokens.js");
|
|
46
|
+
const assert_never_js_1 = require("../runtime/assert-never.js");
|
|
47
|
+
const node_process_signals_js_1 = require("../runtime/adapters/node-process-signals.js");
|
|
48
|
+
const noop_process_signals_js_1 = require("../runtime/adapters/noop-process-signals.js");
|
|
49
|
+
const in_memory_shutdown_events_js_1 = require("../runtime/adapters/in-memory-shutdown-events.js");
|
|
50
|
+
const node_process_terminator_js_1 = require("../runtime/adapters/node-process-terminator.js");
|
|
51
|
+
const throwing_process_terminator_js_1 = require("../runtime/adapters/throwing-process-terminator.js");
|
|
52
|
+
const app_config_js_1 = require("../config/app-config.js");
|
|
53
|
+
const formatter_js_1 = require("../errors/formatter.js");
|
|
54
|
+
let initialized = false;
|
|
55
|
+
let asyncInitialized = false;
|
|
56
|
+
let initializationPromise = null;
|
|
57
|
+
let isInitializing = false;
|
|
58
|
+
async function registerConfig() {
|
|
59
|
+
if (!tsyringe_1.container.isRegistered(tokens_js_1.DI.Config.App)) {
|
|
60
|
+
const configResult = (0, app_config_js_1.loadConfig)({ env: process.env, projectPath: process.cwd() });
|
|
61
|
+
if (configResult.kind === 'err') {
|
|
62
|
+
console.error((0, formatter_js_1.formatAppError)(configResult.error));
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
const config = configResult.value;
|
|
66
|
+
tsyringe_1.container.register(tokens_js_1.DI.Config.App, { useValue: config });
|
|
67
|
+
tsyringe_1.container.register(tokens_js_1.DI.Config.CacheTTL, { useValue: config.cache.ttlMs });
|
|
68
|
+
tsyringe_1.container.register(tokens_js_1.DI.Config.WorkflowDir, { useValue: config.paths.workflowDir });
|
|
69
|
+
tsyringe_1.container.register(tokens_js_1.DI.Config.ProjectPath, { useValue: config.paths.projectPath });
|
|
70
|
+
tsyringe_1.container.register(tokens_js_1.DI.Config.DashboardMode, { useValue: config.dashboard.mode });
|
|
71
|
+
tsyringe_1.container.register(tokens_js_1.DI.Config.BrowserBehavior, { useValue: config.dashboard.browserBehavior });
|
|
72
|
+
}
|
|
73
|
+
if (!tsyringe_1.container.isRegistered(tokens_js_1.DI.Infra.FeatureFlags)) {
|
|
74
|
+
const { EnvironmentFeatureFlagProvider } = await Promise.resolve().then(() => __importStar(require('../config/feature-flags.js')));
|
|
75
|
+
tsyringe_1.container.register(tokens_js_1.DI.Infra.FeatureFlags, {
|
|
76
|
+
useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => c.resolve(EnvironmentFeatureFlagProvider))
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function detectRuntimeMode() {
|
|
81
|
+
if (process.env.VITEST || process.env.NODE_ENV === 'test') {
|
|
82
|
+
return { kind: 'test' };
|
|
83
|
+
}
|
|
84
|
+
return { kind: 'production' };
|
|
85
|
+
}
|
|
86
|
+
function toProcessLifecyclePolicy(mode) {
|
|
87
|
+
switch (mode.kind) {
|
|
88
|
+
case 'test':
|
|
89
|
+
return { kind: 'no_signal_handlers' };
|
|
90
|
+
case 'cli':
|
|
91
|
+
case 'rpc':
|
|
92
|
+
case 'production':
|
|
93
|
+
return { kind: 'install_signal_handlers' };
|
|
94
|
+
default:
|
|
95
|
+
return (0, assert_never_js_1.assertNever)(mode);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function registerRuntime(options = {}) {
|
|
99
|
+
const mode = options.runtimeMode ?? detectRuntimeMode();
|
|
100
|
+
const policy = toProcessLifecyclePolicy(mode);
|
|
101
|
+
tsyringe_1.container.register(tokens_js_1.DI.Runtime.Mode, { useValue: mode });
|
|
102
|
+
tsyringe_1.container.register(tokens_js_1.DI.Runtime.ProcessLifecyclePolicy, { useValue: policy });
|
|
103
|
+
const signals = policy.kind === 'no_signal_handlers' ? new noop_process_signals_js_1.NoopProcessSignals() : new node_process_signals_js_1.NodeProcessSignals();
|
|
104
|
+
tsyringe_1.container.register(tokens_js_1.DI.Runtime.ProcessSignals, { useValue: signals });
|
|
105
|
+
tsyringe_1.container.register(tokens_js_1.DI.Runtime.ShutdownEvents, { useValue: new in_memory_shutdown_events_js_1.InMemoryShutdownEvents() });
|
|
106
|
+
const terminator = mode.kind === 'test' ? new throwing_process_terminator_js_1.ThrowingProcessTerminator() : new node_process_terminator_js_1.NodeProcessTerminator();
|
|
107
|
+
tsyringe_1.container.register(tokens_js_1.DI.Runtime.ProcessTerminator, { useValue: terminator });
|
|
108
|
+
}
|
|
109
|
+
async function registerStorageChain() {
|
|
110
|
+
const { EnhancedMultiSourceWorkflowStorage } = await Promise.resolve().then(() => __importStar(require('../infrastructure/storage/enhanced-multi-source-workflow-storage.js')));
|
|
111
|
+
const { SchemaValidatingWorkflowStorage } = await Promise.resolve().then(() => __importStar(require('../infrastructure/storage/schema-validating-workflow-storage.js')));
|
|
112
|
+
const { CachingWorkflowStorage } = await Promise.resolve().then(() => __importStar(require('../infrastructure/storage/caching-workflow-storage.js')));
|
|
113
|
+
tsyringe_1.container.register(tokens_js_1.DI.Storage.Base, {
|
|
114
|
+
useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => {
|
|
115
|
+
const featureFlags = c.resolve(tokens_js_1.DI.Infra.FeatureFlags);
|
|
116
|
+
return new EnhancedMultiSourceWorkflowStorage({}, featureFlags);
|
|
117
|
+
}),
|
|
118
|
+
});
|
|
119
|
+
tsyringe_1.container.register(tokens_js_1.DI.Storage.Validated, {
|
|
120
|
+
useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => {
|
|
121
|
+
const base = c.resolve(tokens_js_1.DI.Storage.Base);
|
|
122
|
+
return new SchemaValidatingWorkflowStorage(base);
|
|
123
|
+
}),
|
|
124
|
+
});
|
|
125
|
+
tsyringe_1.container.register(tokens_js_1.DI.Storage.Primary, {
|
|
126
|
+
useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => {
|
|
127
|
+
const validated = c.resolve(tokens_js_1.DI.Storage.Validated);
|
|
128
|
+
const ttl = c.resolve(tokens_js_1.DI.Config.CacheTTL);
|
|
129
|
+
return new CachingWorkflowStorage(validated, ttl);
|
|
130
|
+
}),
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
async function registerServices() {
|
|
134
|
+
const { EnhancedLoopValidator } = await Promise.resolve().then(() => __importStar(require('../application/services/enhanced-loop-validator.js')));
|
|
135
|
+
const { SessionDataNormalizer } = await Promise.resolve().then(() => __importStar(require('../infrastructure/session/SessionDataNormalizer.js')));
|
|
136
|
+
const { SessionDataValidator } = await Promise.resolve().then(() => __importStar(require('../infrastructure/session/SessionDataValidator.js')));
|
|
137
|
+
const { ValidationEngine } = await Promise.resolve().then(() => __importStar(require('../application/services/validation-engine.js')));
|
|
138
|
+
const { WorkflowCompiler } = await Promise.resolve().then(() => __importStar(require('../application/services/workflow-compiler.js')));
|
|
139
|
+
const { WorkflowInterpreter } = await Promise.resolve().then(() => __importStar(require('../application/services/workflow-interpreter.js')));
|
|
140
|
+
const { ToolDescriptionProvider } = await Promise.resolve().then(() => __importStar(require('../mcp/tool-description-provider.js')));
|
|
141
|
+
const { DefaultWorkflowService } = await Promise.resolve().then(() => __importStar(require('../application/services/workflow-service.js')));
|
|
142
|
+
const { SessionManager } = await Promise.resolve().then(() => __importStar(require('../infrastructure/session/SessionManager.js')));
|
|
143
|
+
const { HttpServer } = await Promise.resolve().then(() => __importStar(require('../infrastructure/session/HttpServer.js')));
|
|
144
|
+
tsyringe_1.container.register(tokens_js_1.DI.Infra.EnhancedLoopValidator, {
|
|
145
|
+
useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => c.resolve(EnhancedLoopValidator))
|
|
146
|
+
});
|
|
147
|
+
tsyringe_1.container.register(tokens_js_1.DI.Infra.SessionDataNormalizer, {
|
|
148
|
+
useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => c.resolve(SessionDataNormalizer))
|
|
149
|
+
});
|
|
150
|
+
tsyringe_1.container.register(tokens_js_1.DI.Infra.SessionDataValidator, {
|
|
151
|
+
useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => c.resolve(SessionDataValidator))
|
|
152
|
+
});
|
|
153
|
+
tsyringe_1.container.register(tokens_js_1.DI.Infra.ValidationEngine, {
|
|
154
|
+
useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => c.resolve(ValidationEngine))
|
|
155
|
+
});
|
|
156
|
+
tsyringe_1.container.register(tokens_js_1.DI.Services.WorkflowCompiler, {
|
|
157
|
+
useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => c.resolve(WorkflowCompiler)),
|
|
158
|
+
});
|
|
159
|
+
tsyringe_1.container.register(tokens_js_1.DI.Services.WorkflowInterpreter, {
|
|
160
|
+
useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => c.resolve(WorkflowInterpreter)),
|
|
161
|
+
});
|
|
162
|
+
tsyringe_1.container.register(tokens_js_1.DI.Services.Workflow, {
|
|
163
|
+
useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => c.resolve(DefaultWorkflowService))
|
|
164
|
+
});
|
|
165
|
+
tsyringe_1.container.register(tokens_js_1.DI.Infra.SessionManager, {
|
|
166
|
+
useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => c.resolve(SessionManager))
|
|
167
|
+
});
|
|
168
|
+
tsyringe_1.container.register(tokens_js_1.DI.Infra.HttpServer, {
|
|
169
|
+
useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => c.resolve(HttpServer))
|
|
170
|
+
});
|
|
171
|
+
if (!tsyringe_1.container.isRegistered(tokens_js_1.DI.Mcp.DescriptionProvider)) {
|
|
172
|
+
tsyringe_1.container.registerSingleton(tokens_js_1.DI.Mcp.DescriptionProvider, ToolDescriptionProvider);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
async function initializeContainer(options = {}) {
|
|
176
|
+
if (initialized)
|
|
177
|
+
return;
|
|
178
|
+
if (isInitializing) {
|
|
179
|
+
const INIT_TIMEOUT_MS = 5000;
|
|
180
|
+
const POLL_INTERVAL_MS = 10;
|
|
181
|
+
let waited = 0;
|
|
182
|
+
while (isInitializing && !initialized && waited < INIT_TIMEOUT_MS) {
|
|
183
|
+
await new Promise(resolve => setTimeout(resolve, POLL_INTERVAL_MS));
|
|
184
|
+
waited += POLL_INTERVAL_MS;
|
|
185
|
+
}
|
|
186
|
+
if (initialized)
|
|
187
|
+
return;
|
|
188
|
+
if (waited >= INIT_TIMEOUT_MS) {
|
|
189
|
+
throw new Error('[DI] Container initialization timeout after 5 seconds');
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (initialized)
|
|
193
|
+
return;
|
|
194
|
+
isInitializing = true;
|
|
195
|
+
try {
|
|
196
|
+
registerRuntime(options);
|
|
197
|
+
await registerConfig();
|
|
198
|
+
await registerStorageChain();
|
|
199
|
+
await registerServices();
|
|
200
|
+
initialized = true;
|
|
201
|
+
console.error('[DI] Container initialized');
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
205
|
+
throw new Error(`[DI] Container initialization failed: ${message}`);
|
|
206
|
+
}
|
|
207
|
+
finally {
|
|
208
|
+
isInitializing = false;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
async function startAsyncServices() {
|
|
212
|
+
if (!initialized) {
|
|
213
|
+
await initializeContainer();
|
|
214
|
+
}
|
|
215
|
+
if (asyncInitialized)
|
|
216
|
+
return;
|
|
217
|
+
try {
|
|
218
|
+
const flags = tsyringe_1.container.resolve(tokens_js_1.DI.Infra.FeatureFlags);
|
|
219
|
+
if (flags.isEnabled('sessionTools')) {
|
|
220
|
+
const server = tsyringe_1.container.resolve(tokens_js_1.DI.Infra.HttpServer);
|
|
221
|
+
await server.start();
|
|
222
|
+
console.error('[DI] HTTP server started');
|
|
223
|
+
}
|
|
224
|
+
asyncInitialized = true;
|
|
225
|
+
}
|
|
226
|
+
catch (error) {
|
|
227
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
228
|
+
throw new Error(`[DI] Async services initialization failed: ${message}`);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
async function bootstrap(options = {}) {
|
|
232
|
+
await initializeContainer(options);
|
|
233
|
+
await startAsyncServices();
|
|
234
|
+
}
|
|
235
|
+
function resetContainer() {
|
|
236
|
+
tsyringe_1.container.reset();
|
|
237
|
+
initialized = false;
|
|
238
|
+
asyncInitialized = false;
|
|
239
|
+
initializationPromise = null;
|
|
240
|
+
isInitializing = false;
|
|
241
|
+
}
|
|
242
|
+
function isInitialized() {
|
|
243
|
+
return initialized;
|
|
244
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const DI: {
|
|
2
|
+
readonly Storage: {
|
|
3
|
+
readonly Primary: symbol;
|
|
4
|
+
readonly Base: symbol;
|
|
5
|
+
readonly Validated: symbol;
|
|
6
|
+
};
|
|
7
|
+
readonly Services: {
|
|
8
|
+
readonly Workflow: symbol;
|
|
9
|
+
readonly WorkflowCompiler: symbol;
|
|
10
|
+
readonly WorkflowInterpreter: symbol;
|
|
11
|
+
};
|
|
12
|
+
readonly Infra: {
|
|
13
|
+
readonly FeatureFlags: symbol;
|
|
14
|
+
readonly SessionManager: symbol;
|
|
15
|
+
readonly HttpServer: symbol;
|
|
16
|
+
readonly ValidationEngine: symbol;
|
|
17
|
+
readonly EnhancedLoopValidator: symbol;
|
|
18
|
+
readonly SessionDataNormalizer: symbol;
|
|
19
|
+
readonly SessionDataValidator: symbol;
|
|
20
|
+
};
|
|
21
|
+
readonly Mcp: {
|
|
22
|
+
readonly DescriptionProvider: symbol;
|
|
23
|
+
};
|
|
24
|
+
readonly Runtime: {
|
|
25
|
+
readonly Mode: symbol;
|
|
26
|
+
readonly ProcessLifecyclePolicy: symbol;
|
|
27
|
+
readonly ProcessSignals: symbol;
|
|
28
|
+
readonly ShutdownEvents: symbol;
|
|
29
|
+
readonly ProcessTerminator: symbol;
|
|
30
|
+
};
|
|
31
|
+
readonly Config: {
|
|
32
|
+
readonly App: symbol;
|
|
33
|
+
readonly CacheTTL: symbol;
|
|
34
|
+
readonly WorkflowDir: symbol;
|
|
35
|
+
readonly ProjectPath: symbol;
|
|
36
|
+
readonly DashboardMode: symbol;
|
|
37
|
+
readonly BrowserBehavior: symbol;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export type DIToken = typeof DI[keyof typeof DI][keyof typeof DI[keyof typeof DI]];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DI = void 0;
|
|
4
|
+
exports.DI = {
|
|
5
|
+
Storage: {
|
|
6
|
+
Primary: Symbol('Storage.Primary'),
|
|
7
|
+
Base: Symbol('Storage.Base'),
|
|
8
|
+
Validated: Symbol('Storage.Validated'),
|
|
9
|
+
},
|
|
10
|
+
Services: {
|
|
11
|
+
Workflow: Symbol('Services.Workflow'),
|
|
12
|
+
WorkflowCompiler: Symbol('Services.WorkflowCompiler'),
|
|
13
|
+
WorkflowInterpreter: Symbol('Services.WorkflowInterpreter'),
|
|
14
|
+
},
|
|
15
|
+
Infra: {
|
|
16
|
+
FeatureFlags: Symbol('Infra.FeatureFlags'),
|
|
17
|
+
SessionManager: Symbol('Infra.SessionManager'),
|
|
18
|
+
HttpServer: Symbol('Infra.HttpServer'),
|
|
19
|
+
ValidationEngine: Symbol('Infra.ValidationEngine'),
|
|
20
|
+
EnhancedLoopValidator: Symbol('Infra.EnhancedLoopValidator'),
|
|
21
|
+
SessionDataNormalizer: Symbol('Infra.SessionDataNormalizer'),
|
|
22
|
+
SessionDataValidator: Symbol('Infra.SessionDataValidator'),
|
|
23
|
+
},
|
|
24
|
+
Mcp: {
|
|
25
|
+
DescriptionProvider: Symbol('Mcp.DescriptionProvider'),
|
|
26
|
+
},
|
|
27
|
+
Runtime: {
|
|
28
|
+
Mode: Symbol('Runtime.Mode'),
|
|
29
|
+
ProcessLifecyclePolicy: Symbol('Runtime.ProcessLifecyclePolicy'),
|
|
30
|
+
ProcessSignals: Symbol('Runtime.ProcessSignals'),
|
|
31
|
+
ShutdownEvents: Symbol('Runtime.ShutdownEvents'),
|
|
32
|
+
ProcessTerminator: Symbol('Runtime.ProcessTerminator'),
|
|
33
|
+
},
|
|
34
|
+
Config: {
|
|
35
|
+
App: Symbol('Config.App'),
|
|
36
|
+
CacheTTL: Symbol('Config.CacheTTL'),
|
|
37
|
+
WorkflowDir: Symbol('Config.WorkflowDir'),
|
|
38
|
+
ProjectPath: Symbol('Config.ProjectPath'),
|
|
39
|
+
DashboardMode: Symbol('Config.DashboardMode'),
|
|
40
|
+
BrowserBehavior: Symbol('Config.BrowserBehavior'),
|
|
41
|
+
},
|
|
42
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type DomainError = {
|
|
2
|
+
readonly _tag: 'WorkflowNotFound';
|
|
3
|
+
readonly workflowId: string;
|
|
4
|
+
readonly message: string;
|
|
5
|
+
} | {
|
|
6
|
+
readonly _tag: 'InvalidState';
|
|
7
|
+
readonly message: string;
|
|
8
|
+
} | {
|
|
9
|
+
readonly _tag: 'InvalidLoop';
|
|
10
|
+
readonly loopId: string;
|
|
11
|
+
readonly message: string;
|
|
12
|
+
} | {
|
|
13
|
+
readonly _tag: 'ConditionEvalFailed';
|
|
14
|
+
readonly message: string;
|
|
15
|
+
} | {
|
|
16
|
+
readonly _tag: 'MaxIterationsExceeded';
|
|
17
|
+
readonly loopId: string;
|
|
18
|
+
readonly maxIterations: number;
|
|
19
|
+
readonly message: string;
|
|
20
|
+
} | {
|
|
21
|
+
readonly _tag: 'MissingContext';
|
|
22
|
+
readonly message: string;
|
|
23
|
+
};
|
|
24
|
+
export declare const Err: {
|
|
25
|
+
readonly workflowNotFound: (workflowId: string) => DomainError;
|
|
26
|
+
readonly invalidState: (message: string) => DomainError;
|
|
27
|
+
readonly invalidLoop: (loopId: string, message: string) => DomainError;
|
|
28
|
+
readonly conditionEvalFailed: (message: string) => DomainError;
|
|
29
|
+
readonly maxIterationsExceeded: (loopId: string, maxIterations: number) => DomainError;
|
|
30
|
+
readonly missingContext: (message: string) => DomainError;
|
|
31
|
+
};
|
|
32
|
+
export declare function isRetriable(_e: DomainError): boolean;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Err = void 0;
|
|
4
|
+
exports.isRetriable = isRetriable;
|
|
5
|
+
exports.Err = {
|
|
6
|
+
workflowNotFound: (workflowId) => ({
|
|
7
|
+
_tag: 'WorkflowNotFound',
|
|
8
|
+
workflowId,
|
|
9
|
+
message: `Workflow '${workflowId}' not found`,
|
|
10
|
+
}),
|
|
11
|
+
invalidState: (message) => ({ _tag: 'InvalidState', message }),
|
|
12
|
+
invalidLoop: (loopId, message) => ({ _tag: 'InvalidLoop', loopId, message }),
|
|
13
|
+
conditionEvalFailed: (message) => ({ _tag: 'ConditionEvalFailed', message }),
|
|
14
|
+
maxIterationsExceeded: (loopId, maxIterations) => ({
|
|
15
|
+
_tag: 'MaxIterationsExceeded',
|
|
16
|
+
loopId,
|
|
17
|
+
maxIterations,
|
|
18
|
+
message: `Loop '${loopId}' exceeded maxIterations (${maxIterations})`,
|
|
19
|
+
}),
|
|
20
|
+
missingContext: (message) => ({ _tag: 'MissingContext', message }),
|
|
21
|
+
};
|
|
22
|
+
function isRetriable(_e) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WorkflowEventSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const state_1 = require("./state");
|
|
6
|
+
exports.WorkflowEventSchema = zod_1.z.discriminatedUnion('kind', [
|
|
7
|
+
zod_1.z.object({
|
|
8
|
+
kind: zod_1.z.literal('step_completed'),
|
|
9
|
+
stepInstanceId: state_1.StepInstanceIdSchema,
|
|
10
|
+
}),
|
|
11
|
+
]);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface LoopPathFrame {
|
|
2
|
+
readonly loopId: string;
|
|
3
|
+
readonly iteration: number;
|
|
4
|
+
}
|
|
5
|
+
export interface StepInstanceId {
|
|
6
|
+
readonly stepId: string;
|
|
7
|
+
readonly loopPath: readonly LoopPathFrame[];
|
|
8
|
+
}
|
|
9
|
+
export declare function toStepInstanceKey(id: StepInstanceId): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toStepInstanceKey = toStepInstanceKey;
|
|
4
|
+
function toStepInstanceKey(id) {
|
|
5
|
+
const path = id.loopPath
|
|
6
|
+
.map((f) => `${f.loopId}@${f.iteration}`)
|
|
7
|
+
.join('/');
|
|
8
|
+
return path.length === 0 ? id.stepId : `${path}::${id.stepId}`;
|
|
9
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isErr = exports.isOk = exports.err = exports.ok = void 0;
|
|
4
|
+
var neverthrow_1 = require("neverthrow");
|
|
5
|
+
Object.defineProperty(exports, "ok", { enumerable: true, get: function () { return neverthrow_1.ok; } });
|
|
6
|
+
Object.defineProperty(exports, "err", { enumerable: true, get: function () { return neverthrow_1.err; } });
|
|
7
|
+
const isOk = (r) => r.isOk();
|
|
8
|
+
exports.isOk = isOk;
|
|
9
|
+
const isErr = (r) => r.isErr();
|
|
10
|
+
exports.isErr = isErr;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { StepInstanceId } from './ids';
|
|
3
|
+
export interface LoopFrame {
|
|
4
|
+
readonly loopId: string;
|
|
5
|
+
readonly iteration: number;
|
|
6
|
+
readonly bodyIndex: number;
|
|
7
|
+
}
|
|
8
|
+
export type ExecutionState = {
|
|
9
|
+
readonly kind: 'init';
|
|
10
|
+
} | {
|
|
11
|
+
readonly kind: 'running';
|
|
12
|
+
readonly completed: readonly string[];
|
|
13
|
+
readonly loopStack: readonly LoopFrame[];
|
|
14
|
+
readonly pendingStep?: StepInstanceId;
|
|
15
|
+
} | {
|
|
16
|
+
readonly kind: 'complete';
|
|
17
|
+
};
|
|
18
|
+
export declare const LoopFrameSchema: z.ZodObject<{
|
|
19
|
+
loopId: z.ZodString;
|
|
20
|
+
iteration: z.ZodNumber;
|
|
21
|
+
bodyIndex: z.ZodNumber;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
iteration: number;
|
|
24
|
+
loopId: string;
|
|
25
|
+
bodyIndex: number;
|
|
26
|
+
}, {
|
|
27
|
+
iteration: number;
|
|
28
|
+
loopId: string;
|
|
29
|
+
bodyIndex: number;
|
|
30
|
+
}>;
|
|
31
|
+
export declare const StepInstanceIdSchema: z.ZodObject<{
|
|
32
|
+
stepId: z.ZodString;
|
|
33
|
+
loopPath: z.ZodArray<z.ZodObject<{
|
|
34
|
+
loopId: z.ZodString;
|
|
35
|
+
iteration: z.ZodNumber;
|
|
36
|
+
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
iteration: number;
|
|
38
|
+
loopId: string;
|
|
39
|
+
}, {
|
|
40
|
+
iteration: number;
|
|
41
|
+
loopId: string;
|
|
42
|
+
}>, "many">;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
stepId: string;
|
|
45
|
+
loopPath: {
|
|
46
|
+
iteration: number;
|
|
47
|
+
loopId: string;
|
|
48
|
+
}[];
|
|
49
|
+
}, {
|
|
50
|
+
stepId: string;
|
|
51
|
+
loopPath: {
|
|
52
|
+
iteration: number;
|
|
53
|
+
loopId: string;
|
|
54
|
+
}[];
|
|
55
|
+
}>;
|
|
56
|
+
export declare const ExecutionStateSchema: z.ZodType<ExecutionState>;
|
|
57
|
+
export declare const initialExecutionState: () => ExecutionState;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initialExecutionState = exports.ExecutionStateSchema = exports.StepInstanceIdSchema = exports.LoopFrameSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.LoopFrameSchema = zod_1.z.object({
|
|
6
|
+
loopId: zod_1.z.string().min(1),
|
|
7
|
+
iteration: zod_1.z.number().int().min(0),
|
|
8
|
+
bodyIndex: zod_1.z.number().int().min(0),
|
|
9
|
+
});
|
|
10
|
+
exports.StepInstanceIdSchema = zod_1.z.object({
|
|
11
|
+
stepId: zod_1.z.string().min(1),
|
|
12
|
+
loopPath: zod_1.z.array(zod_1.z.object({
|
|
13
|
+
loopId: zod_1.z.string().min(1),
|
|
14
|
+
iteration: zod_1.z.number().int().min(0),
|
|
15
|
+
})),
|
|
16
|
+
});
|
|
17
|
+
exports.ExecutionStateSchema = zod_1.z.discriminatedUnion('kind', [
|
|
18
|
+
zod_1.z.object({ kind: zod_1.z.literal('init') }),
|
|
19
|
+
zod_1.z.object({
|
|
20
|
+
kind: zod_1.z.literal('running'),
|
|
21
|
+
completed: zod_1.z.array(zod_1.z.string()),
|
|
22
|
+
loopStack: zod_1.z.array(exports.LoopFrameSchema),
|
|
23
|
+
pendingStep: exports.StepInstanceIdSchema.optional(),
|
|
24
|
+
}),
|
|
25
|
+
zod_1.z.object({ kind: zod_1.z.literal('complete') }),
|
|
26
|
+
]);
|
|
27
|
+
const initialExecutionState = () => ({ kind: 'init' });
|
|
28
|
+
exports.initialExecutionState = initialExecutionState;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Brand } from '../runtime/brand.js';
|
|
2
|
+
export type ConfigIssue = Readonly<{
|
|
3
|
+
readonly path: string;
|
|
4
|
+
readonly message: string;
|
|
5
|
+
}>;
|
|
6
|
+
export type ConfigInvalidError = Readonly<{
|
|
7
|
+
readonly _tag: 'ConfigInvalid';
|
|
8
|
+
readonly issues: readonly ConfigIssue[];
|
|
9
|
+
readonly message: string;
|
|
10
|
+
}>;
|
|
11
|
+
export type StartupFailedError = Readonly<{
|
|
12
|
+
readonly _tag: 'StartupFailed';
|
|
13
|
+
readonly phase: string;
|
|
14
|
+
readonly message: string;
|
|
15
|
+
readonly cause?: unknown;
|
|
16
|
+
}>;
|
|
17
|
+
export type UnexpectedError = Readonly<{
|
|
18
|
+
readonly _tag: 'Unexpected';
|
|
19
|
+
readonly message: string;
|
|
20
|
+
readonly cause: unknown;
|
|
21
|
+
}>;
|
|
22
|
+
export type AppError = ConfigInvalidError | StartupFailedError | UnexpectedError;
|
|
23
|
+
export type ValidatedAppConfig<T> = Brand<T, 'ValidatedAppConfig'>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ConfigIssue, ConfigInvalidError, StartupFailedError, UnexpectedError } from './app-error.js';
|
|
2
|
+
export declare const Err: {
|
|
3
|
+
readonly configInvalid: (issues: readonly ConfigIssue[]) => ConfigInvalidError;
|
|
4
|
+
readonly startupFailed: (phase: string, message: string, cause?: unknown) => StartupFailedError;
|
|
5
|
+
readonly unexpected: (message: string, cause: unknown) => UnexpectedError;
|
|
6
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Err = void 0;
|
|
4
|
+
exports.Err = {
|
|
5
|
+
configInvalid: (issues) => ({
|
|
6
|
+
_tag: 'ConfigInvalid',
|
|
7
|
+
issues,
|
|
8
|
+
message: 'Invalid configuration',
|
|
9
|
+
}),
|
|
10
|
+
startupFailed: (phase, message, cause) => ({
|
|
11
|
+
_tag: 'StartupFailed',
|
|
12
|
+
phase,
|
|
13
|
+
message,
|
|
14
|
+
cause,
|
|
15
|
+
}),
|
|
16
|
+
unexpected: (message, cause) => ({
|
|
17
|
+
_tag: 'Unexpected',
|
|
18
|
+
message,
|
|
19
|
+
cause,
|
|
20
|
+
}),
|
|
21
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatAppError = formatAppError;
|
|
4
|
+
const assert_never_js_1 = require("../runtime/assert-never.js");
|
|
5
|
+
function formatAppError(error) {
|
|
6
|
+
switch (error._tag) {
|
|
7
|
+
case 'ConfigInvalid': {
|
|
8
|
+
const issues = error.issues.length
|
|
9
|
+
? error.issues.map((i) => ` - ${i.path}: ${i.message}`).join('\n')
|
|
10
|
+
: ' - (no details)';
|
|
11
|
+
return `${error.message}\n\n${issues}`;
|
|
12
|
+
}
|
|
13
|
+
case 'StartupFailed': {
|
|
14
|
+
const base = `Startup failed during ${error.phase}: ${error.message}`;
|
|
15
|
+
return error.cause ? `${base}\nCause: ${safeToString(error.cause)}` : base;
|
|
16
|
+
}
|
|
17
|
+
case 'Unexpected':
|
|
18
|
+
return `${error.message}\nCause: ${safeToString(error.cause)}`;
|
|
19
|
+
default:
|
|
20
|
+
return (0, assert_never_js_1.assertNever)(error);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function safeToString(value) {
|
|
24
|
+
if (value instanceof Error)
|
|
25
|
+
return `${value.name}: ${value.message}`;
|
|
26
|
+
try {
|
|
27
|
+
return typeof value === 'string' ? value : JSON.stringify(value);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return String(value);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatAppError = exports.Err = void 0;
|
|
4
|
+
var factories_js_1 = require("./factories.js");
|
|
5
|
+
Object.defineProperty(exports, "Err", { enumerable: true, get: function () { return factories_js_1.Err; } });
|
|
6
|
+
var formatter_js_1 = require("./formatter.js");
|
|
7
|
+
Object.defineProperty(exports, "formatAppError", { enumerable: true, get: function () { return formatter_js_1.formatAppError; } });
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export {
|
|
2
|
+
export { bootstrap, initializeContainer, container, resetContainer } from './di/container.js';
|
|
3
|
+
export { DI } from './di/tokens.js';
|
|
4
|
+
export type { WorkflowService } from './application/services/workflow-service.js';
|
|
5
|
+
export type { IWorkflowStorage } from './types/storage.js';
|
|
6
|
+
export type { IFeatureFlagProvider } from './config/feature-flags.js';
|
|
7
|
+
export { startServer } from './mcp/server.js';
|