@posthog/agent 1.24.2 → 1.25.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/dist/_virtual/_commonjsHelpers.js +6 -0
- package/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/_virtual/additionalItems.js +4 -0
- package/dist/_virtual/additionalItems.js.map +1 -0
- package/dist/_virtual/additionalProperties.js +4 -0
- package/dist/_virtual/additionalProperties.js.map +1 -0
- package/dist/_virtual/ajv.js +4 -0
- package/dist/_virtual/ajv.js.map +1 -0
- package/dist/_virtual/allOf.js +4 -0
- package/dist/_virtual/allOf.js.map +1 -0
- package/dist/_virtual/anyOf.js +4 -0
- package/dist/_virtual/anyOf.js.map +1 -0
- package/dist/_virtual/applicability.js +4 -0
- package/dist/_virtual/applicability.js.map +1 -0
- package/dist/_virtual/boolSchema.js +4 -0
- package/dist/_virtual/boolSchema.js.map +1 -0
- package/dist/_virtual/code.js +4 -0
- package/dist/_virtual/code.js.map +1 -0
- package/dist/_virtual/code2.js +4 -0
- package/dist/_virtual/code2.js.map +1 -0
- package/dist/_virtual/const.js +4 -0
- package/dist/_virtual/const.js.map +1 -0
- package/dist/_virtual/contains.js +4 -0
- package/dist/_virtual/contains.js.map +1 -0
- package/dist/_virtual/core.js +4 -0
- package/dist/_virtual/core.js.map +1 -0
- package/dist/_virtual/dataType.js +4 -0
- package/dist/_virtual/dataType.js.map +1 -0
- package/dist/_virtual/defaults.js +4 -0
- package/dist/_virtual/defaults.js.map +1 -0
- package/dist/_virtual/dependencies.js +4 -0
- package/dist/_virtual/dependencies.js.map +1 -0
- package/dist/_virtual/draft7.js +4 -0
- package/dist/_virtual/draft7.js.map +1 -0
- package/dist/_virtual/enum.js +4 -0
- package/dist/_virtual/enum.js.map +1 -0
- package/dist/_virtual/equal.js +4 -0
- package/dist/_virtual/equal.js.map +1 -0
- package/dist/_virtual/errors.js +4 -0
- package/dist/_virtual/errors.js.map +1 -0
- package/dist/_virtual/format.js +4 -0
- package/dist/_virtual/format.js.map +1 -0
- package/dist/_virtual/formats.js +4 -0
- package/dist/_virtual/formats.js.map +1 -0
- package/dist/_virtual/id.js +4 -0
- package/dist/_virtual/id.js.map +1 -0
- package/dist/_virtual/if.js +4 -0
- package/dist/_virtual/if.js.map +1 -0
- package/dist/_virtual/index.js +4 -0
- package/dist/_virtual/index.js.map +1 -0
- package/dist/_virtual/index10.js +4 -0
- package/dist/_virtual/index10.js.map +1 -0
- package/dist/_virtual/index11.js +4 -0
- package/dist/_virtual/index11.js.map +1 -0
- package/dist/_virtual/index2.js +4 -0
- package/dist/_virtual/index2.js.map +1 -0
- package/dist/_virtual/index3.js +4 -0
- package/dist/_virtual/index3.js.map +1 -0
- package/dist/_virtual/index4.js +4 -0
- package/dist/_virtual/index4.js.map +1 -0
- package/dist/_virtual/index5.js +4 -0
- package/dist/_virtual/index5.js.map +1 -0
- package/dist/_virtual/index6.js +4 -0
- package/dist/_virtual/index6.js.map +1 -0
- package/dist/_virtual/index7.js +4 -0
- package/dist/_virtual/index7.js.map +1 -0
- package/dist/_virtual/index8.js +4 -0
- package/dist/_virtual/index8.js.map +1 -0
- package/dist/_virtual/index9.js +4 -0
- package/dist/_virtual/index9.js.map +1 -0
- package/dist/_virtual/items.js +4 -0
- package/dist/_virtual/items.js.map +1 -0
- package/dist/_virtual/items2020.js +4 -0
- package/dist/_virtual/items2020.js.map +1 -0
- package/dist/_virtual/keyword.js +4 -0
- package/dist/_virtual/keyword.js.map +1 -0
- package/dist/_virtual/limit.js +4 -0
- package/dist/_virtual/limit.js.map +1 -0
- package/dist/_virtual/limitItems.js +4 -0
- package/dist/_virtual/limitItems.js.map +1 -0
- package/dist/_virtual/limitLength.js +4 -0
- package/dist/_virtual/limitLength.js.map +1 -0
- package/dist/_virtual/limitNumber.js +4 -0
- package/dist/_virtual/limitNumber.js.map +1 -0
- package/dist/_virtual/limitProperties.js +4 -0
- package/dist/_virtual/limitProperties.js.map +1 -0
- package/dist/_virtual/metadata.js +4 -0
- package/dist/_virtual/metadata.js.map +1 -0
- package/dist/_virtual/multipleOf.js +4 -0
- package/dist/_virtual/multipleOf.js.map +1 -0
- package/dist/_virtual/names.js +4 -0
- package/dist/_virtual/names.js.map +1 -0
- package/dist/_virtual/not.js +4 -0
- package/dist/_virtual/not.js.map +1 -0
- package/dist/_virtual/oneOf.js +4 -0
- package/dist/_virtual/oneOf.js.map +1 -0
- package/dist/_virtual/pattern.js +4 -0
- package/dist/_virtual/pattern.js.map +1 -0
- package/dist/_virtual/patternProperties.js +4 -0
- package/dist/_virtual/patternProperties.js.map +1 -0
- package/dist/_virtual/prefixItems.js +4 -0
- package/dist/_virtual/prefixItems.js.map +1 -0
- package/dist/_virtual/properties.js +4 -0
- package/dist/_virtual/properties.js.map +1 -0
- package/dist/_virtual/propertyNames.js +4 -0
- package/dist/_virtual/propertyNames.js.map +1 -0
- package/dist/_virtual/ref.js +4 -0
- package/dist/_virtual/ref.js.map +1 -0
- package/dist/_virtual/ref_error.js +4 -0
- package/dist/_virtual/ref_error.js.map +1 -0
- package/dist/_virtual/required.js +4 -0
- package/dist/_virtual/required.js.map +1 -0
- package/dist/_virtual/resolve.js +4 -0
- package/dist/_virtual/resolve.js.map +1 -0
- package/dist/_virtual/rules.js +4 -0
- package/dist/_virtual/rules.js.map +1 -0
- package/dist/_virtual/scope.js +4 -0
- package/dist/_virtual/scope.js.map +1 -0
- package/dist/_virtual/subschema.js +4 -0
- package/dist/_virtual/subschema.js.map +1 -0
- package/dist/_virtual/thenElse.js +4 -0
- package/dist/_virtual/thenElse.js.map +1 -0
- package/dist/_virtual/types.js +4 -0
- package/dist/_virtual/types.js.map +1 -0
- package/dist/_virtual/ucs2length.js +4 -0
- package/dist/_virtual/ucs2length.js.map +1 -0
- package/dist/_virtual/uniqueItems.js +4 -0
- package/dist/_virtual/uniqueItems.js.map +1 -0
- package/dist/_virtual/uri.js +4 -0
- package/dist/_virtual/uri.js.map +1 -0
- package/dist/_virtual/util.js +4 -0
- package/dist/_virtual/util.js.map +1 -0
- package/dist/_virtual/validation_error.js +4 -0
- package/dist/_virtual/validation_error.js.map +1 -0
- package/dist/claude-cli/cli.js +2294 -2146
- package/dist/example-client.d.ts +3 -0
- package/dist/example-client.d.ts.map +1 -0
- package/dist/index.d.ts +19 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/node_modules/@agentclientprotocol/sdk/dist/acp.js +610 -0
- package/dist/node_modules/@agentclientprotocol/sdk/dist/acp.js.map +1 -0
- package/dist/node_modules/@agentclientprotocol/sdk/dist/schema.js +875 -0
- package/dist/node_modules/@agentclientprotocol/sdk/dist/schema.js.map +1 -0
- package/dist/node_modules/@agentclientprotocol/sdk/dist/stream.js +66 -0
- package/dist/node_modules/@agentclientprotocol/sdk/dist/stream.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js +23 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js +331 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js +717 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js +221 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js +56 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +440 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js +94 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js +1610 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js +91 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/ZodError.js +133 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/ZodError.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/errors.js +9 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/errors.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/errorUtil.js +9 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/errorUtil.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/parseUtil.js +112 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/parseUtil.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/util.js +136 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/util.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/locales/en.js +112 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/locales/en.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/types.js +3297 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/types.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/errors.js +44 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/errors.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/iso.js +36 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/iso.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/parse.js +10 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/parse.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/schemas.js +657 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/schemas.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/api.js +449 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/api.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/checks.js +413 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/checks.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/core.js +57 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/core.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/doc.js +38 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/doc.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/errors.js +86 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/errors.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/parse.js +61 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/parse.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/regexes.js +80 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/regexes.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/registries.js +52 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/registries.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/schemas.js +1307 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/schemas.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/to-json-schema.js +842 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/to-json-schema.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/util.js +335 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/util.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/versions.js +8 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/versions.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/mini/schemas.js +51 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/mini/schemas.js.map +1 -0
- package/dist/node_modules/ajv/dist/ajv.js +69 -0
- package/dist/node_modules/ajv/dist/ajv.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/codegen/code.js +169 -0
- package/dist/node_modules/ajv/dist/compile/codegen/code.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/codegen/index.js +712 -0
- package/dist/node_modules/ajv/dist/compile/codegen/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/codegen/scope.js +157 -0
- package/dist/node_modules/ajv/dist/compile/codegen/scope.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/errors.js +140 -0
- package/dist/node_modules/ajv/dist/compile/errors.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/index.js +253 -0
- package/dist/node_modules/ajv/dist/compile/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/names.js +40 -0
- package/dist/node_modules/ajv/dist/compile/names.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/ref_error.js +25 -0
- package/dist/node_modules/ajv/dist/compile/ref_error.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/resolve.js +162 -0
- package/dist/node_modules/ajv/dist/compile/resolve.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/rules.js +29 -0
- package/dist/node_modules/ajv/dist/compile/rules.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/util.js +183 -0
- package/dist/node_modules/ajv/dist/compile/util.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/applicability.js +30 -0
- package/dist/node_modules/ajv/dist/compile/validate/applicability.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js +64 -0
- package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/dataType.js +213 -0
- package/dist/node_modules/ajv/dist/compile/validate/dataType.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/defaults.js +49 -0
- package/dist/node_modules/ajv/dist/compile/validate/defaults.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/index.js +544 -0
- package/dist/node_modules/ajv/dist/compile/validate/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/keyword.js +139 -0
- package/dist/node_modules/ajv/dist/compile/validate/keyword.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/subschema.js +95 -0
- package/dist/node_modules/ajv/dist/compile/validate/subschema.js.map +1 -0
- package/dist/node_modules/ajv/dist/core.js +639 -0
- package/dist/node_modules/ajv/dist/core.js.map +1 -0
- package/dist/node_modules/ajv/dist/refs/data.json.js +31 -0
- package/dist/node_modules/ajv/dist/refs/data.json.js.map +1 -0
- package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json.js +254 -0
- package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json.js.map +1 -0
- package/dist/node_modules/ajv/dist/runtime/equal.js +9 -0
- package/dist/node_modules/ajv/dist/runtime/equal.js.map +1 -0
- package/dist/node_modules/ajv/dist/runtime/ucs2length.js +25 -0
- package/dist/node_modules/ajv/dist/runtime/ucs2length.js.map +1 -0
- package/dist/node_modules/ajv/dist/runtime/uri.js +8 -0
- package/dist/node_modules/ajv/dist/runtime/uri.js.map +1 -0
- package/dist/node_modules/ajv/dist/runtime/validation_error.js +22 -0
- package/dist/node_modules/ajv/dist/runtime/validation_error.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +53 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +112 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js +26 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +14 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js +99 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +93 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js +70 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js +77 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js +57 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js +37 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js +29 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +64 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +80 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +15 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js +61 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +42 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +16 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/code.js +146 -0
- package/dist/node_modules/ajv/dist/vocabularies/code.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/id.js +11 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/id.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/index.js +21 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/ref.js +131 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js +113 -0
- package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js +12 -0
- package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/draft7.js +28 -0
- package/dist/node_modules/ajv/dist/vocabularies/draft7.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/format/format.js +94 -0
- package/dist/node_modules/ajv/dist/vocabularies/format/format.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/format/index.js +9 -0
- package/dist/node_modules/ajv/dist/vocabularies/format/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/metadata.js +21 -0
- package/dist/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/const.js +31 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/const.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js +54 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/index.js +54 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js +26 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js +33 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +29 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +26 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +28 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js +27 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/required.js +84 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +72 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +1 -0
- package/dist/node_modules/ajv-formats/dist/formats.js +212 -0
- package/dist/node_modules/ajv-formats/dist/formats.js.map +1 -0
- package/dist/node_modules/ajv-formats/dist/index.js +52 -0
- package/dist/node_modules/ajv-formats/dist/index.js.map +1 -0
- package/dist/node_modules/ajv-formats/dist/limit.js +75 -0
- package/dist/node_modules/ajv-formats/dist/limit.js.map +1 -0
- package/dist/node_modules/diff/libesm/diff/base.js +256 -0
- package/dist/node_modules/diff/libesm/diff/base.js.map +1 -0
- package/dist/node_modules/diff/libesm/diff/line.js +64 -0
- package/dist/node_modules/diff/libesm/diff/line.js.map +1 -0
- package/dist/node_modules/diff/libesm/patch/create.js +185 -0
- package/dist/node_modules/diff/libesm/patch/create.js.map +1 -0
- package/dist/node_modules/fast-deep-equal/index.js +47 -0
- package/dist/node_modules/fast-deep-equal/index.js.map +1 -0
- package/dist/node_modules/fast-uri/index.js +347 -0
- package/dist/node_modules/fast-uri/index.js.map +1 -0
- package/dist/node_modules/fast-uri/lib/schemes.js +255 -0
- package/dist/node_modules/fast-uri/lib/schemes.js.map +1 -0
- package/dist/node_modules/fast-uri/lib/utils.js +334 -0
- package/dist/node_modules/fast-uri/lib/utils.js.map +1 -0
- package/dist/node_modules/json-schema-traverse/index.js +98 -0
- package/dist/node_modules/json-schema-traverse/index.js.map +1 -0
- package/dist/node_modules/uuid/dist/rng.js +14 -0
- package/dist/node_modules/uuid/dist/rng.js.map +1 -0
- package/dist/node_modules/uuid/dist/stringify.js +29 -0
- package/dist/node_modules/uuid/dist/stringify.js.map +1 -0
- package/dist/node_modules/uuid/dist/v7.js +65 -0
- package/dist/node_modules/uuid/dist/v7.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/Options.js +37 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/Options.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/Refs.js +26 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/Refs.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/errorMessages.js +17 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/errorMessages.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js +11 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parseDef.js +66 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parseDef.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/any.js +21 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/any.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/array.js +30 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/array.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js +53 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js +8 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js +8 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js +8 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/date.js +50 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/date.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/default.js +11 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/default.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js +11 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js +9 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js +56 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js +24 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/map.js +30 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/map.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js +19 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/never.js +15 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/never.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/null.js +13 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/null.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js +37 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/number.js +56 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/number.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/object.js +76 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/object.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js +25 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js +24 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js +8 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js +8 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/record.js +65 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/record.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/set.js +24 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/set.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js +350 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js +36 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js +10 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/union.js +84 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/union.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js +8 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/selectParser.js +109 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/selectParser.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js +90 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/node_modules/zod/v3/types.js +42 -0
- package/dist/node_modules/zod-to-json-schema/node_modules/zod/v3/types.js.map +1 -0
- package/dist/package.json.js +8 -0
- package/dist/package.json.js.map +1 -0
- package/dist/src/acp-extensions.d.ts +91 -0
- package/dist/src/acp-extensions.d.ts.map +1 -0
- package/dist/src/acp-extensions.js +38 -0
- package/dist/src/acp-extensions.js.map +1 -0
- package/dist/src/adapters/claude/claude.d.ts +136 -0
- package/dist/src/adapters/claude/claude.d.ts.map +1 -0
- package/dist/src/adapters/claude/claude.js +1112 -0
- package/dist/src/adapters/claude/claude.js.map +1 -0
- package/dist/src/adapters/claude/mcp-server.d.ts +30 -0
- package/dist/src/adapters/claude/mcp-server.d.ts.map +1 -0
- package/dist/src/adapters/claude/mcp-server.js +655 -0
- package/dist/src/adapters/claude/mcp-server.js.map +1 -0
- package/dist/src/adapters/claude/tools.d.ts +35 -0
- package/dist/src/adapters/claude/tools.d.ts.map +1 -0
- package/dist/src/adapters/claude/tools.js +466 -0
- package/dist/src/adapters/claude/tools.js.map +1 -0
- package/dist/src/adapters/claude/utils.d.ts +48 -0
- package/dist/src/adapters/claude/utils.d.ts.map +1 -0
- package/dist/src/adapters/claude/utils.js +158 -0
- package/dist/src/adapters/claude/utils.js.map +1 -0
- package/dist/src/agent.d.ts +18 -28
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +195 -175
- package/dist/src/agent.js.map +1 -1
- package/dist/src/agents/execution.js.map +1 -1
- package/dist/src/agents/planning.js.map +1 -1
- package/dist/src/agents/research.js.map +1 -1
- package/dist/src/file-manager.d.ts +6 -6
- package/dist/src/file-manager.d.ts.map +1 -1
- package/dist/src/file-manager.js +72 -63
- package/dist/src/file-manager.js.map +1 -1
- package/dist/src/git-manager.d.ts +2 -1
- package/dist/src/git-manager.d.ts.map +1 -1
- package/dist/src/git-manager.js +105 -70
- package/dist/src/git-manager.js.map +1 -1
- package/dist/src/posthog-api.d.ts +8 -14
- package/dist/src/posthog-api.d.ts.map +1 -1
- package/dist/src/posthog-api.js +35 -23
- package/dist/src/posthog-api.js.map +1 -1
- package/dist/src/prompt-builder.d.ts +4 -4
- package/dist/src/prompt-builder.d.ts.map +1 -1
- package/dist/src/prompt-builder.js +129 -99
- package/dist/src/prompt-builder.js.map +1 -1
- package/dist/src/schemas.d.ts +980 -0
- package/dist/src/schemas.d.ts.map +1 -0
- package/dist/src/schemas.js +196 -0
- package/dist/src/schemas.js.map +1 -0
- package/dist/src/session-store.d.ts +53 -0
- package/dist/src/session-store.d.ts.map +1 -0
- package/dist/src/session-store.js +195 -0
- package/dist/src/session-store.js.map +1 -0
- package/dist/src/task-manager.d.ts +7 -7
- package/dist/src/task-manager.d.ts.map +1 -1
- package/dist/src/task-manager.js +19 -18
- package/dist/src/task-manager.js.map +1 -1
- package/dist/src/template-manager.d.ts +1 -1
- package/dist/src/template-manager.d.ts.map +1 -1
- package/dist/src/template-manager.js +30 -28
- package/dist/src/template-manager.js.map +1 -1
- package/dist/src/todo-manager.d.ts +5 -5
- package/dist/src/todo-manager.d.ts.map +1 -1
- package/dist/src/todo-manager.js +33 -24
- package/dist/src/todo-manager.js.map +1 -1
- package/dist/src/tools/registry.d.ts +1 -1
- package/dist/src/tools/registry.js +60 -60
- package/dist/src/tools/registry.js.map +1 -1
- package/dist/src/tools/types.d.ts +31 -31
- package/dist/src/types.d.ts +62 -167
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +1 -0
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/logger.d.ts +14 -6
- package/dist/src/utils/logger.d.ts.map +1 -1
- package/dist/src/utils/logger.js +37 -22
- package/dist/src/utils/logger.js.map +1 -1
- package/dist/src/utils/tapped-stream.d.ts +17 -0
- package/dist/src/utils/tapped-stream.d.ts.map +1 -0
- package/dist/src/utils/tapped-stream.js +45 -0
- package/dist/src/utils/tapped-stream.js.map +1 -0
- package/dist/src/workflow/config.d.ts +1 -1
- package/dist/src/workflow/config.d.ts.map +1 -1
- package/dist/src/workflow/config.js +18 -18
- package/dist/src/workflow/config.js.map +1 -1
- package/dist/src/workflow/steps/build.d.ts +1 -1
- package/dist/src/workflow/steps/build.d.ts.map +1 -1
- package/dist/src/workflow/steps/build.js +53 -39
- package/dist/src/workflow/steps/build.js.map +1 -1
- package/dist/src/workflow/steps/finalize.d.ts +1 -1
- package/dist/src/workflow/steps/finalize.d.ts.map +1 -1
- package/dist/src/workflow/steps/finalize.js +58 -52
- package/dist/src/workflow/steps/finalize.js.map +1 -1
- package/dist/src/workflow/steps/plan.d.ts +1 -1
- package/dist/src/workflow/steps/plan.d.ts.map +1 -1
- package/dist/src/workflow/steps/plan.js +69 -47
- package/dist/src/workflow/steps/plan.js.map +1 -1
- package/dist/src/workflow/steps/research.d.ts +1 -1
- package/dist/src/workflow/steps/research.d.ts.map +1 -1
- package/dist/src/workflow/steps/research.js +86 -67
- package/dist/src/workflow/steps/research.js.map +1 -1
- package/dist/src/workflow/types.d.ts +19 -14
- package/dist/src/workflow/types.d.ts.map +1 -1
- package/dist/src/workflow/utils.d.ts +1 -1
- package/dist/src/workflow/utils.d.ts.map +1 -1
- package/dist/src/workflow/utils.js +7 -4
- package/dist/src/workflow/utils.js.map +1 -1
- package/dist/src/worktree-manager.d.ts +39 -0
- package/dist/src/worktree-manager.d.ts.map +1 -0
- package/dist/src/worktree-manager.js +810 -0
- package/dist/src/worktree-manager.js.map +1 -0
- package/package.json +20 -16
- package/src/acp-extensions.ts +117 -0
- package/src/adapters/claude/claude.ts +1498 -0
- package/src/adapters/claude/mcp-server.ts +810 -0
- package/src/adapters/claude/tools.ts +609 -0
- package/src/adapters/claude/utils.ts +267 -0
- package/src/agent.ts +511 -447
- package/src/agents/execution.ts +1 -1
- package/src/agents/planning.ts +1 -1
- package/src/agents/research.ts +0 -1
- package/src/file-manager.ts +80 -70
- package/src/git-manager.ts +164 -88
- package/src/posthog-api.ts +155 -94
- package/src/prompt-builder.ts +196 -143
- package/src/schemas.ts +241 -0
- package/src/session-store.ts +244 -0
- package/src/task-manager.ts +41 -33
- package/src/template-manager.ts +98 -45
- package/src/todo-manager.ts +43 -32
- package/src/tools/registry.ts +62 -62
- package/src/tools/types.ts +36 -36
- package/src/types.ts +130 -239
- package/src/utils/logger.ts +89 -58
- package/src/utils/tapped-stream.ts +60 -0
- package/src/workflow/config.ts +48 -48
- package/src/workflow/steps/build.ts +127 -113
- package/src/workflow/steps/finalize.ts +207 -182
- package/src/workflow/steps/plan.ts +155 -130
- package/src/workflow/steps/research.ts +207 -187
- package/src/workflow/types.ts +47 -36
- package/src/workflow/utils.ts +37 -34
- package/src/worktree-manager.ts +884 -0
- package/dist/src/adapters/claude/claude-adapter.d.ts +0 -18
- package/dist/src/adapters/claude/claude-adapter.d.ts.map +0 -1
- package/dist/src/adapters/claude/claude-adapter.js +0 -311
- package/dist/src/adapters/claude/claude-adapter.js.map +0 -1
- package/dist/src/adapters/claude/tool-mapper.d.ts +0 -19
- package/dist/src/adapters/claude/tool-mapper.d.ts.map +0 -1
- package/dist/src/adapters/claude/tool-mapper.js +0 -44
- package/dist/src/adapters/claude/tool-mapper.js.map +0 -1
- package/dist/src/adapters/types.d.ts +0 -33
- package/dist/src/adapters/types.d.ts.map +0 -1
- package/dist/src/task-progress-reporter.d.ts +0 -43
- package/dist/src/task-progress-reporter.d.ts.map +0 -1
- package/dist/src/task-progress-reporter.js +0 -393
- package/dist/src/task-progress-reporter.js.map +0 -1
- package/src/adapters/claude/claude-adapter.ts +0 -338
- package/src/adapters/claude/tool-mapper.ts +0 -46
- package/src/adapters/types.ts +0 -37
- package/src/task-progress-reporter.ts +0 -443
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import { safeParse } from '../server/zod-compat.js';
|
|
2
|
+
import { CancelledNotificationSchema, ProgressNotificationSchema, PingRequestSchema, McpError, ErrorCode, isJSONRPCResponse, isJSONRPCError, isJSONRPCRequest, isJSONRPCNotification } from '../types.js';
|
|
3
|
+
import { getMethodLiteral, parseWithCompat } from '../server/zod-json-schema-compat.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The default request timeout, in miliseconds.
|
|
7
|
+
*/
|
|
8
|
+
const DEFAULT_REQUEST_TIMEOUT_MSEC = 60000;
|
|
9
|
+
/**
|
|
10
|
+
* Implements MCP protocol framing on top of a pluggable transport, including
|
|
11
|
+
* features like request/response linking, notifications, and progress.
|
|
12
|
+
*/
|
|
13
|
+
class Protocol {
|
|
14
|
+
constructor(_options) {
|
|
15
|
+
this._options = _options;
|
|
16
|
+
this._requestMessageId = 0;
|
|
17
|
+
this._requestHandlers = new Map();
|
|
18
|
+
this._requestHandlerAbortControllers = new Map();
|
|
19
|
+
this._notificationHandlers = new Map();
|
|
20
|
+
this._responseHandlers = new Map();
|
|
21
|
+
this._progressHandlers = new Map();
|
|
22
|
+
this._timeoutInfo = new Map();
|
|
23
|
+
this._pendingDebouncedNotifications = new Set();
|
|
24
|
+
this.setNotificationHandler(CancelledNotificationSchema, notification => {
|
|
25
|
+
const controller = this._requestHandlerAbortControllers.get(notification.params.requestId);
|
|
26
|
+
controller === null || controller === void 0 ? void 0 : controller.abort(notification.params.reason);
|
|
27
|
+
});
|
|
28
|
+
this.setNotificationHandler(ProgressNotificationSchema, notification => {
|
|
29
|
+
this._onprogress(notification);
|
|
30
|
+
});
|
|
31
|
+
this.setRequestHandler(PingRequestSchema,
|
|
32
|
+
// Automatic pong by default.
|
|
33
|
+
_request => ({}));
|
|
34
|
+
}
|
|
35
|
+
_setupTimeout(messageId, timeout, maxTotalTimeout, onTimeout, resetTimeoutOnProgress = false) {
|
|
36
|
+
this._timeoutInfo.set(messageId, {
|
|
37
|
+
timeoutId: setTimeout(onTimeout, timeout),
|
|
38
|
+
startTime: Date.now(),
|
|
39
|
+
timeout,
|
|
40
|
+
maxTotalTimeout,
|
|
41
|
+
resetTimeoutOnProgress,
|
|
42
|
+
onTimeout
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
_resetTimeout(messageId) {
|
|
46
|
+
const info = this._timeoutInfo.get(messageId);
|
|
47
|
+
if (!info)
|
|
48
|
+
return false;
|
|
49
|
+
const totalElapsed = Date.now() - info.startTime;
|
|
50
|
+
if (info.maxTotalTimeout && totalElapsed >= info.maxTotalTimeout) {
|
|
51
|
+
this._timeoutInfo.delete(messageId);
|
|
52
|
+
throw McpError.fromError(ErrorCode.RequestTimeout, 'Maximum total timeout exceeded', {
|
|
53
|
+
maxTotalTimeout: info.maxTotalTimeout,
|
|
54
|
+
totalElapsed
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
clearTimeout(info.timeoutId);
|
|
58
|
+
info.timeoutId = setTimeout(info.onTimeout, info.timeout);
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
_cleanupTimeout(messageId) {
|
|
62
|
+
const info = this._timeoutInfo.get(messageId);
|
|
63
|
+
if (info) {
|
|
64
|
+
clearTimeout(info.timeoutId);
|
|
65
|
+
this._timeoutInfo.delete(messageId);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Attaches to the given transport, starts it, and starts listening for messages.
|
|
70
|
+
*
|
|
71
|
+
* The Protocol object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward.
|
|
72
|
+
*/
|
|
73
|
+
async connect(transport) {
|
|
74
|
+
var _a, _b, _c;
|
|
75
|
+
this._transport = transport;
|
|
76
|
+
const _onclose = (_a = this.transport) === null || _a === void 0 ? void 0 : _a.onclose;
|
|
77
|
+
this._transport.onclose = () => {
|
|
78
|
+
_onclose === null || _onclose === void 0 ? void 0 : _onclose();
|
|
79
|
+
this._onclose();
|
|
80
|
+
};
|
|
81
|
+
const _onerror = (_b = this.transport) === null || _b === void 0 ? void 0 : _b.onerror;
|
|
82
|
+
this._transport.onerror = (error) => {
|
|
83
|
+
_onerror === null || _onerror === void 0 ? void 0 : _onerror(error);
|
|
84
|
+
this._onerror(error);
|
|
85
|
+
};
|
|
86
|
+
const _onmessage = (_c = this._transport) === null || _c === void 0 ? void 0 : _c.onmessage;
|
|
87
|
+
this._transport.onmessage = (message, extra) => {
|
|
88
|
+
_onmessage === null || _onmessage === void 0 ? void 0 : _onmessage(message, extra);
|
|
89
|
+
if (isJSONRPCResponse(message) || isJSONRPCError(message)) {
|
|
90
|
+
this._onresponse(message);
|
|
91
|
+
}
|
|
92
|
+
else if (isJSONRPCRequest(message)) {
|
|
93
|
+
this._onrequest(message, extra);
|
|
94
|
+
}
|
|
95
|
+
else if (isJSONRPCNotification(message)) {
|
|
96
|
+
this._onnotification(message);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
this._onerror(new Error(`Unknown message type: ${JSON.stringify(message)}`));
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
await this._transport.start();
|
|
103
|
+
}
|
|
104
|
+
_onclose() {
|
|
105
|
+
var _a;
|
|
106
|
+
const responseHandlers = this._responseHandlers;
|
|
107
|
+
this._responseHandlers = new Map();
|
|
108
|
+
this._progressHandlers.clear();
|
|
109
|
+
this._pendingDebouncedNotifications.clear();
|
|
110
|
+
this._transport = undefined;
|
|
111
|
+
(_a = this.onclose) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
112
|
+
const error = McpError.fromError(ErrorCode.ConnectionClosed, 'Connection closed');
|
|
113
|
+
for (const handler of responseHandlers.values()) {
|
|
114
|
+
handler(error);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
_onerror(error) {
|
|
118
|
+
var _a;
|
|
119
|
+
(_a = this.onerror) === null || _a === void 0 ? void 0 : _a.call(this, error);
|
|
120
|
+
}
|
|
121
|
+
_onnotification(notification) {
|
|
122
|
+
var _a;
|
|
123
|
+
const handler = (_a = this._notificationHandlers.get(notification.method)) !== null && _a !== void 0 ? _a : this.fallbackNotificationHandler;
|
|
124
|
+
// Ignore notifications not being subscribed to.
|
|
125
|
+
if (handler === undefined) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
// Starting with Promise.resolve() puts any synchronous errors into the monad as well.
|
|
129
|
+
Promise.resolve()
|
|
130
|
+
.then(() => handler(notification))
|
|
131
|
+
.catch(error => this._onerror(new Error(`Uncaught error in notification handler: ${error}`)));
|
|
132
|
+
}
|
|
133
|
+
_onrequest(request, extra) {
|
|
134
|
+
var _a, _b;
|
|
135
|
+
const handler = (_a = this._requestHandlers.get(request.method)) !== null && _a !== void 0 ? _a : this.fallbackRequestHandler;
|
|
136
|
+
// Capture the current transport at request time to ensure responses go to the correct client
|
|
137
|
+
const capturedTransport = this._transport;
|
|
138
|
+
if (handler === undefined) {
|
|
139
|
+
capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.send({
|
|
140
|
+
jsonrpc: '2.0',
|
|
141
|
+
id: request.id,
|
|
142
|
+
error: {
|
|
143
|
+
code: ErrorCode.MethodNotFound,
|
|
144
|
+
message: 'Method not found'
|
|
145
|
+
}
|
|
146
|
+
}).catch(error => this._onerror(new Error(`Failed to send an error response: ${error}`)));
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const abortController = new AbortController();
|
|
150
|
+
this._requestHandlerAbortControllers.set(request.id, abortController);
|
|
151
|
+
const fullExtra = {
|
|
152
|
+
signal: abortController.signal,
|
|
153
|
+
sessionId: capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.sessionId,
|
|
154
|
+
_meta: (_b = request.params) === null || _b === void 0 ? void 0 : _b._meta,
|
|
155
|
+
sendNotification: notification => this.notification(notification, { relatedRequestId: request.id }),
|
|
156
|
+
sendRequest: (r, resultSchema, options) => this.request(r, resultSchema, { ...options, relatedRequestId: request.id }),
|
|
157
|
+
authInfo: extra === null || extra === void 0 ? void 0 : extra.authInfo,
|
|
158
|
+
requestId: request.id,
|
|
159
|
+
requestInfo: extra === null || extra === void 0 ? void 0 : extra.requestInfo
|
|
160
|
+
};
|
|
161
|
+
// Starting with Promise.resolve() puts any synchronous errors into the monad as well.
|
|
162
|
+
Promise.resolve()
|
|
163
|
+
.then(() => handler(request, fullExtra))
|
|
164
|
+
.then(result => {
|
|
165
|
+
if (abortController.signal.aborted) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
return capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.send({
|
|
169
|
+
result,
|
|
170
|
+
jsonrpc: '2.0',
|
|
171
|
+
id: request.id
|
|
172
|
+
});
|
|
173
|
+
}, error => {
|
|
174
|
+
var _a;
|
|
175
|
+
if (abortController.signal.aborted) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
return capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.send({
|
|
179
|
+
jsonrpc: '2.0',
|
|
180
|
+
id: request.id,
|
|
181
|
+
error: {
|
|
182
|
+
code: Number.isSafeInteger(error['code']) ? error['code'] : ErrorCode.InternalError,
|
|
183
|
+
message: (_a = error.message) !== null && _a !== void 0 ? _a : 'Internal error',
|
|
184
|
+
...(error['data'] !== undefined && { data: error['data'] })
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
})
|
|
188
|
+
.catch(error => this._onerror(new Error(`Failed to send response: ${error}`)))
|
|
189
|
+
.finally(() => {
|
|
190
|
+
this._requestHandlerAbortControllers.delete(request.id);
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
_onprogress(notification) {
|
|
194
|
+
const { progressToken, ...params } = notification.params;
|
|
195
|
+
const messageId = Number(progressToken);
|
|
196
|
+
const handler = this._progressHandlers.get(messageId);
|
|
197
|
+
if (!handler) {
|
|
198
|
+
this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(notification)}`));
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const responseHandler = this._responseHandlers.get(messageId);
|
|
202
|
+
const timeoutInfo = this._timeoutInfo.get(messageId);
|
|
203
|
+
if (timeoutInfo && responseHandler && timeoutInfo.resetTimeoutOnProgress) {
|
|
204
|
+
try {
|
|
205
|
+
this._resetTimeout(messageId);
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
responseHandler(error);
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
handler(params);
|
|
213
|
+
}
|
|
214
|
+
_onresponse(response) {
|
|
215
|
+
const messageId = Number(response.id);
|
|
216
|
+
const handler = this._responseHandlers.get(messageId);
|
|
217
|
+
if (handler === undefined) {
|
|
218
|
+
this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(response)}`));
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
this._responseHandlers.delete(messageId);
|
|
222
|
+
this._progressHandlers.delete(messageId);
|
|
223
|
+
this._cleanupTimeout(messageId);
|
|
224
|
+
if (isJSONRPCResponse(response)) {
|
|
225
|
+
handler(response);
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
const error = McpError.fromError(response.error.code, response.error.message, response.error.data);
|
|
229
|
+
handler(error);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
get transport() {
|
|
233
|
+
return this._transport;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Closes the connection.
|
|
237
|
+
*/
|
|
238
|
+
async close() {
|
|
239
|
+
var _a;
|
|
240
|
+
await ((_a = this._transport) === null || _a === void 0 ? void 0 : _a.close());
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Sends a request and wait for a response.
|
|
244
|
+
*
|
|
245
|
+
* Do not use this method to emit notifications! Use notification() instead.
|
|
246
|
+
*/
|
|
247
|
+
request(request, resultSchema, options) {
|
|
248
|
+
const { relatedRequestId, resumptionToken, onresumptiontoken } = options !== null && options !== void 0 ? options : {};
|
|
249
|
+
return new Promise((resolve, reject) => {
|
|
250
|
+
var _a, _b, _c, _d, _e, _f;
|
|
251
|
+
if (!this._transport) {
|
|
252
|
+
reject(new Error('Not connected'));
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
if (((_a = this._options) === null || _a === void 0 ? void 0 : _a.enforceStrictCapabilities) === true) {
|
|
256
|
+
this.assertCapabilityForMethod(request.method);
|
|
257
|
+
}
|
|
258
|
+
(_b = options === null || options === void 0 ? void 0 : options.signal) === null || _b === void 0 ? void 0 : _b.throwIfAborted();
|
|
259
|
+
const messageId = this._requestMessageId++;
|
|
260
|
+
const jsonrpcRequest = {
|
|
261
|
+
...request,
|
|
262
|
+
jsonrpc: '2.0',
|
|
263
|
+
id: messageId
|
|
264
|
+
};
|
|
265
|
+
if (options === null || options === void 0 ? void 0 : options.onprogress) {
|
|
266
|
+
this._progressHandlers.set(messageId, options.onprogress);
|
|
267
|
+
jsonrpcRequest.params = {
|
|
268
|
+
...request.params,
|
|
269
|
+
_meta: {
|
|
270
|
+
...(((_c = request.params) === null || _c === void 0 ? void 0 : _c._meta) || {}),
|
|
271
|
+
progressToken: messageId
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
const cancel = (reason) => {
|
|
276
|
+
var _a;
|
|
277
|
+
this._responseHandlers.delete(messageId);
|
|
278
|
+
this._progressHandlers.delete(messageId);
|
|
279
|
+
this._cleanupTimeout(messageId);
|
|
280
|
+
(_a = this._transport) === null || _a === void 0 ? void 0 : _a.send({
|
|
281
|
+
jsonrpc: '2.0',
|
|
282
|
+
method: 'notifications/cancelled',
|
|
283
|
+
params: {
|
|
284
|
+
requestId: messageId,
|
|
285
|
+
reason: String(reason)
|
|
286
|
+
}
|
|
287
|
+
}, { relatedRequestId, resumptionToken, onresumptiontoken }).catch(error => this._onerror(new Error(`Failed to send cancellation: ${error}`)));
|
|
288
|
+
reject(reason);
|
|
289
|
+
};
|
|
290
|
+
this._responseHandlers.set(messageId, response => {
|
|
291
|
+
var _a;
|
|
292
|
+
if ((_a = options === null || options === void 0 ? void 0 : options.signal) === null || _a === void 0 ? void 0 : _a.aborted) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
if (response instanceof Error) {
|
|
296
|
+
return reject(response);
|
|
297
|
+
}
|
|
298
|
+
try {
|
|
299
|
+
const parseResult = safeParse(resultSchema, response.result);
|
|
300
|
+
if (!parseResult.success) {
|
|
301
|
+
// Type guard: if success is false, error is guaranteed to exist
|
|
302
|
+
reject(parseResult.error);
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
resolve(parseResult.data);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
catch (error) {
|
|
309
|
+
reject(error);
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
(_d = options === null || options === void 0 ? void 0 : options.signal) === null || _d === void 0 ? void 0 : _d.addEventListener('abort', () => {
|
|
313
|
+
var _a;
|
|
314
|
+
cancel((_a = options === null || options === void 0 ? void 0 : options.signal) === null || _a === void 0 ? void 0 : _a.reason);
|
|
315
|
+
});
|
|
316
|
+
const timeout = (_e = options === null || options === void 0 ? void 0 : options.timeout) !== null && _e !== void 0 ? _e : DEFAULT_REQUEST_TIMEOUT_MSEC;
|
|
317
|
+
const timeoutHandler = () => cancel(McpError.fromError(ErrorCode.RequestTimeout, 'Request timed out', { timeout }));
|
|
318
|
+
this._setupTimeout(messageId, timeout, options === null || options === void 0 ? void 0 : options.maxTotalTimeout, timeoutHandler, (_f = options === null || options === void 0 ? void 0 : options.resetTimeoutOnProgress) !== null && _f !== void 0 ? _f : false);
|
|
319
|
+
this._transport.send(jsonrpcRequest, { relatedRequestId, resumptionToken, onresumptiontoken }).catch(error => {
|
|
320
|
+
this._cleanupTimeout(messageId);
|
|
321
|
+
reject(error);
|
|
322
|
+
});
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Emits a notification, which is a one-way message that does not expect a response.
|
|
327
|
+
*/
|
|
328
|
+
async notification(notification, options) {
|
|
329
|
+
var _a, _b;
|
|
330
|
+
if (!this._transport) {
|
|
331
|
+
throw new Error('Not connected');
|
|
332
|
+
}
|
|
333
|
+
this.assertNotificationCapability(notification.method);
|
|
334
|
+
const debouncedMethods = (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.debouncedNotificationMethods) !== null && _b !== void 0 ? _b : [];
|
|
335
|
+
// A notification can only be debounced if it's in the list AND it's "simple"
|
|
336
|
+
// (i.e., has no parameters and no related request ID that could be lost).
|
|
337
|
+
const canDebounce = debouncedMethods.includes(notification.method) && !notification.params && !(options === null || options === void 0 ? void 0 : options.relatedRequestId);
|
|
338
|
+
if (canDebounce) {
|
|
339
|
+
// If a notification of this type is already scheduled, do nothing.
|
|
340
|
+
if (this._pendingDebouncedNotifications.has(notification.method)) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
// Mark this notification type as pending.
|
|
344
|
+
this._pendingDebouncedNotifications.add(notification.method);
|
|
345
|
+
// Schedule the actual send to happen in the next microtask.
|
|
346
|
+
// This allows all synchronous calls in the current event loop tick to be coalesced.
|
|
347
|
+
Promise.resolve().then(() => {
|
|
348
|
+
var _a;
|
|
349
|
+
// Un-mark the notification so the next one can be scheduled.
|
|
350
|
+
this._pendingDebouncedNotifications.delete(notification.method);
|
|
351
|
+
// SAFETY CHECK: If the connection was closed while this was pending, abort.
|
|
352
|
+
if (!this._transport) {
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
const jsonrpcNotification = {
|
|
356
|
+
...notification,
|
|
357
|
+
jsonrpc: '2.0'
|
|
358
|
+
};
|
|
359
|
+
// Send the notification, but don't await it here to avoid blocking.
|
|
360
|
+
// Handle potential errors with a .catch().
|
|
361
|
+
(_a = this._transport) === null || _a === void 0 ? void 0 : _a.send(jsonrpcNotification, options).catch(error => this._onerror(error));
|
|
362
|
+
});
|
|
363
|
+
// Return immediately.
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
const jsonrpcNotification = {
|
|
367
|
+
...notification,
|
|
368
|
+
jsonrpc: '2.0'
|
|
369
|
+
};
|
|
370
|
+
await this._transport.send(jsonrpcNotification, options);
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Registers a handler to invoke when this protocol object receives a request with the given method.
|
|
374
|
+
*
|
|
375
|
+
* Note that this will replace any previous request handler for the same method.
|
|
376
|
+
*/
|
|
377
|
+
setRequestHandler(requestSchema, handler) {
|
|
378
|
+
const method = getMethodLiteral(requestSchema);
|
|
379
|
+
this.assertRequestHandlerCapability(method);
|
|
380
|
+
this._requestHandlers.set(method, (request, extra) => {
|
|
381
|
+
const parsed = parseWithCompat(requestSchema, request);
|
|
382
|
+
return Promise.resolve(handler(parsed, extra));
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Removes the request handler for the given method.
|
|
387
|
+
*/
|
|
388
|
+
removeRequestHandler(method) {
|
|
389
|
+
this._requestHandlers.delete(method);
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Asserts that a request handler has not already been set for the given method, in preparation for a new one being automatically installed.
|
|
393
|
+
*/
|
|
394
|
+
assertCanSetRequestHandler(method) {
|
|
395
|
+
if (this._requestHandlers.has(method)) {
|
|
396
|
+
throw new Error(`A request handler for ${method} already exists, which would be overridden`);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Registers a handler to invoke when this protocol object receives a notification with the given method.
|
|
401
|
+
*
|
|
402
|
+
* Note that this will replace any previous notification handler for the same method.
|
|
403
|
+
*/
|
|
404
|
+
setNotificationHandler(notificationSchema, handler) {
|
|
405
|
+
const method = getMethodLiteral(notificationSchema);
|
|
406
|
+
this._notificationHandlers.set(method, notification => {
|
|
407
|
+
const parsed = parseWithCompat(notificationSchema, notification);
|
|
408
|
+
return Promise.resolve(handler(parsed));
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Removes the notification handler for the given method.
|
|
413
|
+
*/
|
|
414
|
+
removeNotificationHandler(method) {
|
|
415
|
+
this._notificationHandlers.delete(method);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
function isPlainObject(value) {
|
|
419
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
420
|
+
}
|
|
421
|
+
function mergeCapabilities(base, additional) {
|
|
422
|
+
const result = { ...base };
|
|
423
|
+
for (const key in additional) {
|
|
424
|
+
const k = key;
|
|
425
|
+
const addValue = additional[k];
|
|
426
|
+
if (addValue === undefined)
|
|
427
|
+
continue;
|
|
428
|
+
const baseValue = result[k];
|
|
429
|
+
if (isPlainObject(baseValue) && isPlainObject(addValue)) {
|
|
430
|
+
result[k] = { ...baseValue, ...addValue };
|
|
431
|
+
}
|
|
432
|
+
else {
|
|
433
|
+
result[k] = addValue;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
return result;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
export { DEFAULT_REQUEST_TIMEOUT_MSEC, Protocol, mergeCapabilities };
|
|
440
|
+
//# sourceMappingURL=protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sources":["../../../../../../../../../node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js"],"sourcesContent":["import { safeParse } from '../server/zod-compat.js';\nimport { CancelledNotificationSchema, ErrorCode, isJSONRPCError, isJSONRPCRequest, isJSONRPCResponse, isJSONRPCNotification, McpError, PingRequestSchema, ProgressNotificationSchema } from '../types.js';\nimport { getMethodLiteral, parseWithCompat } from '../server/zod-json-schema-compat.js';\n/**\n * The default request timeout, in miliseconds.\n */\nexport const DEFAULT_REQUEST_TIMEOUT_MSEC = 60000;\n/**\n * Implements MCP protocol framing on top of a pluggable transport, including\n * features like request/response linking, notifications, and progress.\n */\nexport class Protocol {\n constructor(_options) {\n this._options = _options;\n this._requestMessageId = 0;\n this._requestHandlers = new Map();\n this._requestHandlerAbortControllers = new Map();\n this._notificationHandlers = new Map();\n this._responseHandlers = new Map();\n this._progressHandlers = new Map();\n this._timeoutInfo = new Map();\n this._pendingDebouncedNotifications = new Set();\n this.setNotificationHandler(CancelledNotificationSchema, notification => {\n const controller = this._requestHandlerAbortControllers.get(notification.params.requestId);\n controller === null || controller === void 0 ? void 0 : controller.abort(notification.params.reason);\n });\n this.setNotificationHandler(ProgressNotificationSchema, notification => {\n this._onprogress(notification);\n });\n this.setRequestHandler(PingRequestSchema, \n // Automatic pong by default.\n _request => ({}));\n }\n _setupTimeout(messageId, timeout, maxTotalTimeout, onTimeout, resetTimeoutOnProgress = false) {\n this._timeoutInfo.set(messageId, {\n timeoutId: setTimeout(onTimeout, timeout),\n startTime: Date.now(),\n timeout,\n maxTotalTimeout,\n resetTimeoutOnProgress,\n onTimeout\n });\n }\n _resetTimeout(messageId) {\n const info = this._timeoutInfo.get(messageId);\n if (!info)\n return false;\n const totalElapsed = Date.now() - info.startTime;\n if (info.maxTotalTimeout && totalElapsed >= info.maxTotalTimeout) {\n this._timeoutInfo.delete(messageId);\n throw McpError.fromError(ErrorCode.RequestTimeout, 'Maximum total timeout exceeded', {\n maxTotalTimeout: info.maxTotalTimeout,\n totalElapsed\n });\n }\n clearTimeout(info.timeoutId);\n info.timeoutId = setTimeout(info.onTimeout, info.timeout);\n return true;\n }\n _cleanupTimeout(messageId) {\n const info = this._timeoutInfo.get(messageId);\n if (info) {\n clearTimeout(info.timeoutId);\n this._timeoutInfo.delete(messageId);\n }\n }\n /**\n * Attaches to the given transport, starts it, and starts listening for messages.\n *\n * The Protocol object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward.\n */\n async connect(transport) {\n var _a, _b, _c;\n this._transport = transport;\n const _onclose = (_a = this.transport) === null || _a === void 0 ? void 0 : _a.onclose;\n this._transport.onclose = () => {\n _onclose === null || _onclose === void 0 ? void 0 : _onclose();\n this._onclose();\n };\n const _onerror = (_b = this.transport) === null || _b === void 0 ? void 0 : _b.onerror;\n this._transport.onerror = (error) => {\n _onerror === null || _onerror === void 0 ? void 0 : _onerror(error);\n this._onerror(error);\n };\n const _onmessage = (_c = this._transport) === null || _c === void 0 ? void 0 : _c.onmessage;\n this._transport.onmessage = (message, extra) => {\n _onmessage === null || _onmessage === void 0 ? void 0 : _onmessage(message, extra);\n if (isJSONRPCResponse(message) || isJSONRPCError(message)) {\n this._onresponse(message);\n }\n else if (isJSONRPCRequest(message)) {\n this._onrequest(message, extra);\n }\n else if (isJSONRPCNotification(message)) {\n this._onnotification(message);\n }\n else {\n this._onerror(new Error(`Unknown message type: ${JSON.stringify(message)}`));\n }\n };\n await this._transport.start();\n }\n _onclose() {\n var _a;\n const responseHandlers = this._responseHandlers;\n this._responseHandlers = new Map();\n this._progressHandlers.clear();\n this._pendingDebouncedNotifications.clear();\n this._transport = undefined;\n (_a = this.onclose) === null || _a === void 0 ? void 0 : _a.call(this);\n const error = McpError.fromError(ErrorCode.ConnectionClosed, 'Connection closed');\n for (const handler of responseHandlers.values()) {\n handler(error);\n }\n }\n _onerror(error) {\n var _a;\n (_a = this.onerror) === null || _a === void 0 ? void 0 : _a.call(this, error);\n }\n _onnotification(notification) {\n var _a;\n const handler = (_a = this._notificationHandlers.get(notification.method)) !== null && _a !== void 0 ? _a : this.fallbackNotificationHandler;\n // Ignore notifications not being subscribed to.\n if (handler === undefined) {\n return;\n }\n // Starting with Promise.resolve() puts any synchronous errors into the monad as well.\n Promise.resolve()\n .then(() => handler(notification))\n .catch(error => this._onerror(new Error(`Uncaught error in notification handler: ${error}`)));\n }\n _onrequest(request, extra) {\n var _a, _b;\n const handler = (_a = this._requestHandlers.get(request.method)) !== null && _a !== void 0 ? _a : this.fallbackRequestHandler;\n // Capture the current transport at request time to ensure responses go to the correct client\n const capturedTransport = this._transport;\n if (handler === undefined) {\n capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.send({\n jsonrpc: '2.0',\n id: request.id,\n error: {\n code: ErrorCode.MethodNotFound,\n message: 'Method not found'\n }\n }).catch(error => this._onerror(new Error(`Failed to send an error response: ${error}`)));\n return;\n }\n const abortController = new AbortController();\n this._requestHandlerAbortControllers.set(request.id, abortController);\n const fullExtra = {\n signal: abortController.signal,\n sessionId: capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.sessionId,\n _meta: (_b = request.params) === null || _b === void 0 ? void 0 : _b._meta,\n sendNotification: notification => this.notification(notification, { relatedRequestId: request.id }),\n sendRequest: (r, resultSchema, options) => this.request(r, resultSchema, { ...options, relatedRequestId: request.id }),\n authInfo: extra === null || extra === void 0 ? void 0 : extra.authInfo,\n requestId: request.id,\n requestInfo: extra === null || extra === void 0 ? void 0 : extra.requestInfo\n };\n // Starting with Promise.resolve() puts any synchronous errors into the monad as well.\n Promise.resolve()\n .then(() => handler(request, fullExtra))\n .then(result => {\n if (abortController.signal.aborted) {\n return;\n }\n return capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.send({\n result,\n jsonrpc: '2.0',\n id: request.id\n });\n }, error => {\n var _a;\n if (abortController.signal.aborted) {\n return;\n }\n return capturedTransport === null || capturedTransport === void 0 ? void 0 : capturedTransport.send({\n jsonrpc: '2.0',\n id: request.id,\n error: {\n code: Number.isSafeInteger(error['code']) ? error['code'] : ErrorCode.InternalError,\n message: (_a = error.message) !== null && _a !== void 0 ? _a : 'Internal error',\n ...(error['data'] !== undefined && { data: error['data'] })\n }\n });\n })\n .catch(error => this._onerror(new Error(`Failed to send response: ${error}`)))\n .finally(() => {\n this._requestHandlerAbortControllers.delete(request.id);\n });\n }\n _onprogress(notification) {\n const { progressToken, ...params } = notification.params;\n const messageId = Number(progressToken);\n const handler = this._progressHandlers.get(messageId);\n if (!handler) {\n this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(notification)}`));\n return;\n }\n const responseHandler = this._responseHandlers.get(messageId);\n const timeoutInfo = this._timeoutInfo.get(messageId);\n if (timeoutInfo && responseHandler && timeoutInfo.resetTimeoutOnProgress) {\n try {\n this._resetTimeout(messageId);\n }\n catch (error) {\n responseHandler(error);\n return;\n }\n }\n handler(params);\n }\n _onresponse(response) {\n const messageId = Number(response.id);\n const handler = this._responseHandlers.get(messageId);\n if (handler === undefined) {\n this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(response)}`));\n return;\n }\n this._responseHandlers.delete(messageId);\n this._progressHandlers.delete(messageId);\n this._cleanupTimeout(messageId);\n if (isJSONRPCResponse(response)) {\n handler(response);\n }\n else {\n const error = McpError.fromError(response.error.code, response.error.message, response.error.data);\n handler(error);\n }\n }\n get transport() {\n return this._transport;\n }\n /**\n * Closes the connection.\n */\n async close() {\n var _a;\n await ((_a = this._transport) === null || _a === void 0 ? void 0 : _a.close());\n }\n /**\n * Sends a request and wait for a response.\n *\n * Do not use this method to emit notifications! Use notification() instead.\n */\n request(request, resultSchema, options) {\n const { relatedRequestId, resumptionToken, onresumptiontoken } = options !== null && options !== void 0 ? options : {};\n return new Promise((resolve, reject) => {\n var _a, _b, _c, _d, _e, _f;\n if (!this._transport) {\n reject(new Error('Not connected'));\n return;\n }\n if (((_a = this._options) === null || _a === void 0 ? void 0 : _a.enforceStrictCapabilities) === true) {\n this.assertCapabilityForMethod(request.method);\n }\n (_b = options === null || options === void 0 ? void 0 : options.signal) === null || _b === void 0 ? void 0 : _b.throwIfAborted();\n const messageId = this._requestMessageId++;\n const jsonrpcRequest = {\n ...request,\n jsonrpc: '2.0',\n id: messageId\n };\n if (options === null || options === void 0 ? void 0 : options.onprogress) {\n this._progressHandlers.set(messageId, options.onprogress);\n jsonrpcRequest.params = {\n ...request.params,\n _meta: {\n ...(((_c = request.params) === null || _c === void 0 ? void 0 : _c._meta) || {}),\n progressToken: messageId\n }\n };\n }\n const cancel = (reason) => {\n var _a;\n this._responseHandlers.delete(messageId);\n this._progressHandlers.delete(messageId);\n this._cleanupTimeout(messageId);\n (_a = this._transport) === null || _a === void 0 ? void 0 : _a.send({\n jsonrpc: '2.0',\n method: 'notifications/cancelled',\n params: {\n requestId: messageId,\n reason: String(reason)\n }\n }, { relatedRequestId, resumptionToken, onresumptiontoken }).catch(error => this._onerror(new Error(`Failed to send cancellation: ${error}`)));\n reject(reason);\n };\n this._responseHandlers.set(messageId, response => {\n var _a;\n if ((_a = options === null || options === void 0 ? void 0 : options.signal) === null || _a === void 0 ? void 0 : _a.aborted) {\n return;\n }\n if (response instanceof Error) {\n return reject(response);\n }\n try {\n const parseResult = safeParse(resultSchema, response.result);\n if (!parseResult.success) {\n // Type guard: if success is false, error is guaranteed to exist\n reject(parseResult.error);\n }\n else {\n resolve(parseResult.data);\n }\n }\n catch (error) {\n reject(error);\n }\n });\n (_d = options === null || options === void 0 ? void 0 : options.signal) === null || _d === void 0 ? void 0 : _d.addEventListener('abort', () => {\n var _a;\n cancel((_a = options === null || options === void 0 ? void 0 : options.signal) === null || _a === void 0 ? void 0 : _a.reason);\n });\n const timeout = (_e = options === null || options === void 0 ? void 0 : options.timeout) !== null && _e !== void 0 ? _e : DEFAULT_REQUEST_TIMEOUT_MSEC;\n const timeoutHandler = () => cancel(McpError.fromError(ErrorCode.RequestTimeout, 'Request timed out', { timeout }));\n this._setupTimeout(messageId, timeout, options === null || options === void 0 ? void 0 : options.maxTotalTimeout, timeoutHandler, (_f = options === null || options === void 0 ? void 0 : options.resetTimeoutOnProgress) !== null && _f !== void 0 ? _f : false);\n this._transport.send(jsonrpcRequest, { relatedRequestId, resumptionToken, onresumptiontoken }).catch(error => {\n this._cleanupTimeout(messageId);\n reject(error);\n });\n });\n }\n /**\n * Emits a notification, which is a one-way message that does not expect a response.\n */\n async notification(notification, options) {\n var _a, _b;\n if (!this._transport) {\n throw new Error('Not connected');\n }\n this.assertNotificationCapability(notification.method);\n const debouncedMethods = (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.debouncedNotificationMethods) !== null && _b !== void 0 ? _b : [];\n // A notification can only be debounced if it's in the list AND it's \"simple\"\n // (i.e., has no parameters and no related request ID that could be lost).\n const canDebounce = debouncedMethods.includes(notification.method) && !notification.params && !(options === null || options === void 0 ? void 0 : options.relatedRequestId);\n if (canDebounce) {\n // If a notification of this type is already scheduled, do nothing.\n if (this._pendingDebouncedNotifications.has(notification.method)) {\n return;\n }\n // Mark this notification type as pending.\n this._pendingDebouncedNotifications.add(notification.method);\n // Schedule the actual send to happen in the next microtask.\n // This allows all synchronous calls in the current event loop tick to be coalesced.\n Promise.resolve().then(() => {\n var _a;\n // Un-mark the notification so the next one can be scheduled.\n this._pendingDebouncedNotifications.delete(notification.method);\n // SAFETY CHECK: If the connection was closed while this was pending, abort.\n if (!this._transport) {\n return;\n }\n const jsonrpcNotification = {\n ...notification,\n jsonrpc: '2.0'\n };\n // Send the notification, but don't await it here to avoid blocking.\n // Handle potential errors with a .catch().\n (_a = this._transport) === null || _a === void 0 ? void 0 : _a.send(jsonrpcNotification, options).catch(error => this._onerror(error));\n });\n // Return immediately.\n return;\n }\n const jsonrpcNotification = {\n ...notification,\n jsonrpc: '2.0'\n };\n await this._transport.send(jsonrpcNotification, options);\n }\n /**\n * Registers a handler to invoke when this protocol object receives a request with the given method.\n *\n * Note that this will replace any previous request handler for the same method.\n */\n setRequestHandler(requestSchema, handler) {\n const method = getMethodLiteral(requestSchema);\n this.assertRequestHandlerCapability(method);\n this._requestHandlers.set(method, (request, extra) => {\n const parsed = parseWithCompat(requestSchema, request);\n return Promise.resolve(handler(parsed, extra));\n });\n }\n /**\n * Removes the request handler for the given method.\n */\n removeRequestHandler(method) {\n this._requestHandlers.delete(method);\n }\n /**\n * Asserts that a request handler has not already been set for the given method, in preparation for a new one being automatically installed.\n */\n assertCanSetRequestHandler(method) {\n if (this._requestHandlers.has(method)) {\n throw new Error(`A request handler for ${method} already exists, which would be overridden`);\n }\n }\n /**\n * Registers a handler to invoke when this protocol object receives a notification with the given method.\n *\n * Note that this will replace any previous notification handler for the same method.\n */\n setNotificationHandler(notificationSchema, handler) {\n const method = getMethodLiteral(notificationSchema);\n this._notificationHandlers.set(method, notification => {\n const parsed = parseWithCompat(notificationSchema, notification);\n return Promise.resolve(handler(parsed));\n });\n }\n /**\n * Removes the notification handler for the given method.\n */\n removeNotificationHandler(method) {\n this._notificationHandlers.delete(method);\n }\n}\nfunction isPlainObject(value) {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\nexport function mergeCapabilities(base, additional) {\n const result = { ...base };\n for (const key in additional) {\n const k = key;\n const addValue = additional[k];\n if (addValue === undefined)\n continue;\n const baseValue = result[k];\n if (isPlainObject(baseValue) && isPlainObject(addValue)) {\n result[k] = { ...baseValue, ...addValue };\n }\n else {\n result[k] = addValue;\n }\n }\n return result;\n}\n//# sourceMappingURL=protocol.js.map"],"names":[],"mappings":";;;;AAGA;AACA;AACA;AACY,MAAC,4BAA4B,GAAG;AAC5C;AACA;AACA;AACA;AACO,MAAM,QAAQ,CAAC;AACtB,IAAI,WAAW,CAAC,QAAQ,EAAE;AAC1B,QAAQ,IAAI,CAAC,QAAQ,GAAG,QAAQ;AAChC,QAAQ,IAAI,CAAC,iBAAiB,GAAG,CAAC;AAClC,QAAQ,IAAI,CAAC,gBAAgB,GAAG,IAAI,GAAG,EAAE;AACzC,QAAQ,IAAI,CAAC,+BAA+B,GAAG,IAAI,GAAG,EAAE;AACxD,QAAQ,IAAI,CAAC,qBAAqB,GAAG,IAAI,GAAG,EAAE;AAC9C,QAAQ,IAAI,CAAC,iBAAiB,GAAG,IAAI,GAAG,EAAE;AAC1C,QAAQ,IAAI,CAAC,iBAAiB,GAAG,IAAI,GAAG,EAAE;AAC1C,QAAQ,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,EAAE;AACrC,QAAQ,IAAI,CAAC,8BAA8B,GAAG,IAAI,GAAG,EAAE;AACvD,QAAQ,IAAI,CAAC,sBAAsB,CAAC,2BAA2B,EAAE,YAAY,IAAI;AACjF,YAAY,MAAM,UAAU,GAAG,IAAI,CAAC,+BAA+B,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC;AACtG,YAAY,UAAU,KAAK,IAAI,IAAI,UAAU,KAAK,MAAM,GAAG,MAAM,GAAG,UAAU,CAA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IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;AAC/E;AACO,SAAS,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE;AACpD,IAAI,MAAM,MAAM,GAAG,EAAE,GAAG,IAAI,EAAE;AAC9B,IAAI,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE;AAClC,QAAQ,MAAM,CAAC,GAAG,GAAG;AACrB,QAAQ,MAAM,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC;AACtC,QAAQ,IAAI,QAAQ,KAAK,SAAS;AAClC,YAAY;AACZ,QAAQ,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC;AACnC,QAAQ,IAAI,aAAa,CAAC,SAAS,CAAC,IAAI,aAAa,CAAC,QAAQ,CAAC,EAAE;AACjE,YAAY,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,SAAS,EAAE,GAAG,QAAQ,EAAE;AACrD,QAAQ;AACR,aAAa;AACb,YAAY,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ;AAChC,QAAQ;AACR,IAAI;AACJ,IAAI,OAAO,MAAM;AACjB;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool name validation utilities according to SEP: Specify Format for Tool Names
|
|
3
|
+
*
|
|
4
|
+
* Tool names SHOULD be between 1 and 128 characters in length (inclusive).
|
|
5
|
+
* Tool names are case-sensitive.
|
|
6
|
+
* Allowed characters: uppercase and lowercase ASCII letters (A-Z, a-z), digits
|
|
7
|
+
* (0-9), underscore (_), dash (-), and dot (.).
|
|
8
|
+
* Tool names SHOULD NOT contain spaces, commas, or other special characters.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Regular expression for valid tool names according to SEP-986 specification
|
|
12
|
+
*/
|
|
13
|
+
const TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
|
|
14
|
+
/**
|
|
15
|
+
* Validates a tool name according to the SEP specification
|
|
16
|
+
* @param name - The tool name to validate
|
|
17
|
+
* @returns An object containing validation result and any warnings
|
|
18
|
+
*/
|
|
19
|
+
function validateToolName(name) {
|
|
20
|
+
const warnings = [];
|
|
21
|
+
// Check length
|
|
22
|
+
if (name.length === 0) {
|
|
23
|
+
return {
|
|
24
|
+
isValid: false,
|
|
25
|
+
warnings: ['Tool name cannot be empty']
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
if (name.length > 128) {
|
|
29
|
+
return {
|
|
30
|
+
isValid: false,
|
|
31
|
+
warnings: [`Tool name exceeds maximum length of 128 characters (current: ${name.length})`]
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
// Check for specific problematic patterns (these are warnings, not validation failures)
|
|
35
|
+
if (name.includes(' ')) {
|
|
36
|
+
warnings.push('Tool name contains spaces, which may cause parsing issues');
|
|
37
|
+
}
|
|
38
|
+
if (name.includes(',')) {
|
|
39
|
+
warnings.push('Tool name contains commas, which may cause parsing issues');
|
|
40
|
+
}
|
|
41
|
+
// Check for potentially confusing patterns (leading/trailing dashes, dots, slashes)
|
|
42
|
+
if (name.startsWith('-') || name.endsWith('-')) {
|
|
43
|
+
warnings.push('Tool name starts or ends with a dash, which may cause parsing issues in some contexts');
|
|
44
|
+
}
|
|
45
|
+
if (name.startsWith('.') || name.endsWith('.')) {
|
|
46
|
+
warnings.push('Tool name starts or ends with a dot, which may cause parsing issues in some contexts');
|
|
47
|
+
}
|
|
48
|
+
// Check for invalid characters
|
|
49
|
+
if (!TOOL_NAME_REGEX.test(name)) {
|
|
50
|
+
const invalidChars = name
|
|
51
|
+
.split('')
|
|
52
|
+
.filter(char => !/[A-Za-z0-9._-]/.test(char))
|
|
53
|
+
.filter((char, index, arr) => arr.indexOf(char) === index); // Remove duplicates
|
|
54
|
+
warnings.push(`Tool name contains invalid characters: ${invalidChars.map(c => `"${c}"`).join(', ')}`, 'Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)');
|
|
55
|
+
return {
|
|
56
|
+
isValid: false,
|
|
57
|
+
warnings
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
isValid: true,
|
|
62
|
+
warnings
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Issues warnings for non-conforming tool names
|
|
67
|
+
* @param name - The tool name that triggered the warnings
|
|
68
|
+
* @param warnings - Array of warning messages
|
|
69
|
+
*/
|
|
70
|
+
function issueToolNameWarning(name, warnings) {
|
|
71
|
+
if (warnings.length > 0) {
|
|
72
|
+
console.warn(`Tool name validation warning for "${name}":`);
|
|
73
|
+
for (const warning of warnings) {
|
|
74
|
+
console.warn(` - ${warning}`);
|
|
75
|
+
}
|
|
76
|
+
console.warn('Tool registration will proceed, but this may cause compatibility issues.');
|
|
77
|
+
console.warn('Consider updating the tool name to conform to the MCP tool naming standard.');
|
|
78
|
+
console.warn('See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.');
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Validates a tool name and issues warnings for non-conforming names
|
|
83
|
+
* @param name - The tool name to validate
|
|
84
|
+
* @returns true if the name is valid, false otherwise
|
|
85
|
+
*/
|
|
86
|
+
function validateAndWarnToolName(name) {
|
|
87
|
+
const result = validateToolName(name);
|
|
88
|
+
// Always issue warnings for any validation issues (both invalid names and warnings)
|
|
89
|
+
issueToolNameWarning(name, result.warnings);
|
|
90
|
+
return result.isValid;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export { issueToolNameWarning, validateAndWarnToolName, validateToolName };
|
|
94
|
+
//# sourceMappingURL=toolNameValidation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolNameValidation.js","sources":["../../../../../../../../../node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js"],"sourcesContent":["/**\n * Tool name validation utilities according to SEP: Specify Format for Tool Names\n *\n * Tool names SHOULD be between 1 and 128 characters in length (inclusive).\n * Tool names are case-sensitive.\n * Allowed characters: uppercase and lowercase ASCII letters (A-Z, a-z), digits\n * (0-9), underscore (_), dash (-), and dot (.).\n * Tool names SHOULD NOT contain spaces, commas, or other special characters.\n */\n/**\n * Regular expression for valid tool names according to SEP-986 specification\n */\nconst TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;\n/**\n * Validates a tool name according to the SEP specification\n * @param name - The tool name to validate\n * @returns An object containing validation result and any warnings\n */\nexport function validateToolName(name) {\n const warnings = [];\n // Check length\n if (name.length === 0) {\n return {\n isValid: false,\n warnings: ['Tool name cannot be empty']\n };\n }\n if (name.length > 128) {\n return {\n isValid: false,\n warnings: [`Tool name exceeds maximum length of 128 characters (current: ${name.length})`]\n };\n }\n // Check for specific problematic patterns (these are warnings, not validation failures)\n if (name.includes(' ')) {\n warnings.push('Tool name contains spaces, which may cause parsing issues');\n }\n if (name.includes(',')) {\n warnings.push('Tool name contains commas, which may cause parsing issues');\n }\n // Check for potentially confusing patterns (leading/trailing dashes, dots, slashes)\n if (name.startsWith('-') || name.endsWith('-')) {\n warnings.push('Tool name starts or ends with a dash, which may cause parsing issues in some contexts');\n }\n if (name.startsWith('.') || name.endsWith('.')) {\n warnings.push('Tool name starts or ends with a dot, which may cause parsing issues in some contexts');\n }\n // Check for invalid characters\n if (!TOOL_NAME_REGEX.test(name)) {\n const invalidChars = name\n .split('')\n .filter(char => !/[A-Za-z0-9._-]/.test(char))\n .filter((char, index, arr) => arr.indexOf(char) === index); // Remove duplicates\n warnings.push(`Tool name contains invalid characters: ${invalidChars.map(c => `\"${c}\"`).join(', ')}`, 'Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)');\n return {\n isValid: false,\n warnings\n };\n }\n return {\n isValid: true,\n warnings\n };\n}\n/**\n * Issues warnings for non-conforming tool names\n * @param name - The tool name that triggered the warnings\n * @param warnings - Array of warning messages\n */\nexport function issueToolNameWarning(name, warnings) {\n if (warnings.length > 0) {\n console.warn(`Tool name validation warning for \"${name}\":`);\n for (const warning of warnings) {\n console.warn(` - ${warning}`);\n }\n console.warn('Tool registration will proceed, but this may cause compatibility issues.');\n console.warn('Consider updating the tool name to conform to the MCP tool naming standard.');\n console.warn('See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.');\n }\n}\n/**\n * Validates a tool name and issues warnings for non-conforming names\n * @param name - The tool name to validate\n * @returns true if the name is valid, false otherwise\n */\nexport function validateAndWarnToolName(name) {\n const result = validateToolName(name);\n // Always issue warnings for any validation issues (both invalid names and warnings)\n issueToolNameWarning(name, result.warnings);\n return result.isValid;\n}\n//# sourceMappingURL=toolNameValidation.js.map"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,eAAe,GAAG,yBAAyB;AACjD;AACA;AACA;AACA;AACA;AACO,SAAS,gBAAgB,CAAC,IAAI,EAAE;AACvC,IAAI,MAAM,QAAQ,GAAG,EAAE;AACvB;AACA,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;AAC3B,QAAQ,OAAO;AACf,YAAY,OAAO,EAAE,KAAK;AAC1B,YAAY,QAAQ,EAAE,CAAC,2BAA2B;AAClD,SAAS;AACT,IAAI;AACJ,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,GAAG,EAAE;AAC3B,QAAQ,OAAO;AACf,YAAY,OAAO,EAAE,KAAK;AAC1B,YAAY,QAAQ,EAAE,CAAC,CAAC,6DAA6D,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AACrG,SAAS;AACT,IAAI;AACJ;AACA,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AAC5B,QAAQ,QAAQ,CAAC,IAAI,CAAC,2DAA2D,CAAC;AAClF,IAA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