@cyanheads/mcp-ts-core 0.11.4 → 0.12.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/AGENTS.md +28 -24
- package/CLAUDE.md +28 -24
- package/README.md +10 -10
- package/biome.json +1 -1
- package/changelog/0.11.x/0.11.5.md +28 -0
- package/changelog/0.12.x/0.12.0.md +96 -0
- package/changelog/template.md +55 -16
- package/dist/cli/init.js +1 -1
- package/dist/cli/init.js.map +1 -1
- package/dist/config/index.d.ts +0 -18
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +0 -25
- package/dist/config/index.js.map +1 -1
- package/dist/core/app.d.ts +5 -7
- package/dist/core/app.d.ts.map +1 -1
- package/dist/core/app.js +18 -27
- package/dist/core/app.js.map +1 -1
- package/dist/core/context.d.ts +90 -57
- package/dist/core/context.d.ts.map +1 -1
- package/dist/core/context.js +32 -33
- package/dist/core/context.js.map +1 -1
- package/dist/core/gcPressure.d.ts.map +1 -1
- package/dist/core/gcPressure.js +3 -4
- package/dist/core/gcPressure.js.map +1 -1
- package/dist/core/index.d.ts +6 -7
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +10 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/serverManifest.d.ts +1 -3
- package/dist/core/serverManifest.d.ts.map +1 -1
- package/dist/core/serverManifest.js +9 -4
- package/dist/core/serverManifest.js.map +1 -1
- package/dist/core/worker.d.ts.map +1 -1
- package/dist/core/worker.js +32 -35
- package/dist/core/worker.js.map +1 -1
- package/dist/logs/combined.log +10 -0
- package/dist/logs/error.log +6 -0
- package/dist/logs/interactions.log +0 -0
- package/dist/mcp-server/inputRequired.d.ts +52 -0
- package/dist/mcp-server/inputRequired.d.ts.map +1 -0
- package/dist/mcp-server/inputRequired.js +76 -0
- package/dist/mcp-server/inputRequired.js.map +1 -0
- package/dist/mcp-server/notifications.d.ts +33 -31
- package/dist/mcp-server/notifications.d.ts.map +1 -1
- package/dist/mcp-server/notifications.js +34 -26
- package/dist/mcp-server/notifications.js.map +1 -1
- package/dist/mcp-server/prompts/prompt-registration.d.ts +2 -2
- package/dist/mcp-server/prompts/prompt-registration.d.ts.map +1 -1
- package/dist/mcp-server/prompts/prompt-registration.js +15 -5
- package/dist/mcp-server/prompts/prompt-registration.js.map +1 -1
- package/dist/mcp-server/prompts/utils/promptDefinition.d.ts +1 -1
- package/dist/mcp-server/prompts/utils/promptDefinition.d.ts.map +1 -1
- package/dist/mcp-server/resources/resource-registration.d.ts +3 -3
- package/dist/mcp-server/resources/resource-registration.d.ts.map +1 -1
- package/dist/mcp-server/resources/resource-registration.js +8 -15
- package/dist/mcp-server/resources/resource-registration.js.map +1 -1
- package/dist/mcp-server/resources/resourceSubscriptions.d.ts +45 -0
- package/dist/mcp-server/resources/resourceSubscriptions.d.ts.map +1 -0
- package/dist/mcp-server/resources/resourceSubscriptions.js +51 -0
- package/dist/mcp-server/resources/resourceSubscriptions.js.map +1 -0
- package/dist/mcp-server/resources/utils/resourceDefinition.d.ts +3 -5
- package/dist/mcp-server/resources/utils/resourceDefinition.d.ts.map +1 -1
- package/dist/mcp-server/resources/utils/resourceDefinition.js +1 -1
- package/dist/mcp-server/resources/utils/resourceDefinition.js.map +1 -1
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts +8 -15
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts.map +1 -1
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.js +21 -22
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.js.map +1 -1
- package/dist/mcp-server/server.d.ts +12 -21
- package/dist/mcp-server/server.d.ts.map +1 -1
- package/dist/mcp-server/server.js +38 -28
- package/dist/mcp-server/server.js.map +1 -1
- package/dist/mcp-server/tools/tool-registration.d.ts +11 -33
- package/dist/mcp-server/tools/tool-registration.d.ts.map +1 -1
- package/dist/mcp-server/tools/tool-registration.js +17 -243
- package/dist/mcp-server/tools/tool-registration.js.map +1 -1
- package/dist/mcp-server/tools/utils/toolDefinition.d.ts +1 -3
- package/dist/mcp-server/tools/utils/toolDefinition.d.ts.map +1 -1
- package/dist/mcp-server/tools/utils/toolDefinition.js +48 -1
- package/dist/mcp-server/tools/utils/toolDefinition.js.map +1 -1
- package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts +46 -20
- package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts.map +1 -1
- package/dist/mcp-server/tools/utils/toolHandlerFactory.js +131 -25
- package/dist/mcp-server/tools/utils/toolHandlerFactory.js.map +1 -1
- package/dist/mcp-server/transports/ITransport.d.ts +2 -2
- package/dist/mcp-server/transports/ITransport.d.ts.map +1 -1
- package/dist/mcp-server/transports/auth/authFactory.js +1 -1
- package/dist/mcp-server/transports/auth/authFactory.js.map +1 -1
- package/dist/mcp-server/transports/auth/lib/authTypes.d.ts +1 -1
- package/dist/mcp-server/transports/auth/lib/authTypes.d.ts.map +1 -1
- package/dist/mcp-server/transports/auth/lib/authUtils.d.ts.map +1 -1
- package/dist/mcp-server/transports/auth/lib/authUtils.js +5 -13
- package/dist/mcp-server/transports/auth/lib/authUtils.js.map +1 -1
- package/dist/mcp-server/transports/auth/strategies/jwtStrategy.js +5 -11
- package/dist/mcp-server/transports/auth/strategies/jwtStrategy.js.map +1 -1
- package/dist/mcp-server/transports/auth/strategies/oauthStrategy.d.ts.map +1 -1
- package/dist/mcp-server/transports/auth/strategies/oauthStrategy.js +9 -22
- package/dist/mcp-server/transports/auth/strategies/oauthStrategy.js.map +1 -1
- package/dist/mcp-server/transports/heartbeat.d.ts.map +1 -1
- package/dist/mcp-server/transports/heartbeat.js +4 -8
- package/dist/mcp-server/transports/heartbeat.js.map +1 -1
- package/dist/mcp-server/transports/http/httpErrorHandler.d.ts.map +1 -1
- package/dist/mcp-server/transports/http/httpErrorHandler.js +6 -24
- package/dist/mcp-server/transports/http/httpErrorHandler.js.map +1 -1
- package/dist/mcp-server/transports/http/httpServer.d.ts +3 -3
- package/dist/mcp-server/transports/http/httpServer.d.ts.map +1 -1
- package/dist/mcp-server/transports/http/httpServer.js +15 -32
- package/dist/mcp-server/transports/http/httpServer.js.map +1 -1
- package/dist/mcp-server/transports/http/httpTransport.d.ts +25 -8
- package/dist/mcp-server/transports/http/httpTransport.d.ts.map +1 -1
- package/dist/mcp-server/transports/http/httpTransport.js +156 -310
- package/dist/mcp-server/transports/http/httpTransport.js.map +1 -1
- package/dist/mcp-server/transports/http/landing-page/assets/styles.d.ts.map +1 -1
- package/dist/mcp-server/transports/http/landing-page/assets/styles.js +0 -1
- package/dist/mcp-server/transports/http/landing-page/assets/styles.js.map +1 -1
- package/dist/mcp-server/transports/http/landing-page/handler.d.ts.map +1 -1
- package/dist/mcp-server/transports/http/landing-page/handler.js +4 -8
- package/dist/mcp-server/transports/http/landing-page/handler.js.map +1 -1
- package/dist/mcp-server/transports/http/landing-page/sections/tools.js +0 -2
- package/dist/mcp-server/transports/http/landing-page/sections/tools.js.map +1 -1
- package/dist/mcp-server/transports/http/protectedResourceMetadata.d.ts.map +1 -1
- package/dist/mcp-server/transports/http/protectedResourceMetadata.js +2 -6
- package/dist/mcp-server/transports/http/protectedResourceMetadata.js.map +1 -1
- package/dist/mcp-server/transports/http/robotsTxt.js +2 -2
- package/dist/mcp-server/transports/http/robotsTxt.js.map +1 -1
- package/dist/mcp-server/transports/http/serverCard.d.ts.map +1 -1
- package/dist/mcp-server/transports/http/serverCard.js +2 -6
- package/dist/mcp-server/transports/http/serverCard.js.map +1 -1
- package/dist/mcp-server/transports/http/sessionStore.d.ts +48 -45
- package/dist/mcp-server/transports/http/sessionStore.d.ts.map +1 -1
- package/dist/mcp-server/transports/http/sessionStore.js +141 -185
- package/dist/mcp-server/transports/http/sessionStore.js.map +1 -1
- package/dist/mcp-server/transports/manager.d.ts +12 -4
- package/dist/mcp-server/transports/manager.d.ts.map +1 -1
- package/dist/mcp-server/transports/manager.js +35 -33
- package/dist/mcp-server/transports/manager.js.map +1 -1
- package/dist/mcp-server/transports/stdio/stdioTransport.d.ts +24 -31
- package/dist/mcp-server/transports/stdio/stdioTransport.d.ts.map +1 -1
- package/dist/mcp-server/transports/stdio/stdioTransport.js +23 -38
- package/dist/mcp-server/transports/stdio/stdioTransport.js.map +1 -1
- package/dist/mcp-server/types.d.ts +25 -0
- package/dist/mcp-server/types.d.ts.map +1 -0
- package/dist/mcp-server/types.js +10 -0
- package/dist/mcp-server/types.js.map +1 -0
- package/dist/services/canvas/core/CanvasInstance.d.ts +2 -2
- package/dist/services/canvas/core/CanvasInstance.d.ts.map +1 -1
- package/dist/services/canvas/core/CanvasInstance.js.map +1 -1
- package/dist/services/canvas/core/CanvasRegistry.d.ts +4 -4
- package/dist/services/canvas/core/CanvasRegistry.d.ts.map +1 -1
- package/dist/services/canvas/core/CanvasRegistry.js +8 -18
- package/dist/services/canvas/core/CanvasRegistry.js.map +1 -1
- package/dist/services/canvas/core/DataCanvas.d.ts +5 -5
- package/dist/services/canvas/core/DataCanvas.d.ts.map +1 -1
- package/dist/services/canvas/core/DataCanvas.js +2 -3
- package/dist/services/canvas/core/DataCanvas.js.map +1 -1
- package/dist/services/canvas/core/IDataCanvasProvider.d.ts +11 -11
- package/dist/services/canvas/core/IDataCanvasProvider.d.ts.map +1 -1
- package/dist/services/canvas/providers/duckdb/DuckdbProvider.d.ts +11 -11
- package/dist/services/canvas/providers/duckdb/DuckdbProvider.d.ts.map +1 -1
- package/dist/services/canvas/providers/duckdb/DuckdbProvider.js +4 -10
- package/dist/services/canvas/providers/duckdb/DuckdbProvider.js.map +1 -1
- package/dist/services/llm/providers/openrouter.provider.d.ts.map +1 -1
- package/dist/services/llm/providers/openrouter.provider.js +2 -5
- package/dist/services/llm/providers/openrouter.provider.js.map +1 -1
- package/dist/services/mirror/core/defineMirror.js +1 -1
- package/dist/services/mirror/core/defineMirror.js.map +1 -1
- package/dist/services/mirror/types.d.ts +5 -5
- package/dist/services/mirror/types.d.ts.map +1 -1
- package/dist/services/speech/providers/elevenlabs.provider.js +1 -1
- package/dist/services/speech/providers/elevenlabs.provider.js.map +1 -1
- package/dist/services/speech/providers/whisper.provider.js +1 -1
- package/dist/services/speech/providers/whisper.provider.js.map +1 -1
- package/dist/storage/core/StorageService.d.ts +1 -1
- package/dist/storage/core/StorageService.d.ts.map +1 -1
- package/dist/storage/core/StorageService.js +12 -20
- package/dist/storage/core/StorageService.js.map +1 -1
- package/dist/storage/core/storageFactory.d.ts.map +1 -1
- package/dist/storage/core/storageFactory.js.map +1 -1
- package/dist/storage/core/storageValidation.d.ts +1 -1
- package/dist/storage/core/storageValidation.d.ts.map +1 -1
- package/dist/storage/core/storageValidation.js +2 -2
- package/dist/storage/core/storageValidation.js.map +1 -1
- package/dist/storage/providers/cloudflare/d1Provider.d.ts +1 -1
- package/dist/storage/providers/cloudflare/d1Provider.d.ts.map +1 -1
- package/dist/storage/providers/cloudflare/d1Provider.js +4 -12
- package/dist/storage/providers/cloudflare/d1Provider.js.map +1 -1
- package/dist/storage/providers/cloudflare/kvProvider.d.ts +1 -1
- package/dist/storage/providers/cloudflare/kvProvider.d.ts.map +1 -1
- package/dist/storage/providers/cloudflare/kvProvider.js +3 -8
- package/dist/storage/providers/cloudflare/kvProvider.js.map +1 -1
- package/dist/storage/providers/cloudflare/r2Provider.d.ts +1 -1
- package/dist/storage/providers/cloudflare/r2Provider.d.ts.map +1 -1
- package/dist/storage/providers/cloudflare/r2Provider.js +3 -8
- package/dist/storage/providers/cloudflare/r2Provider.js.map +1 -1
- package/dist/storage/providers/inMemory/inMemoryProvider.d.ts +1 -1
- package/dist/storage/providers/inMemory/inMemoryProvider.d.ts.map +1 -1
- package/dist/storage/providers/inMemory/inMemoryProvider.js +2 -4
- package/dist/storage/providers/inMemory/inMemoryProvider.js.map +1 -1
- package/dist/testing/index.d.ts +35 -12
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +53 -38
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/vitest.d.ts +1 -1
- package/dist/testing/vitest.d.ts.map +1 -1
- package/dist/types-global/errors.d.ts +28 -15
- package/dist/types-global/errors.d.ts.map +1 -1
- package/dist/types-global/errors.js +8 -1
- package/dist/types-global/errors.js.map +1 -1
- package/dist/utils/formatting/diffFormatter.d.ts +5 -5
- package/dist/utils/formatting/diffFormatter.d.ts.map +1 -1
- package/dist/utils/formatting/diffFormatter.js +7 -20
- package/dist/utils/formatting/diffFormatter.js.map +1 -1
- package/dist/utils/formatting/tableFormatter.d.ts +3 -3
- package/dist/utils/formatting/tableFormatter.d.ts.map +1 -1
- package/dist/utils/formatting/tableFormatter.js +6 -17
- package/dist/utils/formatting/tableFormatter.js.map +1 -1
- package/dist/utils/formatting/treeFormatter.d.ts +3 -3
- package/dist/utils/formatting/treeFormatter.d.ts.map +1 -1
- package/dist/utils/formatting/treeFormatter.js +5 -18
- package/dist/utils/formatting/treeFormatter.js.map +1 -1
- package/dist/utils/index.d.ts +4 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -2
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/internal/error-handler/errorHandler.d.ts +1 -1
- package/dist/utils/internal/error-handler/errorHandler.d.ts.map +1 -1
- package/dist/utils/internal/error-handler/errorHandler.js +23 -11
- package/dist/utils/internal/error-handler/errorHandler.js.map +1 -1
- package/dist/utils/internal/error-handler/types.d.ts +10 -13
- package/dist/utils/internal/error-handler/types.d.ts.map +1 -1
- package/dist/utils/internal/logger.d.ts +3 -3
- package/dist/utils/internal/logger.d.ts.map +1 -1
- package/dist/utils/internal/logger.js +11 -5
- package/dist/utils/internal/logger.js.map +1 -1
- package/dist/utils/internal/performance.d.ts +1 -1
- package/dist/utils/internal/performance.d.ts.map +1 -1
- package/dist/utils/internal/performance.js +57 -13
- package/dist/utils/internal/performance.js.map +1 -1
- package/dist/utils/internal/requestContext.d.ts +79 -55
- package/dist/utils/internal/requestContext.d.ts.map +1 -1
- package/dist/utils/internal/requestContext.js +77 -32
- package/dist/utils/internal/requestContext.js.map +1 -1
- package/dist/utils/metrics/tokenCounter.d.ts +3 -3
- package/dist/utils/metrics/tokenCounter.d.ts.map +1 -1
- package/dist/utils/metrics/tokenCounter.js.map +1 -1
- package/dist/utils/network/fetchWithTimeout.d.ts +2 -2
- package/dist/utils/network/fetchWithTimeout.d.ts.map +1 -1
- package/dist/utils/network/fetchWithTimeout.js +8 -24
- package/dist/utils/network/fetchWithTimeout.js.map +1 -1
- package/dist/utils/network/retry.d.ts +2 -2
- package/dist/utils/network/retry.d.ts.map +1 -1
- package/dist/utils/overflow/outlineOnOverflow.d.ts +1 -1
- package/dist/utils/overflow/outlineOnOverflow.d.ts.map +1 -1
- package/dist/utils/pagination/pagination.d.ts +3 -3
- package/dist/utils/pagination/pagination.d.ts.map +1 -1
- package/dist/utils/pagination/pagination.js +3 -3
- package/dist/utils/pagination/pagination.js.map +1 -1
- package/dist/utils/parsing/csvParser.d.ts +2 -2
- package/dist/utils/parsing/csvParser.d.ts.map +1 -1
- package/dist/utils/parsing/csvParser.js +4 -8
- package/dist/utils/parsing/csvParser.js.map +1 -1
- package/dist/utils/parsing/dateParser.d.ts +3 -3
- package/dist/utils/parsing/dateParser.d.ts.map +1 -1
- package/dist/utils/parsing/dateParser.js +3 -2
- package/dist/utils/parsing/dateParser.js.map +1 -1
- package/dist/utils/parsing/frontmatterParser.d.ts +2 -2
- package/dist/utils/parsing/frontmatterParser.d.ts.map +1 -1
- package/dist/utils/parsing/frontmatterParser.js +7 -10
- package/dist/utils/parsing/frontmatterParser.js.map +1 -1
- package/dist/utils/parsing/htmlExtractor.d.ts +2 -2
- package/dist/utils/parsing/htmlExtractor.d.ts.map +1 -1
- package/dist/utils/parsing/htmlExtractor.js +6 -11
- package/dist/utils/parsing/htmlExtractor.js.map +1 -1
- package/dist/utils/parsing/jsonParser.d.ts +2 -2
- package/dist/utils/parsing/jsonParser.d.ts.map +1 -1
- package/dist/utils/parsing/jsonParser.js +4 -8
- package/dist/utils/parsing/jsonParser.js.map +1 -1
- package/dist/utils/parsing/pdfParser.d.ts +10 -10
- package/dist/utils/parsing/pdfParser.d.ts.map +1 -1
- package/dist/utils/parsing/pdfParser.js +26 -89
- package/dist/utils/parsing/pdfParser.js.map +1 -1
- package/dist/utils/parsing/xmlParser.d.ts +2 -2
- package/dist/utils/parsing/xmlParser.d.ts.map +1 -1
- package/dist/utils/parsing/xmlParser.js +4 -8
- package/dist/utils/parsing/xmlParser.js.map +1 -1
- package/dist/utils/parsing/yamlParser.d.ts +2 -2
- package/dist/utils/parsing/yamlParser.d.ts.map +1 -1
- package/dist/utils/parsing/yamlParser.js +4 -8
- package/dist/utils/parsing/yamlParser.js.map +1 -1
- package/dist/utils/scheduling/scheduler.d.ts.map +1 -1
- package/dist/utils/scheduling/scheduler.js +5 -6
- package/dist/utils/scheduling/scheduler.js.map +1 -1
- package/dist/utils/security/rateLimiter.d.ts +2 -2
- package/dist/utils/security/rateLimiter.d.ts.map +1 -1
- package/dist/utils/security/rateLimiter.js +1 -1
- package/dist/utils/security/rateLimiter.js.map +1 -1
- package/dist/utils/telemetry/attributes.d.ts +23 -7
- package/dist/utils/telemetry/attributes.d.ts.map +1 -1
- package/dist/utils/telemetry/attributes.js +23 -10
- package/dist/utils/telemetry/attributes.js.map +1 -1
- package/dist/utils/telemetry/trace.d.ts +3 -3
- package/dist/utils/telemetry/trace.d.ts.map +1 -1
- package/dist/utils/telemetry/trace.js +4 -2
- package/dist/utils/telemetry/trace.js.map +1 -1
- package/package.json +22 -26
- package/scripts/lint-mcp.ts +1 -3
- package/scripts/lint-packaging.ts +1 -1
- package/skills/add-service/SKILL.md +2 -2
- package/skills/add-test/SKILL.md +42 -20
- package/skills/add-tool/SKILL.md +68 -19
- package/skills/api-canvas/SKILL.md +2 -2
- package/skills/api-config/SKILL.md +1 -11
- package/skills/api-context/SKILL.md +175 -111
- package/skills/api-linter/SKILL.md +2 -2
- package/skills/api-telemetry/SKILL.md +8 -12
- package/skills/api-testing/SKILL.md +53 -52
- package/skills/code-simplifier/SKILL.md +2 -2
- package/skills/design-mcp-server/SKILL.md +34 -18
- package/skills/field-test/SKILL.md +4 -2
- package/skills/git-wrapup/SKILL.md +3 -3
- package/skills/polish-docs-meta/SKILL.md +1 -1
- package/skills/polish-docs-meta/references/agent-protocol.md +2 -2
- package/skills/polish-docs-meta/references/readme.md +1 -1
- package/skills/release-and-publish/SKILL.md +3 -1
- package/skills/report-issue-framework/SKILL.md +2 -2
- package/skills/report-issue-local/SKILL.md +2 -2
- package/skills/security-pass/SKILL.md +16 -14
- package/templates/.github/CODE_OF_CONDUCT.md +28 -0
- package/templates/.github/CONTRIBUTING.md +50 -0
- package/templates/.github/SECURITY.md +24 -0
- package/templates/AGENTS.md +6 -6
- package/templates/CLAUDE.md +6 -6
- package/templates/changelog/template.md +55 -16
- package/templates/tests/resources/echo.resource.test.ts +16 -9
- package/dist/mcp-server/elicitation.d.ts +0 -64
- package/dist/mcp-server/elicitation.d.ts.map +0 -1
- package/dist/mcp-server/elicitation.js +0 -81
- package/dist/mcp-server/elicitation.js.map +0 -1
- package/dist/mcp-server/protocolSession.d.ts +0 -34
- package/dist/mcp-server/protocolSession.d.ts.map +0 -1
- package/dist/mcp-server/protocolSession.js +0 -13
- package/dist/mcp-server/protocolSession.js.map +0 -1
- package/dist/mcp-server/tasks/core/evictingTaskMessageQueue.d.ts +0 -53
- package/dist/mcp-server/tasks/core/evictingTaskMessageQueue.d.ts.map +0 -1
- package/dist/mcp-server/tasks/core/evictingTaskMessageQueue.js +0 -65
- package/dist/mcp-server/tasks/core/evictingTaskMessageQueue.js.map +0 -1
- package/dist/mcp-server/tasks/core/sessionAwareTaskStore.d.ts +0 -70
- package/dist/mcp-server/tasks/core/sessionAwareTaskStore.d.ts.map +0 -1
- package/dist/mcp-server/tasks/core/sessionAwareTaskStore.js +0 -130
- package/dist/mcp-server/tasks/core/sessionAwareTaskStore.js.map +0 -1
- package/dist/mcp-server/tasks/core/storageBackedTaskStore.d.ts +0 -109
- package/dist/mcp-server/tasks/core/storageBackedTaskStore.d.ts.map +0 -1
- package/dist/mcp-server/tasks/core/storageBackedTaskStore.js +0 -209
- package/dist/mcp-server/tasks/core/storageBackedTaskStore.js.map +0 -1
- package/dist/mcp-server/tasks/core/taskManager.d.ts +0 -91
- package/dist/mcp-server/tasks/core/taskManager.d.ts.map +0 -1
- package/dist/mcp-server/tasks/core/taskManager.js +0 -210
- package/dist/mcp-server/tasks/core/taskManager.js.map +0 -1
- package/dist/mcp-server/tasks/core/taskTypes.d.ts +0 -18
- package/dist/mcp-server/tasks/core/taskTypes.d.ts.map +0 -1
- package/dist/mcp-server/tasks/core/taskTypes.js +0 -20
- package/dist/mcp-server/tasks/core/taskTypes.js.map +0 -1
- package/dist/mcp-server/tasks/utils/taskToolDefinition.d.ts +0 -101
- package/dist/mcp-server/tasks/utils/taskToolDefinition.d.ts.map +0 -1
- package/dist/mcp-server/tasks/utils/taskToolDefinition.js +0 -14
- package/dist/mcp-server/tasks/utils/taskToolDefinition.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inMemoryProvider.js","sourceRoot":"","sources":["../../../../src/storage/providers/inMemory/inMemoryProvider.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAC1F,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"inMemoryProvider.js","sourceRoot":"","sources":["../../../../src/storage/providers/inMemory/inMemoryProvider.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAC1F,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD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,MAAM,CAAC,KAAK,CACV,8BAA8B,YAAY,IAAI,IAAI,CAAC,MAAM,qBAAqB,QAAQ,EAAE,EACxF,OAAO,CACR,CAAC;QACF,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,QAAgB,EAAE,OAAuB;QAC7C,MAAM,CAAC,KAAK,CAAC,oDAAoD,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;QACtF,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC7C,IAAI,CAAC,WAAW;YAAE,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC5C,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC;QAC/B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC5B,IAAI,CAAC,UAAU,IAAI,KAAK,CAAC;QACzB,MAAM,CAAC,IAAI,CAAC,8BAA8B,KAAK,qBAAqB,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;QACzF,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;CACF"}
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* `createInMemoryStorage()` for unit-testing services in isolation.
|
|
6
6
|
* @module src/testing/index
|
|
7
7
|
*/
|
|
8
|
-
import type { CallToolResult, ContentBlock,
|
|
8
|
+
import type { CallToolResult, ContentBlock, InputRequiredResult, InputResponses } from '@modelcontextprotocol/server';
|
|
9
9
|
import type { z } from 'zod';
|
|
10
10
|
import type { AuthContext, Context, ContextLogger, HandlerContext, ReasonOf } from '../core/context.js';
|
|
11
11
|
import type { AnyToolDefinition } from '../mcp-server/tools/utils/toolDefinition.js';
|
|
@@ -23,13 +23,6 @@ import type { ErrorContract } from '../types-global/errors.js';
|
|
|
23
23
|
export interface MockContextOptions<TErrors extends readonly ErrorContract[] | undefined = readonly ErrorContract[] | undefined> {
|
|
24
24
|
/** Auth context. */
|
|
25
25
|
auth?: AuthContext;
|
|
26
|
-
/**
|
|
27
|
-
* Mock elicitation handler for form-mode elicitation. When provided, the
|
|
28
|
-
* mock context's `ctx.elicit` is set to this function with a default no-op
|
|
29
|
-
* `.url(...)` stub attached — tests that only exercise form-mode elicitation
|
|
30
|
-
* don't need to supply `.url` explicitly.
|
|
31
|
-
*/
|
|
32
|
-
elicit?: (message: string, schema: z.ZodObject<z.ZodRawShape>) => Promise<ElicitResult>;
|
|
33
26
|
/**
|
|
34
27
|
* Error contract to attach a typed `ctx.fail` against. Pass the definition's
|
|
35
28
|
* own `errors` array (`createMockContext({ errors: myTool.errors })`) so the
|
|
@@ -41,6 +34,12 @@ export interface MockContextOptions<TErrors extends readonly ErrorContract[] | u
|
|
|
41
34
|
* directly under `exactOptionalPropertyTypes`.
|
|
42
35
|
*/
|
|
43
36
|
errors?: TErrors | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Input responses a retried request would carry, keyed by the identifiers a
|
|
39
|
+
* prior `ctx.requestInput(...)` assigned. Seeds `ctx.inputs` so a
|
|
40
|
+
* multi-round-trip handler can be driven through its second round directly.
|
|
41
|
+
*/
|
|
42
|
+
inputResponses?: InputResponses | Record<string, unknown>;
|
|
44
43
|
/** Mock prompt list changed notifier. */
|
|
45
44
|
notifyPromptListChanged?: () => void;
|
|
46
45
|
/** Mock resource list changed notifier. */
|
|
@@ -49,10 +48,10 @@ export interface MockContextOptions<TErrors extends readonly ErrorContract[] | u
|
|
|
49
48
|
notifyResourceUpdated?: (uri: string) => void;
|
|
50
49
|
/** Mock tool list changed notifier. */
|
|
51
50
|
notifyToolListChanged?: () => void;
|
|
52
|
-
/** Enable task progress (creates a mock ContextProgress). */
|
|
53
|
-
progress?: boolean;
|
|
54
51
|
/** Request ID override. Defaults to 'test-request-id'. */
|
|
55
52
|
requestId?: string;
|
|
53
|
+
/** Multi-round-trip state for this round. Seeds `ctx.inputs.state()`. */
|
|
54
|
+
requestState?: unknown;
|
|
56
55
|
/**
|
|
57
56
|
* HTTP session ID. Defaults to undefined. Set to exercise handlers that
|
|
58
57
|
* branch on `ctx.sessionId` — mirrors what a stateful HTTP request would
|
|
@@ -116,8 +115,8 @@ export declare function createMockLogger(): MockContextLogger;
|
|
|
116
115
|
* // Typed ctx.fail against a definition's contract
|
|
117
116
|
* const ctx = createMockContext({ errors: myTool.errors });
|
|
118
117
|
*
|
|
119
|
-
* //
|
|
120
|
-
* const ctx = createMockContext({
|
|
118
|
+
* // Second round of a multi-round-trip handler
|
|
119
|
+
* const ctx = createMockContext({ inputResponses: { confirm: { action: 'accept', content: { ok: true } } } });
|
|
121
120
|
* ```
|
|
122
121
|
*/
|
|
123
122
|
export declare function createMockContext<const TErrors extends readonly ErrorContract[] | undefined = undefined>(options?: MockContextOptions<TErrors>): HandlerContext<ReasonOf<TErrors>>;
|
|
@@ -280,4 +279,28 @@ export declare function runToolContract<TDefinition extends AnyToolDefinition>(d
|
|
|
280
279
|
* ```
|
|
281
280
|
*/
|
|
282
281
|
export declare function createInMemoryStorage(options?: InMemoryProviderOptions): StorageService;
|
|
282
|
+
/**
|
|
283
|
+
* Runs a handler and returns the `input_required` result it asked for.
|
|
284
|
+
*
|
|
285
|
+
* `ctx.requestInput(...)` never returns — it throws a control-flow signal the
|
|
286
|
+
* handler factory converts into the protocol result — so a direct unit test of
|
|
287
|
+
* a multi-round-trip handler has to catch it. Drive the next round by feeding
|
|
288
|
+
* the answers back through `createMockContext({ inputResponses, requestState })`.
|
|
289
|
+
*
|
|
290
|
+
* @throws When the handler returned normally or failed for any other reason —
|
|
291
|
+
* the original error propagates untouched.
|
|
292
|
+
*
|
|
293
|
+
* @example
|
|
294
|
+
* ```ts
|
|
295
|
+
* const asked = await expectInputRequired(() => deleteTool.handler({ path }, ctx));
|
|
296
|
+
* expect(asked.inputRequests?.confirm?.method).toBe('elicitation/create');
|
|
297
|
+
*
|
|
298
|
+
* const answered = createMockContext({
|
|
299
|
+
* inputResponses: { confirm: { action: 'accept', content: { ok: true } } },
|
|
300
|
+
* requestState: asked.requestState,
|
|
301
|
+
* });
|
|
302
|
+
* expect(await deleteTool.handler({ path }, answered)).toEqual({ deleted: true });
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
305
|
+
export declare function expectInputRequired(run: () => unknown): Promise<InputRequiredResult>;
|
|
283
306
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,cAAc,EAEf,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EACV,WAAW,EACX,OAAO,EAEP,aAAa,EACb,cAAc,EACd,QAAQ,EACT,MAAM,mBAAmB,CAAC;AAc3B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAKpF,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,kDAAkD,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAM9D;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB,CACjC,OAAO,SAAS,SAAS,aAAa,EAAE,GAAG,SAAS,GAAG,SAAS,aAAa,EAAE,GAAG,SAAS;IAE3F,oBAAoB;IACpB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,OAA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MD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAW1F"}
|
package/dist/testing/index.js
CHANGED
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
* `createInMemoryStorage()` for unit-testing services in isolation.
|
|
6
6
|
* @module src/testing/index
|
|
7
7
|
*/
|
|
8
|
+
import { acceptedContent, inputResponse } from '@modelcontextprotocol/server';
|
|
8
9
|
import { attachTypedFail, createContentCollect, createContentStore, createContextState, createEnrich, createEnrichmentStore, readContentStore, readEnrichmentStore, stashContentStore, stashEnrichmentStore, } from '../core/context.js';
|
|
10
|
+
import { createRequestInput, isInputRequiredSignal } from '../mcp-server/inputRequired.js';
|
|
9
11
|
import { buildToolSuccessResult, classifyAndBuildToolErrorResult, } from '../mcp-server/tools/utils/toolHandlerFactory.js';
|
|
10
12
|
import { StorageService } from '../storage/core/StorageService.js';
|
|
11
13
|
import { InMemoryProvider, } from '../storage/providers/inMemory/inMemoryProvider.js';
|
|
@@ -38,31 +40,16 @@ export function createMockLogger() {
|
|
|
38
40
|
},
|
|
39
41
|
};
|
|
40
42
|
}
|
|
41
|
-
function
|
|
42
|
-
const
|
|
43
|
+
function createMockInputs(responses, requestState) {
|
|
44
|
+
const accepted = ((key, schema) => schema === undefined
|
|
45
|
+
? acceptedContent(responses, key)
|
|
46
|
+
: acceptedContent(responses, key, schema));
|
|
43
47
|
return {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
get _messages() {
|
|
51
|
-
return state._messages;
|
|
52
|
-
},
|
|
53
|
-
setTotal(n) {
|
|
54
|
-
state._total = n;
|
|
55
|
-
state._completed = 0;
|
|
56
|
-
return Promise.resolve();
|
|
57
|
-
},
|
|
58
|
-
increment(amount = 1) {
|
|
59
|
-
state._completed = Math.min(state._completed + amount, state._total || state._completed + amount);
|
|
60
|
-
return Promise.resolve();
|
|
61
|
-
},
|
|
62
|
-
update(message) {
|
|
63
|
-
state._messages.push(message);
|
|
64
|
-
return Promise.resolve();
|
|
65
|
-
},
|
|
48
|
+
accepted,
|
|
49
|
+
dropped: [],
|
|
50
|
+
responses,
|
|
51
|
+
state: () => requestState,
|
|
52
|
+
view: (key) => inputResponse(responses, key),
|
|
66
53
|
};
|
|
67
54
|
}
|
|
68
55
|
// ---------------------------------------------------------------------------
|
|
@@ -93,8 +80,8 @@ const DEFAULT_MOCK_TENANT_ID = 'default';
|
|
|
93
80
|
* // Typed ctx.fail against a definition's contract
|
|
94
81
|
* const ctx = createMockContext({ errors: myTool.errors });
|
|
95
82
|
*
|
|
96
|
-
* //
|
|
97
|
-
* const ctx = createMockContext({
|
|
83
|
+
* // Second round of a multi-round-trip handler
|
|
84
|
+
* const ctx = createMockContext({ inputResponses: { confirm: { action: 'accept', content: { ok: true } } } });
|
|
98
85
|
* ```
|
|
99
86
|
*/
|
|
100
87
|
export function createMockContext(options = {}) {
|
|
@@ -104,18 +91,8 @@ export function createMockContext(options = {}) {
|
|
|
104
91
|
const tenantId = options.tenantId ?? DEFAULT_MOCK_TENANT_ID;
|
|
105
92
|
const signal = options.signal ?? new AbortController().signal;
|
|
106
93
|
const state = createContextState(createInMemoryStorage(), { requestId, timestamp, operation: 'createMockContext', tenantId }, signal);
|
|
107
|
-
const progress = options.progress ? createMockProgress() : undefined;
|
|
108
94
|
const enrichmentStore = createEnrichmentStore();
|
|
109
95
|
const contentStore = createContentStore();
|
|
110
|
-
// Wrap the caller's elicit mock into an ElicitFn so that tests calling
|
|
111
|
-
// ctx.elicit.url(...) don't throw TypeError. The default url stub returns a
|
|
112
|
-
// cancelled result and can be overridden by casting the mock to ElicitFn.
|
|
113
|
-
let elicit;
|
|
114
|
-
if (options.elicit) {
|
|
115
|
-
const base = options.elicit;
|
|
116
|
-
base.url = async (_message, _url) => ({ action: 'cancel' });
|
|
117
|
-
elicit = base;
|
|
118
|
-
}
|
|
119
96
|
const ctx = {
|
|
120
97
|
requestId,
|
|
121
98
|
timestamp,
|
|
@@ -125,12 +102,12 @@ export function createMockContext(options = {}) {
|
|
|
125
102
|
tenantId,
|
|
126
103
|
sessionId: options.sessionId,
|
|
127
104
|
auth: options.auth,
|
|
128
|
-
|
|
105
|
+
inputs: createMockInputs(options.inputResponses, options.requestState),
|
|
106
|
+
requestInput: createRequestInput(),
|
|
129
107
|
notifyPromptListChanged: options.notifyPromptListChanged,
|
|
130
108
|
notifyResourceListChanged: options.notifyResourceListChanged,
|
|
131
109
|
notifyResourceUpdated: options.notifyResourceUpdated,
|
|
132
110
|
notifyToolListChanged: options.notifyToolListChanged,
|
|
133
|
-
progress,
|
|
134
111
|
uri: options.uri,
|
|
135
112
|
content: createContentCollect(contentStore),
|
|
136
113
|
enrich: createEnrich(enrichmentStore),
|
|
@@ -339,4 +316,42 @@ export async function runToolContract(definition, input, options = {}) {
|
|
|
339
316
|
export function createInMemoryStorage(options) {
|
|
340
317
|
return new StorageService(new InMemoryProvider(options));
|
|
341
318
|
}
|
|
319
|
+
// ---------------------------------------------------------------------------
|
|
320
|
+
// Multi-round-trip input
|
|
321
|
+
// ---------------------------------------------------------------------------
|
|
322
|
+
/**
|
|
323
|
+
* Runs a handler and returns the `input_required` result it asked for.
|
|
324
|
+
*
|
|
325
|
+
* `ctx.requestInput(...)` never returns — it throws a control-flow signal the
|
|
326
|
+
* handler factory converts into the protocol result — so a direct unit test of
|
|
327
|
+
* a multi-round-trip handler has to catch it. Drive the next round by feeding
|
|
328
|
+
* the answers back through `createMockContext({ inputResponses, requestState })`.
|
|
329
|
+
*
|
|
330
|
+
* @throws When the handler returned normally or failed for any other reason —
|
|
331
|
+
* the original error propagates untouched.
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* ```ts
|
|
335
|
+
* const asked = await expectInputRequired(() => deleteTool.handler({ path }, ctx));
|
|
336
|
+
* expect(asked.inputRequests?.confirm?.method).toBe('elicitation/create');
|
|
337
|
+
*
|
|
338
|
+
* const answered = createMockContext({
|
|
339
|
+
* inputResponses: { confirm: { action: 'accept', content: { ok: true } } },
|
|
340
|
+
* requestState: asked.requestState,
|
|
341
|
+
* });
|
|
342
|
+
* expect(await deleteTool.handler({ path }, answered)).toEqual({ deleted: true });
|
|
343
|
+
* ```
|
|
344
|
+
*/
|
|
345
|
+
export async function expectInputRequired(run) {
|
|
346
|
+
let returned;
|
|
347
|
+
try {
|
|
348
|
+
returned = await run();
|
|
349
|
+
}
|
|
350
|
+
catch (error) {
|
|
351
|
+
if (isInputRequiredSignal(error))
|
|
352
|
+
return error.result;
|
|
353
|
+
throw error;
|
|
354
|
+
}
|
|
355
|
+
throw new Error(`Expected the handler to request input, but it returned: ${JSON.stringify(returned)}`);
|
|
356
|
+
}
|
|
342
357
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAU9E,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,EACZ,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAE1F,OAAO,EACL,sBAAsB,EACtB,+BAA+B,GAChC,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EACL,gBAAgB,GAEjB,MAAM,kDAAkD,CAAC;AA6E1D;;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qBAAqB,CAAC,OAAiC;IACrE,OAAO,IAAI,cAAc,CAAC,IAAI,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED,8EAA8E;AAC9E,yBAAyB;AACzB,8EAA8E;AAE9E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,GAAkB;IAC1D,IAAI,QAAiB,CAAC;IACtB,IAAI,CAAC;QACH,QAAQ,GAAG,MAAM,GAAG,EAAE,CAAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,qBAAqB,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC,MAAM,CAAC;QACtD,MAAM,KAAK,CAAC;IACd,CAAC;IACD,MAAM,IAAI,KAAK,CACb,2DAA2D,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CACtF,CAAC;AACJ,CAAC"}
|
package/dist/testing/vitest.d.ts
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*
|
|
24
24
|
* @module src/testing/vitest
|
|
25
25
|
*/
|
|
26
|
-
import type { CallToolResult } from '@modelcontextprotocol/
|
|
26
|
+
import type { CallToolResult } from '@modelcontextprotocol/server';
|
|
27
27
|
import type { z } from 'zod';
|
|
28
28
|
import type { Context } from '../core/context.js';
|
|
29
29
|
import type { AnyToolDefinition } from '../mcp-server/tools/utils/toolDefinition.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../../src/testing/vitest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../../src/testing/vitest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,c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AAI,EAAE,MAAM,CAAC;CACd;AAED,+DAA+D;AAC/D,MAAM,WAAW,qBAAqB,CAAC,WAAW,SAAS,iBAAiB;IAC1E,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,sDAAsD;IACtD,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;IACrC,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,8DAA8D;AAC9D,MAAM,WAAW,wBAAwB,CAAC,WAAW,SAAS,iBAAiB;IAC7E,+CAA+C;IAC/C,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,kEAAkE;IAClE,MAAM,CAAC,EAAE,SAAS,qBAAqB,CAAC,WAAW,CAAC,EAAE,CAAC;IACvD,wEAAwE;IACxE,OAAO,EAAE,SAAS,uBAAuB,CAAC,WAAW,CAAC,EAAE,CAAC;CAC1D;AAUD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,SAAS,iBAAiB,EACrE,UAAU,EAAE,WAAW,EACvB,OAAO,EAAE,wBAAwB,CAAC,WAAW,CAAC,GAC7C,IAAI,CA8CN;AAMD,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,WAAW,EAAE,CAAC;AAClE;;;GAGG;AACH,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,GAChB,CAAC"}
|
|
@@ -6,6 +6,19 @@
|
|
|
6
6
|
* @module src/types-global/errors
|
|
7
7
|
*/
|
|
8
8
|
import { z } from 'zod';
|
|
9
|
+
import type { RequestContext } from '../utils/internal/requestContext.js';
|
|
10
|
+
/**
|
|
11
|
+
* Structured payload for an error's JSON-RPC `data` field.
|
|
12
|
+
*
|
|
13
|
+
* Accepts a {@link RequestContext} directly — passing the operation's context
|
|
14
|
+
* as diagnostic data is the established pattern across the framework, and
|
|
15
|
+
* `RequestContext` is a closed interface, so it is not assignable to a bare
|
|
16
|
+
* `Record<string, unknown>`.
|
|
17
|
+
*
|
|
18
|
+
* `auth` is dropped by {@link McpError} before the payload is stored; see the
|
|
19
|
+
* constructor.
|
|
20
|
+
*/
|
|
21
|
+
export type ErrorData = Readonly<Record<string, unknown>> | RequestContext;
|
|
9
22
|
/**
|
|
10
23
|
* Defines JSON-RPC 2.0 error codes, including standard and implementation-defined codes.
|
|
11
24
|
* @see https://www.jsonrpc.org/specification#error_object
|
|
@@ -56,40 +69,40 @@ export declare class McpError extends Error {
|
|
|
56
69
|
* @param message - A human-readable description of the error.
|
|
57
70
|
* @param data - Optional. A record containing additional structured data about the error.
|
|
58
71
|
*/
|
|
59
|
-
constructor(code: JsonRpcErrorCode, message?: string, data?:
|
|
72
|
+
constructor(code: JsonRpcErrorCode, message?: string, data?: ErrorData, options?: {
|
|
60
73
|
cause?: unknown;
|
|
61
74
|
});
|
|
62
75
|
}
|
|
63
76
|
/** Options shared by all error factory functions (re-uses the ES2022 built-in). */
|
|
64
77
|
export type ErrorFactoryOptions = ErrorOptions;
|
|
65
78
|
/** Create an InvalidParams (-32602) error. */
|
|
66
|
-
export declare const invalidParams: (message: string, data?:
|
|
79
|
+
export declare const invalidParams: (message: string, data?: ErrorData, options?: ErrorFactoryOptions) => McpError;
|
|
67
80
|
/** Create an InvalidRequest (-32600) error. */
|
|
68
|
-
export declare const invalidRequest: (message: string, data?:
|
|
81
|
+
export declare const invalidRequest: (message: string, data?: ErrorData, options?: ErrorFactoryOptions) => McpError;
|
|
69
82
|
/** Create a NotFound (-32001) error. */
|
|
70
|
-
export declare const notFound: (message: string, data?:
|
|
83
|
+
export declare const notFound: (message: string, data?: ErrorData, options?: ErrorFactoryOptions) => McpError;
|
|
71
84
|
/** Create a Forbidden (-32005) error. */
|
|
72
|
-
export declare const forbidden: (message: string, data?:
|
|
85
|
+
export declare const forbidden: (message: string, data?: ErrorData, options?: ErrorFactoryOptions) => McpError;
|
|
73
86
|
/** Create an Unauthorized (-32006) error. */
|
|
74
|
-
export declare const unauthorized: (message: string, data?:
|
|
87
|
+
export declare const unauthorized: (message: string, data?: ErrorData, options?: ErrorFactoryOptions) => McpError;
|
|
75
88
|
/** Create a ValidationError (-32007) error. */
|
|
76
|
-
export declare const validationError: (message: string, data?:
|
|
89
|
+
export declare const validationError: (message: string, data?: ErrorData, options?: ErrorFactoryOptions) => McpError;
|
|
77
90
|
/** Create a Conflict (-32002) error. */
|
|
78
|
-
export declare const conflict: (message: string, data?:
|
|
91
|
+
export declare const conflict: (message: string, data?: ErrorData, options?: ErrorFactoryOptions) => McpError;
|
|
79
92
|
/** Create a RateLimited (-32003) error. */
|
|
80
|
-
export declare const rateLimited: (message: string, data?:
|
|
93
|
+
export declare const rateLimited: (message: string, data?: ErrorData, options?: ErrorFactoryOptions) => McpError;
|
|
81
94
|
/** Create a Timeout (-32004) error. */
|
|
82
|
-
export declare const timeout: (message: string, data?:
|
|
95
|
+
export declare const timeout: (message: string, data?: ErrorData, options?: ErrorFactoryOptions) => McpError;
|
|
83
96
|
/** Create a ServiceUnavailable (-32000) error. */
|
|
84
|
-
export declare const serviceUnavailable: (message: string, data?:
|
|
97
|
+
export declare const serviceUnavailable: (message: string, data?: ErrorData, options?: ErrorFactoryOptions) => McpError;
|
|
85
98
|
/** Create a ConfigurationError (-32008) error. */
|
|
86
|
-
export declare const configurationError: (message: string, data?:
|
|
99
|
+
export declare const configurationError: (message: string, data?: ErrorData, options?: ErrorFactoryOptions) => McpError;
|
|
87
100
|
/** Create an InternalError (-32603) error. */
|
|
88
|
-
export declare const internalError: (message: string, data?:
|
|
101
|
+
export declare const internalError: (message: string, data?: ErrorData, options?: ErrorFactoryOptions) => McpError;
|
|
89
102
|
/** Create a SerializationError (-32070) error — JSON/XML/parser failures. */
|
|
90
|
-
export declare const serializationError: (message: string, data?:
|
|
103
|
+
export declare const serializationError: (message: string, data?: ErrorData, options?: ErrorFactoryOptions) => McpError;
|
|
91
104
|
/** Create a DatabaseError (-32010) error. */
|
|
92
|
-
export declare const databaseError: (message: string, data?:
|
|
105
|
+
export declare const databaseError: (message: string, data?: ErrorData, options?: ErrorFactoryOptions) => McpError;
|
|
93
106
|
/**
|
|
94
107
|
* Zod schema for validating error objects. This schema can be used for:
|
|
95
108
|
* - Validating error structures when parsing error responses from external services.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/types-global/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,oBAAY,gBAAgB;IAE1B,UAAU,SAAS;IACnB,cAAc,SAAS;IACvB,cAAc,SAAS;IACvB,aAAa,SAAS;IACtB,aAAa,SAAS;IAGtB,kBAAkB,SAAS;IAC3B,QAAQ,SAAS;IACjB,QAAQ,SAAS;IACjB,WAAW,SAAS;IACpB,OAAO,SAAS;IAChB,SAAS,SAAS;IAClB,YAAY,SAAS;IACrB,eAAe,SAAS;IACxB,kBAAkB,SAAS;IAC3B,oBAAoB,SAAS;IAC7B,aAAa,SAAS;IACtB,kBAAkB,SAAS,CAAE,4CAA4C;IACzE,YAAY,SAAS;CACtB;AAED;;;;;;;GAOG;AACH,qBAAa,QAAS,SAAQ,KAAK;IACjC;;OAEG;IACH,SAAgB,IAAI,EAAE,gBAAgB,CAAC;IAEvC;;;;OAIG;IACH,SAAgB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE/C;;;;;;OAMG;IACH,YACE,IAAI,EAAE,gBAAgB,EACtB,OAAO,CAAC,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/types-global/errors.ts"],"names":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M,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAMxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,WAAW,aAAa;IAC5B,kDAAkD;IAClD,IAAI,EAAE,gBAAgB,CAAC;IACvB;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -63,7 +63,14 @@ export class McpError extends Error {
|
|
|
63
63
|
super(message, options);
|
|
64
64
|
this.code = code;
|
|
65
65
|
if (data) {
|
|
66
|
-
|
|
66
|
+
// `data` travels to the client on the wire and into every error log and
|
|
67
|
+
// span. A `RequestContext` carries `auth`, and `auth.token` is the raw
|
|
68
|
+
// bearer credential — the framework's logger redacts `*.token` paths
|
|
69
|
+
// precisely so it is never persisted, and this payload bypasses that.
|
|
70
|
+
// Authentication is never diagnostic; drop it rather than redact one
|
|
71
|
+
// field, so a future `AuthContext` addition cannot reopen the hole.
|
|
72
|
+
const { auth: _auth, ...safe } = data;
|
|
73
|
+
this.data = safe;
|
|
67
74
|
}
|
|
68
75
|
this.name = 'McpError';
|
|
69
76
|
// Maintain a proper prototype chain.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/types-global/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/types-global/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBxB;;;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AAO,CAAC,CAAC;AAEvE,6EAA6E;AAC7E,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,OAAe,EACf,IAAgB,EAChB,OAA6B,EAC7B,EAAE,CAAC,IAAI,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAE/E,6CAA6C;AAC7C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAe,EAAE,IAAgB,EAAE,OAA6B,EAAE,EAAE,CAChG,IAAI,QAAQ,CAAC,gBAAgB,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAEvE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC;KACzB,MAAM,CAAC;IACN;;;OAGG;IACH,IAAI,EAAE,CAAC;SACJ,UAAU,CAAC,gBAAgB,CAAC;SAC5B,QAAQ,CAAC,oDAAoD,CAAC;IACjE;;;OAGG;IACH,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,EAAE,gCAAgC,CAAC;SACxC,QAAQ,CAAC,uCAAuC,CAAC;IACpD;;;OAGG;IACH,IAAI,EAAE,CAAC;SACJ,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;SAC/B,QAAQ,EAAE;SACV,QAAQ,CAAC,iEAAiE,CAAC;CAC/E,CAAC;KACD,QAAQ,CACP,0FAA0F,CAC3F,CAAC"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* the import cost when the formatter is not needed.
|
|
7
7
|
* @module src/utils/formatting/diffFormatter
|
|
8
8
|
*/
|
|
9
|
-
import { type RequestContext
|
|
9
|
+
import { type RequestContext } from '../../utils/internal/requestContext.js';
|
|
10
10
|
/**
|
|
11
11
|
* Diff output format options.
|
|
12
12
|
* - `unified`: Standard unified diff hunks only — strips file/index headers (like `git diff` body).
|
|
@@ -84,7 +84,7 @@ export declare class DiffFormatter {
|
|
|
84
84
|
* const result = await diffFormatter.diff(oldCode, newCode, { context: 2 });
|
|
85
85
|
* ```
|
|
86
86
|
*/
|
|
87
|
-
diff(oldText: string, newText: string, options?: DiffFormatterOptions, context?:
|
|
87
|
+
diff(oldText: string, newText: string, options?: DiffFormatterOptions, context?: RequestContext): Promise<string>;
|
|
88
88
|
/**
|
|
89
89
|
* Generate a diff between two arrays of lines.
|
|
90
90
|
*
|
|
@@ -107,7 +107,7 @@ export declare class DiffFormatter {
|
|
|
107
107
|
* const result = await diffFormatter.diffLines(oldLines, newLines);
|
|
108
108
|
* ```
|
|
109
109
|
*/
|
|
110
|
-
diffLines(oldLines: string[], newLines: string[], options?: DiffFormatterOptions, context?:
|
|
110
|
+
diffLines(oldLines: string[], newLines: string[], options?: DiffFormatterOptions, context?: RequestContext): Promise<string>;
|
|
111
111
|
/**
|
|
112
112
|
* Generate a word-level diff between two text strings.
|
|
113
113
|
*
|
|
@@ -134,7 +134,7 @@ export declare class DiffFormatter {
|
|
|
134
134
|
* // => 'The [-quick-][+fast+] brown [-fox-][+dog+]'
|
|
135
135
|
* ```
|
|
136
136
|
*/
|
|
137
|
-
diffWords(oldText: string, newText: string, context?:
|
|
137
|
+
diffWords(oldText: string, newText: string, context?: RequestContext): Promise<string>;
|
|
138
138
|
/**
|
|
139
139
|
* Dispatch to the appropriate formatter based on `options.format`.
|
|
140
140
|
*
|
|
@@ -185,7 +185,7 @@ export declare class DiffFormatter {
|
|
|
185
185
|
* console.log(`+${stats.additions} -${stats.deletions} (~${stats.changes} lines changed)`);
|
|
186
186
|
* ```
|
|
187
187
|
*/
|
|
188
|
-
getStats(oldText: string, newText: string, context?:
|
|
188
|
+
getStats(oldText: string, newText: string, context?: RequestContext): Promise<{
|
|
189
189
|
additions: number;
|
|
190
190
|
deletions: number;
|
|
191
191
|
changes: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diffFormatter.d.ts","sourceRoot":"","sources":["../../../src/utils/formatting/diffFormatter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH,OAAO,EACL,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"diffFormatter.d.ts","sourceRoot":"","sources":["../../../src/utils/formatting/diffFormatter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,oCAAoC,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;IAEpB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;;GASG;AACH,qBAAa,aAAa;IACxB,yFAAyF;IACzF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAK7B;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACG,IAAI,CACR,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,oBAAoB,EAC9B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,MAAM,CAAC,CA0DjB;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,SAAS,CACb,QAAQ,EAAE,MAAM,EAAE,EAClB,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,CAAC,EAAE,oBAAoB,EAC9B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,MAAM,CAAC,CAiBjB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACG,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA+C3F;IAED;;;;;;OAMG;IACH,OAAO,CAAC,UAAU;IAuBlB;;;;;;;OAOG;IACH,OAAO,CAAC,YAAY;IAUpB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,YAAY;IA+BpB;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,QAAQ,CACZ,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAgCpE;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,aAAa,eAAsB,CAAC"}
|
|
@@ -10,7 +10,7 @@ import { JsonRpcErrorCode, McpError, validationError } from '../../types-global/
|
|
|
10
10
|
import { lazyImport } from '../../utils/internal/lazyImport.js';
|
|
11
11
|
import { logger } from '../../utils/internal/logger.js';
|
|
12
12
|
const getDiff = lazyImport(() => import('diff'), 'Install "diff" to use diff formatting: bun add diff');
|
|
13
|
-
import { requestContextService, } from '../../utils/internal/requestContext.js';
|
|
13
|
+
import { requestContextService, withExtra, } from '../../utils/internal/requestContext.js';
|
|
14
14
|
/**
|
|
15
15
|
* Utility class for generating diffs between text content.
|
|
16
16
|
*
|
|
@@ -69,30 +69,23 @@ export class DiffFormatter {
|
|
|
69
69
|
...options,
|
|
70
70
|
};
|
|
71
71
|
try {
|
|
72
|
-
logger.debug('Generating diff', {
|
|
73
|
-
...logContext,
|
|
72
|
+
logger.debug('Generating diff', withExtra(logContext, {
|
|
74
73
|
oldLines: oldText.split('\n').length,
|
|
75
74
|
newLines: newText.split('\n').length,
|
|
76
75
|
format: opts.format,
|
|
77
|
-
});
|
|
76
|
+
}));
|
|
78
77
|
// Generate diff using jsdiff library
|
|
79
78
|
const Diff = await getDiff();
|
|
80
79
|
const patches = Diff.createPatch(opts.oldPath || 'a/file', oldText, newText, opts.oldPath || 'old', opts.newPath || 'new', { context: opts.context });
|
|
81
80
|
// Format based on selected format
|
|
82
81
|
const result = this.formatDiff(patches, opts);
|
|
83
|
-
logger.debug('Diff generated successfully', {
|
|
84
|
-
...logContext,
|
|
85
|
-
resultLength: result.length,
|
|
86
|
-
});
|
|
82
|
+
logger.debug('Diff generated successfully', withExtra(logContext, { resultLength: result.length }));
|
|
87
83
|
return result;
|
|
88
84
|
}
|
|
89
85
|
catch (error) {
|
|
90
86
|
const message = error instanceof Error ? error.message : String(error);
|
|
91
87
|
const stack = error instanceof Error ? error.stack : undefined;
|
|
92
|
-
logger.error('Failed to generate diff', {
|
|
93
|
-
...logContext,
|
|
94
|
-
error: message,
|
|
95
|
-
});
|
|
88
|
+
logger.error('Failed to generate diff', withExtra(logContext, { error: message }));
|
|
96
89
|
throw new McpError(JsonRpcErrorCode.InternalError, `Failed to generate diff: ${message}`, {
|
|
97
90
|
...logContext,
|
|
98
91
|
originalError: stack,
|
|
@@ -186,19 +179,13 @@ export class DiffFormatter {
|
|
|
186
179
|
return part.value;
|
|
187
180
|
})
|
|
188
181
|
.join('');
|
|
189
|
-
logger.debug('Word diff generated successfully', {
|
|
190
|
-
...logContext,
|
|
191
|
-
changeCount: changes.length,
|
|
192
|
-
});
|
|
182
|
+
logger.debug('Word diff generated successfully', withExtra(logContext, { changeCount: changes.length }));
|
|
193
183
|
return result;
|
|
194
184
|
}
|
|
195
185
|
catch (error) {
|
|
196
186
|
const message = error instanceof Error ? error.message : String(error);
|
|
197
187
|
const stack = error instanceof Error ? error.stack : undefined;
|
|
198
|
-
logger.error('Failed to generate word diff', {
|
|
199
|
-
...logContext,
|
|
200
|
-
error: message,
|
|
201
|
-
});
|
|
188
|
+
logger.error('Failed to generate word diff', withExtra(logContext, { error: message }));
|
|
202
189
|
throw new McpError(JsonRpcErrorCode.InternalError, `Failed to generate word diff: ${message}`, { ...logContext, originalError: stack });
|
|
203
190
|
}
|
|
204
191
|
}
|