@cyanheads/mcp-ts-core 0.13.6 → 0.13.8
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 +5 -5
- package/CLAUDE.md +5 -5
- package/README.md +57 -52
- package/biome.json +1 -1
- package/changelog/0.13.x/0.13.7.md +77 -0
- package/changelog/0.13.x/0.13.8.md +101 -0
- package/config/tsconfig.base.json +2 -2
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +61 -11
- package/dist/config/index.js.map +1 -1
- package/dist/core/app.d.ts.map +1 -1
- package/dist/core/app.js +35 -6
- package/dist/core/app.js.map +1 -1
- package/dist/core/context.d.ts +9 -1
- package/dist/core/context.d.ts.map +1 -1
- package/dist/core/context.js +17 -16
- package/dist/core/context.js.map +1 -1
- package/dist/core/worker.d.ts +2 -0
- package/dist/core/worker.d.ts.map +1 -1
- package/dist/core/worker.js +9 -1
- package/dist/core/worker.js.map +1 -1
- package/dist/linter/rules/enrichment-rules.d.ts +3 -2
- package/dist/linter/rules/enrichment-rules.d.ts.map +1 -1
- package/dist/linter/rules/enrichment-rules.js +9 -2
- package/dist/linter/rules/enrichment-rules.js.map +1 -1
- package/dist/linter/rules/handler-body-rules.d.ts.map +1 -1
- package/dist/linter/rules/handler-body-rules.js +10 -4
- package/dist/linter/rules/handler-body-rules.js.map +1 -1
- package/dist/linter/rules/schema-rules.d.ts +5 -0
- package/dist/linter/rules/schema-rules.d.ts.map +1 -1
- package/dist/linter/rules/schema-rules.js +44 -17
- package/dist/linter/rules/schema-rules.js.map +1 -1
- package/dist/mcp-server/handlerContext.d.ts +6 -0
- package/dist/mcp-server/handlerContext.d.ts.map +1 -1
- package/dist/mcp-server/handlerContext.js +3 -0
- package/dist/mcp-server/handlerContext.js.map +1 -1
- package/dist/mcp-server/outputContract.d.ts +33 -0
- package/dist/mcp-server/outputContract.d.ts.map +1 -0
- package/dist/mcp-server/outputContract.js +43 -0
- package/dist/mcp-server/outputContract.js.map +1 -0
- package/dist/mcp-server/prompts/prompt-registration.d.ts.map +1 -1
- package/dist/mcp-server/prompts/prompt-registration.js +6 -3
- package/dist/mcp-server/prompts/prompt-registration.js.map +1 -1
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts.map +1 -1
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.js +10 -2
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.js.map +1 -1
- package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts +16 -5
- package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts.map +1 -1
- package/dist/mcp-server/tools/utils/toolHandlerFactory.js +70 -14
- package/dist/mcp-server/tools/utils/toolHandlerFactory.js.map +1 -1
- package/dist/mcp-server/transports/auth/lib/authUtils.js +4 -1
- package/dist/mcp-server/transports/auth/lib/authUtils.js.map +1 -1
- package/dist/mcp-server/transports/auth/strategies/jwtStrategy.d.ts.map +1 -1
- package/dist/mcp-server/transports/auth/strategies/jwtStrategy.js +1 -1
- 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 +2 -5
- package/dist/mcp-server/transports/auth/strategies/oauthStrategy.js.map +1 -1
- package/dist/mcp-server/transports/http/httpErrorHandler.d.ts.map +1 -1
- package/dist/mcp-server/transports/http/httpErrorHandler.js +15 -5
- package/dist/mcp-server/transports/http/httpErrorHandler.js.map +1 -1
- package/dist/mcp-server/transports/http/sessionStore.d.ts.map +1 -1
- package/dist/mcp-server/transports/http/sessionStore.js +2 -2
- package/dist/mcp-server/transports/http/sessionStore.js.map +1 -1
- package/dist/services/canvas/core/CanvasRegistry.js +1 -1
- package/dist/services/canvas/core/CanvasRegistry.js.map +1 -1
- package/dist/services/canvas/core/DataCanvas.d.ts.map +1 -1
- package/dist/services/canvas/core/DataCanvas.js +7 -5
- package/dist/services/canvas/core/DataCanvas.js.map +1 -1
- package/dist/services/canvas/core/canvasFactory.d.ts.map +1 -1
- package/dist/services/canvas/core/canvasFactory.js +2 -2
- package/dist/services/canvas/core/canvasFactory.js.map +1 -1
- package/dist/services/canvas/providers/duckdb/DuckdbProvider.d.ts.map +1 -1
- package/dist/services/canvas/providers/duckdb/DuckdbProvider.js +25 -16
- package/dist/services/canvas/providers/duckdb/DuckdbProvider.js.map +1 -1
- package/dist/services/llm/providers/openrouter.provider.js +1 -1
- package/dist/services/llm/providers/openrouter.provider.js.map +1 -1
- package/dist/services/speech/providers/elevenlabs.provider.js +3 -3
- package/dist/services/speech/providers/elevenlabs.provider.js.map +1 -1
- package/dist/services/speech/providers/whisper.provider.d.ts.map +1 -1
- package/dist/services/speech/providers/whisper.provider.js +5 -5
- package/dist/services/speech/providers/whisper.provider.js.map +1 -1
- package/dist/storage/core/IStorageProvider.d.ts +5 -2
- package/dist/storage/core/IStorageProvider.d.ts.map +1 -1
- package/dist/storage/core/StorageService.d.ts.map +1 -1
- package/dist/storage/core/StorageService.js +3 -6
- package/dist/storage/core/StorageService.js.map +1 -1
- package/dist/storage/core/providerHelpers.d.ts +29 -8
- package/dist/storage/core/providerHelpers.d.ts.map +1 -1
- package/dist/storage/core/providerHelpers.js +49 -11
- package/dist/storage/core/providerHelpers.js.map +1 -1
- package/dist/storage/core/storageFactory.d.ts.map +1 -1
- package/dist/storage/core/storageFactory.js +12 -15
- package/dist/storage/core/storageFactory.js.map +1 -1
- package/dist/storage/core/storageValidation.d.ts +13 -13
- package/dist/storage/core/storageValidation.d.ts.map +1 -1
- package/dist/storage/core/storageValidation.js +49 -125
- package/dist/storage/core/storageValidation.js.map +1 -1
- package/dist/storage/providers/cloudflare/d1Provider.d.ts.map +1 -1
- package/dist/storage/providers/cloudflare/d1Provider.js +9 -7
- package/dist/storage/providers/cloudflare/d1Provider.js.map +1 -1
- package/dist/storage/providers/cloudflare/kvProvider.d.ts +2 -0
- package/dist/storage/providers/cloudflare/kvProvider.d.ts.map +1 -1
- package/dist/storage/providers/cloudflare/kvProvider.js +12 -10
- package/dist/storage/providers/cloudflare/kvProvider.js.map +1 -1
- package/dist/storage/providers/cloudflare/r2Provider.d.ts.map +1 -1
- package/dist/storage/providers/cloudflare/r2Provider.js +11 -8
- package/dist/storage/providers/cloudflare/r2Provider.js.map +1 -1
- package/dist/storage/providers/fileSystem/fileSystemProvider.d.ts +1 -0
- package/dist/storage/providers/fileSystem/fileSystemProvider.d.ts.map +1 -1
- package/dist/storage/providers/fileSystem/fileSystemProvider.js +14 -12
- package/dist/storage/providers/fileSystem/fileSystemProvider.js.map +1 -1
- package/dist/storage/providers/inMemory/inMemoryProvider.d.ts +6 -1
- package/dist/storage/providers/inMemory/inMemoryProvider.d.ts.map +1 -1
- package/dist/storage/providers/inMemory/inMemoryProvider.js +15 -10
- package/dist/storage/providers/inMemory/inMemoryProvider.js.map +1 -1
- package/dist/storage/providers/supabase/supabaseProvider.d.ts.map +1 -1
- package/dist/storage/providers/supabase/supabaseProvider.js +5 -1
- package/dist/storage/providers/supabase/supabaseProvider.js.map +1 -1
- package/dist/testing/fuzz.d.ts.map +1 -1
- package/dist/testing/fuzz.js +7 -1
- package/dist/testing/fuzz.js.map +1 -1
- package/dist/testing/index.d.ts +21 -6
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +57 -10
- package/dist/testing/index.js.map +1 -1
- package/dist/types-global/errors.d.ts +7 -4
- package/dist/types-global/errors.d.ts.map +1 -1
- package/dist/types-global/errors.js.map +1 -1
- package/dist/utils/formatting/codeSpan.d.ts +27 -0
- package/dist/utils/formatting/codeSpan.d.ts.map +1 -0
- package/dist/utils/formatting/codeSpan.js +42 -0
- package/dist/utils/formatting/codeSpan.js.map +1 -0
- package/dist/utils/formatting/diffFormatter.d.ts.map +1 -1
- package/dist/utils/formatting/diffFormatter.js +7 -15
- package/dist/utils/formatting/diffFormatter.js.map +1 -1
- package/dist/utils/formatting/markdownBuilder.d.ts +12 -5
- package/dist/utils/formatting/markdownBuilder.d.ts.map +1 -1
- package/dist/utils/formatting/markdownBuilder.js +14 -2
- package/dist/utils/formatting/markdownBuilder.js.map +1 -1
- package/dist/utils/formatting/partialResult.d.ts +28 -2
- package/dist/utils/formatting/partialResult.d.ts.map +1 -1
- package/dist/utils/formatting/partialResult.js +46 -2
- package/dist/utils/formatting/partialResult.js.map +1 -1
- package/dist/utils/formatting/tableFormatter.d.ts.map +1 -1
- package/dist/utils/formatting/tableFormatter.js +5 -9
- package/dist/utils/formatting/tableFormatter.js.map +1 -1
- package/dist/utils/formatting/treeFormatter.d.ts.map +1 -1
- package/dist/utils/formatting/treeFormatter.js +5 -9
- package/dist/utils/formatting/treeFormatter.js.map +1 -1
- package/dist/utils/internal/error-handler/errorHandler.d.ts +21 -8
- package/dist/utils/internal/error-handler/errorHandler.d.ts.map +1 -1
- package/dist/utils/internal/error-handler/errorHandler.js +70 -38
- package/dist/utils/internal/error-handler/errorHandler.js.map +1 -1
- package/dist/utils/internal/error-handler/mappings.d.ts +18 -1
- package/dist/utils/internal/error-handler/mappings.d.ts.map +1 -1
- package/dist/utils/internal/error-handler/mappings.js +23 -1
- package/dist/utils/internal/error-handler/mappings.js.map +1 -1
- package/dist/utils/internal/error-handler/types.d.ts +2 -0
- package/dist/utils/internal/error-handler/types.d.ts.map +1 -1
- package/dist/utils/internal/logger.d.ts +75 -3
- package/dist/utils/internal/logger.d.ts.map +1 -1
- package/dist/utils/internal/logger.js +181 -52
- package/dist/utils/internal/logger.js.map +1 -1
- package/dist/utils/internal/performance.d.ts +16 -1
- package/dist/utils/internal/performance.d.ts.map +1 -1
- package/dist/utils/internal/performance.js +59 -20
- package/dist/utils/internal/performance.js.map +1 -1
- package/dist/utils/network/fetchWithTimeout.d.ts +11 -5
- package/dist/utils/network/fetchWithTimeout.d.ts.map +1 -1
- package/dist/utils/network/fetchWithTimeout.js +50 -23
- package/dist/utils/network/fetchWithTimeout.js.map +1 -1
- package/dist/utils/network/retry.d.ts +16 -8
- package/dist/utils/network/retry.d.ts.map +1 -1
- package/dist/utils/network/retry.js +19 -8
- package/dist/utils/network/retry.js.map +1 -1
- package/dist/utils/overflow/outlineOnOverflow.d.ts +18 -2
- package/dist/utils/overflow/outlineOnOverflow.d.ts.map +1 -1
- package/dist/utils/overflow/outlineOnOverflow.js +28 -3
- package/dist/utils/overflow/outlineOnOverflow.js.map +1 -1
- package/dist/utils/pagination/pagination.d.ts +3 -1
- package/dist/utils/pagination/pagination.d.ts.map +1 -1
- package/dist/utils/pagination/pagination.js +10 -2
- package/dist/utils/pagination/pagination.js.map +1 -1
- package/dist/utils/parsing/csvParser.d.ts.map +1 -1
- package/dist/utils/parsing/csvParser.js +4 -2
- package/dist/utils/parsing/csvParser.js.map +1 -1
- package/dist/utils/parsing/htmlExtractor.js +1 -1
- package/dist/utils/parsing/htmlExtractor.js.map +1 -1
- package/dist/utils/parsing/jsonParser.d.ts.map +1 -1
- package/dist/utils/parsing/jsonParser.js +3 -1
- package/dist/utils/parsing/jsonParser.js.map +1 -1
- package/dist/utils/parsing/xmlParser.d.ts.map +1 -1
- package/dist/utils/parsing/xmlParser.js +3 -1
- package/dist/utils/parsing/xmlParser.js.map +1 -1
- package/dist/utils/parsing/yamlParser.d.ts.map +1 -1
- package/dist/utils/parsing/yamlParser.js +3 -1
- package/dist/utils/parsing/yamlParser.js.map +1 -1
- package/dist/utils/security/idGenerator.d.ts.map +1 -1
- package/dist/utils/security/idGenerator.js +20 -4
- package/dist/utils/security/idGenerator.js.map +1 -1
- package/dist/utils/security/sanitization.d.ts +46 -15
- package/dist/utils/security/sanitization.d.ts.map +1 -1
- package/dist/utils/security/sanitization.js +203 -96
- package/dist/utils/security/sanitization.js.map +1 -1
- package/dist/utils/telemetry/attributes.d.ts +16 -1
- package/dist/utils/telemetry/attributes.d.ts.map +1 -1
- package/dist/utils/telemetry/attributes.js +16 -1
- package/dist/utils/telemetry/attributes.js.map +1 -1
- package/dist/utils/telemetry/instrumentation.d.ts +13 -3
- package/dist/utils/telemetry/instrumentation.d.ts.map +1 -1
- package/dist/utils/telemetry/instrumentation.js +104 -17
- package/dist/utils/telemetry/instrumentation.js.map +1 -1
- package/framework-skills/add-app-tool/SKILL.md +12 -18
- package/framework-skills/add-prompt/SKILL.md +3 -1
- package/framework-skills/add-provider/SKILL.md +14 -4
- package/framework-skills/add-resource/SKILL.md +3 -3
- package/framework-skills/add-tool/SKILL.md +22 -7
- package/framework-skills/api-auth/SKILL.md +3 -1
- package/framework-skills/api-canvas/SKILL.md +4 -4
- package/framework-skills/api-config/SKILL.md +9 -5
- package/framework-skills/api-context/SKILL.md +10 -7
- package/framework-skills/api-errors/SKILL.md +20 -11
- package/framework-skills/api-linter/SKILL.md +14 -10
- package/framework-skills/api-telemetry/SKILL.md +38 -13
- package/framework-skills/api-testing/SKILL.md +25 -15
- package/framework-skills/api-utils/SKILL.md +10 -10
- package/framework-skills/api-utils/references/formatting.md +1 -1
- package/framework-skills/api-utils/references/parsing.md +2 -2
- package/framework-skills/api-utils/references/security.md +13 -10
- package/framework-skills/code-simplifier/SKILL.md +31 -18
- package/framework-skills/design-mcp-server/SKILL.md +62 -35
- package/framework-skills/git-wrapup/SKILL.md +19 -10
- package/framework-skills/maintenance/SKILL.md +3 -3
- package/framework-skills/orchestrations/SKILL.md +1 -1
- package/framework-skills/orchestrations/workflows/greenfield-build.md +15 -8
- package/framework-skills/polish-docs-meta/SKILL.md +2 -2
- package/framework-skills/polish-docs-meta/references/package-meta.md +1 -1
- package/framework-skills/polish-docs-meta/references/readme.md +4 -3
- package/framework-skills/release-and-publish/SKILL.md +7 -5
- package/framework-skills/release-pr-review/SKILL.md +18 -1
- package/framework-skills/report-issue-framework/SKILL.md +2 -2
- package/framework-skills/report-issue-local/SKILL.md +3 -3
- package/framework-skills/security-pass/SKILL.md +11 -3
- package/framework-skills/techniques/SKILL.md +1 -1
- package/framework-skills/techniques/references/outline-on-overflow.md +12 -7
- package/framework-skills/tool-defs-analysis/SKILL.md +3 -3
- package/package.json +30 -36
- package/scripts/check-skill-versions.ts +103 -22
- package/scripts/devcheck.ts +4 -3
- package/scripts/lint-packaging.ts +38 -1
- package/templates/.env.example +7 -1
- package/templates/.github/ISSUE_TEMPLATE/feature_request.yml +1 -1
- package/templates/AGENTS.md +2 -2
- package/templates/CLAUDE.md +2 -2
- package/templates/Dockerfile +30 -10
- package/templates/package.json +4 -3
- package/templates/src/mcp-server/prompts/definitions/echo.prompt.ts +2 -4
- package/templates/src/mcp-server/resources/definitions/echo-app-ui.app-resource.ts +51 -14
- package/templates/src/mcp-server/resources/definitions/echo.resource.ts +1 -1
- package/templates/src/mcp-server/tools/definitions/echo-app.app-tool.ts +2 -3
- package/templates/src/mcp-server/tools/definitions/echo.tool.ts +1 -1
- package/dist/utils/telemetry/index.d.ts +0 -12
- package/dist/utils/telemetry/index.d.ts.map +0 -1
- package/dist/utils/telemetry/index.js +0 -12
- package/dist/utils/telemetry/index.js.map +0 -1
|
@@ -100,7 +100,7 @@ export class TreeFormatter {
|
|
|
100
100
|
});
|
|
101
101
|
// Validate input
|
|
102
102
|
if (!root || typeof root.name !== 'string') {
|
|
103
|
-
throw validationError('Root node must have a name property'
|
|
103
|
+
throw validationError('Root node must have a name property');
|
|
104
104
|
}
|
|
105
105
|
const opts = {
|
|
106
106
|
...this.defaultOptions,
|
|
@@ -121,12 +121,8 @@ export class TreeFormatter {
|
|
|
121
121
|
throw error;
|
|
122
122
|
}
|
|
123
123
|
const message = error instanceof Error ? error.message : String(error);
|
|
124
|
-
const stack = error instanceof Error ? error.stack : undefined;
|
|
125
124
|
logger.error('Failed to format tree', withExtra(logContext, { error: message }));
|
|
126
|
-
throw new McpError(JsonRpcErrorCode.InternalError, `Failed to format tree: ${message}`, {
|
|
127
|
-
...logContext,
|
|
128
|
-
originalError: stack,
|
|
129
|
-
});
|
|
125
|
+
throw new McpError(JsonRpcErrorCode.InternalError, `Failed to format tree: ${message}`, undefined, { cause: error });
|
|
130
126
|
}
|
|
131
127
|
}
|
|
132
128
|
/**
|
|
@@ -167,7 +163,7 @@ export class TreeFormatter {
|
|
|
167
163
|
operation: 'TreeFormatter.formatMultiple',
|
|
168
164
|
});
|
|
169
165
|
if (!Array.isArray(roots) || roots.length === 0) {
|
|
170
|
-
throw validationError('Roots must be a non-empty array'
|
|
166
|
+
throw validationError('Roots must be a non-empty array');
|
|
171
167
|
}
|
|
172
168
|
try {
|
|
173
169
|
logger.debug('Formatting multiple tree structures', withExtra(logContext, { count: roots.length }));
|
|
@@ -179,8 +175,8 @@ export class TreeFormatter {
|
|
|
179
175
|
throw error;
|
|
180
176
|
}
|
|
181
177
|
const message = error instanceof Error ? error.message : String(error);
|
|
182
|
-
|
|
183
|
-
throw new McpError(JsonRpcErrorCode.InternalError, `Failed to format multiple trees: ${message}`, {
|
|
178
|
+
logger.error('Failed to format multiple trees', withExtra(logContext, { error: message }));
|
|
179
|
+
throw new McpError(JsonRpcErrorCode.InternalError, `Failed to format multiple trees: ${message}`, undefined, { cause: error });
|
|
184
180
|
}
|
|
185
181
|
}
|
|
186
182
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeFormatter.js","sourceRoot":"","sources":["../../../src/utils/formatting/treeFormatter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACvF,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAEL,qBAAqB,EACrB,SAAS,GACV,MAAM,oCAAoC,CAAC;AAqH5C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,OAAO,aAAa;IACxB;;;OAGG;IACc,cAAc,GAAwB;QACrD,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,SAAS;QACnB,YAAY,EAAE,KAAK;QACnB,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,IAAI;QACZ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AC,QAAQ,EAAE,CAAC;YAC5C,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;aAC1C,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;aAChD,IAAI,CAAC,IAAI,CAAC,CAAC;QAEd,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACxC,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC"}
|
|
@@ -28,7 +28,11 @@ export declare function initErrorMetrics(): void;
|
|
|
28
28
|
*
|
|
29
29
|
* Applied inside the measured region by both handler factories, so the
|
|
30
30
|
* completion log's `metrics.errorCode` and the execution span's error-code
|
|
31
|
-
* attribute carry `-32011` alongside the classified envelope.
|
|
31
|
+
* attribute carry `-32011` alongside the classified envelope. The HTTP
|
|
32
|
+
* transport's error handler applies it against the inbound request's signal,
|
|
33
|
+
* and `runToolContract` against the mock context's, over the handler and the
|
|
34
|
+
* success pipeline after it, so a contract test of cancellation sees the
|
|
35
|
+
* envelope the factory emits (#513).
|
|
32
36
|
*
|
|
33
37
|
* Returns the value unchanged while the signal is live, for an `input_required`
|
|
34
38
|
* signal (protocol control flow, never a failure), and for an error already
|
|
@@ -50,11 +54,13 @@ export declare class ErrorHandler {
|
|
|
50
54
|
* Resolution order:
|
|
51
55
|
* 1. `McpError` instances — returns `error.code` directly.
|
|
52
56
|
* 2. SDK `ConnectionClosed` rejections — mapped to `RequestCancelled`, ahead of the pattern ladder.
|
|
53
|
-
* 3.
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
57
|
+
* 3. Engine resource-limit `RangeError`s — a whole message in `ENGINE_RESOURCE_LIMIT_MESSAGES`
|
|
58
|
+
* (stack overflow, maximum string size) maps to `InternalError` (#482).
|
|
59
|
+
* 4. Standard JS error constructor names via `ERROR_TYPE_MAPPINGS` (e.g. `SyntaxError` → `ValidationError`).
|
|
60
|
+
* 5. Provider-specific patterns (AWS, HTTP status codes, Supabase, OpenRouter) — checked before common patterns for specificity.
|
|
61
|
+
* 6. Common message/name patterns (auth, not-found, rate-limit, etc.).
|
|
62
|
+
* 7. `AbortError` name — mapped to `Timeout`.
|
|
63
|
+
* 8. Falls back to `JsonRpcErrorCode.InternalError`.
|
|
58
64
|
*
|
|
59
65
|
* @param error - The error instance or value to classify.
|
|
60
66
|
* @returns The most specific `JsonRpcErrorCode` that fits the error.
|
|
@@ -79,8 +85,11 @@ export declare class ErrorHandler {
|
|
|
79
85
|
* 1. Records the exception on the active OTel span and sets span status to ERROR.
|
|
80
86
|
* 2. Sanitizes `options.input` via `sanitizeInputForLogging` before including in logs.
|
|
81
87
|
* 3. Extracts and consolidates error data, original stack, and the full cause chain.
|
|
82
|
-
* 4. Rebuilds the error as a new `McpError` carrying the consolidated data
|
|
83
|
-
*
|
|
88
|
+
* 4. Rebuilds the error as a new `McpError` carrying the consolidated data — the thrown
|
|
89
|
+
* error's own `data`, `originalErrorName`, `originalMessage`, and `rootCause` — preserving
|
|
90
|
+
* the classified code (or delegates to `options.errorMapper`). That `data` is client-visible
|
|
91
|
+
* once the error is thrown toward a handler, so it carries no stack and no `context`:
|
|
92
|
+
* `originalStack`, `causeChain`, and the context ride the log record only.
|
|
84
93
|
* 5. Logs the result via the global logger with full structured context — at `error` level,
|
|
85
94
|
* or at `info` without a stack for `RequestCancelled`, which is a routine caller disconnect.
|
|
86
95
|
* 6. Returns the processed error, or rethrows it if `options.rethrow` is `true`.
|
|
@@ -175,6 +184,10 @@ export declare class ErrorHandler {
|
|
|
175
184
|
* Use this in service code where you want structured logging and OTel integration without duplicating
|
|
176
185
|
* error-handling boilerplate.
|
|
177
186
|
*
|
|
187
|
+
* The thrown error's `data` reaches the client when a tool or resource handler lets it propagate,
|
|
188
|
+
* so it carries `originalErrorName`, `originalMessage`, `rootCause`, and `options.context`'s canonical
|
|
189
|
+
* fields and `extra`, but no stack; the throw-site stack and cause chain are logged.
|
|
190
|
+
*
|
|
178
191
|
* @template T The expected return type of `fn`.
|
|
179
192
|
* @param fn - The function to execute. May be synchronous or return a `Promise`.
|
|
180
193
|
* @param options - Error handling options passed to `handleError` (`rethrow` is always `true` and cannot be overridden).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorHandler.d.ts","sourceRoot":"","sources":["../../../../src/utils/internal/error-handler/errorHandler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,EAAE,gBAAgB,EAA8B,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"errorHandler.d.ts","sourceRoot":"","sources":["../../../../src/utils/internal/error-handler/errorHandler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,EAAE,gBAAgB,EAA8B,MAAM,0BAA0B,CAAC;AAoBxF,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAapE,0FAA0F;AAC1F,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAI/E;AAED;;GAEG;AAEH,qBAAa,YAAY;IACvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,OAAc,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CA0DjE;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACH,OAAc,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAmB,GAAG,KAAK,CA6K7E;IAED;;;;;;;;;;OAUG;IACH,OAAc,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG;QAC1C,IAAI,EAAE,gBAAgB,CAAC;QACvB,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAChC,CAeA;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,OAAc,QAAQ,CAAC,CAAC,SAAS,KAAK,EACpC,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EACxC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,GACxE,CAAC,GAAG,KAAK,CAgBX;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,OAAc,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsBjE;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,OAAoB,QAAQ,CAAC,CAAC,EAC5B,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EACxB,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAAE,SAAS,CAAC,GAC5C,OAAO,CAAC,CAAC,CAAC,CAUZ;CACF"}
|
|
@@ -9,13 +9,12 @@ import { ZodError } from 'zod';
|
|
|
9
9
|
import { isInputRequiredSignal } from '../../../mcp-server/inputRequired.js';
|
|
10
10
|
import { JsonRpcErrorCode, McpError, requestCancelled } from '../../../types-global/errors.js';
|
|
11
11
|
import { logger } from '../logger.js';
|
|
12
|
-
import { toCanonicalContext } from '../requestContext.js';
|
|
13
12
|
import { generateUUID } from '../../security/idGenerator.js';
|
|
14
13
|
import { sanitizeInputForLogging } from '../../security/sanitization.js';
|
|
15
|
-
import { ATTR_MCP_ERROR_CLASSIFIED_CODE, ATTR_MCP_ERROR_SEVERITY, } from '../../telemetry/attributes.js';
|
|
14
|
+
import { ATTR_MCP_ERROR_CATEGORY, ATTR_MCP_ERROR_CLASSIFIED_CODE, ATTR_MCP_ERROR_SEVERITY, } from '../../telemetry/attributes.js';
|
|
16
15
|
import { createCounter } from '../../telemetry/metrics.js';
|
|
17
16
|
import { extractErrorCauseChain, getErrorMessage, getErrorName } from './helpers.js';
|
|
18
|
-
import { COMPILED_ERROR_PATTERNS, COMPILED_PROVIDER_PATTERNS, ERROR_TYPE_MAPPINGS, getCompiledPattern, } from './mappings.js';
|
|
17
|
+
import { COMPILED_ERROR_PATTERNS, COMPILED_PROVIDER_PATTERNS, ENGINE_RESOURCE_LIMIT_MESSAGES, ERROR_TYPE_MAPPINGS, getCompiledPattern, getErrorCategory, } from './mappings.js';
|
|
19
18
|
let errorClassifiedCounter;
|
|
20
19
|
function getErrorMetrics() {
|
|
21
20
|
errorClassifiedCounter ??= createCounter('mcp.errors.classified', 'Total errors classified by JSON-RPC error code', '{errors}');
|
|
@@ -46,7 +45,11 @@ export function initErrorMetrics() {
|
|
|
46
45
|
*
|
|
47
46
|
* Applied inside the measured region by both handler factories, so the
|
|
48
47
|
* completion log's `metrics.errorCode` and the execution span's error-code
|
|
49
|
-
* attribute carry `-32011` alongside the classified envelope.
|
|
48
|
+
* attribute carry `-32011` alongside the classified envelope. The HTTP
|
|
49
|
+
* transport's error handler applies it against the inbound request's signal,
|
|
50
|
+
* and `runToolContract` against the mock context's, over the handler and the
|
|
51
|
+
* success pipeline after it, so a contract test of cancellation sees the
|
|
52
|
+
* envelope the factory emits (#513).
|
|
50
53
|
*
|
|
51
54
|
* Returns the value unchanged while the signal is live, for an `input_required`
|
|
52
55
|
* signal (protocol control flow, never a failure), and for an error already
|
|
@@ -75,11 +78,13 @@ export class ErrorHandler {
|
|
|
75
78
|
* Resolution order:
|
|
76
79
|
* 1. `McpError` instances — returns `error.code` directly.
|
|
77
80
|
* 2. SDK `ConnectionClosed` rejections — mapped to `RequestCancelled`, ahead of the pattern ladder.
|
|
78
|
-
* 3.
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
81
|
+
* 3. Engine resource-limit `RangeError`s — a whole message in `ENGINE_RESOURCE_LIMIT_MESSAGES`
|
|
82
|
+
* (stack overflow, maximum string size) maps to `InternalError` (#482).
|
|
83
|
+
* 4. Standard JS error constructor names via `ERROR_TYPE_MAPPINGS` (e.g. `SyntaxError` → `ValidationError`).
|
|
84
|
+
* 5. Provider-specific patterns (AWS, HTTP status codes, Supabase, OpenRouter) — checked before common patterns for specificity.
|
|
85
|
+
* 6. Common message/name patterns (auth, not-found, rate-limit, etc.).
|
|
86
|
+
* 7. `AbortError` name — mapped to `Timeout`.
|
|
87
|
+
* 8. Falls back to `JsonRpcErrorCode.InternalError`.
|
|
83
88
|
*
|
|
84
89
|
* @param error - The error instance or value to classify.
|
|
85
90
|
* @returns The most specific `JsonRpcErrorCode` that fits the error.
|
|
@@ -112,6 +117,15 @@ export class ErrorHandler {
|
|
|
112
117
|
}
|
|
113
118
|
const errorName = getErrorName(error);
|
|
114
119
|
const errorMessage = getErrorMessage(error);
|
|
120
|
+
/**
|
|
121
|
+
* The engine's own resource limits — a runaway recursion, a string past the
|
|
122
|
+
* maximum size — surface as `RangeError`s whose text names nothing a caller
|
|
123
|
+
* can change. Matched by whole message ahead of the constructor table, which
|
|
124
|
+
* files every other `RangeError` as a caller's `ValidationError`.
|
|
125
|
+
*/
|
|
126
|
+
if (errorName === 'RangeError' && ENGINE_RESOURCE_LIMIT_MESSAGES.has(errorMessage)) {
|
|
127
|
+
return JsonRpcErrorCode.InternalError;
|
|
128
|
+
}
|
|
115
129
|
// Check against standard JavaScript error types
|
|
116
130
|
const mappedFromType = ERROR_TYPE_MAPPINGS[errorName];
|
|
117
131
|
if (mappedFromType) {
|
|
@@ -145,8 +159,11 @@ export class ErrorHandler {
|
|
|
145
159
|
* 1. Records the exception on the active OTel span and sets span status to ERROR.
|
|
146
160
|
* 2. Sanitizes `options.input` via `sanitizeInputForLogging` before including in logs.
|
|
147
161
|
* 3. Extracts and consolidates error data, original stack, and the full cause chain.
|
|
148
|
-
* 4. Rebuilds the error as a new `McpError` carrying the consolidated data
|
|
149
|
-
*
|
|
162
|
+
* 4. Rebuilds the error as a new `McpError` carrying the consolidated data — the thrown
|
|
163
|
+
* error's own `data`, `originalErrorName`, `originalMessage`, and `rootCause` — preserving
|
|
164
|
+
* the classified code (or delegates to `options.errorMapper`). That `data` is client-visible
|
|
165
|
+
* once the error is thrown toward a handler, so it carries no stack and no `context`:
|
|
166
|
+
* `originalStack`, `causeChain`, and the context ride the log record only.
|
|
150
167
|
* 5. Logs the result via the global logger with full structured context — at `error` level,
|
|
151
168
|
* or at `info` without a stack for `RequestCancelled`, which is a routine caller disconnect.
|
|
152
169
|
* 6. Returns the processed error, or rethrows it if `options.rethrow` is `true`.
|
|
@@ -202,51 +219,57 @@ export class ErrorHandler {
|
|
|
202
219
|
const errorDataSeed = error instanceof McpError && typeof error.data === 'object' && error.data !== null
|
|
203
220
|
? { ...error.data }
|
|
204
221
|
: {};
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
222
|
+
/**
|
|
223
|
+
* `consolidatedData` becomes `McpError.data`, which the tool handler puts on
|
|
224
|
+
* `structuredContent.error.data`. It carries the thrown error's own data and
|
|
225
|
+
* its classification, never `context`: a service handed the handler `ctx`
|
|
226
|
+
* (the documented `{ context: ctx }` pattern) would otherwise publish
|
|
227
|
+
* request metadata, and `extra` holds whatever a server attached — scope
|
|
228
|
+
* names, identifiers, input. The context reaches the log record below (#548).
|
|
229
|
+
*/
|
|
211
230
|
const consolidatedData = {
|
|
212
231
|
...errorDataSeed,
|
|
213
|
-
...canonicalContext,
|
|
214
|
-
...extra,
|
|
215
232
|
originalErrorName,
|
|
216
233
|
originalMessage: originalErrorMessage,
|
|
217
234
|
};
|
|
235
|
+
/**
|
|
236
|
+
* Stack-bearing diagnostics go to the log record only, never into the
|
|
237
|
+
* returned error's `data`: `tryCatch` throws that error, and tools and
|
|
238
|
+
* resources forward an `McpError`'s `data` to the client verbatim (#519).
|
|
239
|
+
* A cancellation carries neither — its every node would hold a stack and
|
|
240
|
+
* invite triage to read a caller hanging up as a fault in this server.
|
|
241
|
+
*/
|
|
242
|
+
const diagnostics = {};
|
|
218
243
|
if (originalStack &&
|
|
219
244
|
!isCancellation &&
|
|
220
245
|
!(error instanceof McpError && error.data?.originalStack)) {
|
|
221
|
-
|
|
246
|
+
diagnostics.originalStack = originalStack;
|
|
222
247
|
}
|
|
223
248
|
const cause = error instanceof Error ? error : undefined;
|
|
224
|
-
// Extract cause chain only when the error actually has a cause — and never
|
|
225
|
-
// for a cancellation, whose every node would carry a stack and reintroduce
|
|
226
|
-
// the triage noise the `originalStack` gate above exists to keep out.
|
|
227
249
|
if (!isCancellation && error instanceof Error && error.cause) {
|
|
228
250
|
const causeChain = extractErrorCauseChain(error);
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
name: rootCause.name,
|
|
234
|
-
message: rootCause.message,
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
consolidatedData.causeChain = causeChain;
|
|
251
|
+
const rootCause = causeChain.at(-1);
|
|
252
|
+
if (rootCause) {
|
|
253
|
+
consolidatedData.rootCause = { name: rootCause.name, message: rootCause.message };
|
|
254
|
+
diagnostics.causeChain = causeChain;
|
|
238
255
|
}
|
|
239
256
|
}
|
|
240
257
|
const finalError = errorMapper
|
|
241
258
|
? errorMapper(error)
|
|
242
259
|
: new McpError(loggedErrorCode, originalErrorMessage, consolidatedData, { cause });
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
260
|
+
/**
|
|
261
|
+
* Record error classification metric. The category is the same
|
|
262
|
+
* `getErrorCategory` answer the per-surface error counters carry, handed
|
|
263
|
+
* the thrown `McpError`'s `data` so the canvas tenant-cap refusal files
|
|
264
|
+
* under `server` rather than upstream throttling (#481). The declared
|
|
265
|
+
* severity is a bounded dimension and rides as an attribute; it is present
|
|
266
|
+
* only when one resolved, so a server that declares none keeps exactly its
|
|
267
|
+
* old series. The `reason` behind either never becomes a metric attribute —
|
|
268
|
+
* unbounded across a fleet, so it belongs on the span and in the log.
|
|
269
|
+
*/
|
|
248
270
|
getErrorMetrics().errorClassifiedCounter.add(1, {
|
|
249
271
|
[ATTR_MCP_ERROR_CLASSIFIED_CODE]: String(loggedErrorCode),
|
|
272
|
+
[ATTR_MCP_ERROR_CATEGORY]: getErrorCategory(loggedErrorCode, error instanceof McpError ? error.data : undefined),
|
|
250
273
|
operation,
|
|
251
274
|
...(severity !== undefined && { [ATTR_MCP_ERROR_SEVERITY]: severity }),
|
|
252
275
|
});
|
|
@@ -277,7 +300,12 @@ export class ErrorHandler {
|
|
|
277
300
|
errorCode: loggedErrorCode,
|
|
278
301
|
originalErrorType: originalErrorName,
|
|
279
302
|
finalErrorType: getErrorName(finalError),
|
|
280
|
-
errorData:
|
|
303
|
+
errorData: {
|
|
304
|
+
...(finalError instanceof McpError && finalError.data
|
|
305
|
+
? finalError.data
|
|
306
|
+
: consolidatedData),
|
|
307
|
+
...diagnostics,
|
|
308
|
+
},
|
|
281
309
|
...(includeStack && stack && !isCancellation ? { stack } : {}),
|
|
282
310
|
},
|
|
283
311
|
};
|
|
@@ -413,6 +441,10 @@ export class ErrorHandler {
|
|
|
413
441
|
* Use this in service code where you want structured logging and OTel integration without duplicating
|
|
414
442
|
* error-handling boilerplate.
|
|
415
443
|
*
|
|
444
|
+
* The thrown error's `data` reaches the client when a tool or resource handler lets it propagate,
|
|
445
|
+
* so it carries `originalErrorName`, `originalMessage`, `rootCause`, and `options.context`'s canonical
|
|
446
|
+
* fields and `extra`, but no stack; the throw-site stack and cause chain are logged.
|
|
447
|
+
*
|
|
416
448
|
* @template T The expected return type of `fn`.
|
|
417
449
|
* @param fn - The function to execute. May be synchronous or return a `Promise`.
|
|
418
450
|
* @param options - Error handling options passed to `handleError` (`rethrow` is always `true` and cannot be overridden).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorHandler.js","sourceRoot":"","sources":["../../../../src/utils/internal/error-handler/errorHandler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAE/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"errorHandler.js","sourceRoot":"","sources":["../../../../src/utils/internal/error-handler/errorHandler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAE/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,C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rB,MAAM,OAAO,GAAG,YAAY,CAAC,WAAW,CAAC,WAAW,EAAE;gBACpD,GAAG,OAAO;gBACV,OAAO,EAAE,KAAK;aACf,CAAC,CAAC;YACH,MAAM,OAAO,CAAC;QAChB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -44,22 +44,39 @@ interface CompiledErrorMapping extends BaseErrorMapping {
|
|
|
44
44
|
* | Constructor | Mapped Code |
|
|
45
45
|
* |-------------|-------------|
|
|
46
46
|
* | `SyntaxError` | `ValidationError` |
|
|
47
|
-
* | `RangeError` | `ValidationError` |
|
|
47
|
+
* | `RangeError` | `ValidationError` (except an engine resource limit — see below) |
|
|
48
48
|
* | `URIError` | `ValidationError` |
|
|
49
49
|
* | `ReferenceError` | `InternalError` |
|
|
50
50
|
* | `EvalError` | `InternalError` |
|
|
51
51
|
* | `AggregateError` | `InternalError` |
|
|
52
|
+
* | `ZodError` | `ValidationError` |
|
|
52
53
|
*
|
|
53
54
|
* Note: `TypeError` is intentionally excluded. Runtime TypeErrors (e.g. "Cannot read
|
|
54
55
|
* properties of undefined") are programming errors, not validation failures. Letting them
|
|
55
56
|
* fall through to message-pattern matching or the `InternalError` fallback is more accurate.
|
|
56
57
|
*
|
|
58
|
+
* A `RangeError` whose whole message is in {@link ENGINE_RESOURCE_LIMIT_MESSAGES} never
|
|
59
|
+
* reaches this table: `determineErrorCode` maps it to `InternalError` first (#482).
|
|
60
|
+
*
|
|
57
61
|
* @example
|
|
58
62
|
* ```ts
|
|
59
63
|
* ERROR_TYPE_MAPPINGS['SyntaxError']; // → JsonRpcErrorCode.ValidationError
|
|
60
64
|
* ```
|
|
61
65
|
*/
|
|
62
66
|
export declare const ERROR_TYPE_MAPPINGS: Readonly<Record<string, JsonRpcErrorCode>>;
|
|
67
|
+
/**
|
|
68
|
+
* The whole messages V8 and JavaScriptCore give the `RangeError` they raise when the
|
|
69
|
+
* engine itself runs out of a resource: the call stack (JavaScriptCore adds a trailing
|
|
70
|
+
* period) and the maximum string size (V8's `Invalid string length`, JavaScriptCore's
|
|
71
|
+
* `Out of memory`).
|
|
72
|
+
*
|
|
73
|
+
* `ErrorHandler.determineErrorCode` maps a `RangeError` carrying one of these to
|
|
74
|
+
* `InternalError` ahead of {@link ERROR_TYPE_MAPPINGS}: it names nothing a caller can
|
|
75
|
+
* change, so it is a server fault, not the `ValidationError` every other `RangeError` is
|
|
76
|
+
* (#482). Matched by whole message, so a `RangeError` that merely mentions one keeps
|
|
77
|
+
* `ValidationError`.
|
|
78
|
+
*/
|
|
79
|
+
export declare const ENGINE_RESOURCE_LIMIT_MESSAGES: ReadonlySet<string>;
|
|
63
80
|
/**
|
|
64
81
|
* Pre-compiled common error patterns used by `ErrorHandler.determineErrorCode`.
|
|
65
82
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mappings.d.ts","sourceRoot":"","sources":["../../../../src/utils/internal/error-handler/mappings.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AASnD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAyBnE;AAED;;;GAGG;AACH,UAAU,oBAAqB,SAAQ,gBAAgB;IACrD,wDAAwD;IACxD,eAAe,EAAE,MAAM,CAAC;CACzB;AAED
|
|
1
|
+
{"version":3,"file":"mappings.d.ts","sourceRoot":"","sources":["../../../../src/utils/internal/error-handler/mappings.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AASnD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAyBnE;AAED;;;GAGG;AACH,UAAU,oBAAqB,SAAQ,gBAAgB;IACrD,wDAAwD;IACxD,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAQ1E,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,8BAA8B,EAAE,WAAW,CAAC,MAAM,CAK7D,CAAC;AAoDH;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,EAAE,aAAa,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAI7E,CAAC;AA6EN;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,0BAA0B,EAAE,aAAa,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAIhF,CAAC;AAMN,0EAA0E;AAC1E,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAiB7D;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,8BAA8B,CAAC;AAE5E;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,gBAAgB,EACtB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,aAAa,CASf"}
|
|
@@ -64,16 +64,20 @@ export function getCompiledPattern(pattern) {
|
|
|
64
64
|
* | Constructor | Mapped Code |
|
|
65
65
|
* |-------------|-------------|
|
|
66
66
|
* | `SyntaxError` | `ValidationError` |
|
|
67
|
-
* | `RangeError` | `ValidationError` |
|
|
67
|
+
* | `RangeError` | `ValidationError` (except an engine resource limit — see below) |
|
|
68
68
|
* | `URIError` | `ValidationError` |
|
|
69
69
|
* | `ReferenceError` | `InternalError` |
|
|
70
70
|
* | `EvalError` | `InternalError` |
|
|
71
71
|
* | `AggregateError` | `InternalError` |
|
|
72
|
+
* | `ZodError` | `ValidationError` |
|
|
72
73
|
*
|
|
73
74
|
* Note: `TypeError` is intentionally excluded. Runtime TypeErrors (e.g. "Cannot read
|
|
74
75
|
* properties of undefined") are programming errors, not validation failures. Letting them
|
|
75
76
|
* fall through to message-pattern matching or the `InternalError` fallback is more accurate.
|
|
76
77
|
*
|
|
78
|
+
* A `RangeError` whose whole message is in {@link ENGINE_RESOURCE_LIMIT_MESSAGES} never
|
|
79
|
+
* reaches this table: `determineErrorCode` maps it to `InternalError` first (#482).
|
|
80
|
+
*
|
|
77
81
|
* @example
|
|
78
82
|
* ```ts
|
|
79
83
|
* ERROR_TYPE_MAPPINGS['SyntaxError']; // → JsonRpcErrorCode.ValidationError
|
|
@@ -88,6 +92,24 @@ export const ERROR_TYPE_MAPPINGS = {
|
|
|
88
92
|
AggregateError: JsonRpcErrorCode.InternalError,
|
|
89
93
|
ZodError: JsonRpcErrorCode.ValidationError,
|
|
90
94
|
};
|
|
95
|
+
/**
|
|
96
|
+
* The whole messages V8 and JavaScriptCore give the `RangeError` they raise when the
|
|
97
|
+
* engine itself runs out of a resource: the call stack (JavaScriptCore adds a trailing
|
|
98
|
+
* period) and the maximum string size (V8's `Invalid string length`, JavaScriptCore's
|
|
99
|
+
* `Out of memory`).
|
|
100
|
+
*
|
|
101
|
+
* `ErrorHandler.determineErrorCode` maps a `RangeError` carrying one of these to
|
|
102
|
+
* `InternalError` ahead of {@link ERROR_TYPE_MAPPINGS}: it names nothing a caller can
|
|
103
|
+
* change, so it is a server fault, not the `ValidationError` every other `RangeError` is
|
|
104
|
+
* (#482). Matched by whole message, so a `RangeError` that merely mentions one keeps
|
|
105
|
+
* `ValidationError`.
|
|
106
|
+
*/
|
|
107
|
+
export const ENGINE_RESOURCE_LIMIT_MESSAGES = new Set([
|
|
108
|
+
'Maximum call stack size exceeded',
|
|
109
|
+
'Maximum call stack size exceeded.',
|
|
110
|
+
'Invalid string length',
|
|
111
|
+
'Out of memory',
|
|
112
|
+
]);
|
|
91
113
|
/**
|
|
92
114
|
* Common error patterns for classifying errors by message/name.
|
|
93
115
|
* Order matters: more specific patterns should precede generic ones.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mappings.js","sourceRoot":"","sources":["../../../../src/utils/internal/error-handler/mappings.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG5D;;;;GAIG;AACH,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAwB;IACzD,4BAA4B;IAC5B,MAAM,QAAQ,GAAG,OAAO,YAAY,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;IAEtF,qCAAqC;IACrC,IAAI,sBAAsB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzC,OAAO,sBAAsB,CAAC,GAAG,CAAC,QAAQ,CAAW,CAAC;IACxD,CAAC;IAED,sBAAsB;IACtB,IAAI,QAAgB,CAAC;IACrB,IAAI,OAAO,YAAY,MAAM,EAAE,CAAC;QAC9B,8CAA8C;QAC9C,IAAI,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAC3C,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,KAAK,IAAI,GAAG,CAAC;QACf,CAAC;QACD,QAAQ,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC;SAAM,CAAC;QACN,QAAQ,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACtC,CAAC;IAED,uBAAuB;IACvB,sBAAsB,CAAC,GAAG,CAAC,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AC1D,gBAAgB,CAAC,aAAa;IAC9B,gBAAgB,CAAC,YAAY;IAC7B,gBAAgB,CAAC,aAAa;IAC9B,gBAAgB,CAAC,kBAAkB;IACnC,gBAAgB,CAAC,oBAAoB;IACrC,gBAAgB,CAAC,kBAAkB;CACpC,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,2BAA2B,CAAC;AAE5E;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAsB,EACtB,IAA8B;IAE9B,2EAA2E;IAC3E,oCAAoC;IACpC,IAAI,IAAI,KAAK,gBAAgB,CAAC,WAAW,IAAI,IAAI,EAAE,MAAM,KAAK,gCAAgC,EAAE,CAAC;QAC/F,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,IAAI,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,UAAU,CAAC;IAChD,IAAI,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,QAAQ,CAAC;IAC5C,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -50,6 +50,8 @@ export interface ErrorHandlerOptions {
|
|
|
50
50
|
/**
|
|
51
51
|
* The context of the operation that caused the error.
|
|
52
52
|
* This can include `requestId` and other relevant debugging information.
|
|
53
|
+
* It reaches the log record only, never the returned error's client-visible
|
|
54
|
+
* `data`; put caller-actionable fields in the thrown `McpError`'s `data`.
|
|
53
55
|
*/
|
|
54
56
|
context?: ErrorContext;
|
|
55
57
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/utils/internal/error-handler/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACxF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,YAAa,SAAQ,OAAO,CAAC,cAAc,CAAC;IAC3D;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,mBAAmB;IAClC
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/utils/internal/error-handler/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACxF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,YAAa,SAAQ,OAAO,CAAC,cAAc,CAAC;IAC3D;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IAEvB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAE7B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,CAAC;IAExC;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,qBAAqB,CAAC;CAClC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,SAAS,EAAE,gBAAgB,CAAC;IAE5B;;;OAGG;IAC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