@exaudeus/workrail 0.8.6 → 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 +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 +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/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
|
@@ -1,410 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SqliteMetadataStorage = void 0;
|
|
7
|
-
const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
|
|
8
|
-
const crypto_1 = __importDefault(require("crypto"));
|
|
9
|
-
const path_1 = __importDefault(require("path"));
|
|
10
|
-
const fs_1 = __importDefault(require("fs"));
|
|
11
|
-
const sqlite_migrator_1 = require("./sqlite-migrator");
|
|
12
|
-
class SqliteMetadataStorage {
|
|
13
|
-
constructor(config) {
|
|
14
|
-
this.db = null;
|
|
15
|
-
this.migrator = null;
|
|
16
|
-
this.isInitialized = false;
|
|
17
|
-
this.heartbeatIntervals = new Map();
|
|
18
|
-
this.cleanupInterval = null;
|
|
19
|
-
this.statements = {};
|
|
20
|
-
this.config = config;
|
|
21
|
-
}
|
|
22
|
-
async initialize() {
|
|
23
|
-
if (this.isInitialized) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
try {
|
|
27
|
-
await this.ensureDataDirectory();
|
|
28
|
-
const dbPath = path_1.default.join(this.config.dataDirectory, this.config.database.path);
|
|
29
|
-
this.db = new better_sqlite3_1.default(dbPath, {
|
|
30
|
-
timeout: this.config.database.timeout,
|
|
31
|
-
verbose: undefined
|
|
32
|
-
});
|
|
33
|
-
if (this.config.database.walMode) {
|
|
34
|
-
this.db.pragma('journal_mode = WAL');
|
|
35
|
-
}
|
|
36
|
-
this.db.pragma('synchronous = NORMAL');
|
|
37
|
-
this.db.pragma('cache_size = 1000');
|
|
38
|
-
this.db.pragma('temp_store = memory');
|
|
39
|
-
this.db.pragma('foreign_keys = ON');
|
|
40
|
-
this.migrator = new sqlite_migrator_1.SqliteMigrator(dbPath);
|
|
41
|
-
await this.migrator.initialize();
|
|
42
|
-
const migrationResults = await this.migrator.migrate();
|
|
43
|
-
if (migrationResults.some(result => !result.success)) {
|
|
44
|
-
throw new Error('Database migration failed');
|
|
45
|
-
}
|
|
46
|
-
const isValid = await this.migrator.validateIntegrity();
|
|
47
|
-
if (!isValid) {
|
|
48
|
-
throw new Error('Database integrity validation failed');
|
|
49
|
-
}
|
|
50
|
-
await this.prepareStatements();
|
|
51
|
-
await this.cleanupInterruptedOperations();
|
|
52
|
-
this.setupAutomaticCleanup();
|
|
53
|
-
this.isInitialized = true;
|
|
54
|
-
console.log('✅ SQLite metadata storage initialized');
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
await this.cleanup();
|
|
58
|
-
throw new Error(`Failed to initialize SQLite metadata storage: ${error}`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
async saveCheckpointMetadata(metadata) {
|
|
62
|
-
this.ensureInitialized();
|
|
63
|
-
try {
|
|
64
|
-
this.statements.insertCheckpoint.run(metadata.id, metadata.sessionId, metadata.name || null, metadata.agentId || null, metadata.createdAt, metadata.tags ? JSON.stringify(metadata.tags) : null, metadata.contextSizeBytes, metadata.contextHash, metadata.blobPath, metadata.status, null, 1.0, metadata.classificationSummary ? JSON.stringify(metadata.classificationSummary) : null);
|
|
65
|
-
console.log(`📦 Saved checkpoint metadata: ${metadata.id}`);
|
|
66
|
-
}
|
|
67
|
-
catch (error) {
|
|
68
|
-
throw new Error(`Failed to save checkpoint metadata: ${error}`);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
async getCheckpointMetadata(checkpointId) {
|
|
72
|
-
this.ensureInitialized();
|
|
73
|
-
try {
|
|
74
|
-
const row = this.statements.selectCheckpoint.get(checkpointId);
|
|
75
|
-
if (!row) {
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
return this.mapRowToCheckpointMetadata(row);
|
|
79
|
-
}
|
|
80
|
-
catch (error) {
|
|
81
|
-
throw new Error(`Failed to get checkpoint metadata: ${error}`);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
async listCheckpointMetadata(sessionId, limit = 20, offset = 0) {
|
|
85
|
-
this.ensureInitialized();
|
|
86
|
-
try {
|
|
87
|
-
const rows = this.statements.selectCheckpointsBySession.all(sessionId, limit, offset);
|
|
88
|
-
return rows.map(row => this.mapRowToCheckpointMetadata(row));
|
|
89
|
-
}
|
|
90
|
-
catch (error) {
|
|
91
|
-
throw new Error(`Failed to list checkpoint metadata: ${error}`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
async deleteCheckpointMetadata(checkpointId) {
|
|
95
|
-
this.ensureInitialized();
|
|
96
|
-
try {
|
|
97
|
-
const result = this.statements.deleteCheckpoint.run(checkpointId);
|
|
98
|
-
if (result.changes === 0) {
|
|
99
|
-
throw new Error(`Checkpoint ${checkpointId} not found`);
|
|
100
|
-
}
|
|
101
|
-
console.log(`🗑️ Deleted checkpoint metadata: ${checkpointId}`);
|
|
102
|
-
}
|
|
103
|
-
catch (error) {
|
|
104
|
-
throw new Error(`Failed to delete checkpoint metadata: ${error}`);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
async upsertSessionInfo(session) {
|
|
108
|
-
this.ensureInitialized();
|
|
109
|
-
try {
|
|
110
|
-
this.statements.upsertSession.run(session.id, session.createdAt, session.lastAccessedAt, session.tags ? JSON.stringify(session.tags) : null, session.totalSizeBytes);
|
|
111
|
-
console.log(`📋 Upserted session: ${session.id}`);
|
|
112
|
-
}
|
|
113
|
-
catch (error) {
|
|
114
|
-
throw new Error(`Failed to upsert session: ${error}`);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
async getSessionInfo(sessionId) {
|
|
118
|
-
this.ensureInitialized();
|
|
119
|
-
try {
|
|
120
|
-
const row = this.statements.selectSession.get(sessionId);
|
|
121
|
-
if (!row) {
|
|
122
|
-
return null;
|
|
123
|
-
}
|
|
124
|
-
return {
|
|
125
|
-
id: row.id,
|
|
126
|
-
createdAt: row.created_at,
|
|
127
|
-
lastAccessedAt: row.last_accessed_at,
|
|
128
|
-
tags: row.tags ? JSON.parse(row.tags) : undefined,
|
|
129
|
-
totalSizeBytes: row.total_size_bytes
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
catch (error) {
|
|
133
|
-
throw new Error(`Failed to get session info: ${error}`);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
async deleteSessionInfo(sessionId) {
|
|
137
|
-
this.ensureInitialized();
|
|
138
|
-
try {
|
|
139
|
-
const result = this.statements.deleteSession.run(sessionId);
|
|
140
|
-
if (result.changes === 0) {
|
|
141
|
-
throw new Error(`Session ${sessionId} not found`);
|
|
142
|
-
}
|
|
143
|
-
console.log(`🗑️ Deleted session: ${sessionId}`);
|
|
144
|
-
}
|
|
145
|
-
catch (error) {
|
|
146
|
-
throw new Error(`Failed to delete session: ${error}`);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
async acquireSessionLock(sessionId, operationType, timeoutMs) {
|
|
150
|
-
this.ensureInitialized();
|
|
151
|
-
const operationId = crypto_1.default.randomUUID();
|
|
152
|
-
const timeout = timeoutMs || this.config.concurrency.operationTimeoutMs;
|
|
153
|
-
const expiresAt = new Date(Date.now() + timeout).toISOString();
|
|
154
|
-
const maxRetries = this.config.concurrency.maxRetries;
|
|
155
|
-
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
156
|
-
try {
|
|
157
|
-
await this.cleanupStaleOperations();
|
|
158
|
-
this.statements.insertActiveOperation.run(operationId, sessionId, operationType, new Date().toISOString(), new Date().toISOString(), timeout, JSON.stringify({ attempt, maxRetries }));
|
|
159
|
-
this.statements.acquireSessionLock.run(sessionId, operationId, new Date().toISOString(), expiresAt);
|
|
160
|
-
this.startHeartbeat(operationId);
|
|
161
|
-
console.log(`🔒 Acquired lock for session ${sessionId}, operation: ${operationId}`);
|
|
162
|
-
return operationId;
|
|
163
|
-
}
|
|
164
|
-
catch (error) {
|
|
165
|
-
if (attempt === maxRetries) {
|
|
166
|
-
throw new Error(`Failed to acquire session lock for ${sessionId} after ${maxRetries} attempts: ${error}`);
|
|
167
|
-
}
|
|
168
|
-
const delay = Math.min(1000 * Math.pow(2, attempt - 1), 5000);
|
|
169
|
-
await new Promise(resolve => setTimeout(resolve, delay));
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
throw new Error(`Unable to acquire session lock for ${sessionId}`);
|
|
173
|
-
}
|
|
174
|
-
async releaseSessionLock(operationId) {
|
|
175
|
-
this.ensureInitialized();
|
|
176
|
-
try {
|
|
177
|
-
this.stopHeartbeat(operationId);
|
|
178
|
-
this.statements.releaseSessionLock.run(operationId);
|
|
179
|
-
this.statements.deleteActiveOperation.run(operationId);
|
|
180
|
-
console.log(`🔓 Released lock for operation: ${operationId}`);
|
|
181
|
-
}
|
|
182
|
-
catch (error) {
|
|
183
|
-
console.warn(`Warning: Failed to release session lock ${operationId}:`, error);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
async updateOperationHeartbeat(operationId) {
|
|
187
|
-
this.ensureInitialized();
|
|
188
|
-
try {
|
|
189
|
-
this.statements.updateHeartbeat.run(new Date().toISOString(), operationId);
|
|
190
|
-
}
|
|
191
|
-
catch (error) {
|
|
192
|
-
console.warn(`Warning: Failed to update heartbeat for ${operationId}:`, error);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
async cleanupStaleOperations() {
|
|
196
|
-
this.ensureInitialized();
|
|
197
|
-
try {
|
|
198
|
-
const result = this.statements.cleanupStaleOperations.run();
|
|
199
|
-
if (result.changes > 0) {
|
|
200
|
-
console.log(`🧹 Cleaned up ${result.changes} stale operations`);
|
|
201
|
-
}
|
|
202
|
-
return result.changes;
|
|
203
|
-
}
|
|
204
|
-
catch (error) {
|
|
205
|
-
console.warn('Warning: Failed to cleanup stale operations:', error);
|
|
206
|
-
return 0;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
async getMetadataStats() {
|
|
210
|
-
this.ensureInitialized();
|
|
211
|
-
try {
|
|
212
|
-
const countsQuery = `
|
|
213
|
-
SELECT
|
|
214
|
-
(SELECT COUNT(*) FROM sessions) as sessions,
|
|
215
|
-
(SELECT COUNT(*) FROM checkpoint_metadata) as checkpoints,
|
|
216
|
-
(SELECT COUNT(*) FROM active_operations) as active_ops,
|
|
217
|
-
(SELECT AVG(context_size_bytes) FROM checkpoint_metadata) as avg_size
|
|
218
|
-
`;
|
|
219
|
-
const counts = this.db.prepare(countsQuery).get();
|
|
220
|
-
const dbPath = path_1.default.join(this.config.dataDirectory, this.config.database.path);
|
|
221
|
-
const dbStats = fs_1.default.statSync(dbPath);
|
|
222
|
-
return {
|
|
223
|
-
databaseSizeBytes: dbStats.size,
|
|
224
|
-
totalSessions: counts.sessions || 0,
|
|
225
|
-
totalCheckpoints: counts.checkpoints || 0,
|
|
226
|
-
activeOperations: counts.active_ops || 0,
|
|
227
|
-
averageCheckpointSize: counts.avg_size || 0,
|
|
228
|
-
indexEfficiency: 1.0
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
catch (error) {
|
|
232
|
-
throw new Error(`Failed to get metadata stats: ${error}`);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
async close() {
|
|
236
|
-
await this.cleanup();
|
|
237
|
-
}
|
|
238
|
-
ensureInitialized() {
|
|
239
|
-
if (!this.isInitialized || !this.db) {
|
|
240
|
-
throw new Error('SqliteMetadataStorage not initialized');
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
async ensureDataDirectory() {
|
|
244
|
-
try {
|
|
245
|
-
await fs_1.default.promises.mkdir(this.config.dataDirectory, {
|
|
246
|
-
recursive: true,
|
|
247
|
-
mode: this.config.blobs.directoryPermissions
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
catch (error) {
|
|
251
|
-
throw new Error(`Failed to create data directory: ${error}`);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
async prepareStatements() {
|
|
255
|
-
if (!this.db)
|
|
256
|
-
return;
|
|
257
|
-
this.statements = {
|
|
258
|
-
insertCheckpoint: this.db.prepare(`
|
|
259
|
-
INSERT OR REPLACE INTO checkpoint_metadata (
|
|
260
|
-
id, session_id, name, agent_id, created_at, tags,
|
|
261
|
-
context_size_bytes, context_hash, blob_path, status,
|
|
262
|
-
created_by_operation, compression_ratio, classification_info
|
|
263
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
264
|
-
`),
|
|
265
|
-
selectCheckpoint: this.db.prepare(`
|
|
266
|
-
SELECT * FROM checkpoint_metadata WHERE id = ?
|
|
267
|
-
`),
|
|
268
|
-
selectCheckpointsBySession: this.db.prepare(`
|
|
269
|
-
SELECT * FROM checkpoint_metadata
|
|
270
|
-
WHERE session_id = ?
|
|
271
|
-
ORDER BY created_at DESC
|
|
272
|
-
LIMIT ? OFFSET ?
|
|
273
|
-
`),
|
|
274
|
-
deleteCheckpoint: this.db.prepare(`
|
|
275
|
-
DELETE FROM checkpoint_metadata WHERE id = ?
|
|
276
|
-
`),
|
|
277
|
-
upsertSession: this.db.prepare(`
|
|
278
|
-
INSERT OR REPLACE INTO sessions (
|
|
279
|
-
id, created_at, last_accessed_at, tags, total_size_bytes
|
|
280
|
-
) VALUES (?, ?, ?, ?, ?)
|
|
281
|
-
`),
|
|
282
|
-
selectSession: this.db.prepare(`
|
|
283
|
-
SELECT * FROM sessions WHERE id = ?
|
|
284
|
-
`),
|
|
285
|
-
deleteSession: this.db.prepare(`
|
|
286
|
-
DELETE FROM sessions WHERE id = ?
|
|
287
|
-
`),
|
|
288
|
-
insertActiveOperation: this.db.prepare(`
|
|
289
|
-
INSERT INTO active_operations (
|
|
290
|
-
id, session_id, operation_type, started_at, heartbeat_at, timeout_ms, metadata
|
|
291
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
292
|
-
`),
|
|
293
|
-
deleteActiveOperation: this.db.prepare(`
|
|
294
|
-
DELETE FROM active_operations WHERE id = ?
|
|
295
|
-
`),
|
|
296
|
-
updateHeartbeat: this.db.prepare(`
|
|
297
|
-
UPDATE active_operations SET heartbeat_at = ? WHERE id = ?
|
|
298
|
-
`),
|
|
299
|
-
cleanupStaleOperations: this.db.prepare(`
|
|
300
|
-
DELETE FROM active_operations
|
|
301
|
-
WHERE heartbeat_at < datetime('now', '-5 minutes')
|
|
302
|
-
OR started_at < datetime('now', '-10 minutes')
|
|
303
|
-
`),
|
|
304
|
-
acquireSessionLock: this.db.prepare(`
|
|
305
|
-
UPDATE sessions
|
|
306
|
-
SET locked_at = ?, locked_by = ?, lock_timeout_at = ?
|
|
307
|
-
WHERE id = ? AND (locked_at IS NULL OR lock_timeout_at < CURRENT_TIMESTAMP)
|
|
308
|
-
`),
|
|
309
|
-
releaseSessionLock: this.db.prepare(`
|
|
310
|
-
UPDATE sessions
|
|
311
|
-
SET locked_at = NULL, locked_by = NULL, lock_timeout_at = NULL
|
|
312
|
-
WHERE locked_by = ?
|
|
313
|
-
`),
|
|
314
|
-
checkSessionLock: this.db.prepare(`
|
|
315
|
-
SELECT locked_by, lock_timeout_at FROM sessions
|
|
316
|
-
WHERE id = ? AND locked_at IS NOT NULL
|
|
317
|
-
`)
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
mapRowToCheckpointMetadata(row) {
|
|
321
|
-
return {
|
|
322
|
-
id: row.id,
|
|
323
|
-
sessionId: row.session_id,
|
|
324
|
-
name: row.name || undefined,
|
|
325
|
-
agentId: row.agent_id || undefined,
|
|
326
|
-
createdAt: row.created_at,
|
|
327
|
-
tags: row.tags ? JSON.parse(row.tags) : undefined,
|
|
328
|
-
contextSizeBytes: row.context_size_bytes,
|
|
329
|
-
contextHash: row.context_hash,
|
|
330
|
-
blobPath: row.blob_path,
|
|
331
|
-
status: row.status,
|
|
332
|
-
classificationSummary: row.classification_info ? JSON.parse(row.classification_info) : undefined
|
|
333
|
-
};
|
|
334
|
-
}
|
|
335
|
-
async cleanupInterruptedOperations() {
|
|
336
|
-
try {
|
|
337
|
-
const cleanupCount = await this.cleanupStaleOperations();
|
|
338
|
-
if (cleanupCount > 0) {
|
|
339
|
-
console.log(`🔄 Cleaned up ${cleanupCount} interrupted operations from previous session`);
|
|
340
|
-
}
|
|
341
|
-
this.db.prepare(`
|
|
342
|
-
UPDATE sessions
|
|
343
|
-
SET locked_at = NULL, locked_by = NULL, lock_timeout_at = NULL
|
|
344
|
-
WHERE lock_timeout_at < CURRENT_TIMESTAMP
|
|
345
|
-
`).run();
|
|
346
|
-
}
|
|
347
|
-
catch (error) {
|
|
348
|
-
console.warn('Warning: Failed to cleanup interrupted operations:', error);
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
startHeartbeat(operationId) {
|
|
352
|
-
const interval = setInterval(async () => {
|
|
353
|
-
try {
|
|
354
|
-
await this.updateOperationHeartbeat(operationId);
|
|
355
|
-
}
|
|
356
|
-
catch (error) {
|
|
357
|
-
console.warn(`Heartbeat failed for operation ${operationId}:`, error);
|
|
358
|
-
this.stopHeartbeat(operationId);
|
|
359
|
-
}
|
|
360
|
-
}, this.config.concurrency.heartbeatIntervalMs);
|
|
361
|
-
this.heartbeatIntervals.set(operationId, interval);
|
|
362
|
-
}
|
|
363
|
-
stopHeartbeat(operationId) {
|
|
364
|
-
const interval = this.heartbeatIntervals.get(operationId);
|
|
365
|
-
if (interval) {
|
|
366
|
-
clearInterval(interval);
|
|
367
|
-
this.heartbeatIntervals.delete(operationId);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
setupAutomaticCleanup() {
|
|
371
|
-
this.cleanupInterval = setInterval(async () => {
|
|
372
|
-
try {
|
|
373
|
-
await this.cleanupStaleOperations();
|
|
374
|
-
}
|
|
375
|
-
catch (error) {
|
|
376
|
-
console.warn('Automatic cleanup failed:', error);
|
|
377
|
-
}
|
|
378
|
-
}, this.config.concurrency.cleanupIntervalMs);
|
|
379
|
-
process.on('exit', () => {
|
|
380
|
-
if (this.cleanupInterval) {
|
|
381
|
-
clearInterval(this.cleanupInterval);
|
|
382
|
-
}
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
async cleanup() {
|
|
386
|
-
try {
|
|
387
|
-
for (const interval of this.heartbeatIntervals.values()) {
|
|
388
|
-
clearInterval(interval);
|
|
389
|
-
}
|
|
390
|
-
this.heartbeatIntervals.clear();
|
|
391
|
-
if (this.cleanupInterval) {
|
|
392
|
-
clearInterval(this.cleanupInterval);
|
|
393
|
-
this.cleanupInterval = null;
|
|
394
|
-
}
|
|
395
|
-
if (this.migrator) {
|
|
396
|
-
this.migrator.close();
|
|
397
|
-
this.migrator = null;
|
|
398
|
-
}
|
|
399
|
-
if (this.db) {
|
|
400
|
-
this.db.close();
|
|
401
|
-
this.db = null;
|
|
402
|
-
}
|
|
403
|
-
this.isInitialized = false;
|
|
404
|
-
}
|
|
405
|
-
catch (error) {
|
|
406
|
-
console.warn('Warning during SQLite metadata storage cleanup:', error);
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
exports.SqliteMetadataStorage = SqliteMetadataStorage;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export interface Migration {
|
|
2
|
-
version: number;
|
|
3
|
-
filename: string;
|
|
4
|
-
description: string;
|
|
5
|
-
sql: string;
|
|
6
|
-
checksum: string;
|
|
7
|
-
}
|
|
8
|
-
export interface MigrationResult {
|
|
9
|
-
success: boolean;
|
|
10
|
-
appliedVersion?: number;
|
|
11
|
-
error?: string;
|
|
12
|
-
rollbackPerformed?: boolean;
|
|
13
|
-
duration?: number;
|
|
14
|
-
}
|
|
15
|
-
export interface MigrationStatus {
|
|
16
|
-
currentVersion: number;
|
|
17
|
-
targetVersion: number;
|
|
18
|
-
pendingMigrations: Migration[];
|
|
19
|
-
appliedMigrations: AppliedMigration[];
|
|
20
|
-
}
|
|
21
|
-
export interface AppliedMigration {
|
|
22
|
-
version: number;
|
|
23
|
-
description: string;
|
|
24
|
-
appliedAt: string;
|
|
25
|
-
checksum: string;
|
|
26
|
-
}
|
|
27
|
-
export declare class SqliteMigrator {
|
|
28
|
-
private db;
|
|
29
|
-
private migrationsDir;
|
|
30
|
-
private readonly maxRetries;
|
|
31
|
-
private readonly lockTimeout;
|
|
32
|
-
constructor(databasePath: string, migrationsDir?: string);
|
|
33
|
-
initialize(): Promise<void>;
|
|
34
|
-
getCurrentVersion(): number;
|
|
35
|
-
loadAvailableMigrations(): Migration[];
|
|
36
|
-
getMigrationStatus(): MigrationStatus;
|
|
37
|
-
migrate(): Promise<MigrationResult[]>;
|
|
38
|
-
private applyMigration;
|
|
39
|
-
private acquireMigrationLock;
|
|
40
|
-
private releaseMigrationLock;
|
|
41
|
-
private validateMigrationChecksum;
|
|
42
|
-
private calculateChecksum;
|
|
43
|
-
validateIntegrity(): Promise<boolean>;
|
|
44
|
-
close(): void;
|
|
45
|
-
getStats(): Record<string, any>;
|
|
46
|
-
}
|