@tambo-ai/react 0.67.1 → 0.69.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -5
- package/dist/context-helpers/context-helpers.test.js +16 -4
- package/dist/context-helpers/context-helpers.test.js.map +1 -1
- package/dist/context-helpers/current-interactables-context-helper.d.ts +2 -2
- package/dist/context-helpers/current-interactables-context-helper.d.ts.map +1 -1
- package/dist/context-helpers/current-interactables-context-helper.js +31 -12
- package/dist/context-helpers/current-interactables-context-helper.js.map +1 -1
- package/dist/context-helpers/registry.d.ts +2 -2
- package/dist/context-helpers/registry.d.ts.map +1 -1
- package/dist/context-helpers/registry.js.map +1 -1
- package/dist/context-helpers/types.d.ts +2 -2
- package/dist/context-helpers/types.d.ts.map +1 -1
- package/dist/context-helpers/types.js.map +1 -1
- package/dist/hoc/with-tambo-interactable.d.ts +50 -4
- package/dist/hoc/with-tambo-interactable.d.ts.map +1 -1
- package/dist/hoc/with-tambo-interactable.js +20 -5
- package/dist/hoc/with-tambo-interactable.js.map +1 -1
- package/dist/hooks/use-component-state.d.ts +3 -8
- package/dist/hooks/use-component-state.d.ts.map +1 -1
- package/dist/hooks/use-component-state.js +8 -0
- package/dist/hooks/use-component-state.js.map +1 -1
- package/dist/hooks/use-component-state.test.js +37 -0
- package/dist/hooks/use-component-state.test.js.map +1 -1
- package/dist/hooks/use-message-images.test.js +174 -37
- package/dist/hooks/use-message-images.test.js.map +1 -1
- package/dist/hooks/use-tambo-threads.js +1 -1
- package/dist/hooks/use-tambo-threads.js.map +1 -1
- package/dist/hooks/use-tambo-voice.d.ts +1 -1
- package/dist/hooks/use-tambo-voice.js +1 -1
- package/dist/hooks/use-tambo-voice.js.map +1 -1
- package/dist/hooks/use-tambo-voice.test.d.ts +2 -0
- package/dist/hooks/use-tambo-voice.test.d.ts.map +1 -0
- package/dist/hooks/use-tambo-voice.test.js +239 -0
- package/dist/hooks/use-tambo-voice.test.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/elicitation.d.ts.map +1 -1
- package/dist/mcp/elicitation.js +12 -0
- package/dist/mcp/elicitation.js.map +1 -1
- package/dist/mcp/elicitation.test.js +8 -1
- package/dist/mcp/elicitation.test.js.map +1 -1
- package/dist/mcp/mcp-client.d.ts +6 -10
- package/dist/mcp/mcp-client.d.ts.map +1 -1
- package/dist/mcp/mcp-client.js.map +1 -1
- package/dist/mcp/mcp-constants.d.ts +19 -0
- package/dist/mcp/mcp-constants.d.ts.map +1 -0
- package/dist/mcp/mcp-constants.js +21 -0
- package/dist/mcp/mcp-constants.js.map +1 -0
- package/dist/mcp/mcp-hooks.d.ts +21 -40
- package/dist/mcp/mcp-hooks.d.ts.map +1 -1
- package/dist/mcp/mcp-hooks.js +130 -39
- package/dist/mcp/mcp-hooks.js.map +1 -1
- package/dist/mcp/mcp-hooks.test.js +431 -5
- package/dist/mcp/mcp-hooks.test.js.map +1 -1
- package/dist/mcp/tambo-mcp-provider.d.ts +7 -0
- package/dist/mcp/tambo-mcp-provider.d.ts.map +1 -1
- package/dist/mcp/tambo-mcp-provider.js +205 -155
- package/dist/mcp/tambo-mcp-provider.js.map +1 -1
- package/dist/mcp/tambo-mcp-provider.test.js +37 -0
- package/dist/mcp/tambo-mcp-provider.test.js.map +1 -1
- package/dist/model/component-metadata.d.ts +54 -21
- package/dist/model/component-metadata.d.ts.map +1 -1
- package/dist/model/component-metadata.js.map +1 -1
- package/dist/model/tambo-interactable.d.ts +13 -5
- package/dist/model/tambo-interactable.d.ts.map +1 -1
- package/dist/model/tambo-interactable.js.map +1 -1
- package/dist/providers/__tests__/thread-input-resource-resolution.test.d.ts +2 -0
- package/dist/providers/__tests__/thread-input-resource-resolution.test.d.ts.map +1 -0
- package/dist/providers/__tests__/thread-input-resource-resolution.test.js +592 -0
- package/dist/providers/__tests__/thread-input-resource-resolution.test.js.map +1 -0
- package/dist/providers/index.d.ts +1 -1
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/tambo-client-provider.d.ts +8 -0
- package/dist/providers/tambo-client-provider.d.ts.map +1 -1
- package/dist/providers/tambo-client-provider.js +10 -11
- package/dist/providers/tambo-client-provider.js.map +1 -1
- package/dist/providers/tambo-client-provider.test.d.ts +2 -0
- package/dist/providers/tambo-client-provider.test.d.ts.map +1 -0
- package/dist/providers/tambo-client-provider.test.js +208 -0
- package/dist/providers/tambo-client-provider.test.js.map +1 -0
- package/dist/providers/tambo-context-attachment-provider.d.ts +34 -92
- package/dist/providers/tambo-context-attachment-provider.d.ts.map +1 -1
- package/dist/providers/tambo-context-attachment-provider.js +62 -105
- package/dist/providers/tambo-context-attachment-provider.js.map +1 -1
- package/dist/providers/tambo-context-attachment-provider.test.js +229 -463
- package/dist/providers/tambo-context-attachment-provider.test.js.map +1 -1
- package/dist/providers/tambo-interactable-provider-partial-updates.test.js +22 -21
- package/dist/providers/tambo-interactable-provider-partial-updates.test.js.map +1 -1
- package/dist/providers/tambo-interactable-provider.d.ts +5 -2
- package/dist/providers/tambo-interactable-provider.d.ts.map +1 -1
- package/dist/providers/tambo-interactable-provider.js +126 -17
- package/dist/providers/tambo-interactable-provider.js.map +1 -1
- package/dist/providers/tambo-interactable-provider.test.js +242 -0
- package/dist/providers/tambo-interactable-provider.test.js.map +1 -1
- package/dist/providers/tambo-interactables-additional-context.test.js +2 -5
- package/dist/providers/tambo-interactables-additional-context.test.js.map +1 -1
- package/dist/providers/tambo-provider.d.ts +2 -3
- package/dist/providers/tambo-provider.d.ts.map +1 -1
- package/dist/providers/tambo-provider.js +6 -5
- package/dist/providers/tambo-provider.js.map +1 -1
- package/dist/providers/tambo-registry-provider.test.js +16 -0
- package/dist/providers/tambo-registry-provider.test.js.map +1 -1
- package/dist/providers/tambo-registry-schema-compat.test.js +31 -0
- package/dist/providers/tambo-registry-schema-compat.test.js.map +1 -1
- package/dist/providers/tambo-thread-input-provider.d.ts +1 -1
- package/dist/providers/tambo-thread-input-provider.d.ts.map +1 -1
- package/dist/providers/tambo-thread-input-provider.js +26 -4
- package/dist/providers/tambo-thread-input-provider.js.map +1 -1
- package/dist/providers/tambo-thread-provider-initial-messages.test.js +84 -2
- package/dist/providers/tambo-thread-provider-initial-messages.test.js.map +1 -1
- package/dist/providers/tambo-thread-provider.d.ts.map +1 -1
- package/dist/providers/tambo-thread-provider.js +53 -42
- package/dist/providers/tambo-thread-provider.js.map +1 -1
- package/dist/providers/tambo-thread-provider.test.js +368 -262
- package/dist/providers/tambo-thread-provider.test.js.map +1 -1
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +2 -1
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/json-schema.d.ts +7 -0
- package/dist/schema/json-schema.d.ts.map +1 -1
- package/dist/schema/json-schema.js +40 -29
- package/dist/schema/json-schema.js.map +1 -1
- package/dist/schema/json-schema.test.d.ts +2 -0
- package/dist/schema/json-schema.test.d.ts.map +1 -0
- package/dist/schema/json-schema.test.js +204 -0
- package/dist/schema/json-schema.test.js.map +1 -0
- package/dist/schema/schema.test.js +237 -0
- package/dist/schema/schema.test.js.map +1 -1
- package/dist/schema/standard-schema.d.ts +1 -0
- package/dist/schema/standard-schema.d.ts.map +1 -1
- package/dist/schema/standard-schema.js +18 -13
- package/dist/schema/standard-schema.js.map +1 -1
- package/dist/schema/standard-schema.test.d.ts +2 -0
- package/dist/schema/standard-schema.test.d.ts.map +1 -0
- package/dist/schema/standard-schema.test.js +165 -0
- package/dist/schema/standard-schema.test.js.map +1 -0
- package/dist/schema/validate.test.js +149 -0
- package/dist/schema/validate.test.js.map +1 -1
- package/dist/schema/zod.d.ts +7 -4
- package/dist/schema/zod.d.ts.map +1 -1
- package/dist/schema/zod.js +65 -22
- package/dist/schema/zod.js.map +1 -1
- package/dist/schema/zod.test.js +112 -0
- package/dist/schema/zod.test.js.map +1 -1
- package/dist/setupTests.js +3 -0
- package/dist/setupTests.js.map +1 -1
- package/dist/testing/tools.d.ts +4 -1
- package/dist/testing/tools.d.ts.map +1 -1
- package/dist/testing/tools.js +6 -1
- package/dist/testing/tools.js.map +1 -1
- package/dist/util/generate-component.d.ts.map +1 -1
- package/dist/util/generate-component.js +18 -3
- package/dist/util/generate-component.js.map +1 -1
- package/dist/util/generate-component.test.d.ts +2 -0
- package/dist/util/generate-component.test.d.ts.map +1 -0
- package/dist/util/generate-component.test.js +340 -0
- package/dist/util/generate-component.test.js.map +1 -0
- package/dist/util/is-promise.d.ts +9 -0
- package/dist/util/is-promise.d.ts.map +1 -0
- package/dist/util/is-promise.js +20 -0
- package/dist/util/is-promise.js.map +1 -0
- package/dist/util/is-promise.test.d.ts +2 -0
- package/dist/util/is-promise.test.d.ts.map +1 -0
- package/dist/util/is-promise.test.js +48 -0
- package/dist/util/is-promise.test.js.map +1 -0
- package/dist/util/message-builder.d.ts +3 -1
- package/dist/util/message-builder.d.ts.map +1 -1
- package/dist/util/message-builder.js +20 -3
- package/dist/util/message-builder.js.map +1 -1
- package/dist/util/message-builder.test.js +269 -0
- package/dist/util/message-builder.test.js.map +1 -1
- package/dist/util/query-utils.test.d.ts +2 -0
- package/dist/util/query-utils.test.d.ts.map +1 -0
- package/dist/util/query-utils.test.js +382 -0
- package/dist/util/query-utils.test.js.map +1 -0
- package/dist/util/registry-validators.d.ts.map +1 -1
- package/dist/util/registry-validators.js +7 -0
- package/dist/util/registry-validators.js.map +1 -1
- package/dist/util/registry-validators.test.js +57 -0
- package/dist/util/registry-validators.test.js.map +1 -1
- package/dist/util/registry.d.ts.map +1 -1
- package/dist/util/registry.js +9 -0
- package/dist/util/registry.js.map +1 -1
- package/dist/util/registry.test.js +323 -1
- package/dist/util/registry.test.js.map +1 -1
- package/dist/util/resource-content-resolver.d.ts +20 -0
- package/dist/util/resource-content-resolver.d.ts.map +1 -0
- package/dist/util/resource-content-resolver.js +93 -0
- package/dist/util/resource-content-resolver.js.map +1 -0
- package/dist/util/resource-content-resolver.test.d.ts +2 -0
- package/dist/util/resource-content-resolver.test.d.ts.map +1 -0
- package/dist/util/resource-content-resolver.test.js +254 -0
- package/dist/util/resource-content-resolver.test.js.map +1 -0
- package/dist/util/resource-validators.test.d.ts +2 -0
- package/dist/util/resource-validators.test.d.ts.map +1 -0
- package/dist/util/resource-validators.test.js +90 -0
- package/dist/util/resource-validators.test.js.map +1 -0
- package/dist/util/tool-caller.d.ts +2 -2
- package/dist/util/tool-caller.d.ts.map +1 -1
- package/dist/util/tool-caller.js +8 -8
- package/dist/util/tool-caller.js.map +1 -1
- package/dist/util/validate-component-name.test.d.ts +2 -0
- package/dist/util/validate-component-name.test.d.ts.map +1 -0
- package/dist/util/validate-component-name.test.js +35 -0
- package/dist/util/validate-component-name.test.js.map +1 -0
- package/esm/context-helpers/context-helpers.test.js +16 -4
- package/esm/context-helpers/context-helpers.test.js.map +1 -1
- package/esm/context-helpers/current-interactables-context-helper.d.ts +2 -2
- package/esm/context-helpers/current-interactables-context-helper.d.ts.map +1 -1
- package/esm/context-helpers/current-interactables-context-helper.js +31 -12
- package/esm/context-helpers/current-interactables-context-helper.js.map +1 -1
- package/esm/context-helpers/registry.d.ts +2 -2
- package/esm/context-helpers/registry.d.ts.map +1 -1
- package/esm/context-helpers/registry.js.map +1 -1
- package/esm/context-helpers/types.d.ts +2 -2
- package/esm/context-helpers/types.d.ts.map +1 -1
- package/esm/context-helpers/types.js.map +1 -1
- package/esm/hoc/with-tambo-interactable.d.ts +50 -4
- package/esm/hoc/with-tambo-interactable.d.ts.map +1 -1
- package/esm/hoc/with-tambo-interactable.js +20 -5
- package/esm/hoc/with-tambo-interactable.js.map +1 -1
- package/esm/hooks/use-component-state.d.ts +3 -8
- package/esm/hooks/use-component-state.d.ts.map +1 -1
- package/esm/hooks/use-component-state.js +8 -0
- package/esm/hooks/use-component-state.js.map +1 -1
- package/esm/hooks/use-component-state.test.js +37 -0
- package/esm/hooks/use-component-state.test.js.map +1 -1
- package/esm/hooks/use-message-images.test.js +174 -37
- package/esm/hooks/use-message-images.test.js.map +1 -1
- package/esm/hooks/use-tambo-threads.js +1 -1
- package/esm/hooks/use-tambo-threads.js.map +1 -1
- package/esm/hooks/use-tambo-voice.d.ts +1 -1
- package/esm/hooks/use-tambo-voice.js +1 -1
- package/esm/hooks/use-tambo-voice.js.map +1 -1
- package/esm/hooks/use-tambo-voice.test.d.ts +2 -0
- package/esm/hooks/use-tambo-voice.test.d.ts.map +1 -0
- package/esm/hooks/use-tambo-voice.test.js +234 -0
- package/esm/hooks/use-tambo-voice.test.js.map +1 -0
- package/esm/index.d.ts +2 -2
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js.map +1 -1
- package/esm/mcp/elicitation.d.ts.map +1 -1
- package/esm/mcp/elicitation.js +12 -0
- package/esm/mcp/elicitation.js.map +1 -1
- package/esm/mcp/elicitation.test.js +8 -1
- package/esm/mcp/elicitation.test.js.map +1 -1
- package/esm/mcp/mcp-client.d.ts +6 -10
- package/esm/mcp/mcp-client.d.ts.map +1 -1
- package/esm/mcp/mcp-client.js.map +1 -1
- package/esm/mcp/mcp-constants.d.ts +19 -0
- package/esm/mcp/mcp-constants.d.ts.map +1 -0
- package/esm/mcp/mcp-constants.js +18 -0
- package/esm/mcp/mcp-constants.js.map +1 -0
- package/esm/mcp/mcp-hooks.d.ts +21 -40
- package/esm/mcp/mcp-hooks.d.ts.map +1 -1
- package/esm/mcp/mcp-hooks.js +97 -40
- package/esm/mcp/mcp-hooks.js.map +1 -1
- package/esm/mcp/mcp-hooks.test.js +431 -5
- package/esm/mcp/mcp-hooks.test.js.map +1 -1
- package/esm/mcp/tambo-mcp-provider.d.ts +7 -0
- package/esm/mcp/tambo-mcp-provider.d.ts.map +1 -1
- package/esm/mcp/tambo-mcp-provider.js +204 -154
- package/esm/mcp/tambo-mcp-provider.js.map +1 -1
- package/esm/mcp/tambo-mcp-provider.test.js +37 -0
- package/esm/mcp/tambo-mcp-provider.test.js.map +1 -1
- package/esm/model/component-metadata.d.ts +54 -21
- package/esm/model/component-metadata.d.ts.map +1 -1
- package/esm/model/component-metadata.js.map +1 -1
- package/esm/model/tambo-interactable.d.ts +13 -5
- package/esm/model/tambo-interactable.d.ts.map +1 -1
- package/esm/model/tambo-interactable.js.map +1 -1
- package/esm/providers/__tests__/thread-input-resource-resolution.test.d.ts +2 -0
- package/esm/providers/__tests__/thread-input-resource-resolution.test.d.ts.map +1 -0
- package/esm/providers/__tests__/thread-input-resource-resolution.test.js +587 -0
- package/esm/providers/__tests__/thread-input-resource-resolution.test.js.map +1 -0
- package/esm/providers/index.d.ts +1 -1
- package/esm/providers/index.d.ts.map +1 -1
- package/esm/providers/index.js.map +1 -1
- package/esm/providers/tambo-client-provider.d.ts +8 -0
- package/esm/providers/tambo-client-provider.d.ts.map +1 -1
- package/esm/providers/tambo-client-provider.js +11 -12
- package/esm/providers/tambo-client-provider.js.map +1 -1
- package/esm/providers/tambo-client-provider.test.d.ts +2 -0
- package/esm/providers/tambo-client-provider.test.d.ts.map +1 -0
- package/esm/providers/tambo-client-provider.test.js +203 -0
- package/esm/providers/tambo-client-provider.test.js.map +1 -0
- package/esm/providers/tambo-context-attachment-provider.d.ts +34 -92
- package/esm/providers/tambo-context-attachment-provider.d.ts.map +1 -1
- package/esm/providers/tambo-context-attachment-provider.js +63 -106
- package/esm/providers/tambo-context-attachment-provider.js.map +1 -1
- package/esm/providers/tambo-context-attachment-provider.test.js +230 -464
- package/esm/providers/tambo-context-attachment-provider.test.js.map +1 -1
- package/esm/providers/tambo-interactable-provider-partial-updates.test.js +22 -21
- package/esm/providers/tambo-interactable-provider-partial-updates.test.js.map +1 -1
- package/esm/providers/tambo-interactable-provider.d.ts +5 -2
- package/esm/providers/tambo-interactable-provider.d.ts.map +1 -1
- package/esm/providers/tambo-interactable-provider.js +126 -17
- package/esm/providers/tambo-interactable-provider.js.map +1 -1
- package/esm/providers/tambo-interactable-provider.test.js +242 -0
- package/esm/providers/tambo-interactable-provider.test.js.map +1 -1
- package/esm/providers/tambo-interactables-additional-context.test.js +2 -5
- package/esm/providers/tambo-interactables-additional-context.test.js.map +1 -1
- package/esm/providers/tambo-provider.d.ts +2 -3
- package/esm/providers/tambo-provider.d.ts.map +1 -1
- package/esm/providers/tambo-provider.js +6 -5
- package/esm/providers/tambo-provider.js.map +1 -1
- package/esm/providers/tambo-registry-provider.test.js +16 -0
- package/esm/providers/tambo-registry-provider.test.js.map +1 -1
- package/esm/providers/tambo-registry-schema-compat.test.js +31 -0
- package/esm/providers/tambo-registry-schema-compat.test.js.map +1 -1
- package/esm/providers/tambo-thread-input-provider.d.ts +1 -1
- package/esm/providers/tambo-thread-input-provider.d.ts.map +1 -1
- package/esm/providers/tambo-thread-input-provider.js +26 -4
- package/esm/providers/tambo-thread-input-provider.js.map +1 -1
- package/esm/providers/tambo-thread-provider-initial-messages.test.js +84 -2
- package/esm/providers/tambo-thread-provider-initial-messages.test.js.map +1 -1
- package/esm/providers/tambo-thread-provider.d.ts.map +1 -1
- package/esm/providers/tambo-thread-provider.js +53 -42
- package/esm/providers/tambo-thread-provider.js.map +1 -1
- package/esm/providers/tambo-thread-provider.test.js +368 -262
- package/esm/providers/tambo-thread-provider.test.js.map +1 -1
- package/esm/schema/index.d.ts +1 -1
- package/esm/schema/index.d.ts.map +1 -1
- package/esm/schema/index.js +1 -1
- package/esm/schema/index.js.map +1 -1
- package/esm/schema/json-schema.d.ts +7 -0
- package/esm/schema/json-schema.d.ts.map +1 -1
- package/esm/schema/json-schema.js +11 -1
- package/esm/schema/json-schema.js.map +1 -1
- package/esm/schema/json-schema.test.d.ts +2 -0
- package/esm/schema/json-schema.test.d.ts.map +1 -0
- package/esm/schema/json-schema.test.js +202 -0
- package/esm/schema/json-schema.test.js.map +1 -0
- package/esm/schema/schema.test.js +238 -1
- package/esm/schema/schema.test.js.map +1 -1
- package/esm/schema/standard-schema.d.ts +1 -0
- package/esm/schema/standard-schema.d.ts.map +1 -1
- package/esm/schema/standard-schema.js +18 -13
- package/esm/schema/standard-schema.js.map +1 -1
- package/esm/schema/standard-schema.test.d.ts +2 -0
- package/esm/schema/standard-schema.test.d.ts.map +1 -0
- package/esm/schema/standard-schema.test.js +130 -0
- package/esm/schema/standard-schema.test.js.map +1 -0
- package/esm/schema/validate.test.js +149 -0
- package/esm/schema/validate.test.js.map +1 -1
- package/esm/schema/zod.d.ts +7 -4
- package/esm/schema/zod.d.ts.map +1 -1
- package/esm/schema/zod.js +65 -22
- package/esm/schema/zod.js.map +1 -1
- package/esm/schema/zod.test.js +113 -1
- package/esm/schema/zod.test.js.map +1 -1
- package/esm/setupTests.js +3 -0
- package/esm/setupTests.js.map +1 -1
- package/esm/testing/tools.d.ts +4 -1
- package/esm/testing/tools.d.ts.map +1 -1
- package/esm/testing/tools.js +6 -1
- package/esm/testing/tools.js.map +1 -1
- package/esm/util/generate-component.d.ts.map +1 -1
- package/esm/util/generate-component.js +18 -3
- package/esm/util/generate-component.js.map +1 -1
- package/esm/util/generate-component.test.d.ts +2 -0
- package/esm/util/generate-component.test.d.ts.map +1 -0
- package/esm/util/generate-component.test.js +302 -0
- package/esm/util/generate-component.test.js.map +1 -0
- package/esm/util/is-promise.d.ts +9 -0
- package/esm/util/is-promise.d.ts.map +1 -0
- package/esm/util/is-promise.js +17 -0
- package/esm/util/is-promise.js.map +1 -0
- package/esm/util/is-promise.test.d.ts +2 -0
- package/esm/util/is-promise.test.d.ts.map +1 -0
- package/esm/util/is-promise.test.js +46 -0
- package/esm/util/is-promise.test.js.map +1 -0
- package/esm/util/message-builder.d.ts +3 -1
- package/esm/util/message-builder.d.ts.map +1 -1
- package/esm/util/message-builder.js +20 -3
- package/esm/util/message-builder.js.map +1 -1
- package/esm/util/message-builder.test.js +269 -0
- package/esm/util/message-builder.test.js.map +1 -1
- package/esm/util/query-utils.test.d.ts +2 -0
- package/esm/util/query-utils.test.d.ts.map +1 -0
- package/esm/util/query-utils.test.js +380 -0
- package/esm/util/query-utils.test.js.map +1 -0
- package/esm/util/registry-validators.d.ts.map +1 -1
- package/esm/util/registry-validators.js +7 -0
- package/esm/util/registry-validators.js.map +1 -1
- package/esm/util/registry-validators.test.js +57 -0
- package/esm/util/registry-validators.test.js.map +1 -1
- package/esm/util/registry.d.ts.map +1 -1
- package/esm/util/registry.js +9 -0
- package/esm/util/registry.js.map +1 -1
- package/esm/util/registry.test.js +324 -2
- package/esm/util/registry.test.js.map +1 -1
- package/esm/util/resource-content-resolver.d.ts +20 -0
- package/esm/util/resource-content-resolver.d.ts.map +1 -0
- package/esm/util/resource-content-resolver.js +89 -0
- package/esm/util/resource-content-resolver.js.map +1 -0
- package/esm/util/resource-content-resolver.test.d.ts +2 -0
- package/esm/util/resource-content-resolver.test.d.ts.map +1 -0
- package/esm/util/resource-content-resolver.test.js +252 -0
- package/esm/util/resource-content-resolver.test.js.map +1 -0
- package/esm/util/resource-validators.test.d.ts +2 -0
- package/esm/util/resource-validators.test.d.ts.map +1 -0
- package/esm/util/resource-validators.test.js +88 -0
- package/esm/util/resource-validators.test.js.map +1 -0
- package/esm/util/tool-caller.d.ts +2 -2
- package/esm/util/tool-caller.d.ts.map +1 -1
- package/esm/util/tool-caller.js +8 -8
- package/esm/util/tool-caller.js.map +1 -1
- package/esm/util/validate-component-name.test.d.ts +2 -0
- package/esm/util/validate-component-name.test.d.ts.map +1 -0
- package/esm/util/validate-component-name.test.js +33 -0
- package/esm/util/validate-component-name.test.js.map +1 -0
- package/package.json +15 -23
- package/dist/schema/alias.d.ts +0 -3
- package/dist/schema/alias.d.ts.map +0 -1
- package/dist/schema/alias.js +0 -6
- package/dist/schema/alias.js.map +0 -1
- package/esm/schema/alias.d.ts +0 -3
- package/esm/schema/alias.d.ts.map +0 -1
- package/esm/schema/alias.js +0 -13
- package/esm/schema/alias.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.test.js","sourceRoot":"","sources":["../../src/util/registry.test.ts"],"names":[],"mappings":";;;;;;;;;;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QAEH,EAAE,CAAC,kEAAkE,EAAE,GAAG,EAAE;YAC1E,MAAM,MAAM,GAAgB;gBAC1B,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBACxB,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;iBACxB;aACF,CAAC;YACF,MAAM,IAAI,GAAG,IAAA,sBAAc,EAAC,MAAM,CAAC,CAAC;YACpC,MAAM,MAAM,GAAG,IAAA,oCAAyB,EAAC,IAAI,CAAC,CAAC;YAC/C,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YAE1C,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;YACnE,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;YAEjE,MAAM,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC;YAChC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAEvC,MAAM,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;YAC/B,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAEtC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,eAAe,EAAE,CAAC;QAC9C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Tests for getParametersFromToolSchema via mapTamboToolToContextTool.\n *\n * These tests verify that tool schemas are correctly converted to parameter specifications:\n *\n * **New interface (inputSchema)**:\n * - inputSchema should be an object schema (Zod object, Valibot object, JSON Schema object)\n * - Returns an array of parameters extracted from the object's properties\n * - Tool function receives single object argument: tool({ name: \"...\", age: 30 })\n *\n * **Deprecated interface (toolSchema)**:\n * - toolSchema uses z.function().args(...) pattern\n * - Returns positional parameters: param1, param2, etc.\n * - Tool function receives spread arguments: tool(value1, value2)\n */\nimport type { JSONSchema7 } from \"json-schema\";\nimport * as z3 from \"zod/v3\";\nimport * as z4 from \"zod/v4\";\nimport { createMockTool, createMockToolWithToolSchema } from \"../testing/tools\";\nimport { mapTamboToolToContextTool } from \"./registry\";\n\ndescribe(\"getParametersFromToolSchema (via mapTamboToolToContextTool)\", () => {\n describe(\"Deprecated toolSchema interface (Zod function schemas)\", () => {\n it(\"should handle tool with toolSchema\", () => {\n const tool = createMockToolWithToolSchema(\n z3.function().args(z3.string().describe(\"The name\")).returns(z3.void()),\n );\n const result = mapTamboToolToContextTool(tool);\n // Should have at least one parameter (either extracted or wrapped)\n expect(result.parameters.length).toBeGreaterThanOrEqual(1);\n expect(result.name).toBe(\"testTool\");\n expect(result.description).toBe(\"A test tool\");\n });\n\n it(\"should handle toolSchema with multiple args\", () => {\n const tool = createMockToolWithToolSchema(\n z3\n .function()\n .args(\n z3.string().describe(\"First name\"),\n z3.number().describe(\"Age\"),\n z3.boolean().describe(\"Is active\"),\n )\n .returns(z3.void()),\n );\n const result = mapTamboToolToContextTool(tool);\n // Should have parameters (extraction depends on JSON Schema conversion)\n expect(result.parameters.length).toBeGreaterThanOrEqual(1);\n });\n });\n\n describe(\"New inputSchema interface (object schemas)\", () => {\n describe(\"Zod 4 object schemas\", () => {\n it(\"should extract parameters from object schema properties\", () => {\n const tool = createMockTool({\n inputSchema: z4.object({\n name: z4.string().describe(\"User name\"),\n age: z4.number().describe(\"User age\"),\n }),\n outputSchema: z4.boolean(),\n });\n const result = mapTamboToolToContextTool(tool);\n expect(result.parameters).toHaveLength(2);\n\n // Parameters should be extracted from object properties\n const nameParam = result.parameters.find((p) => p.name === \"name\");\n const ageParam = result.parameters.find((p) => p.name === \"age\");\n\n expect(nameParam).toBeDefined();\n expect(nameParam?.type).toBe(\"string\");\n expect(nameParam?.description).toBe(\"User name\");\n expect(nameParam?.isRequired).toBe(true);\n\n expect(ageParam).toBeDefined();\n expect(ageParam?.type).toBe(\"number\");\n expect(ageParam?.description).toBe(\"User age\");\n expect(ageParam?.isRequired).toBe(true);\n\n expect(result.parameters).toMatchSnapshot();\n });\n\n it(\"should handle complex nested objects\", () => {\n const tool = createMockTool({\n inputSchema: z4.object({\n point: z4.object({ x: z4.number(), y: z4.number() }),\n tags: z4.array(z4.string()),\n color: z4.enum([\"red\", \"green\", \"blue\"]),\n }),\n outputSchema: z4.void(),\n });\n const result = mapTamboToolToContextTool(tool);\n expect(result.parameters).toHaveLength(3);\n\n const pointParam = result.parameters.find((p) => p.name === \"point\");\n const tagsParam = result.parameters.find((p) => p.name === \"tags\");\n const colorParam = result.parameters.find((p) => p.name === \"color\");\n\n expect(pointParam).toBeDefined();\n expect(pointParam?.type).toBe(\"object\");\n\n expect(tagsParam).toBeDefined();\n expect(tagsParam?.type).toBe(\"array\");\n\n expect(colorParam).toBeDefined();\n expect(colorParam?.type).toBe(\"string\");\n\n expect(result.parameters).toMatchSnapshot();\n });\n });\n\n describe(\"Zod 3 object schemas\", () => {\n it(\"should extract parameters from object schema properties\", () => {\n const tool = createMockTool({\n inputSchema: z3.object({\n name: z3.string().describe(\"User name\"),\n age: z3.number().describe(\"User age\"),\n }),\n outputSchema: z3.boolean(),\n });\n const result = mapTamboToolToContextTool(tool);\n expect(result.parameters).toHaveLength(2);\n\n const nameParam = result.parameters.find((p) => p.name === \"name\");\n const ageParam = result.parameters.find((p) => p.name === \"age\");\n\n expect(nameParam).toBeDefined();\n expect(nameParam?.type).toBe(\"string\");\n expect(nameParam?.isRequired).toBe(true);\n\n expect(ageParam).toBeDefined();\n expect(ageParam?.type).toBe(\"number\");\n expect(ageParam?.isRequired).toBe(true);\n\n expect(result.parameters).toMatchSnapshot();\n });\n });\n\n describe(\"JSON Schema object schemas\", () => {\n it(\"should extract parameters from object schema properties\", () => {\n const schema: JSONSchema7 = {\n type: \"object\",\n properties: {\n name: { type: \"string\", description: \"User name\" },\n age: { type: \"number\", description: \"User age\" },\n },\n required: [\"name\"],\n description: \"User data\",\n };\n const tool = createMockTool({ inputSchema: schema, outputSchema: {} });\n const result = mapTamboToolToContextTool(tool);\n expect(result.parameters).toHaveLength(2);\n\n const nameParam = result.parameters.find((p) => p.name === \"name\");\n const ageParam = result.parameters.find((p) => p.name === \"age\");\n\n expect(nameParam).toBeDefined();\n expect(nameParam?.type).toBe(\"string\");\n expect(nameParam?.description).toBe(\"User name\");\n expect(nameParam?.isRequired).toBe(true);\n\n expect(ageParam).toBeDefined();\n expect(ageParam?.type).toBe(\"number\");\n expect(ageParam?.description).toBe(\"User age\");\n expect(ageParam?.isRequired).toBe(false);\n\n expect(result.parameters).toMatchSnapshot();\n });\n\n it(\"should handle empty object schema\", () => {\n const schema: JSONSchema7 = {\n type: \"object\",\n properties: {},\n };\n const tool = createMockTool({ inputSchema: schema, outputSchema: {} });\n const result = mapTamboToolToContextTool(tool);\n expect(result.parameters).toHaveLength(0);\n });\n });\n });\n\n describe(\"Direct schema (shorthand for inputSchema)\", () => {\n it(\"should accept Zod 4 object schema directly and extract parameters\", () => {\n const tool = createMockTool(\n z4.object({\n name: z4.string(),\n age: z4.number(),\n }),\n );\n const result = mapTamboToolToContextTool(tool);\n expect(result.parameters).toHaveLength(2);\n\n const nameParam = result.parameters.find((p) => p.name === \"name\");\n const ageParam = result.parameters.find((p) => p.name === \"age\");\n\n expect(nameParam).toBeDefined();\n expect(nameParam?.type).toBe(\"string\");\n\n expect(ageParam).toBeDefined();\n expect(ageParam?.type).toBe(\"number\");\n\n expect(result.parameters).toMatchSnapshot();\n });\n\n it(\"should accept Zod 3 object schema directly and extract parameters\", () => {\n const tool = createMockTool(\n z3.object({\n name: z3.string(),\n age: z3.number(),\n }),\n );\n const result = mapTamboToolToContextTool(tool);\n expect(result.parameters).toHaveLength(2);\n\n const nameParam = result.parameters.find((p) => p.name === \"name\");\n const ageParam = result.parameters.find((p) => p.name === \"age\");\n\n expect(nameParam).toBeDefined();\n expect(ageParam).toBeDefined();\n\n expect(result.parameters).toMatchSnapshot();\n });\n\n it(\"should accept JSON Schema object directly and extract parameters\", () => {\n const schema: JSONSchema7 = {\n type: \"object\",\n properties: {\n name: { type: \"string\" },\n age: { type: \"number\" },\n },\n };\n const tool = createMockTool(schema);\n const result = mapTamboToolToContextTool(tool);\n expect(result.parameters).toHaveLength(2);\n\n const nameParam = result.parameters.find((p) => p.name === \"name\");\n const ageParam = result.parameters.find((p) => p.name === \"age\");\n\n expect(nameParam).toBeDefined();\n expect(nameParam?.type).toBe(\"string\");\n\n expect(ageParam).toBeDefined();\n expect(ageParam?.type).toBe(\"number\");\n\n expect(result.parameters).toMatchSnapshot();\n });\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"registry.test.js","sourceRoot":"","sources":["../../src/util/registry.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,2CAA6B;AAC7B,2CAA6B;AAQ7B,4CAAgF;AAChF,yCAOoB;AAEpB,QAAQ,CAAC,6DAA6D,EAAE,GAAG,EAAE;IAC3E,QAAQ,CAAC,wDAAwD,EAAE,GAAG,EAAE;QACtE,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;YAC5C,MAAM,IAAI,GAAG,IAAA,oCAA4B,EACvC,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EACvE,CAAC,CACF,CAAC;YACF,MAAM,MAAM,GAAG,IAAA,oCAAyB,EAAC,IAAI,CAAC,CAAC;YAC/C,mEAAmE;YACnE,MAAM,CAAC,MAAM,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AAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;QAEpE,MAAM,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC3C,MAAM,MAAM,GAAG,IAAA,+BAAoB,EAAC,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACnE,MAAM,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Tests for registry utilities:\n * - getParametersFromToolSchema via mapTamboToolToContextTool\n * - convertPropsToJsonSchema\n * - adaptToolFromFnSchema\n * - getComponentFromRegistry\n * - getAvailableComponents\n * - getUnassociatedTools\n */\nimport type { JSONSchema7 } from \"json-schema\";\nimport * as z3 from \"zod/v3\";\nimport * as z4 from \"zod/v4\";\nimport {\n ComponentRegistry,\n RegisteredComponent,\n TamboTool,\n TamboToolAssociations,\n TamboToolRegistry,\n} from \"../model/component-metadata\";\nimport { createMockTool, createMockToolWithToolSchema } from \"../testing/tools\";\nimport {\n adaptToolFromFnSchema,\n convertPropsToJsonSchema,\n getAvailableComponents,\n getComponentFromRegistry,\n getUnassociatedTools,\n mapTamboToolToContextTool,\n} from \"./registry\";\n\ndescribe(\"getParametersFromToolSchema (via mapTamboToolToContextTool)\", () => {\n describe(\"Deprecated toolSchema interface (Zod function schemas)\", () => {\n it(\"should handle tool with toolSchema\", () => {\n const tool = createMockToolWithToolSchema(\n z3.function().args(z3.string().describe(\"The name\")).returns(z3.void()),\n 3,\n );\n const result = mapTamboToolToContextTool(tool);\n // Should have at least one parameter (either extracted or wrapped)\n expect(result.parameters.length).toBeGreaterThanOrEqual(1);\n expect(result.name).toBe(\"testTool\");\n expect(result.description).toBe(\"A test tool\");\n expect(result.maxCalls).toBe(3);\n });\n\n it(\"should handle toolSchema with multiple args\", () => {\n const tool = createMockToolWithToolSchema(\n z3\n .function()\n .args(\n z3.string().describe(\"First name\"),\n z3.number().describe(\"Age\"),\n z3.boolean().describe(\"Is active\"),\n )\n .returns(z3.void()),\n );\n const result = mapTamboToolToContextTool(tool);\n // Should have parameters (extraction depends on JSON Schema conversion)\n expect(result.parameters.length).toBeGreaterThanOrEqual(1);\n });\n });\n\n describe(\"New inputSchema interface (object schemas)\", () => {\n describe(\"Zod 4 object schemas\", () => {\n it(\"should extract parameters from object schema properties\", () => {\n const tool = createMockTool({\n inputSchema: z4.object({\n name: z4.string().describe(\"User name\"),\n age: z4.number().describe(\"User age\"),\n }),\n outputSchema: z4.boolean(),\n maxCalls: 10,\n });\n const result = mapTamboToolToContextTool(tool);\n expect(result.maxCalls).toBe(10);\n expect(result.parameters).toHaveLength(2);\n\n // Parameters should be extracted from object properties\n const nameParam = result.parameters.find((p) => p.name === \"name\");\n const ageParam = result.parameters.find((p) => p.name === \"age\");\n\n expect(nameParam).toBeDefined();\n expect(nameParam?.type).toBe(\"string\");\n expect(nameParam?.description).toBe(\"User name\");\n expect(nameParam?.isRequired).toBe(true);\n\n expect(ageParam).toBeDefined();\n expect(ageParam?.type).toBe(\"number\");\n expect(ageParam?.description).toBe(\"User age\");\n expect(ageParam?.isRequired).toBe(true);\n\n expect(result.parameters).toMatchSnapshot();\n });\n\n it(\"should handle complex nested objects\", () => {\n const tool = createMockTool({\n inputSchema: z4.object({\n point: z4.object({ x: z4.number(), y: z4.number() }),\n tags: z4.array(z4.string()),\n color: z4.enum([\"red\", \"green\", \"blue\"]),\n }),\n outputSchema: z4.void(),\n });\n const result = mapTamboToolToContextTool(tool);\n expect(result.parameters).toHaveLength(3);\n\n const pointParam = result.parameters.find((p) => p.name === \"point\");\n const tagsParam = result.parameters.find((p) => p.name === \"tags\");\n const colorParam = result.parameters.find((p) => p.name === \"color\");\n\n expect(pointParam).toBeDefined();\n expect(pointParam?.type).toBe(\"object\");\n\n expect(tagsParam).toBeDefined();\n expect(tagsParam?.type).toBe(\"array\");\n\n expect(colorParam).toBeDefined();\n expect(colorParam?.type).toBe(\"string\");\n\n expect(result.parameters).toMatchSnapshot();\n });\n });\n\n describe(\"Zod 3 object schemas\", () => {\n it(\"should extract parameters from object schema properties\", () => {\n const tool = createMockTool({\n inputSchema: z3.object({\n name: z3.string().describe(\"User name\"),\n age: z3.number().describe(\"User age\"),\n }),\n outputSchema: z3.boolean(),\n });\n const result = mapTamboToolToContextTool(tool);\n expect(result.parameters).toHaveLength(2);\n\n const nameParam = result.parameters.find((p) => p.name === \"name\");\n const ageParam = result.parameters.find((p) => p.name === \"age\");\n\n expect(nameParam).toBeDefined();\n expect(nameParam?.type).toBe(\"string\");\n expect(nameParam?.isRequired).toBe(true);\n\n expect(ageParam).toBeDefined();\n expect(ageParam?.type).toBe(\"number\");\n expect(ageParam?.isRequired).toBe(true);\n\n expect(result.parameters).toMatchSnapshot();\n });\n });\n\n describe(\"JSON Schema object schemas\", () => {\n it(\"should extract parameters from object schema properties\", () => {\n const schema: JSONSchema7 = {\n type: \"object\",\n properties: {\n name: { type: \"string\", description: \"User name\" },\n age: { type: \"number\", description: \"User age\" },\n },\n required: [\"name\"],\n description: \"User data\",\n };\n const tool = createMockTool({ inputSchema: schema, outputSchema: {} });\n const result = mapTamboToolToContextTool(tool);\n expect(result.parameters).toHaveLength(2);\n\n const nameParam = result.parameters.find((p) => p.name === \"name\");\n const ageParam = result.parameters.find((p) => p.name === \"age\");\n\n expect(nameParam).toBeDefined();\n expect(nameParam?.type).toBe(\"string\");\n expect(nameParam?.description).toBe(\"User name\");\n expect(nameParam?.isRequired).toBe(true);\n\n expect(ageParam).toBeDefined();\n expect(ageParam?.type).toBe(\"number\");\n expect(ageParam?.description).toBe(\"User age\");\n expect(ageParam?.isRequired).toBe(false);\n\n expect(result.parameters).toMatchSnapshot();\n });\n\n it(\"should handle empty object schema\", () => {\n const schema: JSONSchema7 = {\n type: \"object\",\n properties: {},\n };\n const tool = createMockTool({ inputSchema: schema, outputSchema: {} });\n const result = mapTamboToolToContextTool(tool);\n expect(result.parameters).toHaveLength(0);\n });\n });\n });\n\n describe(\"Direct schema (shorthand for inputSchema)\", () => {\n it(\"should accept Zod 4 object schema directly and extract parameters\", () => {\n const tool = createMockTool(\n z4.object({\n name: z4.string(),\n age: z4.number(),\n }),\n );\n const result = mapTamboToolToContextTool(tool);\n expect(result.parameters).toHaveLength(2);\n\n const nameParam = result.parameters.find((p) => p.name === \"name\");\n const ageParam = result.parameters.find((p) => p.name === \"age\");\n\n expect(nameParam).toBeDefined();\n expect(nameParam?.type).toBe(\"string\");\n\n expect(ageParam).toBeDefined();\n expect(ageParam?.type).toBe(\"number\");\n\n expect(result.parameters).toMatchSnapshot();\n });\n\n it(\"should accept Zod 3 object schema directly and extract parameters\", () => {\n const tool = createMockTool(\n z3.object({\n name: z3.string(),\n age: z3.number(),\n }),\n );\n const result = mapTamboToolToContextTool(tool);\n expect(result.parameters).toHaveLength(2);\n\n const nameParam = result.parameters.find((p) => p.name === \"name\");\n const ageParam = result.parameters.find((p) => p.name === \"age\");\n\n expect(nameParam).toBeDefined();\n expect(ageParam).toBeDefined();\n\n expect(result.parameters).toMatchSnapshot();\n });\n\n it(\"should accept JSON Schema object directly and extract parameters\", () => {\n const schema: JSONSchema7 = {\n type: \"object\",\n properties: {\n name: { type: \"string\" },\n age: { type: \"number\" },\n },\n };\n const tool = createMockTool(schema);\n const result = mapTamboToolToContextTool(tool);\n expect(result.parameters).toHaveLength(2);\n\n const nameParam = result.parameters.find((p) => p.name === \"name\");\n const ageParam = result.parameters.find((p) => p.name === \"age\");\n\n expect(nameParam).toBeDefined();\n expect(nameParam?.type).toBe(\"string\");\n\n expect(ageParam).toBeDefined();\n expect(ageParam?.type).toBe(\"number\");\n\n expect(result.parameters).toMatchSnapshot();\n });\n });\n});\n\ndescribe(\"registry util: maxCalls\", () => {\n it(\"adaptToolFromFnSchema preserves maxCalls for legacy toolSchema\", () => {\n const legacy = createMockToolWithToolSchema(\n z3.function().args(z3.string()).returns(z3.string()),\n 2,\n );\n const adapted = adaptToolFromFnSchema(legacy);\n expect(adapted.maxCalls).toBe(2);\n });\n\n it(\"mapTamboToolToContextTool includes maxCalls when present\", () => {\n const tool = createMockTool({\n inputSchema: z3.object({ q: z3.string() }),\n maxCalls: 5,\n });\n const meta = mapTamboToolToContextTool(tool);\n expect(meta.maxCalls).toBe(5);\n });\n\n it(\"getUnassociatedTools does not drop unassociated tools and preserves maxCalls\", () => {\n const t1: TamboTool = {\n name: \"a\",\n description: \"a\",\n tool: () => {},\n inputSchema: {},\n outputSchema: {},\n maxCalls: 3,\n };\n const registry = { a: t1 };\n const associations = { SomeComponent: [] as string[] };\n const out = getUnassociatedTools(registry, associations);\n expect(out.find((t) => t.name === \"a\")?.maxCalls).toBe(3);\n });\n});\n\ndescribe(\"registry util: annotations\", () => {\n it(\"mapTamboToolToContextTool includes annotations when present\", () => {\n const tool: TamboTool = {\n name: \"read-only-tool\",\n description: \"A tool that can be called with partial args\",\n tool: () => {},\n inputSchema: z3.object({ text: z3.string() }),\n outputSchema: z3.string(),\n annotations: { readOnlyHint: true },\n };\n const meta = mapTamboToolToContextTool(tool);\n expect(meta.annotations).toEqual({ readOnlyHint: true });\n });\n\n it(\"mapTamboToolToContextTool does not include annotations when undefined\", () => {\n const tool: TamboTool = {\n name: \"regular-tool\",\n description: \"A regular tool\",\n tool: () => {},\n inputSchema: z3.object({ text: z3.string() }),\n outputSchema: z3.string(),\n };\n const meta = mapTamboToolToContextTool(tool);\n expect(meta.annotations).toBeUndefined();\n });\n\n it(\"mapTamboToolToContextTool includes annotations with readOnlyHint: false when explicitly set\", () => {\n const tool: TamboTool = {\n name: \"explicit-non-read-only-tool\",\n description: \"A tool explicitly marked as non-read-only\",\n tool: () => {},\n inputSchema: z3.object({ text: z3.string() }),\n outputSchema: z3.string(),\n annotations: { readOnlyHint: false },\n };\n const meta = mapTamboToolToContextTool(tool);\n expect(meta.annotations).toEqual({ readOnlyHint: false });\n });\n\n it(\"getUnassociatedTools preserves annotations\", () => {\n const tool: TamboTool = {\n name: \"streaming-tool\",\n description: \"A streaming tool\",\n tool: () => {},\n inputSchema: {},\n outputSchema: {},\n annotations: { readOnlyHint: true },\n };\n const registry = { \"streaming-tool\": tool };\n const associations = { SomeComponent: [] as string[] };\n const out = getUnassociatedTools(registry, associations);\n expect(out.find((t) => t.name === \"streaming-tool\")?.annotations).toEqual({\n readOnlyHint: true,\n });\n });\n\n it(\"mapTamboToolToContextTool includes tamboStreamableHint annotation\", () => {\n const tool: TamboTool = {\n name: \"streamable-tool\",\n description: \"A tool safe to call during streaming\",\n tool: () => {},\n inputSchema: z3.object({ text: z3.string() }),\n outputSchema: z3.string(),\n annotations: { tamboStreamableHint: true },\n };\n const meta = mapTamboToolToContextTool(tool);\n expect(meta.annotations).toEqual({ tamboStreamableHint: true });\n });\n\n it(\"mapTamboToolToContextTool preserves multiple combined annotations\", () => {\n const tool: TamboTool = {\n name: \"combined-annotations-tool\",\n description: \"A tool with multiple annotations\",\n tool: () => {},\n inputSchema: z3.object({ text: z3.string() }),\n outputSchema: z3.string(),\n annotations: { readOnlyHint: true, tamboStreamableHint: true },\n };\n const meta = mapTamboToolToContextTool(tool);\n expect(meta.annotations).toEqual({\n readOnlyHint: true,\n tamboStreamableHint: true,\n });\n });\n});\n\ndescribe(\"convertPropsToJsonSchema\", () => {\n it(\"should return undefined when component has no props\", () => {\n const component = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => null,\n props: undefined,\n contextTools: [],\n } as unknown as RegisteredComponent;\n expect(convertPropsToJsonSchema(component)).toBeUndefined();\n });\n\n it(\"should convert Standard Schema (Zod) props to JSON Schema\", () => {\n const zodSchema = z4.object({\n title: z4.string(),\n count: z4.number(),\n });\n const component = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => null,\n props: zodSchema,\n contextTools: [],\n } as unknown as RegisteredComponent;\n const result = convertPropsToJsonSchema(component);\n expect(result).toEqual(\n expect.objectContaining({\n type: \"object\",\n properties: expect.objectContaining({\n title: expect.objectContaining({ type: \"string\" }),\n count: expect.objectContaining({ type: \"number\" }),\n }),\n }),\n );\n });\n\n it(\"should pass through JSON Schema props as-is\", () => {\n const jsonSchema: JSONSchema7 = {\n type: \"object\",\n properties: {\n title: { type: \"string\" },\n count: { type: \"number\" },\n },\n };\n const component = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => null,\n props: jsonSchema,\n contextTools: [],\n } as unknown as RegisteredComponent;\n const result = convertPropsToJsonSchema(component);\n expect(result).toBe(jsonSchema); // Should be the same reference\n });\n\n it(\"should pass through unknown format as-is\", () => {\n const unknownFormat = { custom: \"format\", notStandard: true };\n const component = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => null,\n props: unknownFormat as unknown,\n contextTools: [],\n } as RegisteredComponent;\n const result = convertPropsToJsonSchema(component);\n expect(result).toBe(unknownFormat);\n });\n});\n\ndescribe(\"adaptToolFromFnSchema\", () => {\n it(\"should return tool unchanged when it has inputSchema (new interface)\", () => {\n const tool = createMockTool({\n inputSchema: z4.object({ name: z4.string() }),\n outputSchema: z4.string(),\n });\n const result = adaptToolFromFnSchema(tool);\n expect(result).toBe(tool); // Same reference\n expect(result.inputSchema).toBeDefined();\n });\n\n it(\"should adapt toolSchema to inputSchema/outputSchema\", () => {\n const tool = createMockToolWithToolSchema(\n z3\n .function()\n .args(z3.string().describe(\"Name\"), z3.number().describe(\"Age\"))\n .returns(z3.boolean()),\n );\n const result = adaptToolFromFnSchema(tool);\n expect(result.inputSchema).toBeDefined();\n expect(result.outputSchema).toBeDefined();\n expect(\"toolSchema\" in result).toBe(false);\n });\n});\n\ndescribe(\"getComponentFromRegistry\", () => {\n const mockRegistry: ComponentRegistry = {\n TestComponent: {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => null,\n props: { type: \"object\" },\n contextTools: [],\n },\n AnotherComponent: {\n name: \"AnotherComponent\",\n description: \"Another component\",\n component: () => null,\n props: { type: \"object\" },\n contextTools: [],\n },\n };\n\n it(\"should return component when found in registry\", () => {\n const result = getComponentFromRegistry(\"TestComponent\", mockRegistry);\n expect(result.name).toBe(\"TestComponent\");\n expect(result.description).toBe(\"A test component\");\n });\n\n it(\"should throw error when component not found\", () => {\n expect(() => getComponentFromRegistry(\"NonExistent\", mockRegistry)).toThrow(\n \"Tambo tried to use Component NonExistent, but it was not found\",\n );\n });\n\n it(\"should be case-sensitive for component names\", () => {\n expect(() =>\n getComponentFromRegistry(\"testcomponent\", mockRegistry),\n ).toThrow(\n \"Tambo tried to use Component testcomponent, but it was not found\",\n );\n });\n});\n\ndescribe(\"getAvailableComponents\", () => {\n const mockComponent = () => null;\n\n const mockRegistry: ComponentRegistry = {\n TestComponent: {\n name: \"TestComponent\",\n description: \"A test component\",\n component: mockComponent,\n props: { type: \"object\", properties: { title: { type: \"string\" } } },\n contextTools: [],\n },\n };\n\n const mockTool = createMockTool({\n inputSchema: z4.object({ query: z4.string() }),\n outputSchema: z4.string(),\n });\n mockTool.name = \"testTool\";\n\n const mockToolRegistry: TamboToolRegistry = {\n testTool: mockTool,\n };\n\n it(\"should return available components with no tools when no associations\", () => {\n const associations: TamboToolAssociations = {};\n const result = getAvailableComponents(\n mockRegistry,\n mockToolRegistry,\n associations,\n );\n\n expect(result).toHaveLength(1);\n expect(result[0].name).toBe(\"TestComponent\");\n expect(result[0].description).toBe(\"A test component\");\n expect(result[0].contextTools).toHaveLength(0);\n });\n\n it(\"should include associated tools with components\", () => {\n const associations: TamboToolAssociations = {\n TestComponent: [\"testTool\"],\n };\n const result = getAvailableComponents(\n mockRegistry,\n mockToolRegistry,\n associations,\n );\n\n expect(result).toHaveLength(1);\n expect(result[0].contextTools).toHaveLength(1);\n expect(result[0].contextTools?.[0].name).toBe(\"testTool\");\n });\n\n it(\"should skip tools not found in registry\", () => {\n const associations: TamboToolAssociations = {\n TestComponent: [\"testTool\", \"nonExistentTool\"],\n };\n const result = getAvailableComponents(\n mockRegistry,\n mockToolRegistry,\n associations,\n );\n\n expect(result[0].contextTools).toHaveLength(1);\n expect(result[0].contextTools?.[0].name).toBe(\"testTool\");\n });\n\n it(\"should handle empty registries\", () => {\n const result = getAvailableComponents({}, {}, {});\n expect(result).toHaveLength(0);\n });\n});\n\ndescribe(\"getUnassociatedTools\", () => {\n const mockTool1 = createMockTool({\n inputSchema: z4.object({ a: z4.string() }),\n outputSchema: z4.void(),\n });\n mockTool1.name = \"tool1\";\n\n const mockTool2 = createMockTool({\n inputSchema: z4.object({ b: z4.string() }),\n outputSchema: z4.void(),\n });\n mockTool2.name = \"tool2\";\n\n const mockTool3 = createMockTool({\n inputSchema: z4.object({ c: z4.string() }),\n outputSchema: z4.void(),\n });\n mockTool3.name = \"tool3\";\n\n const mockToolRegistry: TamboToolRegistry = {\n tool1: mockTool1,\n tool2: mockTool2,\n tool3: mockTool3,\n };\n\n it(\"should return all tools when no associations exist\", () => {\n const associations: TamboToolAssociations = {};\n const result = getUnassociatedTools(mockToolRegistry, associations);\n\n expect(result).toHaveLength(3);\n expect(result.map((t) => t.name)).toEqual(\n expect.arrayContaining([\"tool1\", \"tool2\", \"tool3\"]),\n );\n });\n\n it(\"should exclude tools that are associated with components\", () => {\n const associations: TamboToolAssociations = {\n ComponentA: [\"tool1\"],\n ComponentB: [\"tool2\"],\n };\n const result = getUnassociatedTools(mockToolRegistry, associations);\n\n expect(result).toHaveLength(1);\n expect(result[0].name).toBe(\"tool3\");\n });\n\n it(\"should return empty array when all tools are associated\", () => {\n const associations: TamboToolAssociations = {\n ComponentA: [\"tool1\", \"tool2\", \"tool3\"],\n };\n const result = getUnassociatedTools(mockToolRegistry, associations);\n\n expect(result).toHaveLength(0);\n });\n\n it(\"should handle empty tool registry\", () => {\n const result = getUnassociatedTools({}, { ComponentA: [\"tool1\"] });\n expect(result).toHaveLength(0);\n });\n});\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ReadResourceResult } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
import type { McpServer } from "../mcp/tambo-mcp-provider";
|
|
3
|
+
import type { ResourceSource } from "../model/resource-info";
|
|
4
|
+
/**
|
|
5
|
+
* Resolves content for client-side resources (MCP and registry).
|
|
6
|
+
* Server-side (internal Tambo) resources are skipped - the backend can resolve them.
|
|
7
|
+
* @param resourceUris - Prefixed URIs (e.g., "linear:file://foo", "registry:file://bar", "tambo-abc:test://resource")
|
|
8
|
+
* @param mcpServers - Active MCP servers including virtual registry server
|
|
9
|
+
* @param resourceSource - Registry resource source (listResources/getResource)
|
|
10
|
+
* @returns Map of prefixedUri -> ReadResourceResult for resolved resources.
|
|
11
|
+
* Resources that failed to fetch or are internal server resources won't be in the map.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveResourceContents(resourceUris: string[], mcpServers: McpServer[], resourceSource: ResourceSource | undefined): Promise<Map<string, ReadResourceResult>>;
|
|
14
|
+
/**
|
|
15
|
+
* Extracts resource URIs from text using the `@serverKey:uri` pattern.
|
|
16
|
+
* @param text - Text potentially containing resource references
|
|
17
|
+
* @returns Array of prefixed resource URIs (e.g., ["linear:file://foo", "registry:file://bar"])
|
|
18
|
+
*/
|
|
19
|
+
export declare function extractResourceUris(text: string): string[];
|
|
20
|
+
//# sourceMappingURL=resource-content-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-content-resolver.d.ts","sourceRoot":"","sources":["../../src/util/resource-content-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAE7E,OAAO,KAAK,EAAsB,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAU7D;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CAC3C,YAAY,EAAE,MAAM,EAAE,EACtB,UAAU,EAAE,SAAS,EAAE,EACvB,cAAc,EAAE,cAAc,GAAG,SAAS,GACzC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAyE1C;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAI1D"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveResourceContents = resolveResourceContents;
|
|
4
|
+
exports.extractResourceUris = extractResourceUris;
|
|
5
|
+
const mcp_constants_1 = require("../mcp/mcp-constants");
|
|
6
|
+
/**
|
|
7
|
+
* Type guard for narrowing McpServer to a connected server.
|
|
8
|
+
* A connected server has a non-null client.
|
|
9
|
+
*/
|
|
10
|
+
function isConnectedMcpServer(server) {
|
|
11
|
+
return "client" in server && server.client != null;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Resolves content for client-side resources (MCP and registry).
|
|
15
|
+
* Server-side (internal Tambo) resources are skipped - the backend can resolve them.
|
|
16
|
+
* @param resourceUris - Prefixed URIs (e.g., "linear:file://foo", "registry:file://bar", "tambo-abc:test://resource")
|
|
17
|
+
* @param mcpServers - Active MCP servers including virtual registry server
|
|
18
|
+
* @param resourceSource - Registry resource source (listResources/getResource)
|
|
19
|
+
* @returns Map of prefixedUri -> ReadResourceResult for resolved resources.
|
|
20
|
+
* Resources that failed to fetch or are internal server resources won't be in the map.
|
|
21
|
+
*/
|
|
22
|
+
async function resolveResourceContents(resourceUris, mcpServers, resourceSource) {
|
|
23
|
+
const results = new Map();
|
|
24
|
+
const fetchPromises = resourceUris.map(async (prefixedUri) => {
|
|
25
|
+
// Parse serverKey and original URI
|
|
26
|
+
// Format: serverKey:originalUri (e.g., "linear:file://foo", "registry:docs://readme")
|
|
27
|
+
const colonIndex = prefixedUri.indexOf(":");
|
|
28
|
+
if (colonIndex === -1)
|
|
29
|
+
return;
|
|
30
|
+
const serverKey = prefixedUri.slice(0, colonIndex);
|
|
31
|
+
const originalUri = prefixedUri.slice(colonIndex + 1);
|
|
32
|
+
try {
|
|
33
|
+
// Handle registry resources directly - no server lookup needed
|
|
34
|
+
// Registry resources are local to the browser and resolved via resourceSource
|
|
35
|
+
if (serverKey === mcp_constants_1.REGISTRY_SERVER_KEY) {
|
|
36
|
+
if (!resourceSource) {
|
|
37
|
+
console.warn(`No resource source available to resolve registry resource: ${prefixedUri}`);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const registryContent = await resourceSource.getResource(originalUri);
|
|
41
|
+
if (registryContent) {
|
|
42
|
+
results.set(prefixedUri, registryContent);
|
|
43
|
+
}
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
// For non-registry resources, find the server by serverKey
|
|
47
|
+
const server = mcpServers.find((s) => s.serverKey === serverKey);
|
|
48
|
+
if (!server) {
|
|
49
|
+
console.warn(`No server found for resource: ${prefixedUri}`);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
switch (server.serverType) {
|
|
53
|
+
case mcp_constants_1.ServerType.TAMBO_INTERNAL:
|
|
54
|
+
// Skip internal server resources - backend can resolve these
|
|
55
|
+
return;
|
|
56
|
+
case mcp_constants_1.ServerType.TAMBO_REGISTRY:
|
|
57
|
+
// Should not reach here since we handle registry above, but keep for safety
|
|
58
|
+
return;
|
|
59
|
+
case mcp_constants_1.ServerType.BROWSER_SIDE: {
|
|
60
|
+
// Client-side MCP resource
|
|
61
|
+
if (!isConnectedMcpServer(server)) {
|
|
62
|
+
console.warn(`MCP server not connected for resource: ${prefixedUri}`);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const mcpContent = (await server.client.client.readResource({
|
|
66
|
+
uri: originalUri,
|
|
67
|
+
}));
|
|
68
|
+
if (mcpContent) {
|
|
69
|
+
results.set(prefixedUri, mcpContent);
|
|
70
|
+
}
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
// Graceful fallback - log warning and continue without content
|
|
77
|
+
console.warn(`Failed to fetch resource content for ${prefixedUri}:`, error);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
await Promise.all(fetchPromises);
|
|
81
|
+
return results;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Extracts resource URIs from text using the `@serverKey:uri` pattern.
|
|
85
|
+
* @param text - Text potentially containing resource references
|
|
86
|
+
* @returns Array of prefixed resource URIs (e.g., ["linear:file://foo", "registry:file://bar"])
|
|
87
|
+
*/
|
|
88
|
+
function extractResourceUris(text) {
|
|
89
|
+
const pattern = /@([a-zA-Z0-9-]+):(\S+)/g;
|
|
90
|
+
const matches = Array.from(text.matchAll(pattern));
|
|
91
|
+
return matches.map(([, serverKey, uri]) => `${serverKey}:${uri}`);
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=resource-content-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-content-resolver.js","sourceRoot":"","sources":["../../src/util/resource-content-resolver.ts"],"names":[],"mappings":";;AAsBA,0DA6EC;AAOD,kDAIC;AA7GD,wDAAuE;AAIvE;;;GAGG;AACH,SAAS,oBAAoB,CAAC,MAAiB;IAC7C,OAAO,QAAQ,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC;AACrD,CAAC;AAED;;;;;;;;GAQG;AACI,KAAK,UAAU,uBAAuB,CAC3C,YAAsB,EACtB,UAAuB,EACvB,cAA0C;IAE1C,MAAM,OAAO,GAAG,IAAI,GAAG,EAA8B,CAAC;IAEtD,MAAM,aAAa,GAAG,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE;QAC3D,mCAAmC;QACnC,sFAAsF;QACtF,MAAM,UAAU,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5C,IAAI,UAAU,KAAK,CAAC,CAAC;YAAE,OAA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M,UAAU,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;wBAC1D,GAAG,EAAE,WAAW;qBACjB,CAAC,CAA8B,CAAC;oBACjC,IAAI,UAAU,EAAE,CAAC;wBACf,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;oBACvC,CAAC;oBACD,OAAO;gBACT,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,+DAA+D;YAC/D,OAAO,CAAC,IAAI,CACV,wCAAwC,WAAW,GAAG,EACtD,KAAK,CACN,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACjC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,IAAY;IAC9C,MAAM,OAAO,GAAG,yBAAyB,CAAC;IAC1C,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;IACnD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,SAAS,IAAI,GAAG,EAAE,CAAC,CAAC;AACpE,CAAC","sourcesContent":["import type { ReadResourceResult } from \"@modelcontextprotocol/sdk/types.js\";\nimport { REGISTRY_SERVER_KEY, ServerType } from \"../mcp/mcp-constants\";\nimport type { ConnectedMcpServer, McpServer } from \"../mcp/tambo-mcp-provider\";\nimport type { ResourceSource } from \"../model/resource-info\";\n\n/**\n * Type guard for narrowing McpServer to a connected server.\n * A connected server has a non-null client.\n */\nfunction isConnectedMcpServer(server: McpServer): server is ConnectedMcpServer {\n return \"client\" in server && server.client != null;\n}\n\n/**\n * Resolves content for client-side resources (MCP and registry).\n * Server-side (internal Tambo) resources are skipped - the backend can resolve them.\n * @param resourceUris - Prefixed URIs (e.g., \"linear:file://foo\", \"registry:file://bar\", \"tambo-abc:test://resource\")\n * @param mcpServers - Active MCP servers including virtual registry server\n * @param resourceSource - Registry resource source (listResources/getResource)\n * @returns Map of prefixedUri -> ReadResourceResult for resolved resources.\n * Resources that failed to fetch or are internal server resources won't be in the map.\n */\nexport async function resolveResourceContents(\n resourceUris: string[],\n mcpServers: McpServer[],\n resourceSource: ResourceSource | undefined,\n): Promise<Map<string, ReadResourceResult>> {\n const results = new Map<string, ReadResourceResult>();\n\n const fetchPromises = resourceUris.map(async (prefixedUri) => {\n // Parse serverKey and original URI\n // Format: serverKey:originalUri (e.g., \"linear:file://foo\", \"registry:docs://readme\")\n const colonIndex = prefixedUri.indexOf(\":\");\n if (colonIndex === -1) return;\n\n const serverKey = prefixedUri.slice(0, colonIndex);\n const originalUri = prefixedUri.slice(colonIndex + 1);\n\n try {\n // Handle registry resources directly - no server lookup needed\n // Registry resources are local to the browser and resolved via resourceSource\n if (serverKey === REGISTRY_SERVER_KEY) {\n if (!resourceSource) {\n console.warn(\n `No resource source available to resolve registry resource: ${prefixedUri}`,\n );\n return;\n }\n const registryContent = await resourceSource.getResource(originalUri);\n if (registryContent) {\n results.set(prefixedUri, registryContent);\n }\n return;\n }\n\n // For non-registry resources, find the server by serverKey\n const server = mcpServers.find((s) => s.serverKey === serverKey);\n if (!server) {\n console.warn(`No server found for resource: ${prefixedUri}`);\n return;\n }\n\n switch (server.serverType) {\n case ServerType.TAMBO_INTERNAL:\n // Skip internal server resources - backend can resolve these\n return;\n\n case ServerType.TAMBO_REGISTRY:\n // Should not reach here since we handle registry above, but keep for safety\n return;\n\n case ServerType.BROWSER_SIDE: {\n // Client-side MCP resource\n if (!isConnectedMcpServer(server)) {\n console.warn(\n `MCP server not connected for resource: ${prefixedUri}`,\n );\n return;\n }\n const mcpContent = (await server.client.client.readResource({\n uri: originalUri,\n })) as ReadResourceResult | null;\n if (mcpContent) {\n results.set(prefixedUri, mcpContent);\n }\n return;\n }\n }\n } catch (error) {\n // Graceful fallback - log warning and continue without content\n console.warn(\n `Failed to fetch resource content for ${prefixedUri}:`,\n error,\n );\n }\n });\n\n await Promise.all(fetchPromises);\n return results;\n}\n\n/**\n * Extracts resource URIs from text using the `@serverKey:uri` pattern.\n * @param text - Text potentially containing resource references\n * @returns Array of prefixed resource URIs (e.g., [\"linear:file://foo\", \"registry:file://bar\"])\n */\nexport function extractResourceUris(text: string): string[] {\n const pattern = /@([a-zA-Z0-9-]+):(\\S+)/g;\n const matches = Array.from(text.matchAll(pattern));\n return matches.map(([, serverKey, uri]) => `${serverKey}:${uri}`);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-content-resolver.test.d.ts","sourceRoot":"","sources":["../../src/util/resource-content-resolver.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mcp_constants_1 = require("../mcp/mcp-constants");
|
|
4
|
+
const mcp_client_1 = require("../mcp/mcp-client");
|
|
5
|
+
const resource_content_resolver_1 = require("./resource-content-resolver");
|
|
6
|
+
describe("extractResourceUris", () => {
|
|
7
|
+
it("should extract a single resource URI", () => {
|
|
8
|
+
const text = "Check @registry:file:///path/to/doc.txt";
|
|
9
|
+
const result = (0, resource_content_resolver_1.extractResourceUris)(text);
|
|
10
|
+
expect(result).toEqual(["registry:file:///path/to/doc.txt"]);
|
|
11
|
+
});
|
|
12
|
+
it("should extract multiple resource URIs", () => {
|
|
13
|
+
const text = "Check @registry:file:///doc1.txt and @server-a:file:///doc2.txt";
|
|
14
|
+
const result = (0, resource_content_resolver_1.extractResourceUris)(text);
|
|
15
|
+
expect(result).toEqual([
|
|
16
|
+
"registry:file:///doc1.txt",
|
|
17
|
+
"server-a:file:///doc2.txt",
|
|
18
|
+
]);
|
|
19
|
+
});
|
|
20
|
+
it("should extract resource URIs with internal server prefix", () => {
|
|
21
|
+
const text = "Check @tambo-abc123:tambo:test://resource/1";
|
|
22
|
+
const result = (0, resource_content_resolver_1.extractResourceUris)(text);
|
|
23
|
+
expect(result).toEqual(["tambo-abc123:tambo:test://resource/1"]);
|
|
24
|
+
});
|
|
25
|
+
it("should extract resource URIs with hyphens in server key", () => {
|
|
26
|
+
const text = "@my-mcp-server:file:///path/file.txt";
|
|
27
|
+
const result = (0, resource_content_resolver_1.extractResourceUris)(text);
|
|
28
|
+
expect(result).toEqual(["my-mcp-server:file:///path/file.txt"]);
|
|
29
|
+
});
|
|
30
|
+
it("should return empty array for text without resource references", () => {
|
|
31
|
+
const text = "Just some regular text without @mentions";
|
|
32
|
+
const result = (0, resource_content_resolver_1.extractResourceUris)(text);
|
|
33
|
+
expect(result).toEqual([]);
|
|
34
|
+
});
|
|
35
|
+
it("should not extract malformed references without colon", () => {
|
|
36
|
+
const text = "@server-without-colon is not a resource";
|
|
37
|
+
const result = (0, resource_content_resolver_1.extractResourceUris)(text);
|
|
38
|
+
expect(result).toEqual([]);
|
|
39
|
+
});
|
|
40
|
+
it("should handle URIs with multiple colons", () => {
|
|
41
|
+
const text = "@server:http://example.com:8080/path";
|
|
42
|
+
const result = (0, resource_content_resolver_1.extractResourceUris)(text);
|
|
43
|
+
expect(result).toEqual(["server:http://example.com:8080/path"]);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
describe("resolveResourceContents", () => {
|
|
47
|
+
const createMockConnectedServer = (serverKey, readResource, serverType = mcp_constants_1.ServerType.BROWSER_SIDE) => ({
|
|
48
|
+
key: `mcp-${serverKey}`,
|
|
49
|
+
serverKey,
|
|
50
|
+
url: `https://${serverKey}.example.com`,
|
|
51
|
+
name: `MCP Server ${serverKey}`,
|
|
52
|
+
transport: mcp_client_1.MCPTransport.HTTP,
|
|
53
|
+
serverType,
|
|
54
|
+
client: {
|
|
55
|
+
client: {
|
|
56
|
+
readResource,
|
|
57
|
+
listResources: jest.fn().mockResolvedValue({ resources: [] }),
|
|
58
|
+
listTools: jest.fn().mockResolvedValue({ tools: [] }),
|
|
59
|
+
listPrompts: jest.fn().mockResolvedValue({ prompts: [] }),
|
|
60
|
+
getPrompt: jest.fn().mockResolvedValue(null),
|
|
61
|
+
callTool: jest.fn().mockResolvedValue(null),
|
|
62
|
+
},
|
|
63
|
+
close: jest.fn().mockResolvedValue(undefined),
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
const createMockInternalServer = (serverKey) => ({
|
|
67
|
+
key: serverKey,
|
|
68
|
+
serverKey,
|
|
69
|
+
url: "https://api.tambo.ai/mcp",
|
|
70
|
+
name: "__tambo_internal_mcp_server__",
|
|
71
|
+
transport: mcp_client_1.MCPTransport.HTTP,
|
|
72
|
+
serverType: mcp_constants_1.ServerType.TAMBO_INTERNAL,
|
|
73
|
+
connectionError: undefined, // No client for internal servers
|
|
74
|
+
});
|
|
75
|
+
const createMockResourceSource = (getResource) => ({
|
|
76
|
+
listResources: jest.fn().mockResolvedValue([]),
|
|
77
|
+
getResource,
|
|
78
|
+
});
|
|
79
|
+
it("should resolve registry resources via resourceSource", async () => {
|
|
80
|
+
const mockGetResource = jest.fn().mockResolvedValue({
|
|
81
|
+
contents: [
|
|
82
|
+
{
|
|
83
|
+
uri: "file:///local/doc.txt",
|
|
84
|
+
mimeType: "text/plain",
|
|
85
|
+
text: "Registry document content",
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
});
|
|
89
|
+
const resourceSource = createMockResourceSource(mockGetResource);
|
|
90
|
+
const result = await (0, resource_content_resolver_1.resolveResourceContents)(["registry:file:///local/doc.txt"], [], // Registry resources don't need a server - they're handled directly
|
|
91
|
+
resourceSource);
|
|
92
|
+
expect(mockGetResource).toHaveBeenCalledWith("file:///local/doc.txt");
|
|
93
|
+
expect(result.size).toBe(1);
|
|
94
|
+
expect(result.get("registry:file:///local/doc.txt")).toEqual({
|
|
95
|
+
contents: [
|
|
96
|
+
{
|
|
97
|
+
uri: "file:///local/doc.txt",
|
|
98
|
+
mimeType: "text/plain",
|
|
99
|
+
text: "Registry document content",
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
it("should resolve client-side MCP resources via mcpServer", async () => {
|
|
105
|
+
const mockReadResource = jest.fn().mockResolvedValue({
|
|
106
|
+
contents: [
|
|
107
|
+
{
|
|
108
|
+
uri: "file:///mcp/file.txt",
|
|
109
|
+
mimeType: "text/plain",
|
|
110
|
+
text: "MCP server content",
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
});
|
|
114
|
+
const mcpServer = createMockConnectedServer("linear", mockReadResource);
|
|
115
|
+
const result = await (0, resource_content_resolver_1.resolveResourceContents)(["linear:file:///mcp/file.txt"], [mcpServer], undefined);
|
|
116
|
+
expect(mockReadResource).toHaveBeenCalledWith({
|
|
117
|
+
uri: "file:///mcp/file.txt",
|
|
118
|
+
});
|
|
119
|
+
expect(result.size).toBe(1);
|
|
120
|
+
expect(result.get("linear:file:///mcp/file.txt")).toEqual({
|
|
121
|
+
contents: [
|
|
122
|
+
{
|
|
123
|
+
uri: "file:///mcp/file.txt",
|
|
124
|
+
mimeType: "text/plain",
|
|
125
|
+
text: "MCP server content",
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
it("should skip internal server resources (serverType: TAMBO_INTERNAL)", async () => {
|
|
131
|
+
const mockGetResource = jest.fn();
|
|
132
|
+
const resourceSource = createMockResourceSource(mockGetResource);
|
|
133
|
+
const internalServer = createMockInternalServer("tambo-abc123");
|
|
134
|
+
const result = await (0, resource_content_resolver_1.resolveResourceContents)(["tambo-abc123:tambo:test://resource/1"], [internalServer], resourceSource);
|
|
135
|
+
// Should not call getResource for internal server resources
|
|
136
|
+
expect(mockGetResource).not.toHaveBeenCalled();
|
|
137
|
+
// Should return empty map since internal resources are skipped
|
|
138
|
+
expect(result.size).toBe(0);
|
|
139
|
+
});
|
|
140
|
+
it("should resolve multiple resources in parallel", async () => {
|
|
141
|
+
const mockGetResource = jest.fn().mockResolvedValue({
|
|
142
|
+
contents: [{ uri: "file:///doc.txt", text: "registry content" }],
|
|
143
|
+
});
|
|
144
|
+
const mockReadResource = jest.fn().mockResolvedValue({
|
|
145
|
+
contents: [{ uri: "file:///mcp.txt", text: "mcp content" }],
|
|
146
|
+
});
|
|
147
|
+
const resourceSource = createMockResourceSource(mockGetResource);
|
|
148
|
+
const mcpServer = createMockConnectedServer("mcp-server", mockReadResource);
|
|
149
|
+
const result = await (0, resource_content_resolver_1.resolveResourceContents)(["registry:file:///doc.txt", "mcp-server:file:///mcp.txt"], [mcpServer], // Only MCP server needed - registry handled directly
|
|
150
|
+
resourceSource);
|
|
151
|
+
expect(result.size).toBe(2);
|
|
152
|
+
expect(result.has("registry:file:///doc.txt")).toBe(true);
|
|
153
|
+
expect(result.has("mcp-server:file:///mcp.txt")).toBe(true);
|
|
154
|
+
});
|
|
155
|
+
it("should handle mixed internal and client-side resources", async () => {
|
|
156
|
+
const mockGetResource = jest.fn().mockResolvedValue({
|
|
157
|
+
contents: [{ uri: "file:///doc.txt", text: "registry content" }],
|
|
158
|
+
});
|
|
159
|
+
const resourceSource = createMockResourceSource(mockGetResource);
|
|
160
|
+
const internalServer = createMockInternalServer("tambo-abc123");
|
|
161
|
+
const result = await (0, resource_content_resolver_1.resolveResourceContents)([
|
|
162
|
+
"registry:file:///doc.txt", // client-side registry
|
|
163
|
+
"tambo-abc123:tambo:test://resource/1", // internal - should skip
|
|
164
|
+
], [internalServer], // Only internal server needed - registry handled directly
|
|
165
|
+
resourceSource);
|
|
166
|
+
// Only the registry resource should be resolved
|
|
167
|
+
expect(mockGetResource).toHaveBeenCalledTimes(1);
|
|
168
|
+
expect(result.size).toBe(1);
|
|
169
|
+
expect(result.has("registry:file:///doc.txt")).toBe(true);
|
|
170
|
+
expect(result.has("tambo-abc123:tambo:test://resource/1")).toBe(false);
|
|
171
|
+
});
|
|
172
|
+
it("should gracefully handle registry resource fetch failure", async () => {
|
|
173
|
+
const consoleSpy = jest.spyOn(console, "warn").mockImplementation();
|
|
174
|
+
const mockGetResource = jest
|
|
175
|
+
.fn()
|
|
176
|
+
.mockRejectedValue(new Error("Resource not found"));
|
|
177
|
+
const resourceSource = createMockResourceSource(mockGetResource);
|
|
178
|
+
const result = await (0, resource_content_resolver_1.resolveResourceContents)(["registry:file:///missing.txt"], [], // Registry resources don't need a server
|
|
179
|
+
resourceSource);
|
|
180
|
+
expect(consoleSpy).toHaveBeenCalledWith("Failed to fetch resource content for registry:file:///missing.txt:", expect.any(Error));
|
|
181
|
+
expect(result.size).toBe(0);
|
|
182
|
+
consoleSpy.mockRestore();
|
|
183
|
+
});
|
|
184
|
+
it("should gracefully handle MCP resource fetch failure", async () => {
|
|
185
|
+
const consoleSpy = jest.spyOn(console, "warn").mockImplementation();
|
|
186
|
+
const mockReadResource = jest
|
|
187
|
+
.fn()
|
|
188
|
+
.mockRejectedValue(new Error("MCP server error"));
|
|
189
|
+
const mcpServer = createMockConnectedServer("linear", mockReadResource);
|
|
190
|
+
const result = await (0, resource_content_resolver_1.resolveResourceContents)(["linear:file:///missing.txt"], [mcpServer], undefined);
|
|
191
|
+
expect(consoleSpy).toHaveBeenCalledWith("Failed to fetch resource content for linear:file:///missing.txt:", expect.any(Error));
|
|
192
|
+
expect(result.size).toBe(0);
|
|
193
|
+
consoleSpy.mockRestore();
|
|
194
|
+
});
|
|
195
|
+
it("should warn when no resourceSource available for registry resource", async () => {
|
|
196
|
+
const consoleSpy = jest.spyOn(console, "warn").mockImplementation();
|
|
197
|
+
const result = await (0, resource_content_resolver_1.resolveResourceContents)(["registry:file:///doc.txt"], [], // Registry resources don't need a server
|
|
198
|
+
undefined);
|
|
199
|
+
expect(consoleSpy).toHaveBeenCalledWith("No resource source available to resolve registry resource: registry:file:///doc.txt");
|
|
200
|
+
expect(result.size).toBe(0);
|
|
201
|
+
consoleSpy.mockRestore();
|
|
202
|
+
});
|
|
203
|
+
it("should warn when no server found for resource", async () => {
|
|
204
|
+
const consoleSpy = jest.spyOn(console, "warn").mockImplementation();
|
|
205
|
+
const result = await (0, resource_content_resolver_1.resolveResourceContents)(["unknown-server:file:///doc.txt"], [], // no servers
|
|
206
|
+
undefined);
|
|
207
|
+
expect(consoleSpy).toHaveBeenCalledWith("No server found for resource: unknown-server:file:///doc.txt");
|
|
208
|
+
expect(result.size).toBe(0);
|
|
209
|
+
consoleSpy.mockRestore();
|
|
210
|
+
});
|
|
211
|
+
it("should handle resource content with blob data", async () => {
|
|
212
|
+
const mockGetResource = jest.fn().mockResolvedValue({
|
|
213
|
+
contents: [
|
|
214
|
+
{
|
|
215
|
+
uri: "file:///image.png",
|
|
216
|
+
mimeType: "image/png",
|
|
217
|
+
blob: "base64encodeddata",
|
|
218
|
+
},
|
|
219
|
+
],
|
|
220
|
+
});
|
|
221
|
+
const resourceSource = createMockResourceSource(mockGetResource);
|
|
222
|
+
const result = await (0, resource_content_resolver_1.resolveResourceContents)(["registry:file:///image.png"], [], // Registry resources don't need a server
|
|
223
|
+
resourceSource);
|
|
224
|
+
expect(result.get("registry:file:///image.png")).toEqual({
|
|
225
|
+
contents: [
|
|
226
|
+
{
|
|
227
|
+
uri: "file:///image.png",
|
|
228
|
+
mimeType: "image/png",
|
|
229
|
+
blob: "base64encodeddata",
|
|
230
|
+
},
|
|
231
|
+
],
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
it("should handle URIs with no colon (invalid format)", async () => {
|
|
235
|
+
const result = await (0, resource_content_resolver_1.resolveResourceContents)(["invalid-uri-no-colon"], [], undefined);
|
|
236
|
+
expect(result.size).toBe(0);
|
|
237
|
+
});
|
|
238
|
+
it("should handle null content from getResource", async () => {
|
|
239
|
+
const mockGetResource = jest.fn().mockResolvedValue(null);
|
|
240
|
+
const resourceSource = createMockResourceSource(mockGetResource);
|
|
241
|
+
const result = await (0, resource_content_resolver_1.resolveResourceContents)(["registry:file:///doc.txt"], [], // Registry resources don't need a server
|
|
242
|
+
resourceSource);
|
|
243
|
+
expect(mockGetResource).toHaveBeenCalled();
|
|
244
|
+
expect(result.size).toBe(0);
|
|
245
|
+
});
|
|
246
|
+
it("should handle null content from readResource", async () => {
|
|
247
|
+
const mockReadResource = jest.fn().mockResolvedValue(null);
|
|
248
|
+
const mcpServer = createMockConnectedServer("linear", mockReadResource);
|
|
249
|
+
const result = await (0, resource_content_resolver_1.resolveResourceContents)(["linear:file:///doc.txt"], [mcpServer], undefined);
|
|
250
|
+
expect(mockReadResource).toHaveBeenCalled();
|
|
251
|
+
expect(result.size).toBe(0);
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
//# sourceMappingURL=resource-content-resolver.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-content-resolver.test.js","sourceRoot":"","sources":["../../src/util/resource-content-resolver.test.ts"],"names":[],"mappings":";;AACA,wDAAkD;AAGlD,kDAAiD;AAEjD,2EAGqC;AAErC,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC9C,MAAM,IAAI,GAAG,yCAAyC,CAAC;QACvD,MAAM,MAAM,GAAG,IAAA,+CAAmB,EAAC,IAAI,CAAC,CAAC;QACzC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,IAAI,GACR,iEAAiE,CAAC;QACpE,MAAM,MAAM,GAAG,IAAA,+CAAmB,EAAC,IAAI,CAAC,CAAC;QACzC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;YACrB,2BAA2B;YAC3B,2BAA2B;SAC5B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;QAClE,M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ServerType } from \"../mcp/mcp-constants\";\nimport type { McpServer } from \"../mcp/tambo-mcp-provider\";\nimport type { ResourceSource } from \"../model/resource-info\";\nimport { MCPTransport } from \"../mcp/mcp-client\";\n\nimport {\n resolveResourceContents,\n extractResourceUris,\n} from \"./resource-content-resolver\";\n\ndescribe(\"extractResourceUris\", () => {\n it(\"should extract a single resource URI\", () => {\n const text = \"Check @registry:file:///path/to/doc.txt\";\n const result = extractResourceUris(text);\n expect(result).toEqual([\"registry:file:///path/to/doc.txt\"]);\n });\n\n it(\"should extract multiple resource URIs\", () => {\n const text =\n \"Check @registry:file:///doc1.txt and @server-a:file:///doc2.txt\";\n const result = extractResourceUris(text);\n expect(result).toEqual([\n \"registry:file:///doc1.txt\",\n \"server-a:file:///doc2.txt\",\n ]);\n });\n\n it(\"should extract resource URIs with internal server prefix\", () => {\n const text = \"Check @tambo-abc123:tambo:test://resource/1\";\n const result = extractResourceUris(text);\n expect(result).toEqual([\"tambo-abc123:tambo:test://resource/1\"]);\n });\n\n it(\"should extract resource URIs with hyphens in server key\", () => {\n const text = \"@my-mcp-server:file:///path/file.txt\";\n const result = extractResourceUris(text);\n expect(result).toEqual([\"my-mcp-server:file:///path/file.txt\"]);\n });\n\n it(\"should return empty array for text without resource references\", () => {\n const text = \"Just some regular text without @mentions\";\n const result = extractResourceUris(text);\n expect(result).toEqual([]);\n });\n\n it(\"should not extract malformed references without colon\", () => {\n const text = \"@server-without-colon is not a resource\";\n const result = extractResourceUris(text);\n expect(result).toEqual([]);\n });\n\n it(\"should handle URIs with multiple colons\", () => {\n const text = \"@server:http://example.com:8080/path\";\n const result = extractResourceUris(text);\n expect(result).toEqual([\"server:http://example.com:8080/path\"]);\n });\n});\n\ndescribe(\"resolveResourceContents\", () => {\n const createMockConnectedServer = (\n serverKey: string,\n readResource: jest.Mock,\n serverType: ServerType = ServerType.BROWSER_SIDE,\n ): McpServer =>\n ({\n key: `mcp-${serverKey}`,\n serverKey,\n url: `https://${serverKey}.example.com`,\n name: `MCP Server ${serverKey}`,\n transport: MCPTransport.HTTP,\n serverType,\n client: {\n client: {\n readResource,\n listResources: jest.fn().mockResolvedValue({ resources: [] }),\n listTools: jest.fn().mockResolvedValue({ tools: [] }),\n listPrompts: jest.fn().mockResolvedValue({ prompts: [] }),\n getPrompt: jest.fn().mockResolvedValue(null),\n callTool: jest.fn().mockResolvedValue(null),\n },\n close: jest.fn().mockResolvedValue(undefined),\n } as unknown as McpServer[\"client\"],\n }) as McpServer;\n\n const createMockInternalServer = (serverKey: string): McpServer =>\n ({\n key: serverKey,\n serverKey,\n url: \"https://api.tambo.ai/mcp\",\n name: \"__tambo_internal_mcp_server__\",\n transport: MCPTransport.HTTP,\n serverType: ServerType.TAMBO_INTERNAL,\n connectionError: undefined, // No client for internal servers\n }) as unknown as McpServer;\n\n const createMockResourceSource = (\n getResource: jest.Mock,\n ): ResourceSource => ({\n listResources: jest.fn().mockResolvedValue([]),\n getResource,\n });\n\n it(\"should resolve registry resources via resourceSource\", async () => {\n const mockGetResource = jest.fn().mockResolvedValue({\n contents: [\n {\n uri: \"file:///local/doc.txt\",\n mimeType: \"text/plain\",\n text: \"Registry document content\",\n },\n ],\n } satisfies ReadResourceResult);\n\n const resourceSource = createMockResourceSource(mockGetResource);\n\n const result = await resolveResourceContents(\n [\"registry:file:///local/doc.txt\"],\n [], // Registry resources don't need a server - they're handled directly\n resourceSource,\n );\n\n expect(mockGetResource).toHaveBeenCalledWith(\"file:///local/doc.txt\");\n expect(result.size).toBe(1);\n expect(result.get(\"registry:file:///local/doc.txt\")).toEqual({\n contents: [\n {\n uri: \"file:///local/doc.txt\",\n mimeType: \"text/plain\",\n text: \"Registry document content\",\n },\n ],\n });\n });\n\n it(\"should resolve client-side MCP resources via mcpServer\", async () => {\n const mockReadResource = jest.fn().mockResolvedValue({\n contents: [\n {\n uri: \"file:///mcp/file.txt\",\n mimeType: \"text/plain\",\n text: \"MCP server content\",\n },\n ],\n } satisfies ReadResourceResult);\n\n const mcpServer = createMockConnectedServer(\"linear\", mockReadResource);\n\n const result = await resolveResourceContents(\n [\"linear:file:///mcp/file.txt\"],\n [mcpServer],\n undefined,\n );\n\n expect(mockReadResource).toHaveBeenCalledWith({\n uri: \"file:///mcp/file.txt\",\n });\n expect(result.size).toBe(1);\n expect(result.get(\"linear:file:///mcp/file.txt\")).toEqual({\n contents: [\n {\n uri: \"file:///mcp/file.txt\",\n mimeType: \"text/plain\",\n text: \"MCP server content\",\n },\n ],\n });\n });\n\n it(\"should skip internal server resources (serverType: TAMBO_INTERNAL)\", async () => {\n const mockGetResource = jest.fn();\n const resourceSource = createMockResourceSource(mockGetResource);\n const internalServer = createMockInternalServer(\"tambo-abc123\");\n\n const result = await resolveResourceContents(\n [\"tambo-abc123:tambo:test://resource/1\"],\n [internalServer],\n resourceSource,\n );\n\n // Should not call getResource for internal server resources\n expect(mockGetResource).not.toHaveBeenCalled();\n // Should return empty map since internal resources are skipped\n expect(result.size).toBe(0);\n });\n\n it(\"should resolve multiple resources in parallel\", async () => {\n const mockGetResource = jest.fn().mockResolvedValue({\n contents: [{ uri: \"file:///doc.txt\", text: \"registry content\" }],\n });\n const mockReadResource = jest.fn().mockResolvedValue({\n contents: [{ uri: \"file:///mcp.txt\", text: \"mcp content\" }],\n });\n\n const resourceSource = createMockResourceSource(mockGetResource);\n const mcpServer = createMockConnectedServer(\"mcp-server\", mockReadResource);\n\n const result = await resolveResourceContents(\n [\"registry:file:///doc.txt\", \"mcp-server:file:///mcp.txt\"],\n [mcpServer], // Only MCP server needed - registry handled directly\n resourceSource,\n );\n\n expect(result.size).toBe(2);\n expect(result.has(\"registry:file:///doc.txt\")).toBe(true);\n expect(result.has(\"mcp-server:file:///mcp.txt\")).toBe(true);\n });\n\n it(\"should handle mixed internal and client-side resources\", async () => {\n const mockGetResource = jest.fn().mockResolvedValue({\n contents: [{ uri: \"file:///doc.txt\", text: \"registry content\" }],\n });\n const resourceSource = createMockResourceSource(mockGetResource);\n const internalServer = createMockInternalServer(\"tambo-abc123\");\n\n const result = await resolveResourceContents(\n [\n \"registry:file:///doc.txt\", // client-side registry\n \"tambo-abc123:tambo:test://resource/1\", // internal - should skip\n ],\n [internalServer], // Only internal server needed - registry handled directly\n resourceSource,\n );\n\n // Only the registry resource should be resolved\n expect(mockGetResource).toHaveBeenCalledTimes(1);\n expect(result.size).toBe(1);\n expect(result.has(\"registry:file:///doc.txt\")).toBe(true);\n expect(result.has(\"tambo-abc123:tambo:test://resource/1\")).toBe(false);\n });\n\n it(\"should gracefully handle registry resource fetch failure\", async () => {\n const consoleSpy = jest.spyOn(console, \"warn\").mockImplementation();\n const mockGetResource = jest\n .fn()\n .mockRejectedValue(new Error(\"Resource not found\"));\n const resourceSource = createMockResourceSource(mockGetResource);\n\n const result = await resolveResourceContents(\n [\"registry:file:///missing.txt\"],\n [], // Registry resources don't need a server\n resourceSource,\n );\n\n expect(consoleSpy).toHaveBeenCalledWith(\n \"Failed to fetch resource content for registry:file:///missing.txt:\",\n expect.any(Error),\n );\n expect(result.size).toBe(0);\n\n consoleSpy.mockRestore();\n });\n\n it(\"should gracefully handle MCP resource fetch failure\", async () => {\n const consoleSpy = jest.spyOn(console, \"warn\").mockImplementation();\n const mockReadResource = jest\n .fn()\n .mockRejectedValue(new Error(\"MCP server error\"));\n const mcpServer = createMockConnectedServer(\"linear\", mockReadResource);\n\n const result = await resolveResourceContents(\n [\"linear:file:///missing.txt\"],\n [mcpServer],\n undefined,\n );\n\n expect(consoleSpy).toHaveBeenCalledWith(\n \"Failed to fetch resource content for linear:file:///missing.txt:\",\n expect.any(Error),\n );\n expect(result.size).toBe(0);\n\n consoleSpy.mockRestore();\n });\n\n it(\"should warn when no resourceSource available for registry resource\", async () => {\n const consoleSpy = jest.spyOn(console, \"warn\").mockImplementation();\n\n const result = await resolveResourceContents(\n [\"registry:file:///doc.txt\"],\n [], // Registry resources don't need a server\n undefined, // no resourceSource\n );\n\n expect(consoleSpy).toHaveBeenCalledWith(\n \"No resource source available to resolve registry resource: registry:file:///doc.txt\",\n );\n expect(result.size).toBe(0);\n\n consoleSpy.mockRestore();\n });\n\n it(\"should warn when no server found for resource\", async () => {\n const consoleSpy = jest.spyOn(console, \"warn\").mockImplementation();\n\n const result = await resolveResourceContents(\n [\"unknown-server:file:///doc.txt\"],\n [], // no servers\n undefined,\n );\n\n expect(consoleSpy).toHaveBeenCalledWith(\n \"No server found for resource: unknown-server:file:///doc.txt\",\n );\n expect(result.size).toBe(0);\n\n consoleSpy.mockRestore();\n });\n\n it(\"should handle resource content with blob data\", async () => {\n const mockGetResource = jest.fn().mockResolvedValue({\n contents: [\n {\n uri: \"file:///image.png\",\n mimeType: \"image/png\",\n blob: \"base64encodeddata\",\n },\n ],\n } satisfies ReadResourceResult);\n\n const resourceSource = createMockResourceSource(mockGetResource);\n\n const result = await resolveResourceContents(\n [\"registry:file:///image.png\"],\n [], // Registry resources don't need a server\n resourceSource,\n );\n\n expect(result.get(\"registry:file:///image.png\")).toEqual({\n contents: [\n {\n uri: \"file:///image.png\",\n mimeType: \"image/png\",\n blob: \"base64encodeddata\",\n },\n ],\n });\n });\n\n it(\"should handle URIs with no colon (invalid format)\", async () => {\n const result = await resolveResourceContents(\n [\"invalid-uri-no-colon\"],\n [],\n undefined,\n );\n\n expect(result.size).toBe(0);\n });\n\n it(\"should handle null content from getResource\", async () => {\n const mockGetResource = jest.fn().mockResolvedValue(null);\n const resourceSource = createMockResourceSource(mockGetResource);\n\n const result = await resolveResourceContents(\n [\"registry:file:///doc.txt\"],\n [], // Registry resources don't need a server\n resourceSource,\n );\n\n expect(mockGetResource).toHaveBeenCalled();\n expect(result.size).toBe(0);\n });\n\n it(\"should handle null content from readResource\", async () => {\n const mockReadResource = jest.fn().mockResolvedValue(null);\n const mcpServer = createMockConnectedServer(\"linear\", mockReadResource);\n\n const result = await resolveResourceContents(\n [\"linear:file:///doc.txt\"],\n [mcpServer],\n undefined,\n );\n\n expect(mockReadResource).toHaveBeenCalled();\n expect(result.size).toBe(0);\n });\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-validators.test.d.ts","sourceRoot":"","sources":["../../src/util/resource-validators.test.ts"],"names":[],"mappings":""}
|