@amplitude/ai 0.1.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/.cursor/skills/instrument-with-amplitude-ai/SKILL.md +50 -0
- package/AGENTS.md +79 -0
- package/LICENSE +21 -0
- package/README.md +2111 -0
- package/bin/amplitude-ai-completions.mjs +19 -0
- package/bin/amplitude-ai-doctor.mjs +26 -0
- package/bin/amplitude-ai-init.mjs +27 -0
- package/bin/amplitude-ai-instrument.mjs +52 -0
- package/bin/amplitude-ai-mcp.mjs +8 -0
- package/bin/amplitude-ai-register-catalog.mjs +156 -0
- package/bin/amplitude-ai-status.mjs +28 -0
- package/bin/amplitude-ai.mjs +43 -0
- package/bin/validate-catalog-constants.mjs +134 -0
- package/data/agent_event_catalog.json +1277 -0
- package/dist/_virtual/rolldown_runtime.js +31 -0
- package/dist/bound-agent.d.ts +56 -0
- package/dist/bound-agent.d.ts.map +1 -0
- package/dist/bound-agent.js +155 -0
- package/dist/bound-agent.js.map +1 -0
- package/dist/cli/doctor.d.ts +17 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +89 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/init.d.ts +14 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +40 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/providers.d.ts +32 -0
- package/dist/cli/providers.d.ts.map +1 -0
- package/dist/cli/providers.js +46 -0
- package/dist/cli/providers.js.map +1 -0
- package/dist/cli/status.d.ts +14 -0
- package/dist/cli/status.d.ts.map +1 -0
- package/dist/cli/status.js +38 -0
- package/dist/cli/status.js.map +1 -0
- package/dist/client.d.ts +246 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +369 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +60 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +57 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +44 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +53 -0
- package/dist/context.js.map +1 -0
- package/dist/core/constants.d.ts +96 -0
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/constants.js +105 -0
- package/dist/core/constants.js.map +1 -0
- package/dist/core/enrichments.d.ts +139 -0
- package/dist/core/enrichments.d.ts.map +1 -0
- package/dist/core/enrichments.js +177 -0
- package/dist/core/enrichments.js.map +1 -0
- package/dist/core/privacy.d.ts +53 -0
- package/dist/core/privacy.d.ts.map +1 -0
- package/dist/core/privacy.js +235 -0
- package/dist/core/privacy.js.map +1 -0
- package/dist/core/tracking.d.ts +242 -0
- package/dist/core/tracking.d.ts.map +1 -0
- package/dist/core/tracking.js +469 -0
- package/dist/core/tracking.js.map +1 -0
- package/dist/decorators.d.ts +109 -0
- package/dist/decorators.d.ts.map +1 -0
- package/dist/decorators.js +281 -0
- package/dist/decorators.js.map +1 -0
- package/dist/exceptions.d.ts +19 -0
- package/dist/exceptions.d.ts.map +1 -0
- package/dist/exceptions.js +35 -0
- package/dist/exceptions.js.map +1 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +38 -0
- package/dist/integrations/anthropic-tools.d.ts +38 -0
- package/dist/integrations/anthropic-tools.d.ts.map +1 -0
- package/dist/integrations/anthropic-tools.js +175 -0
- package/dist/integrations/anthropic-tools.js.map +1 -0
- package/dist/integrations/crewai.d.ts +14 -0
- package/dist/integrations/crewai.d.ts.map +1 -0
- package/dist/integrations/crewai.js +19 -0
- package/dist/integrations/crewai.js.map +1 -0
- package/dist/integrations/langchain.d.ts +37 -0
- package/dist/integrations/langchain.d.ts.map +1 -0
- package/dist/integrations/langchain.js +189 -0
- package/dist/integrations/langchain.js.map +1 -0
- package/dist/integrations/llamaindex.d.ts +44 -0
- package/dist/integrations/llamaindex.d.ts.map +1 -0
- package/dist/integrations/llamaindex.js +144 -0
- package/dist/integrations/llamaindex.js.map +1 -0
- package/dist/integrations/openai-agents.d.ts +35 -0
- package/dist/integrations/openai-agents.d.ts.map +1 -0
- package/dist/integrations/openai-agents.js +248 -0
- package/dist/integrations/openai-agents.js.map +1 -0
- package/dist/integrations/opentelemetry.d.ts +40 -0
- package/dist/integrations/opentelemetry.d.ts.map +1 -0
- package/dist/integrations/opentelemetry.js +146 -0
- package/dist/integrations/opentelemetry.js.map +1 -0
- package/dist/internals.d.ts +5 -0
- package/dist/internals.js +5 -0
- package/dist/mcp/contract.d.ts +27 -0
- package/dist/mcp/contract.d.ts.map +1 -0
- package/dist/mcp/contract.js +25 -0
- package/dist/mcp/contract.js.map +1 -0
- package/dist/mcp/index.d.ts +4 -0
- package/dist/mcp/index.js +5 -0
- package/dist/mcp/patterns.d.ts +11 -0
- package/dist/mcp/patterns.d.ts.map +1 -0
- package/dist/mcp/patterns.js +38 -0
- package/dist/mcp/patterns.js.map +1 -0
- package/dist/mcp/server.d.ts +10 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +241 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/validate-file.d.ts +20 -0
- package/dist/mcp/validate-file.d.ts.map +1 -0
- package/dist/mcp/validate-file.js +122 -0
- package/dist/mcp/validate-file.js.map +1 -0
- package/dist/middleware.d.ts +32 -0
- package/dist/middleware.d.ts.map +1 -0
- package/dist/middleware.js +67 -0
- package/dist/middleware.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js +54 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js +20 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js +34 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js +225 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js +22 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js +351 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js +634 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js +60 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js +122 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js +37 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +858 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js +32 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js +74 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js +1262 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js +83 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/formats.js +195 -0
- package/dist/node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/formats.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/index.js +44 -0
- package/dist/node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/limit.js +88 -0
- package/dist/node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/limit.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/ajv.js +107 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/ajv.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/code.js +142 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/code.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/index.js +678 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/index.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/scope.js +145 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/scope.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/errors.js +106 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/errors.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/index.js +227 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/index.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/names.js +33 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/names.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/ref_error.js +22 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/ref_error.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/resolve.js +137 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/resolve.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/rules.js +65 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/rules.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/util.js +150 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/util.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/applicability.js +27 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/applicability.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/boolSchema.js +52 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/boolSchema.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/dataType.js +176 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/dataType.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/defaults.js +35 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/defaults.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/index.js +437 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/index.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/keyword.js +117 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/keyword.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/subschema.js +76 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/subschema.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/core.js +587 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/core.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/refs/data.js +22 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/refs/data.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/refs/json-schema-draft-07.js +145 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/refs/json-schema-draft-07.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/equal.js +16 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/equal.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/ucs2length.js +29 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/ucs2length.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/uri.js +16 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/uri.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/validation_error.js +20 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/validation_error.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +61 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +101 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js +34 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +21 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/contains.js +94 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +91 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/if.js +66 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/if.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/index.js +64 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/index.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/items.js +63 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/items.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js +39 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/not.js +36 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/not.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +56 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +66 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +22 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/properties.js +57 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +46 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +22 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/code.js +134 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/code.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/id.js +19 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/id.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/index.js +27 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/index.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/ref.js +116 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/discriminator/index.js +106 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/discriminator/types.js +18 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/draft7.js +31 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/draft7.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/format/format.js +97 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/format/format.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/format/index.js +15 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/format/index.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/metadata.js +27 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/const.js +32 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/const.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/enum.js +54 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/enum.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/index.js +53 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js +33 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js +38 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +52 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +33 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +32 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/pattern.js +43 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/required.js +77 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +75 -0
- package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +1 -0
- package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js +37 -0
- package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js.map +1 -0
- package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js +240 -0
- package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js.map +1 -0
- package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js +194 -0
- package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js.map +1 -0
- package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js +286 -0
- package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js.map +1 -0
- package/dist/node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js +82 -0
- package/dist/node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Options.js +37 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Options.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Refs.js +30 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Refs.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/errorMessages.js +16 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/errorMessages.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js +10 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parseDef.js +57 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parseDef.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/any.js +17 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/any.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/array.js +23 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/array.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js +36 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js +8 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js +10 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js +10 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/date.js +39 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/date.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/default.js +13 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/default.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js +11 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js +11 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js +47 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js +17 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/map.js +38 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/map.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js +16 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/never.js +13 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/never.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/null.js +11 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/null.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js +46 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/number.js +37 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/number.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/object.js +64 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/object.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js +20 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js +27 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js +10 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js +10 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/record.js +56 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/record.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/set.js +21 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/set.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/string.js +250 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/string.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js +38 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js +10 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/union.js +64 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/union.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js +10 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/selectParser.js +78 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/selectParser.js.map +1 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js +70 -0
- package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js +104 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js +11 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js +10 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js +110 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js +99 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js +84 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js +3160 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/errors.js +23 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/errors.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/iso.js +38 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/iso.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/parse.js +12 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/parse.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/schemas.js +611 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/schemas.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/api.js +437 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/api.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/checks.js +360 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/checks.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/core.js +50 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/core.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/doc.js +34 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/doc.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/errors.js +71 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/errors.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/parse.js +74 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/parse.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/regexes.js +63 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/regexes.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/registries.js +50 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/registries.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/schemas.js +1098 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/schemas.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/to-json-schema.js +599 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/to-json-schema.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/util.js +267 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/util.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/versions.js +10 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/versions.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/mini/schemas.js +50 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/mini/schemas.js.map +1 -0
- package/dist/patching.d.ts +59 -0
- package/dist/patching.d.ts.map +1 -0
- package/dist/patching.js +891 -0
- package/dist/patching.js.map +1 -0
- package/dist/propagation.d.ts +8 -0
- package/dist/propagation.d.ts.map +1 -0
- package/dist/propagation.js +46 -0
- package/dist/propagation.js.map +1 -0
- package/dist/providers/anthropic.d.ts +44 -0
- package/dist/providers/anthropic.d.ts.map +1 -0
- package/dist/providers/anthropic.js +287 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/azure-openai.d.ts +32 -0
- package/dist/providers/azure-openai.d.ts.map +1 -0
- package/dist/providers/azure-openai.js +39 -0
- package/dist/providers/azure-openai.js.map +1 -0
- package/dist/providers/base.d.ts +70 -0
- package/dist/providers/base.d.ts.map +1 -0
- package/dist/providers/base.js +141 -0
- package/dist/providers/base.js.map +1 -0
- package/dist/providers/bedrock.d.ts +41 -0
- package/dist/providers/bedrock.d.ts.map +1 -0
- package/dist/providers/bedrock.js +229 -0
- package/dist/providers/bedrock.js.map +1 -0
- package/dist/providers/gemini.d.ts +34 -0
- package/dist/providers/gemini.d.ts.map +1 -0
- package/dist/providers/gemini.js +225 -0
- package/dist/providers/gemini.js.map +1 -0
- package/dist/providers/mistral.d.ts +32 -0
- package/dist/providers/mistral.d.ts.map +1 -0
- package/dist/providers/mistral.js +218 -0
- package/dist/providers/mistral.js.map +1 -0
- package/dist/providers/openai.d.ts +61 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +530 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/register.d.ts +1 -0
- package/dist/register.js +46 -0
- package/dist/register.js.map +1 -0
- package/dist/session.d.ts +46 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +144 -0
- package/dist/session.js.map +1 -0
- package/dist/tenant.d.ts +30 -0
- package/dist/tenant.d.ts.map +1 -0
- package/dist/tenant.js +23 -0
- package/dist/tenant.js.map +1 -0
- package/dist/testing.d.ts +46 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +120 -0
- package/dist/testing.js.map +1 -0
- package/dist/types.d.ts +384 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +13 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/costs.d.ts +27 -0
- package/dist/utils/costs.d.ts.map +1 -0
- package/dist/utils/costs.js +63 -0
- package/dist/utils/costs.js.map +1 -0
- package/dist/utils/debug.d.ts +6 -0
- package/dist/utils/debug.d.ts.map +1 -0
- package/dist/utils/debug.js +73 -0
- package/dist/utils/debug.js.map +1 -0
- package/dist/utils/logger.d.ts +11 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +18 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/model-tiers.d.ts +8 -0
- package/dist/utils/model-tiers.d.ts.map +1 -0
- package/dist/utils/model-tiers.js +76 -0
- package/dist/utils/model-tiers.js.map +1 -0
- package/dist/utils/providers.d.ts +5 -0
- package/dist/utils/providers.d.ts.map +1 -0
- package/dist/utils/providers.js +20 -0
- package/dist/utils/providers.js.map +1 -0
- package/dist/utils/resolve-module.d.ts +5 -0
- package/dist/utils/resolve-module.d.ts.map +1 -0
- package/dist/utils/resolve-module.js +29 -0
- package/dist/utils/resolve-module.js.map +1 -0
- package/dist/utils/streaming.d.ts +55 -0
- package/dist/utils/streaming.d.ts.map +1 -0
- package/dist/utils/streaming.js +72 -0
- package/dist/utils/streaming.js.map +1 -0
- package/dist/utils/tokens.d.ts +16 -0
- package/dist/utils/tokens.d.ts.map +1 -0
- package/dist/utils/tokens.js +80 -0
- package/dist/utils/tokens.js.map +1 -0
- package/dist/wrappers.d.ts +37 -0
- package/dist/wrappers.d.ts.map +1 -0
- package/dist/wrappers.js +61 -0
- package/dist/wrappers.js.map +1 -0
- package/llms-full.txt +127 -0
- package/llms.txt +28 -0
- package/mcp.schema.json +18 -0
- package/package.json +189 -0
|
@@ -0,0 +1,858 @@
|
|
|
1
|
+
import { safeParse } from "../server/zod-compat.js";
|
|
2
|
+
import { CancelTaskRequestSchema, CancelTaskResultSchema, CancelledNotificationSchema, CreateTaskResultSchema, ErrorCode, GetTaskPayloadRequestSchema, GetTaskRequestSchema, GetTaskResultSchema, ListTasksRequestSchema, ListTasksResultSchema, McpError, PingRequestSchema, ProgressNotificationSchema, RELATED_TASK_META_KEY, TaskStatusNotificationSchema, isJSONRPCErrorResponse, isJSONRPCNotification, isJSONRPCRequest, isJSONRPCResultResponse, isTaskAugmentedRequestParams } from "../types.js";
|
|
3
|
+
import { isTerminal } from "../experimental/tasks/interfaces.js";
|
|
4
|
+
import { getMethodLiteral, parseWithCompat } from "../server/zod-json-schema-compat.js";
|
|
5
|
+
|
|
6
|
+
//#region node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
|
|
7
|
+
/**
|
|
8
|
+
* The default request timeout, in miliseconds.
|
|
9
|
+
*/
|
|
10
|
+
const DEFAULT_REQUEST_TIMEOUT_MSEC = 6e4;
|
|
11
|
+
/**
|
|
12
|
+
* Implements MCP protocol framing on top of a pluggable transport, including
|
|
13
|
+
* features like request/response linking, notifications, and progress.
|
|
14
|
+
*/
|
|
15
|
+
var Protocol = class {
|
|
16
|
+
constructor(_options) {
|
|
17
|
+
this._options = _options;
|
|
18
|
+
this._requestMessageId = 0;
|
|
19
|
+
this._requestHandlers = /* @__PURE__ */ new Map();
|
|
20
|
+
this._requestHandlerAbortControllers = /* @__PURE__ */ new Map();
|
|
21
|
+
this._notificationHandlers = /* @__PURE__ */ new Map();
|
|
22
|
+
this._responseHandlers = /* @__PURE__ */ new Map();
|
|
23
|
+
this._progressHandlers = /* @__PURE__ */ new Map();
|
|
24
|
+
this._timeoutInfo = /* @__PURE__ */ new Map();
|
|
25
|
+
this._pendingDebouncedNotifications = /* @__PURE__ */ new Set();
|
|
26
|
+
this._taskProgressTokens = /* @__PURE__ */ new Map();
|
|
27
|
+
this._requestResolvers = /* @__PURE__ */ new Map();
|
|
28
|
+
this.setNotificationHandler(CancelledNotificationSchema, (notification) => {
|
|
29
|
+
this._oncancel(notification);
|
|
30
|
+
});
|
|
31
|
+
this.setNotificationHandler(ProgressNotificationSchema, (notification) => {
|
|
32
|
+
this._onprogress(notification);
|
|
33
|
+
});
|
|
34
|
+
this.setRequestHandler(PingRequestSchema, (_request) => ({}));
|
|
35
|
+
this._taskStore = _options?.taskStore;
|
|
36
|
+
this._taskMessageQueue = _options?.taskMessageQueue;
|
|
37
|
+
if (this._taskStore) {
|
|
38
|
+
this.setRequestHandler(GetTaskRequestSchema, async (request, extra) => {
|
|
39
|
+
const task = await this._taskStore.getTask(request.params.taskId, extra.sessionId);
|
|
40
|
+
if (!task) throw new McpError(ErrorCode.InvalidParams, "Failed to retrieve task: Task not found");
|
|
41
|
+
return { ...task };
|
|
42
|
+
});
|
|
43
|
+
this.setRequestHandler(GetTaskPayloadRequestSchema, async (request, extra) => {
|
|
44
|
+
const handleTaskResult = async () => {
|
|
45
|
+
const taskId = request.params.taskId;
|
|
46
|
+
if (this._taskMessageQueue) {
|
|
47
|
+
let queuedMessage;
|
|
48
|
+
while (queuedMessage = await this._taskMessageQueue.dequeue(taskId, extra.sessionId)) {
|
|
49
|
+
if (queuedMessage.type === "response" || queuedMessage.type === "error") {
|
|
50
|
+
const message = queuedMessage.message;
|
|
51
|
+
const requestId = message.id;
|
|
52
|
+
const resolver = this._requestResolvers.get(requestId);
|
|
53
|
+
if (resolver) {
|
|
54
|
+
this._requestResolvers.delete(requestId);
|
|
55
|
+
if (queuedMessage.type === "response") resolver(message);
|
|
56
|
+
else {
|
|
57
|
+
const errorMessage = message;
|
|
58
|
+
resolver(new McpError(errorMessage.error.code, errorMessage.error.message, errorMessage.error.data));
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
const messageType = queuedMessage.type === "response" ? "Response" : "Error";
|
|
62
|
+
this._onerror(/* @__PURE__ */ new Error(`${messageType} handler missing for request ${requestId}`));
|
|
63
|
+
}
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
await this._transport?.send(queuedMessage.message, { relatedRequestId: extra.requestId });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const task = await this._taskStore.getTask(taskId, extra.sessionId);
|
|
70
|
+
if (!task) throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
|
|
71
|
+
if (!isTerminal(task.status)) {
|
|
72
|
+
await this._waitForTaskUpdate(taskId, extra.signal);
|
|
73
|
+
return await handleTaskResult();
|
|
74
|
+
}
|
|
75
|
+
if (isTerminal(task.status)) {
|
|
76
|
+
const result = await this._taskStore.getTaskResult(taskId, extra.sessionId);
|
|
77
|
+
this._clearTaskQueue(taskId);
|
|
78
|
+
return {
|
|
79
|
+
...result,
|
|
80
|
+
_meta: {
|
|
81
|
+
...result._meta,
|
|
82
|
+
[RELATED_TASK_META_KEY]: { taskId }
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
return await handleTaskResult();
|
|
87
|
+
};
|
|
88
|
+
return await handleTaskResult();
|
|
89
|
+
});
|
|
90
|
+
this.setRequestHandler(ListTasksRequestSchema, async (request, extra) => {
|
|
91
|
+
try {
|
|
92
|
+
const { tasks, nextCursor } = await this._taskStore.listTasks(request.params?.cursor, extra.sessionId);
|
|
93
|
+
return {
|
|
94
|
+
tasks,
|
|
95
|
+
nextCursor,
|
|
96
|
+
_meta: {}
|
|
97
|
+
};
|
|
98
|
+
} catch (error) {
|
|
99
|
+
throw new McpError(ErrorCode.InvalidParams, `Failed to list tasks: ${error instanceof Error ? error.message : String(error)}`);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
this.setRequestHandler(CancelTaskRequestSchema, async (request, extra) => {
|
|
103
|
+
try {
|
|
104
|
+
const task = await this._taskStore.getTask(request.params.taskId, extra.sessionId);
|
|
105
|
+
if (!task) throw new McpError(ErrorCode.InvalidParams, `Task not found: ${request.params.taskId}`);
|
|
106
|
+
if (isTerminal(task.status)) throw new McpError(ErrorCode.InvalidParams, `Cannot cancel task in terminal status: ${task.status}`);
|
|
107
|
+
await this._taskStore.updateTaskStatus(request.params.taskId, "cancelled", "Client cancelled task execution.", extra.sessionId);
|
|
108
|
+
this._clearTaskQueue(request.params.taskId);
|
|
109
|
+
const cancelledTask = await this._taskStore.getTask(request.params.taskId, extra.sessionId);
|
|
110
|
+
if (!cancelledTask) throw new McpError(ErrorCode.InvalidParams, `Task not found after cancellation: ${request.params.taskId}`);
|
|
111
|
+
return {
|
|
112
|
+
_meta: {},
|
|
113
|
+
...cancelledTask
|
|
114
|
+
};
|
|
115
|
+
} catch (error) {
|
|
116
|
+
if (error instanceof McpError) throw error;
|
|
117
|
+
throw new McpError(ErrorCode.InvalidRequest, `Failed to cancel task: ${error instanceof Error ? error.message : String(error)}`);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
async _oncancel(notification) {
|
|
123
|
+
if (!notification.params.requestId) return;
|
|
124
|
+
this._requestHandlerAbortControllers.get(notification.params.requestId)?.abort(notification.params.reason);
|
|
125
|
+
}
|
|
126
|
+
_setupTimeout(messageId, timeout, maxTotalTimeout, onTimeout, resetTimeoutOnProgress = false) {
|
|
127
|
+
this._timeoutInfo.set(messageId, {
|
|
128
|
+
timeoutId: setTimeout(onTimeout, timeout),
|
|
129
|
+
startTime: Date.now(),
|
|
130
|
+
timeout,
|
|
131
|
+
maxTotalTimeout,
|
|
132
|
+
resetTimeoutOnProgress,
|
|
133
|
+
onTimeout
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
_resetTimeout(messageId) {
|
|
137
|
+
const info = this._timeoutInfo.get(messageId);
|
|
138
|
+
if (!info) return false;
|
|
139
|
+
const totalElapsed = Date.now() - info.startTime;
|
|
140
|
+
if (info.maxTotalTimeout && totalElapsed >= info.maxTotalTimeout) {
|
|
141
|
+
this._timeoutInfo.delete(messageId);
|
|
142
|
+
throw McpError.fromError(ErrorCode.RequestTimeout, "Maximum total timeout exceeded", {
|
|
143
|
+
maxTotalTimeout: info.maxTotalTimeout,
|
|
144
|
+
totalElapsed
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
clearTimeout(info.timeoutId);
|
|
148
|
+
info.timeoutId = setTimeout(info.onTimeout, info.timeout);
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
_cleanupTimeout(messageId) {
|
|
152
|
+
const info = this._timeoutInfo.get(messageId);
|
|
153
|
+
if (info) {
|
|
154
|
+
clearTimeout(info.timeoutId);
|
|
155
|
+
this._timeoutInfo.delete(messageId);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Attaches to the given transport, starts it, and starts listening for messages.
|
|
160
|
+
*
|
|
161
|
+
* 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.
|
|
162
|
+
*/
|
|
163
|
+
async connect(transport) {
|
|
164
|
+
if (this._transport) throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");
|
|
165
|
+
this._transport = transport;
|
|
166
|
+
const _onclose = this.transport?.onclose;
|
|
167
|
+
this._transport.onclose = () => {
|
|
168
|
+
_onclose?.();
|
|
169
|
+
this._onclose();
|
|
170
|
+
};
|
|
171
|
+
const _onerror = this.transport?.onerror;
|
|
172
|
+
this._transport.onerror = (error) => {
|
|
173
|
+
_onerror?.(error);
|
|
174
|
+
this._onerror(error);
|
|
175
|
+
};
|
|
176
|
+
const _onmessage = this._transport?.onmessage;
|
|
177
|
+
this._transport.onmessage = (message, extra) => {
|
|
178
|
+
_onmessage?.(message, extra);
|
|
179
|
+
if (isJSONRPCResultResponse(message) || isJSONRPCErrorResponse(message)) this._onresponse(message);
|
|
180
|
+
else if (isJSONRPCRequest(message)) this._onrequest(message, extra);
|
|
181
|
+
else if (isJSONRPCNotification(message)) this._onnotification(message);
|
|
182
|
+
else this._onerror(/* @__PURE__ */ new Error(`Unknown message type: ${JSON.stringify(message)}`));
|
|
183
|
+
};
|
|
184
|
+
await this._transport.start();
|
|
185
|
+
}
|
|
186
|
+
_onclose() {
|
|
187
|
+
const responseHandlers = this._responseHandlers;
|
|
188
|
+
this._responseHandlers = /* @__PURE__ */ new Map();
|
|
189
|
+
this._progressHandlers.clear();
|
|
190
|
+
this._taskProgressTokens.clear();
|
|
191
|
+
this._pendingDebouncedNotifications.clear();
|
|
192
|
+
for (const controller of this._requestHandlerAbortControllers.values()) controller.abort();
|
|
193
|
+
this._requestHandlerAbortControllers.clear();
|
|
194
|
+
const error = McpError.fromError(ErrorCode.ConnectionClosed, "Connection closed");
|
|
195
|
+
this._transport = void 0;
|
|
196
|
+
this.onclose?.();
|
|
197
|
+
for (const handler of responseHandlers.values()) handler(error);
|
|
198
|
+
}
|
|
199
|
+
_onerror(error) {
|
|
200
|
+
this.onerror?.(error);
|
|
201
|
+
}
|
|
202
|
+
_onnotification(notification) {
|
|
203
|
+
const handler = this._notificationHandlers.get(notification.method) ?? this.fallbackNotificationHandler;
|
|
204
|
+
if (handler === void 0) return;
|
|
205
|
+
Promise.resolve().then(() => handler(notification)).catch((error) => this._onerror(/* @__PURE__ */ new Error(`Uncaught error in notification handler: ${error}`)));
|
|
206
|
+
}
|
|
207
|
+
_onrequest(request, extra) {
|
|
208
|
+
const handler = this._requestHandlers.get(request.method) ?? this.fallbackRequestHandler;
|
|
209
|
+
const capturedTransport = this._transport;
|
|
210
|
+
const relatedTaskId = request.params?._meta?.[RELATED_TASK_META_KEY]?.taskId;
|
|
211
|
+
if (handler === void 0) {
|
|
212
|
+
const errorResponse = {
|
|
213
|
+
jsonrpc: "2.0",
|
|
214
|
+
id: request.id,
|
|
215
|
+
error: {
|
|
216
|
+
code: ErrorCode.MethodNotFound,
|
|
217
|
+
message: "Method not found"
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
if (relatedTaskId && this._taskMessageQueue) this._enqueueTaskMessage(relatedTaskId, {
|
|
221
|
+
type: "error",
|
|
222
|
+
message: errorResponse,
|
|
223
|
+
timestamp: Date.now()
|
|
224
|
+
}, capturedTransport?.sessionId).catch((error) => this._onerror(/* @__PURE__ */ new Error(`Failed to enqueue error response: ${error}`)));
|
|
225
|
+
else capturedTransport?.send(errorResponse).catch((error) => this._onerror(/* @__PURE__ */ new Error(`Failed to send an error response: ${error}`)));
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const abortController = new AbortController();
|
|
229
|
+
this._requestHandlerAbortControllers.set(request.id, abortController);
|
|
230
|
+
const taskCreationParams = isTaskAugmentedRequestParams(request.params) ? request.params.task : void 0;
|
|
231
|
+
const taskStore = this._taskStore ? this.requestTaskStore(request, capturedTransport?.sessionId) : void 0;
|
|
232
|
+
const fullExtra = {
|
|
233
|
+
signal: abortController.signal,
|
|
234
|
+
sessionId: capturedTransport?.sessionId,
|
|
235
|
+
_meta: request.params?._meta,
|
|
236
|
+
sendNotification: async (notification) => {
|
|
237
|
+
if (abortController.signal.aborted) return;
|
|
238
|
+
const notificationOptions = { relatedRequestId: request.id };
|
|
239
|
+
if (relatedTaskId) notificationOptions.relatedTask = { taskId: relatedTaskId };
|
|
240
|
+
await this.notification(notification, notificationOptions);
|
|
241
|
+
},
|
|
242
|
+
sendRequest: async (r, resultSchema, options) => {
|
|
243
|
+
if (abortController.signal.aborted) throw new McpError(ErrorCode.ConnectionClosed, "Request was cancelled");
|
|
244
|
+
const requestOptions = {
|
|
245
|
+
...options,
|
|
246
|
+
relatedRequestId: request.id
|
|
247
|
+
};
|
|
248
|
+
if (relatedTaskId && !requestOptions.relatedTask) requestOptions.relatedTask = { taskId: relatedTaskId };
|
|
249
|
+
const effectiveTaskId = requestOptions.relatedTask?.taskId ?? relatedTaskId;
|
|
250
|
+
if (effectiveTaskId && taskStore) await taskStore.updateTaskStatus(effectiveTaskId, "input_required");
|
|
251
|
+
return await this.request(r, resultSchema, requestOptions);
|
|
252
|
+
},
|
|
253
|
+
authInfo: extra?.authInfo,
|
|
254
|
+
requestId: request.id,
|
|
255
|
+
requestInfo: extra?.requestInfo,
|
|
256
|
+
taskId: relatedTaskId,
|
|
257
|
+
taskStore,
|
|
258
|
+
taskRequestedTtl: taskCreationParams?.ttl,
|
|
259
|
+
closeSSEStream: extra?.closeSSEStream,
|
|
260
|
+
closeStandaloneSSEStream: extra?.closeStandaloneSSEStream
|
|
261
|
+
};
|
|
262
|
+
Promise.resolve().then(() => {
|
|
263
|
+
if (taskCreationParams) this.assertTaskHandlerCapability(request.method);
|
|
264
|
+
}).then(() => handler(request, fullExtra)).then(async (result) => {
|
|
265
|
+
if (abortController.signal.aborted) return;
|
|
266
|
+
const response = {
|
|
267
|
+
result,
|
|
268
|
+
jsonrpc: "2.0",
|
|
269
|
+
id: request.id
|
|
270
|
+
};
|
|
271
|
+
if (relatedTaskId && this._taskMessageQueue) await this._enqueueTaskMessage(relatedTaskId, {
|
|
272
|
+
type: "response",
|
|
273
|
+
message: response,
|
|
274
|
+
timestamp: Date.now()
|
|
275
|
+
}, capturedTransport?.sessionId);
|
|
276
|
+
else await capturedTransport?.send(response);
|
|
277
|
+
}, async (error) => {
|
|
278
|
+
if (abortController.signal.aborted) return;
|
|
279
|
+
const errorResponse = {
|
|
280
|
+
jsonrpc: "2.0",
|
|
281
|
+
id: request.id,
|
|
282
|
+
error: {
|
|
283
|
+
code: Number.isSafeInteger(error["code"]) ? error["code"] : ErrorCode.InternalError,
|
|
284
|
+
message: error.message ?? "Internal error",
|
|
285
|
+
...error["data"] !== void 0 && { data: error["data"] }
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
if (relatedTaskId && this._taskMessageQueue) await this._enqueueTaskMessage(relatedTaskId, {
|
|
289
|
+
type: "error",
|
|
290
|
+
message: errorResponse,
|
|
291
|
+
timestamp: Date.now()
|
|
292
|
+
}, capturedTransport?.sessionId);
|
|
293
|
+
else await capturedTransport?.send(errorResponse);
|
|
294
|
+
}).catch((error) => this._onerror(/* @__PURE__ */ new Error(`Failed to send response: ${error}`))).finally(() => {
|
|
295
|
+
this._requestHandlerAbortControllers.delete(request.id);
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
_onprogress(notification) {
|
|
299
|
+
const { progressToken, ...params } = notification.params;
|
|
300
|
+
const messageId = Number(progressToken);
|
|
301
|
+
const handler = this._progressHandlers.get(messageId);
|
|
302
|
+
if (!handler) {
|
|
303
|
+
this._onerror(/* @__PURE__ */ new Error(`Received a progress notification for an unknown token: ${JSON.stringify(notification)}`));
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
const responseHandler = this._responseHandlers.get(messageId);
|
|
307
|
+
const timeoutInfo = this._timeoutInfo.get(messageId);
|
|
308
|
+
if (timeoutInfo && responseHandler && timeoutInfo.resetTimeoutOnProgress) try {
|
|
309
|
+
this._resetTimeout(messageId);
|
|
310
|
+
} catch (error) {
|
|
311
|
+
this._responseHandlers.delete(messageId);
|
|
312
|
+
this._progressHandlers.delete(messageId);
|
|
313
|
+
this._cleanupTimeout(messageId);
|
|
314
|
+
responseHandler(error);
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
handler(params);
|
|
318
|
+
}
|
|
319
|
+
_onresponse(response) {
|
|
320
|
+
const messageId = Number(response.id);
|
|
321
|
+
const resolver = this._requestResolvers.get(messageId);
|
|
322
|
+
if (resolver) {
|
|
323
|
+
this._requestResolvers.delete(messageId);
|
|
324
|
+
if (isJSONRPCResultResponse(response)) resolver(response);
|
|
325
|
+
else resolver(new McpError(response.error.code, response.error.message, response.error.data));
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
const handler = this._responseHandlers.get(messageId);
|
|
329
|
+
if (handler === void 0) {
|
|
330
|
+
this._onerror(/* @__PURE__ */ new Error(`Received a response for an unknown message ID: ${JSON.stringify(response)}`));
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
this._responseHandlers.delete(messageId);
|
|
334
|
+
this._cleanupTimeout(messageId);
|
|
335
|
+
let isTaskResponse = false;
|
|
336
|
+
if (isJSONRPCResultResponse(response) && response.result && typeof response.result === "object") {
|
|
337
|
+
const result = response.result;
|
|
338
|
+
if (result.task && typeof result.task === "object") {
|
|
339
|
+
const task = result.task;
|
|
340
|
+
if (typeof task.taskId === "string") {
|
|
341
|
+
isTaskResponse = true;
|
|
342
|
+
this._taskProgressTokens.set(task.taskId, messageId);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
if (!isTaskResponse) this._progressHandlers.delete(messageId);
|
|
347
|
+
if (isJSONRPCResultResponse(response)) handler(response);
|
|
348
|
+
else handler(McpError.fromError(response.error.code, response.error.message, response.error.data));
|
|
349
|
+
}
|
|
350
|
+
get transport() {
|
|
351
|
+
return this._transport;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Closes the connection.
|
|
355
|
+
*/
|
|
356
|
+
async close() {
|
|
357
|
+
await this._transport?.close();
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Sends a request and returns an AsyncGenerator that yields response messages.
|
|
361
|
+
* The generator is guaranteed to end with either a 'result' or 'error' message.
|
|
362
|
+
*
|
|
363
|
+
* @example
|
|
364
|
+
* ```typescript
|
|
365
|
+
* const stream = protocol.requestStream(request, resultSchema, options);
|
|
366
|
+
* for await (const message of stream) {
|
|
367
|
+
* switch (message.type) {
|
|
368
|
+
* case 'taskCreated':
|
|
369
|
+
* console.log('Task created:', message.task.taskId);
|
|
370
|
+
* break;
|
|
371
|
+
* case 'taskStatus':
|
|
372
|
+
* console.log('Task status:', message.task.status);
|
|
373
|
+
* break;
|
|
374
|
+
* case 'result':
|
|
375
|
+
* console.log('Final result:', message.result);
|
|
376
|
+
* break;
|
|
377
|
+
* case 'error':
|
|
378
|
+
* console.error('Error:', message.error);
|
|
379
|
+
* break;
|
|
380
|
+
* }
|
|
381
|
+
* }
|
|
382
|
+
* ```
|
|
383
|
+
*
|
|
384
|
+
* @experimental Use `client.experimental.tasks.requestStream()` to access this method.
|
|
385
|
+
*/
|
|
386
|
+
async *requestStream(request, resultSchema, options) {
|
|
387
|
+
const { task } = options ?? {};
|
|
388
|
+
if (!task) {
|
|
389
|
+
try {
|
|
390
|
+
yield {
|
|
391
|
+
type: "result",
|
|
392
|
+
result: await this.request(request, resultSchema, options)
|
|
393
|
+
};
|
|
394
|
+
} catch (error) {
|
|
395
|
+
yield {
|
|
396
|
+
type: "error",
|
|
397
|
+
error: error instanceof McpError ? error : new McpError(ErrorCode.InternalError, String(error))
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
let taskId;
|
|
403
|
+
try {
|
|
404
|
+
const createResult = await this.request(request, CreateTaskResultSchema, options);
|
|
405
|
+
if (createResult.task) {
|
|
406
|
+
taskId = createResult.task.taskId;
|
|
407
|
+
yield {
|
|
408
|
+
type: "taskCreated",
|
|
409
|
+
task: createResult.task
|
|
410
|
+
};
|
|
411
|
+
} else throw new McpError(ErrorCode.InternalError, "Task creation did not return a task");
|
|
412
|
+
while (true) {
|
|
413
|
+
const task$1 = await this.getTask({ taskId }, options);
|
|
414
|
+
yield {
|
|
415
|
+
type: "taskStatus",
|
|
416
|
+
task: task$1
|
|
417
|
+
};
|
|
418
|
+
if (isTerminal(task$1.status)) {
|
|
419
|
+
if (task$1.status === "completed") yield {
|
|
420
|
+
type: "result",
|
|
421
|
+
result: await this.getTaskResult({ taskId }, resultSchema, options)
|
|
422
|
+
};
|
|
423
|
+
else if (task$1.status === "failed") yield {
|
|
424
|
+
type: "error",
|
|
425
|
+
error: new McpError(ErrorCode.InternalError, `Task ${taskId} failed`)
|
|
426
|
+
};
|
|
427
|
+
else if (task$1.status === "cancelled") yield {
|
|
428
|
+
type: "error",
|
|
429
|
+
error: new McpError(ErrorCode.InternalError, `Task ${taskId} was cancelled`)
|
|
430
|
+
};
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
if (task$1.status === "input_required") {
|
|
434
|
+
yield {
|
|
435
|
+
type: "result",
|
|
436
|
+
result: await this.getTaskResult({ taskId }, resultSchema, options)
|
|
437
|
+
};
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
const pollInterval = task$1.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
|
|
441
|
+
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
442
|
+
options?.signal?.throwIfAborted();
|
|
443
|
+
}
|
|
444
|
+
} catch (error) {
|
|
445
|
+
yield {
|
|
446
|
+
type: "error",
|
|
447
|
+
error: error instanceof McpError ? error : new McpError(ErrorCode.InternalError, String(error))
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Sends a request and waits for a response.
|
|
453
|
+
*
|
|
454
|
+
* Do not use this method to emit notifications! Use notification() instead.
|
|
455
|
+
*/
|
|
456
|
+
request(request, resultSchema, options) {
|
|
457
|
+
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
458
|
+
return new Promise((resolve, reject) => {
|
|
459
|
+
const earlyReject = (error) => {
|
|
460
|
+
reject(error);
|
|
461
|
+
};
|
|
462
|
+
if (!this._transport) {
|
|
463
|
+
earlyReject(/* @__PURE__ */ new Error("Not connected"));
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
if (this._options?.enforceStrictCapabilities === true) try {
|
|
467
|
+
this.assertCapabilityForMethod(request.method);
|
|
468
|
+
if (task) this.assertTaskCapability(request.method);
|
|
469
|
+
} catch (e) {
|
|
470
|
+
earlyReject(e);
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
options?.signal?.throwIfAborted();
|
|
474
|
+
const messageId = this._requestMessageId++;
|
|
475
|
+
const jsonrpcRequest = {
|
|
476
|
+
...request,
|
|
477
|
+
jsonrpc: "2.0",
|
|
478
|
+
id: messageId
|
|
479
|
+
};
|
|
480
|
+
if (options?.onprogress) {
|
|
481
|
+
this._progressHandlers.set(messageId, options.onprogress);
|
|
482
|
+
jsonrpcRequest.params = {
|
|
483
|
+
...request.params,
|
|
484
|
+
_meta: {
|
|
485
|
+
...request.params?._meta || {},
|
|
486
|
+
progressToken: messageId
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
if (task) jsonrpcRequest.params = {
|
|
491
|
+
...jsonrpcRequest.params,
|
|
492
|
+
task
|
|
493
|
+
};
|
|
494
|
+
if (relatedTask) jsonrpcRequest.params = {
|
|
495
|
+
...jsonrpcRequest.params,
|
|
496
|
+
_meta: {
|
|
497
|
+
...jsonrpcRequest.params?._meta || {},
|
|
498
|
+
[RELATED_TASK_META_KEY]: relatedTask
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
const cancel = (reason) => {
|
|
502
|
+
this._responseHandlers.delete(messageId);
|
|
503
|
+
this._progressHandlers.delete(messageId);
|
|
504
|
+
this._cleanupTimeout(messageId);
|
|
505
|
+
this._transport?.send({
|
|
506
|
+
jsonrpc: "2.0",
|
|
507
|
+
method: "notifications/cancelled",
|
|
508
|
+
params: {
|
|
509
|
+
requestId: messageId,
|
|
510
|
+
reason: String(reason)
|
|
511
|
+
}
|
|
512
|
+
}, {
|
|
513
|
+
relatedRequestId,
|
|
514
|
+
resumptionToken,
|
|
515
|
+
onresumptiontoken
|
|
516
|
+
}).catch((error) => this._onerror(/* @__PURE__ */ new Error(`Failed to send cancellation: ${error}`)));
|
|
517
|
+
reject(reason instanceof McpError ? reason : new McpError(ErrorCode.RequestTimeout, String(reason)));
|
|
518
|
+
};
|
|
519
|
+
this._responseHandlers.set(messageId, (response) => {
|
|
520
|
+
if (options?.signal?.aborted) return;
|
|
521
|
+
if (response instanceof Error) return reject(response);
|
|
522
|
+
try {
|
|
523
|
+
const parseResult = safeParse(resultSchema, response.result);
|
|
524
|
+
if (!parseResult.success) reject(parseResult.error);
|
|
525
|
+
else resolve(parseResult.data);
|
|
526
|
+
} catch (error) {
|
|
527
|
+
reject(error);
|
|
528
|
+
}
|
|
529
|
+
});
|
|
530
|
+
options?.signal?.addEventListener("abort", () => {
|
|
531
|
+
cancel(options?.signal?.reason);
|
|
532
|
+
});
|
|
533
|
+
const timeout = options?.timeout ?? DEFAULT_REQUEST_TIMEOUT_MSEC;
|
|
534
|
+
const timeoutHandler = () => cancel(McpError.fromError(ErrorCode.RequestTimeout, "Request timed out", { timeout }));
|
|
535
|
+
this._setupTimeout(messageId, timeout, options?.maxTotalTimeout, timeoutHandler, options?.resetTimeoutOnProgress ?? false);
|
|
536
|
+
const relatedTaskId = relatedTask?.taskId;
|
|
537
|
+
if (relatedTaskId) {
|
|
538
|
+
const responseResolver = (response) => {
|
|
539
|
+
const handler = this._responseHandlers.get(messageId);
|
|
540
|
+
if (handler) handler(response);
|
|
541
|
+
else this._onerror(/* @__PURE__ */ new Error(`Response handler missing for side-channeled request ${messageId}`));
|
|
542
|
+
};
|
|
543
|
+
this._requestResolvers.set(messageId, responseResolver);
|
|
544
|
+
this._enqueueTaskMessage(relatedTaskId, {
|
|
545
|
+
type: "request",
|
|
546
|
+
message: jsonrpcRequest,
|
|
547
|
+
timestamp: Date.now()
|
|
548
|
+
}).catch((error) => {
|
|
549
|
+
this._cleanupTimeout(messageId);
|
|
550
|
+
reject(error);
|
|
551
|
+
});
|
|
552
|
+
} else this._transport.send(jsonrpcRequest, {
|
|
553
|
+
relatedRequestId,
|
|
554
|
+
resumptionToken,
|
|
555
|
+
onresumptiontoken
|
|
556
|
+
}).catch((error) => {
|
|
557
|
+
this._cleanupTimeout(messageId);
|
|
558
|
+
reject(error);
|
|
559
|
+
});
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Gets the current status of a task.
|
|
564
|
+
*
|
|
565
|
+
* @experimental Use `client.experimental.tasks.getTask()` to access this method.
|
|
566
|
+
*/
|
|
567
|
+
async getTask(params, options) {
|
|
568
|
+
return this.request({
|
|
569
|
+
method: "tasks/get",
|
|
570
|
+
params
|
|
571
|
+
}, GetTaskResultSchema, options);
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Retrieves the result of a completed task.
|
|
575
|
+
*
|
|
576
|
+
* @experimental Use `client.experimental.tasks.getTaskResult()` to access this method.
|
|
577
|
+
*/
|
|
578
|
+
async getTaskResult(params, resultSchema, options) {
|
|
579
|
+
return this.request({
|
|
580
|
+
method: "tasks/result",
|
|
581
|
+
params
|
|
582
|
+
}, resultSchema, options);
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Lists tasks, optionally starting from a pagination cursor.
|
|
586
|
+
*
|
|
587
|
+
* @experimental Use `client.experimental.tasks.listTasks()` to access this method.
|
|
588
|
+
*/
|
|
589
|
+
async listTasks(params, options) {
|
|
590
|
+
return this.request({
|
|
591
|
+
method: "tasks/list",
|
|
592
|
+
params
|
|
593
|
+
}, ListTasksResultSchema, options);
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Cancels a specific task.
|
|
597
|
+
*
|
|
598
|
+
* @experimental Use `client.experimental.tasks.cancelTask()` to access this method.
|
|
599
|
+
*/
|
|
600
|
+
async cancelTask(params, options) {
|
|
601
|
+
return this.request({
|
|
602
|
+
method: "tasks/cancel",
|
|
603
|
+
params
|
|
604
|
+
}, CancelTaskResultSchema, options);
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Emits a notification, which is a one-way message that does not expect a response.
|
|
608
|
+
*/
|
|
609
|
+
async notification(notification, options) {
|
|
610
|
+
if (!this._transport) throw new Error("Not connected");
|
|
611
|
+
this.assertNotificationCapability(notification.method);
|
|
612
|
+
const relatedTaskId = options?.relatedTask?.taskId;
|
|
613
|
+
if (relatedTaskId) {
|
|
614
|
+
const jsonrpcNotification$1 = {
|
|
615
|
+
...notification,
|
|
616
|
+
jsonrpc: "2.0",
|
|
617
|
+
params: {
|
|
618
|
+
...notification.params,
|
|
619
|
+
_meta: {
|
|
620
|
+
...notification.params?._meta || {},
|
|
621
|
+
[RELATED_TASK_META_KEY]: options.relatedTask
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
};
|
|
625
|
+
await this._enqueueTaskMessage(relatedTaskId, {
|
|
626
|
+
type: "notification",
|
|
627
|
+
message: jsonrpcNotification$1,
|
|
628
|
+
timestamp: Date.now()
|
|
629
|
+
});
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
if ((this._options?.debouncedNotificationMethods ?? []).includes(notification.method) && !notification.params && !options?.relatedRequestId && !options?.relatedTask) {
|
|
633
|
+
if (this._pendingDebouncedNotifications.has(notification.method)) return;
|
|
634
|
+
this._pendingDebouncedNotifications.add(notification.method);
|
|
635
|
+
Promise.resolve().then(() => {
|
|
636
|
+
this._pendingDebouncedNotifications.delete(notification.method);
|
|
637
|
+
if (!this._transport) return;
|
|
638
|
+
let jsonrpcNotification$1 = {
|
|
639
|
+
...notification,
|
|
640
|
+
jsonrpc: "2.0"
|
|
641
|
+
};
|
|
642
|
+
if (options?.relatedTask) jsonrpcNotification$1 = {
|
|
643
|
+
...jsonrpcNotification$1,
|
|
644
|
+
params: {
|
|
645
|
+
...jsonrpcNotification$1.params,
|
|
646
|
+
_meta: {
|
|
647
|
+
...jsonrpcNotification$1.params?._meta || {},
|
|
648
|
+
[RELATED_TASK_META_KEY]: options.relatedTask
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
};
|
|
652
|
+
this._transport?.send(jsonrpcNotification$1, options).catch((error) => this._onerror(error));
|
|
653
|
+
});
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
let jsonrpcNotification = {
|
|
657
|
+
...notification,
|
|
658
|
+
jsonrpc: "2.0"
|
|
659
|
+
};
|
|
660
|
+
if (options?.relatedTask) jsonrpcNotification = {
|
|
661
|
+
...jsonrpcNotification,
|
|
662
|
+
params: {
|
|
663
|
+
...jsonrpcNotification.params,
|
|
664
|
+
_meta: {
|
|
665
|
+
...jsonrpcNotification.params?._meta || {},
|
|
666
|
+
[RELATED_TASK_META_KEY]: options.relatedTask
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
};
|
|
670
|
+
await this._transport.send(jsonrpcNotification, options);
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* Registers a handler to invoke when this protocol object receives a request with the given method.
|
|
674
|
+
*
|
|
675
|
+
* Note that this will replace any previous request handler for the same method.
|
|
676
|
+
*/
|
|
677
|
+
setRequestHandler(requestSchema, handler) {
|
|
678
|
+
const method = getMethodLiteral(requestSchema);
|
|
679
|
+
this.assertRequestHandlerCapability(method);
|
|
680
|
+
this._requestHandlers.set(method, (request, extra) => {
|
|
681
|
+
const parsed = parseWithCompat(requestSchema, request);
|
|
682
|
+
return Promise.resolve(handler(parsed, extra));
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Removes the request handler for the given method.
|
|
687
|
+
*/
|
|
688
|
+
removeRequestHandler(method) {
|
|
689
|
+
this._requestHandlers.delete(method);
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* Asserts that a request handler has not already been set for the given method, in preparation for a new one being automatically installed.
|
|
693
|
+
*/
|
|
694
|
+
assertCanSetRequestHandler(method) {
|
|
695
|
+
if (this._requestHandlers.has(method)) throw new Error(`A request handler for ${method} already exists, which would be overridden`);
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Registers a handler to invoke when this protocol object receives a notification with the given method.
|
|
699
|
+
*
|
|
700
|
+
* Note that this will replace any previous notification handler for the same method.
|
|
701
|
+
*/
|
|
702
|
+
setNotificationHandler(notificationSchema, handler) {
|
|
703
|
+
const method = getMethodLiteral(notificationSchema);
|
|
704
|
+
this._notificationHandlers.set(method, (notification) => {
|
|
705
|
+
const parsed = parseWithCompat(notificationSchema, notification);
|
|
706
|
+
return Promise.resolve(handler(parsed));
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* Removes the notification handler for the given method.
|
|
711
|
+
*/
|
|
712
|
+
removeNotificationHandler(method) {
|
|
713
|
+
this._notificationHandlers.delete(method);
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Cleans up the progress handler associated with a task.
|
|
717
|
+
* This should be called when a task reaches a terminal status.
|
|
718
|
+
*/
|
|
719
|
+
_cleanupTaskProgressHandler(taskId) {
|
|
720
|
+
const progressToken = this._taskProgressTokens.get(taskId);
|
|
721
|
+
if (progressToken !== void 0) {
|
|
722
|
+
this._progressHandlers.delete(progressToken);
|
|
723
|
+
this._taskProgressTokens.delete(taskId);
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* Enqueues a task-related message for side-channel delivery via tasks/result.
|
|
728
|
+
* @param taskId The task ID to associate the message with
|
|
729
|
+
* @param message The message to enqueue
|
|
730
|
+
* @param sessionId Optional session ID for binding the operation to a specific session
|
|
731
|
+
* @throws Error if taskStore is not configured or if enqueue fails (e.g., queue overflow)
|
|
732
|
+
*
|
|
733
|
+
* Note: If enqueue fails, it's the TaskMessageQueue implementation's responsibility to handle
|
|
734
|
+
* the error appropriately (e.g., by failing the task, logging, etc.). The Protocol layer
|
|
735
|
+
* simply propagates the error.
|
|
736
|
+
*/
|
|
737
|
+
async _enqueueTaskMessage(taskId, message, sessionId) {
|
|
738
|
+
if (!this._taskStore || !this._taskMessageQueue) throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");
|
|
739
|
+
const maxQueueSize = this._options?.maxTaskQueueSize;
|
|
740
|
+
await this._taskMessageQueue.enqueue(taskId, message, sessionId, maxQueueSize);
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Clears the message queue for a task and rejects any pending request resolvers.
|
|
744
|
+
* @param taskId The task ID whose queue should be cleared
|
|
745
|
+
* @param sessionId Optional session ID for binding the operation to a specific session
|
|
746
|
+
*/
|
|
747
|
+
async _clearTaskQueue(taskId, sessionId) {
|
|
748
|
+
if (this._taskMessageQueue) {
|
|
749
|
+
const messages = await this._taskMessageQueue.dequeueAll(taskId, sessionId);
|
|
750
|
+
for (const message of messages) if (message.type === "request" && isJSONRPCRequest(message.message)) {
|
|
751
|
+
const requestId = message.message.id;
|
|
752
|
+
const resolver = this._requestResolvers.get(requestId);
|
|
753
|
+
if (resolver) {
|
|
754
|
+
resolver(new McpError(ErrorCode.InternalError, "Task cancelled or completed"));
|
|
755
|
+
this._requestResolvers.delete(requestId);
|
|
756
|
+
} else this._onerror(/* @__PURE__ */ new Error(`Resolver missing for request ${requestId} during task ${taskId} cleanup`));
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* Waits for a task update (new messages or status change) with abort signal support.
|
|
762
|
+
* Uses polling to check for updates at the task's configured poll interval.
|
|
763
|
+
* @param taskId The task ID to wait for
|
|
764
|
+
* @param signal Abort signal to cancel the wait
|
|
765
|
+
* @returns Promise that resolves when an update occurs or rejects if aborted
|
|
766
|
+
*/
|
|
767
|
+
async _waitForTaskUpdate(taskId, signal) {
|
|
768
|
+
let interval = this._options?.defaultTaskPollInterval ?? 1e3;
|
|
769
|
+
try {
|
|
770
|
+
const task = await this._taskStore?.getTask(taskId);
|
|
771
|
+
if (task?.pollInterval) interval = task.pollInterval;
|
|
772
|
+
} catch {}
|
|
773
|
+
return new Promise((resolve, reject) => {
|
|
774
|
+
if (signal.aborted) {
|
|
775
|
+
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
778
|
+
const timeoutId = setTimeout(resolve, interval);
|
|
779
|
+
signal.addEventListener("abort", () => {
|
|
780
|
+
clearTimeout(timeoutId);
|
|
781
|
+
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
782
|
+
}, { once: true });
|
|
783
|
+
});
|
|
784
|
+
}
|
|
785
|
+
requestTaskStore(request, sessionId) {
|
|
786
|
+
const taskStore = this._taskStore;
|
|
787
|
+
if (!taskStore) throw new Error("No task store configured");
|
|
788
|
+
return {
|
|
789
|
+
createTask: async (taskParams) => {
|
|
790
|
+
if (!request) throw new Error("No request provided");
|
|
791
|
+
return await taskStore.createTask(taskParams, request.id, {
|
|
792
|
+
method: request.method,
|
|
793
|
+
params: request.params
|
|
794
|
+
}, sessionId);
|
|
795
|
+
},
|
|
796
|
+
getTask: async (taskId) => {
|
|
797
|
+
const task = await taskStore.getTask(taskId, sessionId);
|
|
798
|
+
if (!task) throw new McpError(ErrorCode.InvalidParams, "Failed to retrieve task: Task not found");
|
|
799
|
+
return task;
|
|
800
|
+
},
|
|
801
|
+
storeTaskResult: async (taskId, status, result) => {
|
|
802
|
+
await taskStore.storeTaskResult(taskId, status, result, sessionId);
|
|
803
|
+
const task = await taskStore.getTask(taskId, sessionId);
|
|
804
|
+
if (task) {
|
|
805
|
+
const notification = TaskStatusNotificationSchema.parse({
|
|
806
|
+
method: "notifications/tasks/status",
|
|
807
|
+
params: task
|
|
808
|
+
});
|
|
809
|
+
await this.notification(notification);
|
|
810
|
+
if (isTerminal(task.status)) this._cleanupTaskProgressHandler(taskId);
|
|
811
|
+
}
|
|
812
|
+
},
|
|
813
|
+
getTaskResult: (taskId) => {
|
|
814
|
+
return taskStore.getTaskResult(taskId, sessionId);
|
|
815
|
+
},
|
|
816
|
+
updateTaskStatus: async (taskId, status, statusMessage) => {
|
|
817
|
+
const task = await taskStore.getTask(taskId, sessionId);
|
|
818
|
+
if (!task) throw new McpError(ErrorCode.InvalidParams, `Task "${taskId}" not found - it may have been cleaned up`);
|
|
819
|
+
if (isTerminal(task.status)) throw new McpError(ErrorCode.InvalidParams, `Cannot update task "${taskId}" from terminal status "${task.status}" to "${status}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);
|
|
820
|
+
await taskStore.updateTaskStatus(taskId, status, statusMessage, sessionId);
|
|
821
|
+
const updatedTask = await taskStore.getTask(taskId, sessionId);
|
|
822
|
+
if (updatedTask) {
|
|
823
|
+
const notification = TaskStatusNotificationSchema.parse({
|
|
824
|
+
method: "notifications/tasks/status",
|
|
825
|
+
params: updatedTask
|
|
826
|
+
});
|
|
827
|
+
await this.notification(notification);
|
|
828
|
+
if (isTerminal(updatedTask.status)) this._cleanupTaskProgressHandler(taskId);
|
|
829
|
+
}
|
|
830
|
+
},
|
|
831
|
+
listTasks: (cursor) => {
|
|
832
|
+
return taskStore.listTasks(cursor, sessionId);
|
|
833
|
+
}
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
};
|
|
837
|
+
function isPlainObject(value) {
|
|
838
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
839
|
+
}
|
|
840
|
+
function mergeCapabilities(base, additional) {
|
|
841
|
+
const result = { ...base };
|
|
842
|
+
for (const key in additional) {
|
|
843
|
+
const k = key;
|
|
844
|
+
const addValue = additional[k];
|
|
845
|
+
if (addValue === void 0) continue;
|
|
846
|
+
const baseValue = result[k];
|
|
847
|
+
if (isPlainObject(baseValue) && isPlainObject(addValue)) result[k] = {
|
|
848
|
+
...baseValue,
|
|
849
|
+
...addValue
|
|
850
|
+
};
|
|
851
|
+
else result[k] = addValue;
|
|
852
|
+
}
|
|
853
|
+
return result;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
//#endregion
|
|
857
|
+
export { Protocol, mergeCapabilities };
|
|
858
|
+
//# sourceMappingURL=protocol.js.map
|