@tambo-ai/react 0.54.0 → 0.54.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mcp/__tests__/tambo-mcp-provider.test.js +115 -0
- package/dist/mcp/__tests__/tambo-mcp-provider.test.js.map +1 -1
- package/dist/mcp/tambo-mcp-provider.d.ts +1 -1
- package/dist/mcp/tambo-mcp-provider.d.ts.map +1 -1
- package/dist/mcp/tambo-mcp-provider.js +20 -3
- package/dist/mcp/tambo-mcp-provider.js.map +1 -1
- package/dist/providers/__tests__/tambo-interactable-provider-partial-updates.test.js +15 -0
- package/dist/providers/__tests__/tambo-interactable-provider-partial-updates.test.js.map +1 -1
- package/dist/providers/__tests__/tambo-registry-provider.test.js +44 -9
- package/dist/providers/__tests__/tambo-registry-provider.test.js.map +1 -1
- package/dist/providers/tambo-interactable-provider.d.ts.map +1 -1
- package/dist/providers/tambo-interactable-provider.js +3 -0
- package/dist/providers/tambo-interactable-provider.js.map +1 -1
- package/dist/providers/tambo-registry-provider.d.ts.map +1 -1
- package/dist/providers/tambo-registry-provider.js +12 -1
- package/dist/providers/tambo-registry-provider.js.map +1 -1
- package/dist/util/validate-component-name.d.ts +7 -0
- package/dist/util/validate-component-name.d.ts.map +1 -0
- package/dist/util/validate-component-name.js +14 -0
- package/dist/util/validate-component-name.js.map +1 -0
- package/esm/mcp/__tests__/tambo-mcp-provider.test.js +83 -1
- package/esm/mcp/__tests__/tambo-mcp-provider.test.js.map +1 -1
- package/esm/mcp/tambo-mcp-provider.d.ts +1 -1
- package/esm/mcp/tambo-mcp-provider.d.ts.map +1 -1
- package/esm/mcp/tambo-mcp-provider.js +20 -3
- package/esm/mcp/tambo-mcp-provider.js.map +1 -1
- package/esm/providers/__tests__/tambo-interactable-provider-partial-updates.test.js +15 -0
- package/esm/providers/__tests__/tambo-interactable-provider-partial-updates.test.js.map +1 -1
- package/esm/providers/__tests__/tambo-registry-provider.test.js +44 -9
- package/esm/providers/__tests__/tambo-registry-provider.test.js.map +1 -1
- package/esm/providers/tambo-interactable-provider.d.ts.map +1 -1
- package/esm/providers/tambo-interactable-provider.js +3 -0
- package/esm/providers/tambo-interactable-provider.js.map +1 -1
- package/esm/providers/tambo-registry-provider.d.ts.map +1 -1
- package/esm/providers/tambo-registry-provider.js +12 -1
- package/esm/providers/tambo-registry-provider.js.map +1 -1
- package/esm/util/validate-component-name.d.ts +7 -0
- package/esm/util/validate-component-name.d.ts.map +1 -0
- package/esm/util/validate-component-name.js +11 -0
- package/esm/util/validate-component-name.js.map +1 -0
- package/package.json +3 -2
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const react_1 = require("@testing-library/react");
|
|
37
|
+
const react_2 = __importStar(require("react"));
|
|
38
|
+
const tambo_registry_provider_1 = require("../../providers/tambo-registry-provider");
|
|
39
|
+
const mcp_client_1 = require("../mcp-client");
|
|
3
40
|
const tambo_mcp_provider_1 = require("../tambo-mcp-provider");
|
|
4
41
|
// Mock the MCP client to avoid ES module issues
|
|
5
42
|
jest.mock("../mcp-client", () => ({
|
|
@@ -112,4 +149,82 @@ describe("extractErrorMessage", () => {
|
|
|
112
149
|
});
|
|
113
150
|
});
|
|
114
151
|
});
|
|
152
|
+
describe("TamboMcpProvider server list changes", () => {
|
|
153
|
+
beforeEach(() => {
|
|
154
|
+
// Mock registry so tool registration is a no-op
|
|
155
|
+
tambo_registry_provider_1.useTamboRegistry.mockReturnValue({
|
|
156
|
+
registerTool: jest.fn(),
|
|
157
|
+
});
|
|
158
|
+
// Ensure MCPClient.create exists and returns a fake client with listTools
|
|
159
|
+
mcp_client_1.MCPClient.create = jest
|
|
160
|
+
.fn()
|
|
161
|
+
.mockResolvedValue({ listTools: jest.fn().mockResolvedValue([]) });
|
|
162
|
+
});
|
|
163
|
+
const Capture = ({ onUpdate, }) => {
|
|
164
|
+
const servers = (0, tambo_mcp_provider_1.useTamboMcpServers)();
|
|
165
|
+
(0, react_2.useEffect)(() => {
|
|
166
|
+
onUpdate(servers);
|
|
167
|
+
}, [servers, onUpdate]);
|
|
168
|
+
return react_2.default.createElement("div", { "data-testid": "urls" }, servers.map((s) => s.url).join(","));
|
|
169
|
+
};
|
|
170
|
+
it("adds a new server when the list grows", async () => {
|
|
171
|
+
let latest = [];
|
|
172
|
+
const { rerender, getByTestId } = (0, react_1.render)(react_2.default.createElement(tambo_mcp_provider_1.TamboMcpProvider, { mcpServers: ["https://a.example"] },
|
|
173
|
+
react_2.default.createElement(Capture, { onUpdate: (s) => (latest = s) })));
|
|
174
|
+
// Wait for initial connection
|
|
175
|
+
await (0, react_1.waitFor)(() => {
|
|
176
|
+
expect(latest.length).toBe(1);
|
|
177
|
+
});
|
|
178
|
+
// Add new server
|
|
179
|
+
rerender(react_2.default.createElement(tambo_mcp_provider_1.TamboMcpProvider, { mcpServers: ["https://a.example", "https://b.example"] },
|
|
180
|
+
react_2.default.createElement(Capture, { onUpdate: (s) => (latest = s) })));
|
|
181
|
+
await (0, react_1.waitFor)(() => {
|
|
182
|
+
expect(latest.length).toBe(2);
|
|
183
|
+
const urls = getByTestId("urls").textContent || "";
|
|
184
|
+
expect(urls).toContain("https://a.example");
|
|
185
|
+
expect(urls).toContain("https://b.example");
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
it("removes a server when the list shrinks", async () => {
|
|
189
|
+
let latest = [];
|
|
190
|
+
const { rerender, getByTestId } = (0, react_1.render)(react_2.default.createElement(tambo_mcp_provider_1.TamboMcpProvider, { mcpServers: ["https://a.example", "https://b.example"] },
|
|
191
|
+
react_2.default.createElement(Capture, { onUpdate: (s) => (latest = s) })));
|
|
192
|
+
await (0, react_1.waitFor)(() => {
|
|
193
|
+
expect(latest.length).toBe(2);
|
|
194
|
+
});
|
|
195
|
+
// Remove one server
|
|
196
|
+
rerender(react_2.default.createElement(tambo_mcp_provider_1.TamboMcpProvider, { mcpServers: ["https://a.example"] },
|
|
197
|
+
react_2.default.createElement(Capture, { onUpdate: (s) => (latest = s) })));
|
|
198
|
+
await (0, react_1.waitFor)(() => {
|
|
199
|
+
expect(latest.length).toBe(1);
|
|
200
|
+
const urls = getByTestId("urls").textContent || "";
|
|
201
|
+
expect(urls).toContain("https://a.example");
|
|
202
|
+
expect(urls).not.toContain("https://b.example");
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
it("does not duplicate when a new copy of the same list is passed", async () => {
|
|
206
|
+
let latest = [];
|
|
207
|
+
const initial = [
|
|
208
|
+
{ url: "https://a.example", transport: mcp_client_1.MCPTransport.SSE },
|
|
209
|
+
{ url: "https://b.example", transport: mcp_client_1.MCPTransport.SSE },
|
|
210
|
+
];
|
|
211
|
+
const { rerender } = (0, react_1.render)(react_2.default.createElement(tambo_mcp_provider_1.TamboMcpProvider, { mcpServers: initial },
|
|
212
|
+
react_2.default.createElement(Capture, { onUpdate: (s) => (latest = s) })));
|
|
213
|
+
await (0, react_1.waitFor)(() => {
|
|
214
|
+
expect(latest.length).toBe(2);
|
|
215
|
+
});
|
|
216
|
+
// Pass a new array instance with the same logical servers
|
|
217
|
+
const same = [
|
|
218
|
+
{ url: "https://a.example", transport: mcp_client_1.MCPTransport.SSE },
|
|
219
|
+
{ url: "https://b.example", transport: mcp_client_1.MCPTransport.SSE },
|
|
220
|
+
];
|
|
221
|
+
rerender(react_2.default.createElement(tambo_mcp_provider_1.TamboMcpProvider, { mcpServers: same },
|
|
222
|
+
react_2.default.createElement(Capture, { onUpdate: (s) => (latest = s) })));
|
|
223
|
+
await (0, react_1.waitFor)(() => {
|
|
224
|
+
expect(latest.length).toBe(2);
|
|
225
|
+
const urls = latest.map((s) => s.url).sort();
|
|
226
|
+
expect(urls).toEqual(["https://a.example", "https://b.example"].sort());
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
});
|
|
115
230
|
//# sourceMappingURL=tambo-mcp-provider.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tambo-mcp-provider.test.js","sourceRoot":"","sources":["../../../src/mcp/__tests__/tambo-mcp-provider.test.tsx"],"names":[],"mappings":";;AAAA,8DAA4D;AAE5D,gDAAgD;AAChD,IAAI,CAAC,IAAI,CAAC,eA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ACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { extractErrorMessage } from \"../tambo-mcp-provider\";\n\n// Mock the MCP client to avoid ES module issues\njest.mock(\"../mcp-client\", () => ({\n MCPClient: jest.fn(),\n MCPTransport: {\n SSE: \"sse\",\n HTTP: \"http\",\n },\n}));\n\n// Mock the registry provider to avoid dependency issues\njest.mock(\"../../providers/tambo-registry-provider\", () => ({\n useTamboRegistry: jest.fn(),\n}));\n\ndescribe(\"extractErrorMessage\", () => {\n describe(\"Array content handling\", () => {\n it(\"should extract text from array content with multiple text items\", () => {\n const content = [\n { type: \"text\", text: \"Error:\" },\n { type: \"text\", text: \"Tool execution failed\" },\n { type: \"image\", url: \"http://example.com/error.png\" }, // Should be filtered out\n ];\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\"Error: Tool execution failed\");\n });\n\n it(\"should extract text from array content with single text item\", () => {\n const content = [{ type: \"text\", text: \"Simple error message\" }];\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\"Simple error message\");\n });\n\n it(\"should return fallback message for array content with no text items\", () => {\n const content = [\n { type: \"image\", url: \"http://example.com/error.png\" },\n { type: \"resource\", uri: \"file://error.log\" },\n ];\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\"Error occurred but no details provided\");\n });\n\n it(\"should return fallback message for empty array content\", () => {\n const content: any[] = [];\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\"Error occurred but no details provided\");\n });\n\n it(\"should handle array content with mixed types correctly\", () => {\n const content = [\n { type: \"resource\", uri: \"file://log.txt\" },\n { type: \"text\", text: \"First error\" },\n { type: \"image\", url: \"http://example.com/img.png\" },\n { type: \"text\", text: \"Second error\" },\n { type: \"unknown\", data: \"something\" },\n ];\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\"First error Second error\");\n });\n\n it(\"should handle array content with malformed items\", () => {\n const content = [\n null,\n { type: \"text\", text: \"Valid error\" },\n { type: \"text\" }, // Missing text property\n { type: \"text\", text: null }, // Invalid text type\n { type: \"text\", text: \"Another valid error\" },\n ];\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\"Valid error Another valid error\");\n });\n });\n\n describe(\"Non-array content handling\", () => {\n it(\"should return string content as-is\", () => {\n const content = \"Direct error message\";\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\"Direct error message\");\n });\n\n it(\"should handle null content\", () => {\n const content = null;\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\"Unknown error occurred\");\n });\n\n it(\"should handle undefined content\", () => {\n const content = undefined;\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\"Unknown error occurred\");\n });\n\n it(\"should handle number content\", () => {\n const content = 42;\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\"42\");\n });\n\n it(\"should handle boolean content\", () => {\n const content = false;\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\"false\");\n });\n\n it(\"should handle object content\", () => {\n const content = { error: \"Something went wrong\" };\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe('{\"error\":\"Something went wrong\"}');\n });\n\n it(\"should handle complex object content\", () => {\n const content = {\n error: \"Something went wrong\",\n code: 500,\n details: { message: \"Internal server error\" },\n };\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\n '{\"error\":\"Something went wrong\",\"code\":500,\"details\":{\"message\":\"Internal server error\"}}',\n );\n });\n\n it(\"should handle empty object content\", () => {\n const content = {};\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\"{}\");\n });\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"tambo-mcp-provider.test.js","sourceRoot":"","sources":["../../../src/mcp/__tests__/tambo-mcp-provider.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAyD;AACzD,+CAAyC;AACzC,qFAA2E;AAC3E,8CAAwD;AACxD,8DAK+B;AAE/B,gDAAgD;AAChD,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,GAA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QAC1D,MAAM,IAAI,GAAG;YACX,EAAE,GAAG,EAAE,mBAAmB,EAAE,SAAS,EAAE,yBAAY,CAAC,GAAG,EAAE;YACzD,EAAE,GAAG,EAAE,mBAAmB,EAAE,SAAS,EAAE,yBAAY,CAAC,GAAG,EAAE;SAC1D,CAAC;QACF,QAAQ,CACN,8BAAC,qCAAgB,IAAC,UAAU,EAAE,IAAI;YAChC,8BAAC,OAAO,IAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,GAAI,CACzB,CACpB,CAAC;QAEF,MAAM,IAAA,eAAO,EAAC,GAAG,EAAE;YACjB,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC9B,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;YAC7C,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { render, waitFor } from \"@testing-library/react\";\nimport React, { useEffect } from \"react\";\nimport { useTamboRegistry } from \"../../providers/tambo-registry-provider\";\nimport { MCPClient, MCPTransport } from \"../mcp-client\";\nimport {\n extractErrorMessage,\n TamboMcpProvider,\n useTamboMcpServers,\n type McpServer,\n} from \"../tambo-mcp-provider\";\n\n// Mock the MCP client to avoid ES module issues\njest.mock(\"../mcp-client\", () => ({\n MCPClient: jest.fn(),\n MCPTransport: {\n SSE: \"sse\",\n HTTP: \"http\",\n },\n}));\n\n// Mock the registry provider to avoid dependency issues\njest.mock(\"../../providers/tambo-registry-provider\", () => ({\n useTamboRegistry: jest.fn(),\n}));\n\ndescribe(\"extractErrorMessage\", () => {\n describe(\"Array content handling\", () => {\n it(\"should extract text from array content with multiple text items\", () => {\n const content = [\n { type: \"text\", text: \"Error:\" },\n { type: \"text\", text: \"Tool execution failed\" },\n { type: \"image\", url: \"http://example.com/error.png\" }, // Should be filtered out\n ];\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\"Error: Tool execution failed\");\n });\n\n it(\"should extract text from array content with single text item\", () => {\n const content = [{ type: \"text\", text: \"Simple error message\" }];\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\"Simple error message\");\n });\n\n it(\"should return fallback message for array content with no text items\", () => {\n const content = [\n { type: \"image\", url: \"http://example.com/error.png\" },\n { type: \"resource\", uri: \"file://error.log\" },\n ];\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\"Error occurred but no details provided\");\n });\n\n it(\"should return fallback message for empty array content\", () => {\n const content: any[] = [];\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\"Error occurred but no details provided\");\n });\n\n it(\"should handle array content with mixed types correctly\", () => {\n const content = [\n { type: \"resource\", uri: \"file://log.txt\" },\n { type: \"text\", text: \"First error\" },\n { type: \"image\", url: \"http://example.com/img.png\" },\n { type: \"text\", text: \"Second error\" },\n { type: \"unknown\", data: \"something\" },\n ];\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\"First error Second error\");\n });\n\n it(\"should handle array content with malformed items\", () => {\n const content = [\n null,\n { type: \"text\", text: \"Valid error\" },\n { type: \"text\" }, // Missing text property\n { type: \"text\", text: null }, // Invalid text type\n { type: \"text\", text: \"Another valid error\" },\n ];\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\"Valid error Another valid error\");\n });\n });\n\n describe(\"Non-array content handling\", () => {\n it(\"should return string content as-is\", () => {\n const content = \"Direct error message\";\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\"Direct error message\");\n });\n\n it(\"should handle null content\", () => {\n const content = null;\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\"Unknown error occurred\");\n });\n\n it(\"should handle undefined content\", () => {\n const content = undefined;\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\"Unknown error occurred\");\n });\n\n it(\"should handle number content\", () => {\n const content = 42;\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\"42\");\n });\n\n it(\"should handle boolean content\", () => {\n const content = false;\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\"false\");\n });\n\n it(\"should handle object content\", () => {\n const content = { error: \"Something went wrong\" };\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe('{\"error\":\"Something went wrong\"}');\n });\n\n it(\"should handle complex object content\", () => {\n const content = {\n error: \"Something went wrong\",\n code: 500,\n details: { message: \"Internal server error\" },\n };\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\n '{\"error\":\"Something went wrong\",\"code\":500,\"details\":{\"message\":\"Internal server error\"}}',\n );\n });\n\n it(\"should handle empty object content\", () => {\n const content = {};\n\n const result = extractErrorMessage(content);\n\n expect(result).toBe(\"{}\");\n });\n });\n});\n\ndescribe(\"TamboMcpProvider server list changes\", () => {\n beforeEach(() => {\n // Mock registry so tool registration is a no-op\n (useTamboRegistry as unknown as jest.Mock).mockReturnValue({\n registerTool: jest.fn(),\n });\n\n // Ensure MCPClient.create exists and returns a fake client with listTools\n (MCPClient as unknown as any).create = jest\n .fn()\n .mockResolvedValue({ listTools: jest.fn().mockResolvedValue([]) });\n });\n\n const Capture: React.FC<{ onUpdate: (servers: McpServer[]) => void }> = ({\n onUpdate,\n }) => {\n const servers = useTamboMcpServers();\n useEffect(() => {\n onUpdate(servers);\n }, [servers, onUpdate]);\n return <div data-testid=\"urls\">{servers.map((s) => s.url).join(\",\")}</div>;\n };\n\n it(\"adds a new server when the list grows\", async () => {\n let latest: McpServer[] = [];\n const { rerender, getByTestId } = render(\n <TamboMcpProvider mcpServers={[\"https://a.example\"]}>\n <Capture onUpdate={(s) => (latest = s)} />\n </TamboMcpProvider>,\n );\n\n // Wait for initial connection\n await waitFor(() => {\n expect(latest.length).toBe(1);\n });\n\n // Add new server\n rerender(\n <TamboMcpProvider mcpServers={[\"https://a.example\", \"https://b.example\"]}>\n <Capture onUpdate={(s) => (latest = s)} />\n </TamboMcpProvider>,\n );\n\n await waitFor(() => {\n expect(latest.length).toBe(2);\n const urls = getByTestId(\"urls\").textContent || \"\";\n expect(urls).toContain(\"https://a.example\");\n expect(urls).toContain(\"https://b.example\");\n });\n });\n\n it(\"removes a server when the list shrinks\", async () => {\n let latest: McpServer[] = [];\n const { rerender, getByTestId } = render(\n <TamboMcpProvider mcpServers={[\"https://a.example\", \"https://b.example\"]}>\n <Capture onUpdate={(s) => (latest = s)} />\n </TamboMcpProvider>,\n );\n\n await waitFor(() => {\n expect(latest.length).toBe(2);\n });\n\n // Remove one server\n rerender(\n <TamboMcpProvider mcpServers={[\"https://a.example\"]}>\n <Capture onUpdate={(s) => (latest = s)} />\n </TamboMcpProvider>,\n );\n\n await waitFor(() => {\n expect(latest.length).toBe(1);\n const urls = getByTestId(\"urls\").textContent || \"\";\n expect(urls).toContain(\"https://a.example\");\n expect(urls).not.toContain(\"https://b.example\");\n });\n });\n\n it(\"does not duplicate when a new copy of the same list is passed\", async () => {\n let latest: McpServer[] = [];\n const initial = [\n { url: \"https://a.example\", transport: MCPTransport.SSE },\n { url: \"https://b.example\", transport: MCPTransport.SSE },\n ];\n\n const { rerender } = render(\n <TamboMcpProvider mcpServers={initial}>\n <Capture onUpdate={(s) => (latest = s)} />\n </TamboMcpProvider>,\n );\n\n await waitFor(() => {\n expect(latest.length).toBe(2);\n });\n\n // Pass a new array instance with the same logical servers\n const same = [\n { url: \"https://a.example\", transport: MCPTransport.SSE },\n { url: \"https://b.example\", transport: MCPTransport.SSE },\n ];\n rerender(\n <TamboMcpProvider mcpServers={same}>\n <Capture onUpdate={(s) => (latest = s)} />\n </TamboMcpProvider>,\n );\n\n await waitFor(() => {\n expect(latest.length).toBe(2);\n const urls = latest.map((s) => s.url).sort();\n expect(urls).toEqual([\"https://a.example\", \"https://b.example\"].sort());\n });\n });\n});\n"]}
|
|
@@ -43,7 +43,7 @@ export declare const TamboMcpProvider: FC<{
|
|
|
43
43
|
* For example, to forcibly disconnect and reconnect all MCP servers:
|
|
44
44
|
*
|
|
45
45
|
* ```tsx
|
|
46
|
-
* const mcpServers =
|
|
46
|
+
* const mcpServers = useTamboMcpServers();
|
|
47
47
|
* mcpServers.forEach((mcpServer) => {
|
|
48
48
|
* mcpServer.client?.reconnect();
|
|
49
49
|
* });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tambo-mcp-provider.d.ts","sourceRoot":"","sources":["../../src/mcp/tambo-mcp-provider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tambo-mcp-provider.d.ts","sourceRoot":"","sources":["../../src/mcp/tambo-mcp-provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAEZ,EAAE,EAIH,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEvD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAsB5D;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC;AAED,MAAM,WAAW,kBAAmB,SAAQ,aAAa;IACvD,MAAM,EAAE,SAAS,CAAC;CACnB;AAED,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,eAAe,EAAE,KAAK,CAAC;CACxB;AAED,MAAM,MAAM,SAAS,GAAG,kBAAkB,GAAG,eAAe,CAAC;AAG7D;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC;IAChC,UAAU,EAAE,CAAC,aAAa,GAAG,MAAM,CAAC,EAAE,CAAC;IACvC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAsIA,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,kBAAkB,mBAE9B,CAAC"}
|
|
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.useTamboMcpServers = exports.TamboMcpProvider = void 0;
|
|
37
37
|
exports.extractErrorMessage = extractErrorMessage;
|
|
38
|
+
const fast_equals_1 = require("fast-equals");
|
|
38
39
|
const react_1 = __importStar(require("react"));
|
|
39
40
|
const tambo_registry_provider_1 = require("../providers/tambo-registry-provider");
|
|
40
41
|
const mcp_client_1 = require("./mcp-client");
|
|
@@ -76,6 +77,9 @@ const TamboMcpProvider = ({ mcpServers, children }) => {
|
|
|
76
77
|
async function registerMcpServers(mcpServerInfos) {
|
|
77
78
|
// Maps tool names to the MCP client that registered them
|
|
78
79
|
const mcpServerMap = new Map();
|
|
80
|
+
setConnectedMcpServers((prev) =>
|
|
81
|
+
// remove any servers that are not in the new list
|
|
82
|
+
prev.filter((s) => mcpServerInfos.some((mcpServerInfo) => equalsMcpServer(s, mcpServerInfo))));
|
|
79
83
|
// initialize the MCP clients, converting McpServerInfo -> McpServer
|
|
80
84
|
const mcpServers = await Promise.allSettled(mcpServerInfos.map(async (mcpServerInfo) => {
|
|
81
85
|
try {
|
|
@@ -86,7 +90,11 @@ const TamboMcpProvider = ({ mcpServers, children }) => {
|
|
|
86
90
|
};
|
|
87
91
|
// note because the promises may resolve in any order, the resulting
|
|
88
92
|
// array may not be in the same order as the input array
|
|
89
|
-
setConnectedMcpServers((prev) => [
|
|
93
|
+
setConnectedMcpServers((prev) => [
|
|
94
|
+
// replace the server if it already exists
|
|
95
|
+
...prev.filter((s) => !equalsMcpServer(s, mcpServerInfo)),
|
|
96
|
+
connectedMcpServer,
|
|
97
|
+
]);
|
|
90
98
|
return connectedMcpServer;
|
|
91
99
|
}
|
|
92
100
|
catch (error) {
|
|
@@ -96,7 +104,11 @@ const TamboMcpProvider = ({ mcpServers, children }) => {
|
|
|
96
104
|
};
|
|
97
105
|
// note because the promises may resolve in any order, the resulting
|
|
98
106
|
// array may not be in the same order as the input array
|
|
99
|
-
setConnectedMcpServers((prev) => [
|
|
107
|
+
setConnectedMcpServers((prev) => [
|
|
108
|
+
// replace the server if it already exists
|
|
109
|
+
...prev.filter((s) => !equalsMcpServer(s, mcpServerInfo)),
|
|
110
|
+
failedMcpServer,
|
|
111
|
+
]);
|
|
100
112
|
return failedMcpServer;
|
|
101
113
|
}
|
|
102
114
|
}));
|
|
@@ -170,7 +182,7 @@ exports.TamboMcpProvider = TamboMcpProvider;
|
|
|
170
182
|
* For example, to forcibly disconnect and reconnect all MCP servers:
|
|
171
183
|
*
|
|
172
184
|
* ```tsx
|
|
173
|
-
* const mcpServers =
|
|
185
|
+
* const mcpServers = useTamboMcpServers();
|
|
174
186
|
* mcpServers.forEach((mcpServer) => {
|
|
175
187
|
* mcpServer.client?.reconnect();
|
|
176
188
|
* });
|
|
@@ -184,4 +196,9 @@ const useTamboMcpServers = () => {
|
|
|
184
196
|
return (0, react_1.useContext)(McpProviderContext);
|
|
185
197
|
};
|
|
186
198
|
exports.useTamboMcpServers = useTamboMcpServers;
|
|
199
|
+
function equalsMcpServer(s, mcpServerInfo) {
|
|
200
|
+
return (s.url === mcpServerInfo.url &&
|
|
201
|
+
s.transport === mcpServerInfo.transport &&
|
|
202
|
+
(0, fast_equals_1.deepEqual)(s.customHeaders, mcpServerInfo.customHeaders));
|
|
203
|
+
}
|
|
187
204
|
//# sourceMappingURL=tambo-mcp-provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tambo-mcp-provider.js","sourceRoot":"","sources":["../../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mBAAmB,IACpD,QAAQ,CACmB,CAC/B,CAAC;AACJ,CAAC,CAAC;AAzHW,QAAA,gBAAgB,oBAyH3B;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACI,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,OAAO,IAAA,kBAAU,EAAC,kBAAkB,CAAC,CAAC;AACxC,CAAC,CAAC;AAFW,QAAA,kBAAkB,sBAE7B","sourcesContent":["import React, {\n createContext,\n FC,\n useContext,\n useEffect,\n useState,\n} from \"react\";\nimport { TamboTool } from \"../model/component-metadata\";\nimport { useTamboRegistry } from \"../providers/tambo-registry-provider\";\nimport { MCPClient, MCPTransport } from \"./mcp-client\";\n\n/**\n * Extracts error message from MCP tool result content.\n * Handles both array and string content formats.\n * Always returns a string, even for invalid/null inputs.\n * @returns The extracted error message as a string\n */\nexport function extractErrorMessage(content: unknown): string {\n if (content === undefined || content === null) {\n return \"Unknown error occurred\";\n }\n\n if (Array.isArray(content)) {\n const textItems = content\n .filter(\n (item) => item && item.type === \"text\" && typeof item.text === \"string\",\n )\n .map((item) => item.text);\n\n return textItems.length > 0\n ? textItems.join(\" \")\n : \"Error occurred but no details provided\";\n }\n\n if (typeof content === \"object\") {\n return JSON.stringify(content);\n }\n\n return `${content}`;\n}\n\nexport interface McpServerInfo {\n name?: string;\n url: string;\n description?: string;\n transport?: MCPTransport;\n customHeaders?: Record<string, string>;\n}\n\nexport interface ConnectedMcpServer extends McpServerInfo {\n client: MCPClient;\n}\n\nexport interface FailedMcpServer extends McpServerInfo {\n client?: never;\n connectionError: Error;\n}\n\nexport type McpServer = ConnectedMcpServer | FailedMcpServer;\n\nconst McpProviderContext = createContext<McpServer[]>([]);\n/**\n * This provider is used to register tools from MCP servers.\n * @returns the wrapped children\n */\nexport const TamboMcpProvider: FC<{\n mcpServers: (McpServerInfo | string)[];\n children: React.ReactNode;\n}> = ({ mcpServers, children }) => {\n const { registerTool } = useTamboRegistry();\n const [connectedMcpServers, setConnectedMcpServers] = useState<McpServer[]>(\n [],\n );\n\n useEffect(() => {\n if (!mcpServers) {\n return;\n }\n async function registerMcpServers(mcpServerInfos: McpServerInfo[]) {\n // Maps tool names to the MCP client that registered them\n const mcpServerMap = new Map<string, McpServer>();\n\n // initialize the MCP clients, converting McpServerInfo -> McpServer\n const mcpServers = await Promise.allSettled(\n mcpServerInfos.map(async (mcpServerInfo): Promise<McpServer> => {\n try {\n const client = await MCPClient.create(\n mcpServerInfo.url,\n mcpServerInfo.transport,\n mcpServerInfo.customHeaders,\n );\n const connectedMcpServer = {\n ...mcpServerInfo,\n client: client,\n };\n // note because the promises may resolve in any order, the resulting\n // array may not be in the same order as the input array\n setConnectedMcpServers((prev) => [...prev, connectedMcpServer]);\n return connectedMcpServer;\n } catch (error) {\n const failedMcpServer = {\n ...mcpServerInfo,\n connectionError: error as Error,\n };\n // note because the promises may resolve in any order, the resulting\n // array may not be in the same order as the input array\n setConnectedMcpServers((prev) => [...prev, failedMcpServer]);\n return failedMcpServer;\n }\n }),\n );\n\n // note do not rely on the state\n const connectedMcpServers = mcpServers\n .filter((result) => result.status === \"fulfilled\")\n .map((result) => result.value);\n\n // Now create a map of tool name to MCP client\n const serverToolLists = connectedMcpServers.map(async (mcpServer) => {\n const tools = (await mcpServer.client?.listTools()) ?? [];\n tools.forEach((tool) => {\n mcpServerMap.set(tool.name, mcpServer);\n });\n return tools;\n });\n const toolResults = await Promise.allSettled(serverToolLists);\n\n // Just log the failed tools, we can't do anything about them\n const failedTools = toolResults.filter(\n (result) => result.status === \"rejected\",\n );\n if (failedTools.length > 0) {\n console.error(\n \"Failed to register tools from MCP servers:\",\n failedTools.map((result) => result.reason),\n );\n }\n\n // Register the successful tools\n const allTools = toolResults\n .filter((result) => result.status === \"fulfilled\")\n .map((result) => result.value)\n .flat();\n allTools.forEach((tool) => {\n registerTool({\n description: tool.description ?? \"\",\n name: tool.name,\n tool: async (args: Record<string, unknown>) => {\n const mcpServer = mcpServerMap.get(tool.name);\n if (!mcpServer) {\n // should never happen\n throw new Error(`MCP server for tool ${tool.name} not found`);\n }\n if (!mcpServer.client) {\n // this can't actually happen because the tool can't be registered if the server is not connected\n throw new Error(\n `MCP server for tool ${tool.name} is not connected`,\n );\n }\n const result = await mcpServer.client.callTool(tool.name, args);\n if (result.isError) {\n const errorMessage = extractErrorMessage(result.content);\n throw new Error(errorMessage);\n }\n return result.content;\n },\n toolSchema: tool.inputSchema as TamboTool[\"toolSchema\"],\n });\n });\n }\n\n // normalize the server infos\n const mcpServerInfos = mcpServers.map((mcpServer) =>\n typeof mcpServer === \"string\"\n ? { url: mcpServer, transport: MCPTransport.SSE }\n : mcpServer,\n );\n\n registerMcpServers(mcpServerInfos);\n }, [mcpServers, registerTool]);\n\n return (\n <McpProviderContext.Provider value={connectedMcpServers}>\n {children}\n </McpProviderContext.Provider>\n );\n};\n\n/**\n * Hook to access the actual MCP servers, as they are connected (or fail to\n * connect).\n *\n * You can call methods on the MCP client that is included in the MCP server\n * object.\n *\n * If the server fails to connect, the `client` property will be `undefined` and\n * the `connectionError` property will be set.\n *\n * For example, to forcibly disconnect and reconnect all MCP servers:\n *\n * ```tsx\n * const mcpServers = useMcpServers();\n * mcpServers.forEach((mcpServer) => {\n * mcpServer.client?.reconnect();\n * });\n * ```\n *\n * Note that the MCP servers are not guaranteed to be in the same order as the\n * input array, because they are added as they are connected.\n * @returns The MCP servers\n */\nexport const useTamboMcpServers = () => {\n return useContext(McpProviderContext);\n};\n"]}
|
|
1
|
+
{"version":3,"file":"tambo-mcp-provider.js","sourceRoot":"","sources":["../../src/mcp/tambo-mcp-provider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,kDAsBC;AAxCD,6CAAwC;AACxC,+CAMe;AAEf,kFAAwE;AACxE,6CAAuD;AAEvD;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,OAAgB;IAClD,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,EAAE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C,GAAG,EAAE;YACjD,CAAC,CAAC,SAAS,CACd,CAAC;QAEF,kBAAkB,CAAC,cAAc,CAAC,CAAC;IACrC,CAAC,EAAE,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC;IAE/B,OAAO,CACL,8BAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,mBAAmB,IACpD,QAAQ,CACmB,CAC/B,CAAC;AACJ,CAAC,CAAC;AAzIW,QAAA,gBAAgB,oBAyI3B;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACI,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,OAAO,IAAA,kBAAU,EAAC,kBAAkB,CAAC,CAAC;AACxC,CAAC,CAAC;AAFW,QAAA,kBAAkB,sBAE7B;AACF,SAAS,eAAe,CAAC,CAAY,EAAE,aAA4B;IACjE,OAAO,CACL,CAAC,CAAC,GAAG,KAAK,aAAa,CAAC,GAAG;QAC3B,CAAC,CAAC,SAAS,KAAK,aAAa,CAAC,SAAS;QACvC,IAAA,uBAAS,EAAC,CAAC,CAAC,aAAa,EAAE,aAAa,CAAC,aAAa,CAAC,CACxD,CAAC;AACJ,CAAC","sourcesContent":["import { deepEqual } from \"fast-equals\";\nimport React, {\n createContext,\n FC,\n useContext,\n useEffect,\n useState,\n} from \"react\";\nimport { TamboTool } from \"../model/component-metadata\";\nimport { useTamboRegistry } from \"../providers/tambo-registry-provider\";\nimport { MCPClient, MCPTransport } from \"./mcp-client\";\n\n/**\n * Extracts error message from MCP tool result content.\n * Handles both array and string content formats.\n * Always returns a string, even for invalid/null inputs.\n * @returns The extracted error message as a string\n */\nexport function extractErrorMessage(content: unknown): string {\n if (content === undefined || content === null) {\n return \"Unknown error occurred\";\n }\n\n if (Array.isArray(content)) {\n const textItems = content\n .filter(\n (item) => item && item.type === \"text\" && typeof item.text === \"string\",\n )\n .map((item) => item.text);\n\n return textItems.length > 0\n ? textItems.join(\" \")\n : \"Error occurred but no details provided\";\n }\n\n if (typeof content === \"object\") {\n return JSON.stringify(content);\n }\n\n return `${content}`;\n}\n\nexport interface McpServerInfo {\n name?: string;\n url: string;\n description?: string;\n transport?: MCPTransport;\n customHeaders?: Record<string, string>;\n}\n\nexport interface ConnectedMcpServer extends McpServerInfo {\n client: MCPClient;\n}\n\nexport interface FailedMcpServer extends McpServerInfo {\n client?: never;\n connectionError: Error;\n}\n\nexport type McpServer = ConnectedMcpServer | FailedMcpServer;\n\nconst McpProviderContext = createContext<McpServer[]>([]);\n/**\n * This provider is used to register tools from MCP servers.\n * @returns the wrapped children\n */\nexport const TamboMcpProvider: FC<{\n mcpServers: (McpServerInfo | string)[];\n children: React.ReactNode;\n}> = ({ mcpServers, children }) => {\n const { registerTool } = useTamboRegistry();\n const [connectedMcpServers, setConnectedMcpServers] = useState<McpServer[]>(\n [],\n );\n\n useEffect(() => {\n if (!mcpServers) {\n return;\n }\n async function registerMcpServers(mcpServerInfos: McpServerInfo[]) {\n // Maps tool names to the MCP client that registered them\n const mcpServerMap = new Map<string, McpServer>();\n setConnectedMcpServers((prev) =>\n // remove any servers that are not in the new list\n prev.filter((s) =>\n mcpServerInfos.some((mcpServerInfo) =>\n equalsMcpServer(s, mcpServerInfo),\n ),\n ),\n );\n\n // initialize the MCP clients, converting McpServerInfo -> McpServer\n const mcpServers = await Promise.allSettled(\n mcpServerInfos.map(async (mcpServerInfo): Promise<McpServer> => {\n try {\n const client = await MCPClient.create(\n mcpServerInfo.url,\n mcpServerInfo.transport,\n mcpServerInfo.customHeaders,\n );\n const connectedMcpServer = {\n ...mcpServerInfo,\n client: client,\n };\n // note because the promises may resolve in any order, the resulting\n // array may not be in the same order as the input array\n setConnectedMcpServers((prev) => [\n // replace the server if it already exists\n ...prev.filter((s) => !equalsMcpServer(s, mcpServerInfo)),\n connectedMcpServer,\n ]);\n return connectedMcpServer;\n } catch (error) {\n const failedMcpServer = {\n ...mcpServerInfo,\n connectionError: error as Error,\n };\n // note because the promises may resolve in any order, the resulting\n // array may not be in the same order as the input array\n setConnectedMcpServers((prev) => [\n // replace the server if it already exists\n ...prev.filter((s) => !equalsMcpServer(s, mcpServerInfo)),\n failedMcpServer,\n ]);\n return failedMcpServer;\n }\n }),\n );\n\n // note do not rely on the state\n const connectedMcpServers = mcpServers\n .filter((result) => result.status === \"fulfilled\")\n .map((result) => result.value);\n\n // Now create a map of tool name to MCP client\n const serverToolLists = connectedMcpServers.map(async (mcpServer) => {\n const tools = (await mcpServer.client?.listTools()) ?? [];\n tools.forEach((tool) => {\n mcpServerMap.set(tool.name, mcpServer);\n });\n return tools;\n });\n const toolResults = await Promise.allSettled(serverToolLists);\n\n // Just log the failed tools, we can't do anything about them\n const failedTools = toolResults.filter(\n (result) => result.status === \"rejected\",\n );\n if (failedTools.length > 0) {\n console.error(\n \"Failed to register tools from MCP servers:\",\n failedTools.map((result) => result.reason),\n );\n }\n\n // Register the successful tools\n const allTools = toolResults\n .filter((result) => result.status === \"fulfilled\")\n .map((result) => result.value)\n .flat();\n allTools.forEach((tool) => {\n registerTool({\n description: tool.description ?? \"\",\n name: tool.name,\n tool: async (args: Record<string, unknown>) => {\n const mcpServer = mcpServerMap.get(tool.name);\n if (!mcpServer) {\n // should never happen\n throw new Error(`MCP server for tool ${tool.name} not found`);\n }\n if (!mcpServer.client) {\n // this can't actually happen because the tool can't be registered if the server is not connected\n throw new Error(\n `MCP server for tool ${tool.name} is not connected`,\n );\n }\n const result = await mcpServer.client.callTool(tool.name, args);\n if (result.isError) {\n const errorMessage = extractErrorMessage(result.content);\n throw new Error(errorMessage);\n }\n return result.content;\n },\n toolSchema: tool.inputSchema as TamboTool[\"toolSchema\"],\n });\n });\n }\n\n // normalize the server infos\n const mcpServerInfos = mcpServers.map((mcpServer) =>\n typeof mcpServer === \"string\"\n ? { url: mcpServer, transport: MCPTransport.SSE }\n : mcpServer,\n );\n\n registerMcpServers(mcpServerInfos);\n }, [mcpServers, registerTool]);\n\n return (\n <McpProviderContext.Provider value={connectedMcpServers}>\n {children}\n </McpProviderContext.Provider>\n );\n};\n\n/**\n * Hook to access the actual MCP servers, as they are connected (or fail to\n * connect).\n *\n * You can call methods on the MCP client that is included in the MCP server\n * object.\n *\n * If the server fails to connect, the `client` property will be `undefined` and\n * the `connectionError` property will be set.\n *\n * For example, to forcibly disconnect and reconnect all MCP servers:\n *\n * ```tsx\n * const mcpServers = useTamboMcpServers();\n * mcpServers.forEach((mcpServer) => {\n * mcpServer.client?.reconnect();\n * });\n * ```\n *\n * Note that the MCP servers are not guaranteed to be in the same order as the\n * input array, because they are added as they are connected.\n * @returns The MCP servers\n */\nexport const useTamboMcpServers = () => {\n return useContext(McpProviderContext);\n};\nfunction equalsMcpServer(s: McpServer, mcpServerInfo: McpServerInfo): boolean {\n return (\n s.url === mcpServerInfo.url &&\n s.transport === mcpServerInfo.transport &&\n deepEqual(s.customHeaders, mcpServerInfo.customHeaders)\n );\n}\n"]}
|
|
@@ -278,6 +278,21 @@ describe("updateInteractableComponentProps - Partial Updates", () => {
|
|
|
278
278
|
});
|
|
279
279
|
expect(updateResult).toBe("Updated successfully");
|
|
280
280
|
});
|
|
281
|
+
it("should throw error when component name contains spaces", () => {
|
|
282
|
+
const { result } = (0, react_1.renderHook)(() => (0, tambo_interactable_provider_1.useTamboInteractable)(), { wrapper });
|
|
283
|
+
const invalidComponent = {
|
|
284
|
+
name: "Invalid Component Name", // Contains spaces
|
|
285
|
+
description: "A component with spaces in name",
|
|
286
|
+
component: () => react_2.default.createElement("div", null, "Invalid"),
|
|
287
|
+
props: { title: "Test" },
|
|
288
|
+
propsSchema: zod_1.z.object({ title: zod_1.z.string() }),
|
|
289
|
+
};
|
|
290
|
+
expect(() => {
|
|
291
|
+
(0, react_1.act)(() => {
|
|
292
|
+
result.current.addInteractableComponent(invalidComponent);
|
|
293
|
+
});
|
|
294
|
+
}).toThrow('component "Invalid Component Name" must only contain letters, numbers, underscores, and hyphens.');
|
|
295
|
+
});
|
|
281
296
|
it("should return warning for empty props object", () => {
|
|
282
297
|
const { result } = (0, react_1.renderHook)(() => (0, tambo_interactable_provider_1.useTamboInteractable)(), { wrapper });
|
|
283
298
|
const component = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tambo-interactable-provider-partial-updates.test.js","sourceRoot":"","sources":["../../../src/providers/__tests__/tambo-interactable-provider-partial-updates.test.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyD;AACzD,kDAA0B;AAC1B,6BAAwB;AAExB,gFAGwC;AAExC,2BAA2B;AAC3B,MAAM,oBAAoB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AACvC,MAAM,uBAAuB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAE1C,IAAI,CAAC,IAAI,CAAC,mCAAmC,EAAE,GAAG,EAAE,CAAC,CAAC;IACpD,2BAA2B,EAAE,CAAC,EAC5B,QAAQ,GAGT,EAAE,EAAE,CAAC,8DAAG,QAAQ,CAAI;IACrB,sBAAsB,EAAE,GAAG,EAAE,CAAC,CAAC;QAC7B,gBAAgB,EAAE,oBAAoB;QACtC,mBAAmB,EAAE,uBAAuB;KAC7C,CAAC;CACH,CAAC,CAAC,CAAC;AAEJ,8BAA8B;AAC9B,MAAM,gBAAgB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAEnC,IAAI,CAAC,IAAI,CAAC,6BAA6B,EAAE,GAAG,EAAE,CAAC,CAAC;IAC9C,iBAAiB,EAAE,GAAG,EAAE,CAAC,CAAC;QACxB,YAAY,EAAE,gBAAgB;KAC/B,CAAC;CACH,CAAC,CAAC,CAAC;AAEJ,mCAAmC;AACnC,IAAI,CAAC,IAAI,CAAC,4DAA4D,EAAE,GAAG,EAAE,CAAC,CAAC;IAC7E,gCAAgC,EAAE,GAAG,EAAE,CACrC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;QACb,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE;YACP,WAAW,EAAE,4BAA4B;YACzC,UAAU,EAAE,EAAE;SACf;KACF,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E,IAAI,EAAE,UAAU;4BACtB,8CAA8C;yBAC/C;qBACF;iBACF;aACF,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { act, renderHook } from \"@testing-library/react\";\nimport React from \"react\";\nimport { z } from \"zod\";\nimport { TamboInteractableComponent } from \"../../model/tambo-interactable\";\nimport {\n TamboInteractableProvider,\n useTamboInteractable,\n} from \"../tambo-interactable-provider\";\n\n// Mock the context helpers\nconst mockAddContextHelper = jest.fn();\nconst mockRemoveContextHelper = jest.fn();\n\njest.mock(\"../tambo-context-helpers-provider\", () => ({\n TamboContextHelpersProvider: ({\n children,\n }: {\n children: React.ReactNode;\n }) => <>{children}</>,\n useTamboContextHelpers: () => ({\n addContextHelper: mockAddContextHelper,\n removeContextHelper: mockRemoveContextHelper,\n }),\n}));\n\n// Mock the component provider\nconst mockRegisterTool = jest.fn();\n\njest.mock(\"../tambo-component-provider\", () => ({\n useTamboComponent: () => ({\n registerTool: mockRegisterTool,\n }),\n}));\n\n// Mock the context helper creation\njest.mock(\"../../context-helpers/current-interactables-context-helper\", () => ({\n createInteractablesContextHelper: () =>\n jest.fn(() => ({\n name: \"interactables\",\n context: {\n description: \"Test interactables context\",\n components: [],\n },\n })),\n}));\n\ndescribe(\"updateInteractableComponentProps - Partial Updates\", () => {\n beforeEach(() => {\n jest.clearAllMocks();\n });\n\n const wrapper = ({ children }: { children: React.ReactNode }) => (\n <TamboInteractableProvider>{children}</TamboInteractableProvider>\n );\n\n describe(\"Partial Updates Functionality\", () => {\n it(\"should apply partial updates to existing props\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n count: 0,\n active: true,\n metadata: { type: \"test\", version: \"1.0\" },\n },\n propsSchema: z.object({\n title: z.string(),\n count: z.number(),\n active: z.boolean(),\n metadata: z.object({\n type: z.string(),\n version: z.string(),\n }),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n // Verify initial state\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\",\n count: 0,\n active: true,\n metadata: { type: \"test\", version: \"1.0\" },\n });\n\n // Apply partial update - only change count\n let updateResult = \"\";\n act(() => {\n updateResult = result.current.updateInteractableComponentProps(\n componentId,\n {\n count: 5,\n },\n );\n });\n\n expect(updateResult).toBe(\"Updated successfully\");\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\", // unchanged\n count: 5, // updated\n active: true, // unchanged\n metadata: { type: \"test\", version: \"1.0\" }, // unchanged\n });\n });\n\n it(\"should apply multiple partial updates in sequence\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n count: 0,\n active: true,\n description: \"Original description\",\n },\n propsSchema: z.object({\n title: z.string(),\n count: z.number(),\n active: z.boolean(),\n description: z.string(),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n // First partial update - change title and count\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n title: \"Updated Title\",\n count: 10,\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Updated Title\",\n count: 10,\n active: true,\n description: \"Original description\",\n });\n\n // Second partial update - change active and description\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n active: false,\n description: \"Updated description\",\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Updated Title\", // from previous update\n count: 10, // from previous update\n active: false, // new update\n description: \"Updated description\", // new update\n });\n });\n\n it(\"should handle nested object partial updates (shallow merge behavior)\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n config: {\n theme: \"light\",\n language: \"en\",\n features: {\n notifications: true,\n analytics: false,\n },\n },\n },\n propsSchema: z.object({\n title: z.string(),\n config: z.object({\n theme: z.string(),\n language: z.string(),\n features: z.object({\n notifications: z.boolean(),\n analytics: z.boolean(),\n }),\n }),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n // Partial update - replace entire config object (shallow merge behavior)\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n config: {\n theme: \"dark\",\n // Note: language and features are not provided, so they will be undefined\n // This demonstrates the shallow merge behavior\n },\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\",\n config: {\n theme: \"dark\", // updated\n // language and features are now undefined due to shallow merge\n },\n });\n });\n\n it(\"should handle array partial updates\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n items: [\"item1\", \"item2\", \"item3\"],\n tags: [\"tag1\", \"tag2\"],\n },\n propsSchema: z.object({\n title: z.string(),\n items: z.array(z.string()),\n tags: z.array(z.string()),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n // Partial update - only change items array\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n items: [\"newItem1\", \"newItem2\"],\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\", // unchanged\n items: [\"newItem1\", \"newItem2\"], // updated\n tags: [\"tag1\", \"tag2\"], // unchanged\n });\n });\n\n it(\"should handle null and undefined values in partial updates\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n count: 5,\n description: \"Original description\",\n },\n propsSchema: z.object({\n title: z.string(),\n count: z.number(),\n description: z.string(),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n // Partial update with null value\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n description: null as any,\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\",\n count: 5,\n description: null,\n });\n\n // Partial update with undefined value\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n count: undefined as any,\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\",\n count: undefined,\n description: null,\n });\n });\n });\n\n describe(\"Error Handling\", () => {\n it(\"should return error for non-existent component\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n let updateResult = \"\";\n act(() => {\n updateResult = result.current.updateInteractableComponentProps(\n \"non-existent\",\n {\n title: \"New Title\",\n },\n );\n });\n\n expect(updateResult).toBe(\"Updated successfully\");\n });\n\n it(\"should return warning for empty props object\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: { title: \"Original Title\" },\n propsSchema: z.object({ title: z.string() }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n let updateResult = \"\";\n act(() => {\n updateResult = result.current.updateInteractableComponentProps(\n componentId,\n {},\n );\n });\n\n expect(updateResult).toBe(\n `Warning: No props provided for component with ID ${componentId}.`,\n );\n });\n\n it(\"should return warning for null props\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: { title: \"Original Title\" },\n propsSchema: z.object({ title: z.string() }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n let updateResult = \"\";\n act(() => {\n updateResult = result.current.updateInteractableComponentProps(\n componentId,\n null as any,\n );\n });\n\n expect(updateResult).toBe(\n `Warning: No props provided for component with ID ${componentId}.`,\n );\n });\n\n it(\"should return warning for undefined props\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: { title: \"Original Title\" },\n propsSchema: z.object({ title: z.string() }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n let updateResult = \"\";\n act(() => {\n updateResult = result.current.updateInteractableComponentProps(\n componentId,\n undefined as any,\n );\n });\n\n expect(updateResult).toBe(\n `Warning: No props provided for component with ID ${componentId}.`,\n );\n });\n });\n\n describe(\"Performance and Efficiency\", () => {\n it(\"should only update changed properties without affecting others\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n count: 0,\n active: true,\n metadata: { type: \"test\", version: \"1.0\" },\n items: [\"item1\", \"item2\"],\n },\n propsSchema: z.object({\n title: z.string(),\n count: z.number(),\n active: z.boolean(),\n metadata: z.object({\n type: z.string(),\n version: z.string(),\n }),\n items: z.array(z.string()),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n const originalProps = result.current.interactableComponents[0].props;\n const originalMetadata = originalProps.metadata;\n const originalItems = originalProps.items;\n\n // Apply minimal partial update - only change count\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n count: 1,\n });\n });\n\n const updatedProps = result.current.interactableComponents[0].props;\n\n // Verify that only count changed\n expect(updatedProps.count).toBe(1);\n expect(updatedProps.title).toBe(\"Original Title\");\n expect(updatedProps.active).toBe(true);\n\n // Verify that nested objects are preserved (same reference for efficiency)\n expect(updatedProps.metadata).toBe(originalMetadata);\n expect(updatedProps.items).toBe(originalItems);\n });\n\n it(\"should handle large objects efficiently with partial updates\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n // Create a component with a large initial state\n const largeData = {\n users: Array.from({ length: 1000 }, (_, i) => ({\n id: i,\n name: `User ${i}`,\n })),\n settings: {\n theme: \"light\",\n language: \"en\",\n notifications: true,\n privacy: {\n shareData: false,\n analytics: true,\n marketing: false,\n },\n },\n metadata: {\n version: \"1.0.0\",\n build: \"12345\",\n timestamp: Date.now(),\n },\n };\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component with large data\",\n component: () => <div>Test</div>,\n props: largeData,\n propsSchema: z.object({\n users: z.array(\n z.object({\n id: z.number(),\n name: z.string(),\n }),\n ),\n settings: z.object({\n theme: z.string(),\n language: z.string(),\n notifications: z.boolean(),\n privacy: z.object({\n shareData: z.boolean(),\n analytics: z.boolean(),\n marketing: z.boolean(),\n }),\n }),\n metadata: z.object({\n version: z.string(),\n build: z.string(),\n timestamp: z.number(),\n }),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n const originalProps = result.current.interactableComponents[0].props;\n const originalUsers = originalProps.users;\n\n // Apply a small partial update - only change theme (shallow merge behavior)\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n settings: {\n theme: \"dark\",\n // Note: other settings properties are not provided, so they will be undefined\n // This demonstrates the shallow merge behavior\n },\n });\n });\n\n const updatedProps = result.current.interactableComponents[0].props;\n\n // Verify the update worked\n expect(updatedProps.settings.theme).toBe(\"dark\");\n // Due to shallow merge, other properties are now undefined\n expect(updatedProps.settings.language).toBeUndefined();\n expect(updatedProps.settings.notifications).toBeUndefined();\n\n // Verify that large arrays are preserved (same reference for efficiency)\n expect(updatedProps.users).toBe(originalUsers);\n\n // Verify that metadata is preserved (not updated)\n expect(updatedProps.metadata).toBe(originalProps.metadata);\n });\n });\n\n describe(\"Edge Cases\", () => {\n it(\"should handle updating a property that doesn't exist in original props\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n count: 0,\n },\n propsSchema: z.object({\n title: z.string(),\n count: z.number(),\n newProperty: z.string().optional(),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n // Add a new property that wasn't in the original props\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n newProperty: \"New Value\",\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\",\n count: 0,\n newProperty: \"New Value\",\n });\n });\n\n it(\"should handle updating with same values (no-op updates)\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n count: 5,\n active: true,\n },\n propsSchema: z.object({\n title: z.string(),\n count: z.number(),\n active: z.boolean(),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n const originalProps = result.current.interactableComponents[0].props;\n\n // Update with the same values\n let updateResult = \"\";\n act(() => {\n updateResult = result.current.updateInteractableComponentProps(\n componentId,\n {\n title: \"Original Title\",\n count: 5,\n active: true,\n },\n );\n });\n\n expect(updateResult).toBe(\"Updated successfully\");\n expect(result.current.interactableComponents[0].props).toEqual(\n originalProps,\n );\n });\n\n it(\"should handle proper nested partial updates by providing complete nested structure\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n config: {\n theme: \"light\",\n language: \"en\",\n features: {\n notifications: true,\n analytics: false,\n experimental: {\n beta: false,\n alpha: true,\n },\n },\n },\n },\n propsSchema: z.object({\n title: z.string(),\n config: z.object({\n theme: z.string(),\n language: z.string(),\n features: z.object({\n notifications: z.boolean(),\n analytics: z.boolean(),\n experimental: z.object({\n beta: z.boolean(),\n alpha: z.boolean(),\n }),\n }),\n }),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n // Proper nested partial update - provide complete nested structure\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n config: {\n theme: \"light\", // keep original\n language: \"en\", // keep original\n features: {\n notifications: true, // keep original\n analytics: false, // keep original\n experimental: {\n beta: true, // update this\n alpha: true, // keep original\n },\n },\n },\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\",\n config: {\n theme: \"light\", // unchanged\n language: \"en\", // unchanged\n features: {\n notifications: true, // unchanged\n analytics: false, // unchanged\n experimental: {\n beta: true, // updated\n alpha: true, // unchanged\n },\n },\n },\n });\n });\n\n it(\"should handle complex nested partial updates (shallow merge behavior)\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n config: {\n theme: \"light\",\n language: \"en\",\n features: {\n notifications: true,\n analytics: false,\n experimental: {\n beta: false,\n alpha: true,\n },\n },\n },\n },\n propsSchema: z.object({\n title: z.string(),\n config: z.object({\n theme: z.string(),\n language: z.string(),\n features: z.object({\n notifications: z.boolean(),\n analytics: z.boolean(),\n experimental: z.object({\n beta: z.boolean(),\n alpha: z.boolean(),\n }),\n }),\n }),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n // Deep nested partial update - only change beta flag (shallow merge behavior)\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n config: {\n features: {\n experimental: {\n beta: true,\n // Note: alpha is not provided, so it will be undefined\n // This demonstrates the shallow merge behavior\n },\n },\n },\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\",\n config: {\n // theme and language are now undefined due to shallow merge\n features: {\n // notifications and analytics are now undefined due to shallow merge\n experimental: {\n beta: true, // updated\n // alpha is now undefined due to shallow merge\n },\n },\n },\n });\n });\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"tambo-interactable-provider-partial-updates.test.js","sourceRoot":"","sources":["../../../src/providers/__tests__/tambo-interactable-provider-partial-updates.test.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyD;AACzD,kDAA0B;AAC1B,6BAAwB;AAExB,gFAGwC;AAExC,2BAA2B;AAC3B,MAAM,oBAAoB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AACvC,MAAM,uBAAuB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAE1C,IAAI,CAAC,IAAI,CAAC,mCAAmC,EAAE,GAAG,EAAE,CAAC,CAAC;IACpD,2BAA2B,EAAE,CAAC,EAC5B,QAAQ,GAGT,EAAE,EAAE,CAAC,8DAAG,QAAQ,CAAI;IACrB,sBAAsB,EAAE,GAAG,EAAE,CAAC,CAAC;QAC7B,gBAAgB,EAAE,oBAAoB;QACtC,mBAAmB,EAAE,uBAAuB;KAC7C,CAAC;CACH,CAAC,CAAC,CAAC;AAEJ,8BAA8B;AAC9B,MAAM,gBAAgB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAEnC,IAAI,CAAC,IAAI,CAAC,6BAA6B,EAAE,GA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AC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { act, renderHook } from \"@testing-library/react\";\nimport React from \"react\";\nimport { z } from \"zod\";\nimport { TamboInteractableComponent } from \"../../model/tambo-interactable\";\nimport {\n TamboInteractableProvider,\n useTamboInteractable,\n} from \"../tambo-interactable-provider\";\n\n// Mock the context helpers\nconst mockAddContextHelper = jest.fn();\nconst mockRemoveContextHelper = jest.fn();\n\njest.mock(\"../tambo-context-helpers-provider\", () => ({\n TamboContextHelpersProvider: ({\n children,\n }: {\n children: React.ReactNode;\n }) => <>{children}</>,\n useTamboContextHelpers: () => ({\n addContextHelper: mockAddContextHelper,\n removeContextHelper: mockRemoveContextHelper,\n }),\n}));\n\n// Mock the component provider\nconst mockRegisterTool = jest.fn();\n\njest.mock(\"../tambo-component-provider\", () => ({\n useTamboComponent: () => ({\n registerTool: mockRegisterTool,\n }),\n}));\n\n// Mock the context helper creation\njest.mock(\"../../context-helpers/current-interactables-context-helper\", () => ({\n createInteractablesContextHelper: () =>\n jest.fn(() => ({\n name: \"interactables\",\n context: {\n description: \"Test interactables context\",\n components: [],\n },\n })),\n}));\n\ndescribe(\"updateInteractableComponentProps - Partial Updates\", () => {\n beforeEach(() => {\n jest.clearAllMocks();\n });\n\n const wrapper = ({ children }: { children: React.ReactNode }) => (\n <TamboInteractableProvider>{children}</TamboInteractableProvider>\n );\n\n describe(\"Partial Updates Functionality\", () => {\n it(\"should apply partial updates to existing props\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n count: 0,\n active: true,\n metadata: { type: \"test\", version: \"1.0\" },\n },\n propsSchema: z.object({\n title: z.string(),\n count: z.number(),\n active: z.boolean(),\n metadata: z.object({\n type: z.string(),\n version: z.string(),\n }),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n // Verify initial state\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\",\n count: 0,\n active: true,\n metadata: { type: \"test\", version: \"1.0\" },\n });\n\n // Apply partial update - only change count\n let updateResult = \"\";\n act(() => {\n updateResult = result.current.updateInteractableComponentProps(\n componentId,\n {\n count: 5,\n },\n );\n });\n\n expect(updateResult).toBe(\"Updated successfully\");\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\", // unchanged\n count: 5, // updated\n active: true, // unchanged\n metadata: { type: \"test\", version: \"1.0\" }, // unchanged\n });\n });\n\n it(\"should apply multiple partial updates in sequence\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n count: 0,\n active: true,\n description: \"Original description\",\n },\n propsSchema: z.object({\n title: z.string(),\n count: z.number(),\n active: z.boolean(),\n description: z.string(),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n // First partial update - change title and count\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n title: \"Updated Title\",\n count: 10,\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Updated Title\",\n count: 10,\n active: true,\n description: \"Original description\",\n });\n\n // Second partial update - change active and description\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n active: false,\n description: \"Updated description\",\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Updated Title\", // from previous update\n count: 10, // from previous update\n active: false, // new update\n description: \"Updated description\", // new update\n });\n });\n\n it(\"should handle nested object partial updates (shallow merge behavior)\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n config: {\n theme: \"light\",\n language: \"en\",\n features: {\n notifications: true,\n analytics: false,\n },\n },\n },\n propsSchema: z.object({\n title: z.string(),\n config: z.object({\n theme: z.string(),\n language: z.string(),\n features: z.object({\n notifications: z.boolean(),\n analytics: z.boolean(),\n }),\n }),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n // Partial update - replace entire config object (shallow merge behavior)\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n config: {\n theme: \"dark\",\n // Note: language and features are not provided, so they will be undefined\n // This demonstrates the shallow merge behavior\n },\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\",\n config: {\n theme: \"dark\", // updated\n // language and features are now undefined due to shallow merge\n },\n });\n });\n\n it(\"should handle array partial updates\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n items: [\"item1\", \"item2\", \"item3\"],\n tags: [\"tag1\", \"tag2\"],\n },\n propsSchema: z.object({\n title: z.string(),\n items: z.array(z.string()),\n tags: z.array(z.string()),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n // Partial update - only change items array\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n items: [\"newItem1\", \"newItem2\"],\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\", // unchanged\n items: [\"newItem1\", \"newItem2\"], // updated\n tags: [\"tag1\", \"tag2\"], // unchanged\n });\n });\n\n it(\"should handle null and undefined values in partial updates\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n count: 5,\n description: \"Original description\",\n },\n propsSchema: z.object({\n title: z.string(),\n count: z.number(),\n description: z.string(),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n // Partial update with null value\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n description: null as any,\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\",\n count: 5,\n description: null,\n });\n\n // Partial update with undefined value\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n count: undefined as any,\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\",\n count: undefined,\n description: null,\n });\n });\n });\n\n describe(\"Error Handling\", () => {\n it(\"should return error for non-existent component\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n let updateResult = \"\";\n act(() => {\n updateResult = result.current.updateInteractableComponentProps(\n \"non-existent\",\n {\n title: \"New Title\",\n },\n );\n });\n\n expect(updateResult).toBe(\"Updated successfully\");\n });\n\n it(\"should throw error when component name contains spaces\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const invalidComponent: Omit<\n TamboInteractableComponent,\n \"id\" | \"createdAt\"\n > = {\n name: \"Invalid Component Name\", // Contains spaces\n description: \"A component with spaces in name\",\n component: () => <div>Invalid</div>,\n props: { title: \"Test\" },\n propsSchema: z.object({ title: z.string() }),\n };\n\n expect(() => {\n act(() => {\n result.current.addInteractableComponent(invalidComponent);\n });\n }).toThrow(\n 'component \"Invalid Component Name\" must only contain letters, numbers, underscores, and hyphens.',\n );\n });\n\n it(\"should return warning for empty props object\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: { title: \"Original Title\" },\n propsSchema: z.object({ title: z.string() }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n let updateResult = \"\";\n act(() => {\n updateResult = result.current.updateInteractableComponentProps(\n componentId,\n {},\n );\n });\n\n expect(updateResult).toBe(\n `Warning: No props provided for component with ID ${componentId}.`,\n );\n });\n\n it(\"should return warning for null props\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: { title: \"Original Title\" },\n propsSchema: z.object({ title: z.string() }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n let updateResult = \"\";\n act(() => {\n updateResult = result.current.updateInteractableComponentProps(\n componentId,\n null as any,\n );\n });\n\n expect(updateResult).toBe(\n `Warning: No props provided for component with ID ${componentId}.`,\n );\n });\n\n it(\"should return warning for undefined props\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: { title: \"Original Title\" },\n propsSchema: z.object({ title: z.string() }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n let updateResult = \"\";\n act(() => {\n updateResult = result.current.updateInteractableComponentProps(\n componentId,\n undefined as any,\n );\n });\n\n expect(updateResult).toBe(\n `Warning: No props provided for component with ID ${componentId}.`,\n );\n });\n });\n\n describe(\"Performance and Efficiency\", () => {\n it(\"should only update changed properties without affecting others\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n count: 0,\n active: true,\n metadata: { type: \"test\", version: \"1.0\" },\n items: [\"item1\", \"item2\"],\n },\n propsSchema: z.object({\n title: z.string(),\n count: z.number(),\n active: z.boolean(),\n metadata: z.object({\n type: z.string(),\n version: z.string(),\n }),\n items: z.array(z.string()),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n const originalProps = result.current.interactableComponents[0].props;\n const originalMetadata = originalProps.metadata;\n const originalItems = originalProps.items;\n\n // Apply minimal partial update - only change count\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n count: 1,\n });\n });\n\n const updatedProps = result.current.interactableComponents[0].props;\n\n // Verify that only count changed\n expect(updatedProps.count).toBe(1);\n expect(updatedProps.title).toBe(\"Original Title\");\n expect(updatedProps.active).toBe(true);\n\n // Verify that nested objects are preserved (same reference for efficiency)\n expect(updatedProps.metadata).toBe(originalMetadata);\n expect(updatedProps.items).toBe(originalItems);\n });\n\n it(\"should handle large objects efficiently with partial updates\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n // Create a component with a large initial state\n const largeData = {\n users: Array.from({ length: 1000 }, (_, i) => ({\n id: i,\n name: `User ${i}`,\n })),\n settings: {\n theme: \"light\",\n language: \"en\",\n notifications: true,\n privacy: {\n shareData: false,\n analytics: true,\n marketing: false,\n },\n },\n metadata: {\n version: \"1.0.0\",\n build: \"12345\",\n timestamp: Date.now(),\n },\n };\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component with large data\",\n component: () => <div>Test</div>,\n props: largeData,\n propsSchema: z.object({\n users: z.array(\n z.object({\n id: z.number(),\n name: z.string(),\n }),\n ),\n settings: z.object({\n theme: z.string(),\n language: z.string(),\n notifications: z.boolean(),\n privacy: z.object({\n shareData: z.boolean(),\n analytics: z.boolean(),\n marketing: z.boolean(),\n }),\n }),\n metadata: z.object({\n version: z.string(),\n build: z.string(),\n timestamp: z.number(),\n }),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n const originalProps = result.current.interactableComponents[0].props;\n const originalUsers = originalProps.users;\n\n // Apply a small partial update - only change theme (shallow merge behavior)\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n settings: {\n theme: \"dark\",\n // Note: other settings properties are not provided, so they will be undefined\n // This demonstrates the shallow merge behavior\n },\n });\n });\n\n const updatedProps = result.current.interactableComponents[0].props;\n\n // Verify the update worked\n expect(updatedProps.settings.theme).toBe(\"dark\");\n // Due to shallow merge, other properties are now undefined\n expect(updatedProps.settings.language).toBeUndefined();\n expect(updatedProps.settings.notifications).toBeUndefined();\n\n // Verify that large arrays are preserved (same reference for efficiency)\n expect(updatedProps.users).toBe(originalUsers);\n\n // Verify that metadata is preserved (not updated)\n expect(updatedProps.metadata).toBe(originalProps.metadata);\n });\n });\n\n describe(\"Edge Cases\", () => {\n it(\"should handle updating a property that doesn't exist in original props\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n count: 0,\n },\n propsSchema: z.object({\n title: z.string(),\n count: z.number(),\n newProperty: z.string().optional(),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n // Add a new property that wasn't in the original props\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n newProperty: \"New Value\",\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\",\n count: 0,\n newProperty: \"New Value\",\n });\n });\n\n it(\"should handle updating with same values (no-op updates)\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n count: 5,\n active: true,\n },\n propsSchema: z.object({\n title: z.string(),\n count: z.number(),\n active: z.boolean(),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n const originalProps = result.current.interactableComponents[0].props;\n\n // Update with the same values\n let updateResult = \"\";\n act(() => {\n updateResult = result.current.updateInteractableComponentProps(\n componentId,\n {\n title: \"Original Title\",\n count: 5,\n active: true,\n },\n );\n });\n\n expect(updateResult).toBe(\"Updated successfully\");\n expect(result.current.interactableComponents[0].props).toEqual(\n originalProps,\n );\n });\n\n it(\"should handle proper nested partial updates by providing complete nested structure\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n config: {\n theme: \"light\",\n language: \"en\",\n features: {\n notifications: true,\n analytics: false,\n experimental: {\n beta: false,\n alpha: true,\n },\n },\n },\n },\n propsSchema: z.object({\n title: z.string(),\n config: z.object({\n theme: z.string(),\n language: z.string(),\n features: z.object({\n notifications: z.boolean(),\n analytics: z.boolean(),\n experimental: z.object({\n beta: z.boolean(),\n alpha: z.boolean(),\n }),\n }),\n }),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n // Proper nested partial update - provide complete nested structure\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n config: {\n theme: \"light\", // keep original\n language: \"en\", // keep original\n features: {\n notifications: true, // keep original\n analytics: false, // keep original\n experimental: {\n beta: true, // update this\n alpha: true, // keep original\n },\n },\n },\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\",\n config: {\n theme: \"light\", // unchanged\n language: \"en\", // unchanged\n features: {\n notifications: true, // unchanged\n analytics: false, // unchanged\n experimental: {\n beta: true, // updated\n alpha: true, // unchanged\n },\n },\n },\n });\n });\n\n it(\"should handle complex nested partial updates (shallow merge behavior)\", () => {\n const { result } = renderHook(() => useTamboInteractable(), { wrapper });\n\n const component: Omit<TamboInteractableComponent, \"id\" | \"createdAt\"> = {\n name: \"TestComponent\",\n description: \"A test component\",\n component: () => <div>Test</div>,\n props: {\n title: \"Original Title\",\n config: {\n theme: \"light\",\n language: \"en\",\n features: {\n notifications: true,\n analytics: false,\n experimental: {\n beta: false,\n alpha: true,\n },\n },\n },\n },\n propsSchema: z.object({\n title: z.string(),\n config: z.object({\n theme: z.string(),\n language: z.string(),\n features: z.object({\n notifications: z.boolean(),\n analytics: z.boolean(),\n experimental: z.object({\n beta: z.boolean(),\n alpha: z.boolean(),\n }),\n }),\n }),\n }),\n };\n\n let componentId = \"\";\n act(() => {\n componentId = result.current.addInteractableComponent(component);\n });\n\n // Deep nested partial update - only change beta flag (shallow merge behavior)\n act(() => {\n result.current.updateInteractableComponentProps(componentId, {\n config: {\n features: {\n experimental: {\n beta: true,\n // Note: alpha is not provided, so it will be undefined\n // This demonstrates the shallow merge behavior\n },\n },\n },\n });\n });\n\n expect(result.current.interactableComponents[0].props).toEqual({\n title: \"Original Title\",\n config: {\n // theme and language are now undefined due to shallow merge\n features: {\n // notifications and analytics are now undefined due to shallow merge\n experimental: {\n beta: true, // updated\n // alpha is now undefined due to shallow merge\n },\n },\n },\n });\n });\n });\n});\n"]}
|