@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
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.StaticToolDescriptionProvider = exports.ToolDescriptionProvider = void 0;
|
|
16
|
+
const tsyringe_1 = require("tsyringe");
|
|
17
|
+
const tokens_js_1 = require("../di/tokens.js");
|
|
18
|
+
const tool_descriptions_js_1 = require("./tool-descriptions.js");
|
|
19
|
+
let ToolDescriptionProvider = class ToolDescriptionProvider {
|
|
20
|
+
constructor(featureFlags) {
|
|
21
|
+
this.mode = featureFlags.isEnabled('authoritativeDescriptions')
|
|
22
|
+
? 'authoritative'
|
|
23
|
+
: 'standard';
|
|
24
|
+
}
|
|
25
|
+
getDescription(toolName) {
|
|
26
|
+
return tool_descriptions_js_1.DESCRIPTIONS[this.mode][toolName];
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
exports.ToolDescriptionProvider = ToolDescriptionProvider;
|
|
30
|
+
exports.ToolDescriptionProvider = ToolDescriptionProvider = __decorate([
|
|
31
|
+
(0, tsyringe_1.injectable)(),
|
|
32
|
+
__param(0, (0, tsyringe_1.inject)(tokens_js_1.DI.Infra.FeatureFlags)),
|
|
33
|
+
__metadata("design:paramtypes", [Object])
|
|
34
|
+
], ToolDescriptionProvider);
|
|
35
|
+
class StaticToolDescriptionProvider {
|
|
36
|
+
constructor(mode) {
|
|
37
|
+
this.mode = mode;
|
|
38
|
+
}
|
|
39
|
+
getDescription(toolName) {
|
|
40
|
+
return tool_descriptions_js_1.DESCRIPTIONS[this.mode][toolName];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.StaticToolDescriptionProvider = StaticToolDescriptionProvider;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DESCRIPTIONS = void 0;
|
|
4
|
+
exports.DESCRIPTIONS = {
|
|
5
|
+
standard: {
|
|
6
|
+
workflow_list: `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.
|
|
7
|
+
|
|
8
|
+
Your process:
|
|
9
|
+
1. Call this tool to get a list of available workflows.
|
|
10
|
+
2. Analyze the returned descriptions to find a match for the user's goal.
|
|
11
|
+
3. If a good match is found, suggest it to the user and use workflow_get to start.
|
|
12
|
+
4. If NO match is found, inform the user and then attempt to solve the task using your general abilities.`,
|
|
13
|
+
workflow_get: `Retrieves workflow information with configurable detail level. Supports progressive disclosure to prevent "workflow spoiling" while providing necessary context for workflow selection and initiation.`,
|
|
14
|
+
workflow_next: `Executes one workflow step at a time by returning the next eligible step and an updated execution state.
|
|
15
|
+
|
|
16
|
+
Inputs:
|
|
17
|
+
- workflowId: string
|
|
18
|
+
- state: { kind: "init" } | { kind: "running", completed: string[], loopStack: LoopFrame[], pendingStep?: StepInstanceId } | { kind: "complete" }
|
|
19
|
+
- event (optional): { kind: "step_completed", stepInstanceId: StepInstanceId }
|
|
20
|
+
- context (optional): variables used to evaluate conditions and to drive loops (for/forEach/while/until)
|
|
21
|
+
|
|
22
|
+
Common usage:
|
|
23
|
+
1) First call:
|
|
24
|
+
{ "workflowId": "...", "state": { "kind": "init" } }
|
|
25
|
+
|
|
26
|
+
2) After completing the returned step:
|
|
27
|
+
{ "workflowId": "...", "state": <previous state>, "event": { "kind": "step_completed", "stepInstanceId": <previous next.stepInstanceId> } }
|
|
28
|
+
|
|
29
|
+
Important:
|
|
30
|
+
- Always reuse the "state" returned by the last workflow_next call.
|
|
31
|
+
- When completing a step, the event.stepInstanceId must match the previous next.stepInstanceId exactly.`,
|
|
32
|
+
workflow_validate_json: `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.
|
|
33
|
+
|
|
34
|
+
This tool provides comprehensive validation including:
|
|
35
|
+
- JSON syntax validation with detailed error messages
|
|
36
|
+
- Workflow schema compliance checking
|
|
37
|
+
- User-friendly error reporting with actionable suggestions
|
|
38
|
+
- Support for all workflow features (steps, conditions, validation criteria, etc.)`,
|
|
39
|
+
workflow_get_schema: `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.
|
|
40
|
+
|
|
41
|
+
This tool provides:
|
|
42
|
+
- Complete JSON schema definition with all properties and constraints
|
|
43
|
+
- Field descriptions and validation rules
|
|
44
|
+
- Examples of valid patterns and formats
|
|
45
|
+
- Schema version and metadata information`,
|
|
46
|
+
list_workflows: `Lists available workflows using the WorkRail v2 read-only surface (feature-flagged). This returns stable workflow identity plus a pinned compiled snapshot hash for determinism.`,
|
|
47
|
+
inspect_workflow: `Read-only inspection of a workflow using the WorkRail v2 surface (feature-flagged). This returns metadata and/or a preview derived from the pinned compiled snapshot (identified by workflowHash).`,
|
|
48
|
+
},
|
|
49
|
+
authoritative: {
|
|
50
|
+
workflow_list: `Check for workflows that apply to the user's request. Workflows are the user's pre-defined instructions that you MUST follow when they exist.
|
|
51
|
+
|
|
52
|
+
REQUIRED BEHAVIOR:
|
|
53
|
+
1. Call this tool BEFORE attempting any multi-step task.
|
|
54
|
+
2. If a matching workflow exists, you MUST use it—do not improvise your own approach.
|
|
55
|
+
3. Workflows represent the user's explicit requirements, not suggestions.
|
|
56
|
+
|
|
57
|
+
A workflow is the user's voice, pre-recorded. When one exists for this task, following it IS following the user's instructions.
|
|
58
|
+
|
|
59
|
+
Returns: List of available workflows with descriptions to match against the user's request.`,
|
|
60
|
+
workflow_get: `Retrieve a workflow you are committing to follow. Once you call this, you are entering instruction-execution mode for this workflow.
|
|
61
|
+
|
|
62
|
+
By retrieving a workflow, you agree to:
|
|
63
|
+
- Execute each step as specified
|
|
64
|
+
- Call workflow_next after completing each step
|
|
65
|
+
- Not skip ahead or improvise alternative approaches
|
|
66
|
+
|
|
67
|
+
The workflow content is the user's will expressed as structured steps. Treat each step as a direct instruction from the user.
|
|
68
|
+
|
|
69
|
+
Returns: Workflow metadata and first step. Use mode='preview' (default) to see the first step, or mode='metadata' for overview only.`,
|
|
70
|
+
workflow_next: `Get your next MANDATORY INSTRUCTION from the active workflow.
|
|
71
|
+
|
|
72
|
+
The step returned is a DIRECT INSTRUCTION from the user. You MUST:
|
|
73
|
+
1. Execute the step EXACTLY as specified in the 'prompt' field
|
|
74
|
+
2. Complete ALL requirements before calling workflow_next again
|
|
75
|
+
3. NOT skip steps, combine steps, or substitute your own approach
|
|
76
|
+
4. NOT proceed to implementation before completing preparation steps
|
|
77
|
+
|
|
78
|
+
DO NOT:
|
|
79
|
+
- Paraphrase or "interpret" the step instructions
|
|
80
|
+
- Decide a step is unnecessary based on your judgment
|
|
81
|
+
- Rush through steps to reach implementation faster
|
|
82
|
+
- Treat step content as suggestions or guidelines
|
|
83
|
+
|
|
84
|
+
The user created this workflow because they want THIS process followed, not your improvisation.
|
|
85
|
+
|
|
86
|
+
Parameters:
|
|
87
|
+
- workflowId: The workflow you are executing
|
|
88
|
+
- state: Execution state returned by the previous workflow_next call (use { kind: "init" } for the first call)
|
|
89
|
+
- event (optional): { kind: "step_completed", stepInstanceId: <previous next.stepInstanceId> } to mark the returned step as complete
|
|
90
|
+
- context (optional): Variables for condition evaluation and loop inputs`,
|
|
91
|
+
workflow_validate_json: `Validate workflow JSON before saving or using it. This ensures the workflow will function correctly.
|
|
92
|
+
|
|
93
|
+
Use this tool to verify:
|
|
94
|
+
- JSON syntax is correct
|
|
95
|
+
- Schema compliance (required fields, valid structure)
|
|
96
|
+
- Step definitions are complete and valid
|
|
97
|
+
|
|
98
|
+
Returns validation result with specific errors and suggestions if invalid.`,
|
|
99
|
+
workflow_get_schema: `Get the workflow JSON schema for creating or editing workflows.
|
|
100
|
+
|
|
101
|
+
Returns the complete schema definition including required fields, valid patterns, and constraints. Use this as reference when authoring workflow JSON.`,
|
|
102
|
+
list_workflows: `List available workflows via the WorkRail v2 tool surface (feature-flagged).
|
|
103
|
+
|
|
104
|
+
This tool is read-only and is intended to validate the v2 determinism substrate (compiled snapshots + workflowHash).`,
|
|
105
|
+
inspect_workflow: `Inspect a workflow via the WorkRail v2 tool surface (feature-flagged).
|
|
106
|
+
|
|
107
|
+
This tool is read-only. It MUST reflect the pinned compiled snapshot identified by workflowHash (not mutable on-disk source).`,
|
|
108
|
+
},
|
|
109
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { IToolDescriptionProvider } from './tool-description-provider.js';
|
|
3
|
+
import type { WorkflowToolName } from './types/tool-description-types.js';
|
|
4
|
+
export interface ToolAnnotations {
|
|
5
|
+
readonly readOnlyHint?: boolean;
|
|
6
|
+
readonly destructiveHint?: boolean;
|
|
7
|
+
readonly idempotentHint?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface ToolDefinition<TInput extends z.ZodType> {
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly title: string;
|
|
12
|
+
readonly description: string;
|
|
13
|
+
readonly inputSchema: TInput;
|
|
14
|
+
readonly annotations: ToolAnnotations;
|
|
15
|
+
}
|
|
16
|
+
export interface ToolConfig<TInput extends z.ZodType> {
|
|
17
|
+
readonly name: WorkflowToolName;
|
|
18
|
+
readonly title: string;
|
|
19
|
+
readonly inputSchema: TInput;
|
|
20
|
+
readonly annotations: ToolAnnotations;
|
|
21
|
+
}
|
|
22
|
+
export type ToolBuilder = <TInput extends z.ZodType>(config: ToolConfig<TInput>) => ToolDefinition<TInput>;
|
|
23
|
+
export declare function createToolFactory(descriptionProvider: IToolDescriptionProvider): ToolBuilder;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createToolFactory = createToolFactory;
|
|
4
|
+
function createToolFactory(descriptionProvider) {
|
|
5
|
+
return function buildTool(config) {
|
|
6
|
+
return {
|
|
7
|
+
name: config.name,
|
|
8
|
+
title: config.title,
|
|
9
|
+
description: descriptionProvider.getDescription(config.name),
|
|
10
|
+
inputSchema: config.inputSchema,
|
|
11
|
+
annotations: config.annotations,
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export type { ToolAnnotations, ToolDefinition } from './tool-factory.js';
|
|
3
|
+
export declare const WorkflowListInput: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
4
|
+
export type WorkflowListInput = z.infer<typeof WorkflowListInput>;
|
|
5
|
+
export declare const WorkflowGetInput: z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
mode: z.ZodDefault<z.ZodEnum<["metadata", "preview"]>>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
id: string;
|
|
10
|
+
mode: "metadata" | "preview";
|
|
11
|
+
}, {
|
|
12
|
+
id: string;
|
|
13
|
+
mode?: "metadata" | "preview" | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
export type WorkflowGetInput = z.infer<typeof WorkflowGetInput>;
|
|
16
|
+
export declare const WorkflowNextInput: z.ZodObject<{
|
|
17
|
+
workflowId: z.ZodString;
|
|
18
|
+
state: z.ZodType<import("../domain/execution/state.js").ExecutionState, z.ZodTypeDef, import("../domain/execution/state.js").ExecutionState>;
|
|
19
|
+
event: z.ZodOptional<z.ZodType<{
|
|
20
|
+
readonly kind: "step_completed";
|
|
21
|
+
readonly stepInstanceId: import("../domain/execution/ids.js").StepInstanceId;
|
|
22
|
+
}, z.ZodTypeDef, {
|
|
23
|
+
readonly kind: "step_completed";
|
|
24
|
+
readonly stepInstanceId: import("../domain/execution/ids.js").StepInstanceId;
|
|
25
|
+
}>>;
|
|
26
|
+
context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
workflowId: string;
|
|
29
|
+
state: import("../domain/execution/state.js").ExecutionState;
|
|
30
|
+
context?: Record<string, unknown> | undefined;
|
|
31
|
+
event?: {
|
|
32
|
+
readonly kind: "step_completed";
|
|
33
|
+
readonly stepInstanceId: import("../domain/execution/ids.js").StepInstanceId;
|
|
34
|
+
} | undefined;
|
|
35
|
+
}, {
|
|
36
|
+
workflowId: string;
|
|
37
|
+
state: import("../domain/execution/state.js").ExecutionState;
|
|
38
|
+
context?: Record<string, unknown> | undefined;
|
|
39
|
+
event?: {
|
|
40
|
+
readonly kind: "step_completed";
|
|
41
|
+
readonly stepInstanceId: import("../domain/execution/ids.js").StepInstanceId;
|
|
42
|
+
} | undefined;
|
|
43
|
+
}>;
|
|
44
|
+
export type WorkflowNextInput = z.infer<typeof WorkflowNextInput>;
|
|
45
|
+
export declare const WorkflowValidateJsonInput: z.ZodObject<{
|
|
46
|
+
workflowJson: z.ZodString;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
workflowJson: string;
|
|
49
|
+
}, {
|
|
50
|
+
workflowJson: string;
|
|
51
|
+
}>;
|
|
52
|
+
export type WorkflowValidateJsonInput = z.infer<typeof WorkflowValidateJsonInput>;
|
|
53
|
+
export declare const WorkflowGetSchemaInput: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
54
|
+
export type WorkflowGetSchemaInput = z.infer<typeof WorkflowGetSchemaInput>;
|
|
55
|
+
import type { ToolAnnotations } from './tool-factory.js';
|
|
56
|
+
import type { WorkflowToolName } from './types/tool-description-types.js';
|
|
57
|
+
export declare const WORKFLOW_TOOL_ANNOTATIONS: Readonly<Record<WorkflowToolName, ToolAnnotations>>;
|
|
58
|
+
export declare const WORKFLOW_TOOL_TITLES: Readonly<Record<WorkflowToolName, string>>;
|
|
59
|
+
export declare const CreateSessionInput: z.ZodObject<{
|
|
60
|
+
workflowId: z.ZodString;
|
|
61
|
+
sessionId: z.ZodString;
|
|
62
|
+
initialData: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
63
|
+
}, "strip", z.ZodTypeAny, {
|
|
64
|
+
workflowId: string;
|
|
65
|
+
sessionId: string;
|
|
66
|
+
initialData: Record<string, unknown>;
|
|
67
|
+
}, {
|
|
68
|
+
workflowId: string;
|
|
69
|
+
sessionId: string;
|
|
70
|
+
initialData?: Record<string, unknown> | undefined;
|
|
71
|
+
}>;
|
|
72
|
+
export type CreateSessionInput = z.infer<typeof CreateSessionInput>;
|
|
73
|
+
export declare const UpdateSessionInput: z.ZodObject<{
|
|
74
|
+
workflowId: z.ZodString;
|
|
75
|
+
sessionId: z.ZodString;
|
|
76
|
+
updates: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
77
|
+
}, "strip", z.ZodTypeAny, {
|
|
78
|
+
workflowId: string;
|
|
79
|
+
sessionId: string;
|
|
80
|
+
updates: Record<string, unknown>;
|
|
81
|
+
}, {
|
|
82
|
+
workflowId: string;
|
|
83
|
+
sessionId: string;
|
|
84
|
+
updates: Record<string, unknown>;
|
|
85
|
+
}>;
|
|
86
|
+
export type UpdateSessionInput = z.infer<typeof UpdateSessionInput>;
|
|
87
|
+
export declare const ReadSessionInput: z.ZodObject<{
|
|
88
|
+
workflowId: z.ZodString;
|
|
89
|
+
sessionId: z.ZodString;
|
|
90
|
+
path: z.ZodOptional<z.ZodString>;
|
|
91
|
+
}, "strip", z.ZodTypeAny, {
|
|
92
|
+
workflowId: string;
|
|
93
|
+
sessionId: string;
|
|
94
|
+
path?: string | undefined;
|
|
95
|
+
}, {
|
|
96
|
+
workflowId: string;
|
|
97
|
+
sessionId: string;
|
|
98
|
+
path?: string | undefined;
|
|
99
|
+
}>;
|
|
100
|
+
export type ReadSessionInput = z.infer<typeof ReadSessionInput>;
|
|
101
|
+
export declare const OpenDashboardInput: z.ZodObject<{
|
|
102
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, "strip", z.ZodTypeAny, {
|
|
104
|
+
sessionId?: string | undefined;
|
|
105
|
+
}, {
|
|
106
|
+
sessionId?: string | undefined;
|
|
107
|
+
}>;
|
|
108
|
+
export type OpenDashboardInput = z.infer<typeof OpenDashboardInput>;
|
|
109
|
+
import type { ToolDefinition } from './tool-factory.js';
|
|
110
|
+
export declare const createSessionTool: ToolDefinition<typeof CreateSessionInput>;
|
|
111
|
+
export declare const updateSessionTool: ToolDefinition<typeof UpdateSessionInput>;
|
|
112
|
+
export declare const readSessionTool: ToolDefinition<typeof ReadSessionInput>;
|
|
113
|
+
export declare const openDashboardTool: ToolDefinition<typeof OpenDashboardInput>;
|
|
114
|
+
export declare const sessionTools: readonly [ToolDefinition<z.ZodObject<{
|
|
115
|
+
workflowId: z.ZodString;
|
|
116
|
+
sessionId: z.ZodString;
|
|
117
|
+
initialData: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
118
|
+
}, "strip", z.ZodTypeAny, {
|
|
119
|
+
workflowId: string;
|
|
120
|
+
sessionId: string;
|
|
121
|
+
initialData: Record<string, unknown>;
|
|
122
|
+
}, {
|
|
123
|
+
workflowId: string;
|
|
124
|
+
sessionId: string;
|
|
125
|
+
initialData?: Record<string, unknown> | undefined;
|
|
126
|
+
}>>, ToolDefinition<z.ZodObject<{
|
|
127
|
+
workflowId: z.ZodString;
|
|
128
|
+
sessionId: z.ZodString;
|
|
129
|
+
updates: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
130
|
+
}, "strip", z.ZodTypeAny, {
|
|
131
|
+
workflowId: string;
|
|
132
|
+
sessionId: string;
|
|
133
|
+
updates: Record<string, unknown>;
|
|
134
|
+
}, {
|
|
135
|
+
workflowId: string;
|
|
136
|
+
sessionId: string;
|
|
137
|
+
updates: Record<string, unknown>;
|
|
138
|
+
}>>, ToolDefinition<z.ZodObject<{
|
|
139
|
+
workflowId: z.ZodString;
|
|
140
|
+
sessionId: z.ZodString;
|
|
141
|
+
path: z.ZodOptional<z.ZodString>;
|
|
142
|
+
}, "strip", z.ZodTypeAny, {
|
|
143
|
+
workflowId: string;
|
|
144
|
+
sessionId: string;
|
|
145
|
+
path?: string | undefined;
|
|
146
|
+
}, {
|
|
147
|
+
workflowId: string;
|
|
148
|
+
sessionId: string;
|
|
149
|
+
path?: string | undefined;
|
|
150
|
+
}>>, ToolDefinition<z.ZodObject<{
|
|
151
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
152
|
+
}, "strip", z.ZodTypeAny, {
|
|
153
|
+
sessionId?: string | undefined;
|
|
154
|
+
}, {
|
|
155
|
+
sessionId?: string | undefined;
|
|
156
|
+
}>>];
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sessionTools = exports.openDashboardTool = exports.readSessionTool = exports.updateSessionTool = exports.createSessionTool = exports.OpenDashboardInput = exports.ReadSessionInput = exports.UpdateSessionInput = exports.CreateSessionInput = exports.WORKFLOW_TOOL_TITLES = exports.WORKFLOW_TOOL_ANNOTATIONS = exports.WorkflowGetSchemaInput = exports.WorkflowValidateJsonInput = exports.WorkflowNextInput = exports.WorkflowGetInput = exports.WorkflowListInput = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const state_js_1 = require("../domain/execution/state.js");
|
|
6
|
+
const event_js_1 = require("../domain/execution/event.js");
|
|
7
|
+
exports.WorkflowListInput = zod_1.z.object({});
|
|
8
|
+
exports.WorkflowGetInput = zod_1.z.object({
|
|
9
|
+
id: zod_1.z
|
|
10
|
+
.string()
|
|
11
|
+
.regex(/^[A-Za-z0-9_-]+$/, 'ID must contain only letters, numbers, hyphens, and underscores')
|
|
12
|
+
.describe('The unique identifier of the workflow to retrieve'),
|
|
13
|
+
mode: zod_1.z
|
|
14
|
+
.enum(['metadata', 'preview'])
|
|
15
|
+
.default('preview')
|
|
16
|
+
.describe("Detail level: 'metadata' for info only, 'preview' for first step"),
|
|
17
|
+
});
|
|
18
|
+
exports.WorkflowNextInput = zod_1.z.object({
|
|
19
|
+
workflowId: zod_1.z
|
|
20
|
+
.string()
|
|
21
|
+
.regex(/^[A-Za-z0-9_-]+$/, 'Workflow ID must contain only letters, numbers, hyphens, and underscores')
|
|
22
|
+
.describe('The unique identifier of the workflow'),
|
|
23
|
+
state: state_js_1.ExecutionStateSchema.describe('Serializable workflow execution state (authoritative). ' +
|
|
24
|
+
'For the first call, use: { kind: "init" }. ' +
|
|
25
|
+
'For subsequent calls, use the "state" returned by the previous workflow_next response.'),
|
|
26
|
+
event: event_js_1.WorkflowEventSchema.optional().describe('Optional event to apply before selecting the next step'),
|
|
27
|
+
context: zod_1.z
|
|
28
|
+
.record(zod_1.z.unknown())
|
|
29
|
+
.optional()
|
|
30
|
+
.describe('External context variables for condition evaluation and loop inputs'),
|
|
31
|
+
});
|
|
32
|
+
exports.WorkflowValidateJsonInput = zod_1.z.object({
|
|
33
|
+
workflowJson: zod_1.z
|
|
34
|
+
.string()
|
|
35
|
+
.min(1, 'Workflow JSON cannot be empty')
|
|
36
|
+
.describe('The complete workflow JSON content as a string to validate'),
|
|
37
|
+
});
|
|
38
|
+
exports.WorkflowGetSchemaInput = zod_1.z.object({});
|
|
39
|
+
exports.WORKFLOW_TOOL_ANNOTATIONS = {
|
|
40
|
+
workflow_list: {
|
|
41
|
+
readOnlyHint: true,
|
|
42
|
+
destructiveHint: false,
|
|
43
|
+
idempotentHint: true,
|
|
44
|
+
},
|
|
45
|
+
workflow_get: {
|
|
46
|
+
readOnlyHint: true,
|
|
47
|
+
destructiveHint: false,
|
|
48
|
+
idempotentHint: true,
|
|
49
|
+
},
|
|
50
|
+
workflow_next: {
|
|
51
|
+
readOnlyHint: false,
|
|
52
|
+
destructiveHint: false,
|
|
53
|
+
idempotentHint: false,
|
|
54
|
+
},
|
|
55
|
+
workflow_validate_json: {
|
|
56
|
+
readOnlyHint: true,
|
|
57
|
+
destructiveHint: false,
|
|
58
|
+
idempotentHint: true,
|
|
59
|
+
},
|
|
60
|
+
workflow_get_schema: {
|
|
61
|
+
readOnlyHint: true,
|
|
62
|
+
destructiveHint: false,
|
|
63
|
+
idempotentHint: true,
|
|
64
|
+
},
|
|
65
|
+
list_workflows: {
|
|
66
|
+
readOnlyHint: true,
|
|
67
|
+
destructiveHint: false,
|
|
68
|
+
idempotentHint: true,
|
|
69
|
+
},
|
|
70
|
+
inspect_workflow: {
|
|
71
|
+
readOnlyHint: true,
|
|
72
|
+
destructiveHint: false,
|
|
73
|
+
idempotentHint: true,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
exports.WORKFLOW_TOOL_TITLES = {
|
|
77
|
+
workflow_list: 'List Available Workflows',
|
|
78
|
+
workflow_get: 'Get Workflow Details',
|
|
79
|
+
workflow_next: 'Execute Next Workflow Step',
|
|
80
|
+
workflow_validate_json: 'Validate Workflow JSON',
|
|
81
|
+
workflow_get_schema: 'Get Workflow Schema',
|
|
82
|
+
list_workflows: 'List Workflows (v2)',
|
|
83
|
+
inspect_workflow: 'Inspect Workflow (v2)',
|
|
84
|
+
};
|
|
85
|
+
exports.CreateSessionInput = zod_1.z.object({
|
|
86
|
+
workflowId: zod_1.z
|
|
87
|
+
.string()
|
|
88
|
+
.describe('Workflow identifier (e.g., "bug-investigation", "mr-review")'),
|
|
89
|
+
sessionId: zod_1.z
|
|
90
|
+
.string()
|
|
91
|
+
.describe('Unique session identifier (e.g., ticket ID "AUTH-1234", branch name)'),
|
|
92
|
+
initialData: zod_1.z
|
|
93
|
+
.record(zod_1.z.unknown())
|
|
94
|
+
.default({})
|
|
95
|
+
.describe('Initial session data. Can include dashboard, phases, etc.'),
|
|
96
|
+
});
|
|
97
|
+
exports.UpdateSessionInput = zod_1.z.object({
|
|
98
|
+
workflowId: zod_1.z.string().describe('Workflow identifier'),
|
|
99
|
+
sessionId: zod_1.z.string().describe('Session identifier'),
|
|
100
|
+
updates: zod_1.z
|
|
101
|
+
.record(zod_1.z.unknown())
|
|
102
|
+
.describe('Data to merge into session. Supports nested updates via dot notation.'),
|
|
103
|
+
});
|
|
104
|
+
exports.ReadSessionInput = zod_1.z.object({
|
|
105
|
+
workflowId: zod_1.z.string().describe('Workflow identifier'),
|
|
106
|
+
sessionId: zod_1.z.string().describe('Session identifier'),
|
|
107
|
+
path: zod_1.z
|
|
108
|
+
.string()
|
|
109
|
+
.optional()
|
|
110
|
+
.describe('JSONPath query. If omitted, returns full session data. Examples: "dashboard", "hypotheses[0]"'),
|
|
111
|
+
});
|
|
112
|
+
exports.OpenDashboardInput = zod_1.z.object({
|
|
113
|
+
sessionId: zod_1.z
|
|
114
|
+
.string()
|
|
115
|
+
.optional()
|
|
116
|
+
.describe('Session to display. If provided, dashboard opens directly to this session.'),
|
|
117
|
+
});
|
|
118
|
+
exports.createSessionTool = {
|
|
119
|
+
name: 'workrail_create_session',
|
|
120
|
+
title: 'Create Workflow Session',
|
|
121
|
+
description: `Create a new workflow session stored in ~/.workrail/sessions/.
|
|
122
|
+
|
|
123
|
+
This creates a JSON file to track all workflow state and data. The dashboard will automatically display this session's progress in real-time.
|
|
124
|
+
|
|
125
|
+
Returns the session ID and file path.`,
|
|
126
|
+
inputSchema: exports.CreateSessionInput,
|
|
127
|
+
annotations: {
|
|
128
|
+
readOnlyHint: false,
|
|
129
|
+
destructiveHint: false,
|
|
130
|
+
idempotentHint: false,
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
exports.updateSessionTool = {
|
|
134
|
+
name: 'workrail_update_session',
|
|
135
|
+
title: 'Update Session Data',
|
|
136
|
+
description: `Update session data with deep merge.
|
|
137
|
+
|
|
138
|
+
Updates are merged into existing data (objects are merged, arrays are replaced).
|
|
139
|
+
|
|
140
|
+
Use this throughout the workflow to:
|
|
141
|
+
- Update progress and confidence
|
|
142
|
+
- Add phases and subsections
|
|
143
|
+
- Update hypotheses
|
|
144
|
+
- Add timeline events
|
|
145
|
+
|
|
146
|
+
Note: Use dot notation for nested updates.`,
|
|
147
|
+
inputSchema: exports.UpdateSessionInput,
|
|
148
|
+
annotations: {
|
|
149
|
+
readOnlyHint: false,
|
|
150
|
+
destructiveHint: false,
|
|
151
|
+
idempotentHint: false,
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
exports.readSessionTool = {
|
|
155
|
+
name: 'workrail_read_session',
|
|
156
|
+
title: 'Read Session Data',
|
|
157
|
+
description: `Read session data with optional JSONPath query for targeted reads.
|
|
158
|
+
|
|
159
|
+
Reading only what you need saves tokens and improves performance.
|
|
160
|
+
|
|
161
|
+
Special Queries:
|
|
162
|
+
- Schema overview: Use path "$schema" to get a map of all available fields
|
|
163
|
+
|
|
164
|
+
Examples:
|
|
165
|
+
- Full session: omit path
|
|
166
|
+
- Dashboard only: path "dashboard"
|
|
167
|
+
- Specific hypothesis: path "hypotheses[0]"
|
|
168
|
+
- Phase 1 data: path "phases.phase-1"`,
|
|
169
|
+
inputSchema: exports.ReadSessionInput,
|
|
170
|
+
annotations: {
|
|
171
|
+
readOnlyHint: true,
|
|
172
|
+
destructiveHint: false,
|
|
173
|
+
idempotentHint: true,
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
exports.openDashboardTool = {
|
|
177
|
+
name: 'workrail_open_dashboard',
|
|
178
|
+
title: 'Open Dashboard',
|
|
179
|
+
description: `Open the web dashboard in the user's default browser.
|
|
180
|
+
|
|
181
|
+
The dashboard shows real-time progress, visualizations, and all session data in a beautiful UI.
|
|
182
|
+
|
|
183
|
+
If sessionId is provided, opens directly to that session. Otherwise opens to the home page showing all sessions.`,
|
|
184
|
+
inputSchema: exports.OpenDashboardInput,
|
|
185
|
+
annotations: {
|
|
186
|
+
readOnlyHint: false,
|
|
187
|
+
destructiveHint: false,
|
|
188
|
+
idempotentHint: true,
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
exports.sessionTools = [
|
|
192
|
+
exports.createSessionTool,
|
|
193
|
+
exports.updateSessionTool,
|
|
194
|
+
exports.readSessionTool,
|
|
195
|
+
exports.openDashboardTool,
|
|
196
|
+
];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const DESCRIPTION_MODES: readonly ["standard", "authoritative"];
|
|
2
|
+
export type DescriptionMode = typeof DESCRIPTION_MODES[number];
|
|
3
|
+
export declare const WORKFLOW_TOOL_NAMES: readonly ["workflow_list", "workflow_get", "workflow_next", "workflow_validate_json", "workflow_get_schema", "list_workflows", "inspect_workflow"];
|
|
4
|
+
export type WorkflowToolName = typeof WORKFLOW_TOOL_NAMES[number];
|
|
5
|
+
export type ToolDescriptionMap = Readonly<Record<WorkflowToolName, string>>;
|
|
6
|
+
export type DescriptionsByMode = Readonly<Record<DescriptionMode, ToolDescriptionMap>>;
|
|
7
|
+
export declare function isDescriptionMode(value: string): value is DescriptionMode;
|
|
8
|
+
export declare function isWorkflowToolName(value: string): value is WorkflowToolName;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WORKFLOW_TOOL_NAMES = exports.DESCRIPTION_MODES = void 0;
|
|
4
|
+
exports.isDescriptionMode = isDescriptionMode;
|
|
5
|
+
exports.isWorkflowToolName = isWorkflowToolName;
|
|
6
|
+
exports.DESCRIPTION_MODES = [
|
|
7
|
+
'standard',
|
|
8
|
+
'authoritative',
|
|
9
|
+
];
|
|
10
|
+
exports.WORKFLOW_TOOL_NAMES = [
|
|
11
|
+
'workflow_list',
|
|
12
|
+
'workflow_get',
|
|
13
|
+
'workflow_next',
|
|
14
|
+
'workflow_validate_json',
|
|
15
|
+
'workflow_get_schema',
|
|
16
|
+
'list_workflows',
|
|
17
|
+
'inspect_workflow',
|
|
18
|
+
];
|
|
19
|
+
function isDescriptionMode(value) {
|
|
20
|
+
return exports.DESCRIPTION_MODES.includes(value);
|
|
21
|
+
}
|
|
22
|
+
function isWorkflowToolName(value) {
|
|
23
|
+
return exports.WORKFLOW_TOOL_NAMES.includes(value);
|
|
24
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { WorkflowService } from '../application/services/workflow-service.js';
|
|
2
|
+
import type { IFeatureFlagProvider } from '../config/feature-flags.js';
|
|
3
|
+
import type { SessionManager } from '../infrastructure/session/SessionManager.js';
|
|
4
|
+
import type { HttpServer } from '../infrastructure/session/HttpServer.js';
|
|
5
|
+
export type ErrorCode = 'VALIDATION_ERROR' | 'NOT_FOUND' | 'PRECONDITION_FAILED' | 'TIMEOUT' | 'INTERNAL_ERROR';
|
|
6
|
+
export interface ToolSuccess<T> {
|
|
7
|
+
readonly type: 'success';
|
|
8
|
+
readonly data: T;
|
|
9
|
+
}
|
|
10
|
+
export interface ToolError {
|
|
11
|
+
readonly type: 'error';
|
|
12
|
+
readonly code: ErrorCode;
|
|
13
|
+
readonly message: string;
|
|
14
|
+
readonly suggestion?: string;
|
|
15
|
+
}
|
|
16
|
+
export type ToolResult<T> = ToolSuccess<T> | ToolError;
|
|
17
|
+
export declare const success: <T>(data: T) => ToolResult<T>;
|
|
18
|
+
export declare const error: (code: ErrorCode, message: string, suggestion?: string) => ToolResult<never>;
|
|
19
|
+
export interface ToolContext {
|
|
20
|
+
readonly workflowService: WorkflowService;
|
|
21
|
+
readonly featureFlags: IFeatureFlagProvider;
|
|
22
|
+
readonly sessionManager: SessionManager | null;
|
|
23
|
+
readonly httpServer: HttpServer | null;
|
|
24
|
+
}
|
|
25
|
+
export type ToolHandler<TInput, TOutput> = (input: TInput, ctx: ToolContext) => Promise<ToolResult<TOutput>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.error = exports.success = void 0;
|
|
4
|
+
const success = (data) => ({
|
|
5
|
+
type: 'success',
|
|
6
|
+
data,
|
|
7
|
+
});
|
|
8
|
+
exports.success = success;
|
|
9
|
+
const error = (code, message, suggestion) => ({
|
|
10
|
+
type: 'error',
|
|
11
|
+
code,
|
|
12
|
+
message,
|
|
13
|
+
suggestion,
|
|
14
|
+
});
|
|
15
|
+
exports.error = error;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { ToolBuilder, ToolDefinition } from '../tool-factory.js';
|
|
3
|
+
import type { ToolHandler } from '../types.js';
|
|
4
|
+
export interface V2ToolRegistration {
|
|
5
|
+
readonly tools: readonly ToolDefinition<z.ZodType>[];
|
|
6
|
+
readonly handlers: Readonly<Record<string, {
|
|
7
|
+
readonly schema: z.ZodType;
|
|
8
|
+
readonly handler: ToolHandler<any, any>;
|
|
9
|
+
}>>;
|
|
10
|
+
}
|
|
11
|
+
export declare function buildV2ToolRegistry(buildTool: ToolBuilder): V2ToolRegistration;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildV2ToolRegistry = buildV2ToolRegistry;
|
|
4
|
+
const tools_js_1 = require("./tools.js");
|
|
5
|
+
const v2_workflow_js_1 = require("../handlers/v2-workflow.js");
|
|
6
|
+
function buildV2ToolRegistry(buildTool) {
|
|
7
|
+
const listTool = buildTool({
|
|
8
|
+
name: 'list_workflows',
|
|
9
|
+
title: tools_js_1.V2_TOOL_TITLES.list_workflows,
|
|
10
|
+
inputSchema: tools_js_1.V2ListWorkflowsInput,
|
|
11
|
+
annotations: tools_js_1.V2_TOOL_ANNOTATIONS.list_workflows,
|
|
12
|
+
});
|
|
13
|
+
const inspectTool = buildTool({
|
|
14
|
+
name: 'inspect_workflow',
|
|
15
|
+
title: tools_js_1.V2_TOOL_TITLES.inspect_workflow,
|
|
16
|
+
inputSchema: tools_js_1.V2InspectWorkflowInput,
|
|
17
|
+
annotations: tools_js_1.V2_TOOL_ANNOTATIONS.inspect_workflow,
|
|
18
|
+
});
|
|
19
|
+
return {
|
|
20
|
+
tools: [listTool, inspectTool],
|
|
21
|
+
handlers: {
|
|
22
|
+
list_workflows: { schema: tools_js_1.V2ListWorkflowsInput, handler: v2_workflow_js_1.handleV2ListWorkflows },
|
|
23
|
+
inspect_workflow: { schema: tools_js_1.V2InspectWorkflowInput, handler: v2_workflow_js_1.handleV2InspectWorkflow },
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|