@tambo-ai/react 0.47.0 → 0.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/context-helpers/current-interactables-context-helper.d.ts +28 -0
- package/dist/context-helpers/current-interactables-context-helper.d.ts.map +1 -0
- package/dist/context-helpers/current-interactables-context-helper.js +61 -0
- package/dist/context-helpers/current-interactables-context-helper.js.map +1 -0
- package/dist/context-helpers/index.d.ts +1 -0
- package/dist/context-helpers/index.d.ts.map +1 -1
- package/dist/context-helpers/index.js +1 -0
- package/dist/context-helpers/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/__tests__/tambo-mcp-provider.test.d.ts +2 -0
- package/dist/mcp/__tests__/tambo-mcp-provider.test.d.ts.map +1 -0
- package/dist/mcp/__tests__/tambo-mcp-provider.test.js +115 -0
- package/dist/mcp/__tests__/tambo-mcp-provider.test.js.map +1 -0
- package/dist/mcp/tambo-mcp-provider.d.ts +6 -0
- package/dist/mcp/tambo-mcp-provider.d.ts.map +1 -1
- package/dist/mcp/tambo-mcp-provider.js +25 -2
- package/dist/mcp/tambo-mcp-provider.js.map +1 -1
- package/dist/providers/__tests__/tambo-interactables-additional-context-edge-cases.test.d.ts +2 -0
- package/dist/providers/__tests__/tambo-interactables-additional-context-edge-cases.test.d.ts.map +1 -0
- package/dist/providers/__tests__/tambo-interactables-additional-context-edge-cases.test.js +339 -0
- package/dist/providers/__tests__/tambo-interactables-additional-context-edge-cases.test.js.map +1 -0
- package/dist/providers/__tests__/tambo-interactables-additional-context.test.d.ts +2 -0
- package/dist/providers/__tests__/tambo-interactables-additional-context.test.d.ts.map +1 -0
- package/dist/providers/__tests__/tambo-interactables-additional-context.test.js +299 -0
- package/dist/providers/__tests__/tambo-interactables-additional-context.test.js.map +1 -0
- package/dist/providers/__tests__/tambo-registry-provider.test.d.ts +2 -0
- package/dist/providers/__tests__/tambo-registry-provider.test.d.ts.map +1 -0
- package/dist/providers/__tests__/tambo-registry-provider.test.js +224 -0
- package/dist/providers/__tests__/tambo-registry-provider.test.js.map +1 -0
- package/dist/providers/__tests__/tambo-thread-provider.test.js +99 -0
- package/dist/providers/__tests__/tambo-thread-provider.test.js.map +1 -1
- package/dist/providers/tambo-interactable-provider.d.ts +20 -0
- package/dist/providers/tambo-interactable-provider.d.ts.map +1 -1
- package/dist/providers/tambo-interactable-provider.js +32 -2
- package/dist/providers/tambo-interactable-provider.js.map +1 -1
- package/dist/providers/tambo-provider.d.ts.map +1 -1
- package/dist/providers/tambo-provider.js +2 -2
- package/dist/providers/tambo-provider.js.map +1 -1
- package/dist/providers/tambo-registry-provider.d.ts +12 -0
- package/dist/providers/tambo-registry-provider.d.ts.map +1 -1
- package/dist/providers/tambo-registry-provider.js +3 -1
- package/dist/providers/tambo-registry-provider.js.map +1 -1
- package/dist/providers/tambo-thread-provider.d.ts.map +1 -1
- package/dist/providers/tambo-thread-provider.js +5 -3
- package/dist/providers/tambo-thread-provider.js.map +1 -1
- package/dist/util/tool-caller.d.ts +1 -1
- package/dist/util/tool-caller.d.ts.map +1 -1
- package/dist/util/tool-caller.js +11 -2
- package/dist/util/tool-caller.js.map +1 -1
- package/esm/context-helpers/current-interactables-context-helper.d.ts +28 -0
- package/esm/context-helpers/current-interactables-context-helper.d.ts.map +1 -0
- package/esm/context-helpers/current-interactables-context-helper.js +56 -0
- package/esm/context-helpers/current-interactables-context-helper.js.map +1 -0
- package/esm/context-helpers/index.d.ts +1 -0
- package/esm/context-helpers/index.d.ts.map +1 -1
- package/esm/context-helpers/index.js +1 -0
- package/esm/context-helpers/index.js.map +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/mcp/__tests__/tambo-mcp-provider.test.d.ts +2 -0
- package/esm/mcp/__tests__/tambo-mcp-provider.test.d.ts.map +1 -0
- package/esm/mcp/__tests__/tambo-mcp-provider.test.js +113 -0
- package/esm/mcp/__tests__/tambo-mcp-provider.test.js.map +1 -0
- package/esm/mcp/tambo-mcp-provider.d.ts +6 -0
- package/esm/mcp/tambo-mcp-provider.d.ts.map +1 -1
- package/esm/mcp/tambo-mcp-provider.js +24 -2
- package/esm/mcp/tambo-mcp-provider.js.map +1 -1
- package/esm/providers/__tests__/tambo-interactables-additional-context-edge-cases.test.d.ts +2 -0
- package/esm/providers/__tests__/tambo-interactables-additional-context-edge-cases.test.d.ts.map +1 -0
- package/esm/providers/__tests__/tambo-interactables-additional-context-edge-cases.test.js +334 -0
- package/esm/providers/__tests__/tambo-interactables-additional-context-edge-cases.test.js.map +1 -0
- package/esm/providers/__tests__/tambo-interactables-additional-context.test.d.ts +2 -0
- package/esm/providers/__tests__/tambo-interactables-additional-context.test.d.ts.map +1 -0
- package/esm/providers/__tests__/tambo-interactables-additional-context.test.js +294 -0
- package/esm/providers/__tests__/tambo-interactables-additional-context.test.js.map +1 -0
- package/esm/providers/__tests__/tambo-registry-provider.test.d.ts +2 -0
- package/esm/providers/__tests__/tambo-registry-provider.test.d.ts.map +1 -0
- package/esm/providers/__tests__/tambo-registry-provider.test.js +219 -0
- package/esm/providers/__tests__/tambo-registry-provider.test.js.map +1 -0
- package/esm/providers/__tests__/tambo-thread-provider.test.js +99 -0
- package/esm/providers/__tests__/tambo-thread-provider.test.js.map +1 -1
- package/esm/providers/tambo-interactable-provider.d.ts +20 -0
- package/esm/providers/tambo-interactable-provider.d.ts.map +1 -1
- package/esm/providers/tambo-interactable-provider.js +30 -1
- package/esm/providers/tambo-interactable-provider.js.map +1 -1
- package/esm/providers/tambo-provider.d.ts.map +1 -1
- package/esm/providers/tambo-provider.js +2 -2
- package/esm/providers/tambo-provider.js.map +1 -1
- package/esm/providers/tambo-registry-provider.d.ts +12 -0
- package/esm/providers/tambo-registry-provider.d.ts.map +1 -1
- package/esm/providers/tambo-registry-provider.js +3 -1
- package/esm/providers/tambo-registry-provider.js.map +1 -1
- package/esm/providers/tambo-thread-provider.d.ts.map +1 -1
- package/esm/providers/tambo-thread-provider.js +5 -3
- package/esm/providers/tambo-thread-provider.js.map +1 -1
- package/esm/util/tool-caller.d.ts +1 -1
- package/esm/util/tool-caller.d.ts.map +1 -1
- package/esm/util/tool-caller.js +11 -2
- package/esm/util/tool-caller.js.map +1 -1
- package/package.json +9 -9
- package/dist/mcp/mcp-tools-client.d.ts +0 -96
- package/dist/mcp/mcp-tools-client.d.ts.map +0 -1
- package/dist/mcp/mcp-tools-client.js +0 -178
- package/dist/mcp/mcp-tools-client.js.map +0 -1
- package/esm/mcp/mcp-tools-client.d.ts +0 -96
- package/esm/mcp/mcp-tools-client.d.ts.map +0 -1
- package/esm/mcp/mcp-tools-client.js +0 -174
- package/esm/mcp/mcp-tools-client.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tambo-registry-provider.test.js","sourceRoot":"","sources":["../../../src/providers/__tests__/tambo-registry-provider.test.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyD;AACzD,kDAA0B;AAC1B,6BAAwB;AAExB,wEAGoC;AAEpC,qCAAqC;AACrC,MAAM,eAAe,GAAG,GAAgB,EAAE,CAAC;IACzC;QACE,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,iBAAiB;QAC9B,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,oBAAoB,CAAC;QACvD,UAAU,EAAE,OAAC;aACV,QAAQ,EAAE;aACV,IAAI,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;aAC5C,OAAO,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;KACvB;IACD;QACE,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,kBAAkB;QAC/B,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,oBAAoB,C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AC1C,MAAM,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;gBAC9D,CAAC;YACH,CAAC,CAAC,CAAC;YAEH,MAAM,CAAC,0BAA0B,CAAC,CAAC,oBAAoB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;YAC9D,MAAM,OAAO,GAAG,CAAC,EAAE,QAAQ,EAAiC,EAAE,EAAE,CAAC,CAC/D,8BAAC,+CAAqB,IAAC,UAAU,EAAE,cAAc,IAC9C,QAAQ,CACa,CACzB,CAAC;YAEF,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,kBAAU,EAAC,GAAG,EAAE,CAAC,IAAA,0CAAgB,GAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;YAErE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,aAAa,EAAE,CAAC;QAChE,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 { TamboComponent, TamboTool } from \"../../model/component-metadata\";\nimport {\n TamboRegistryProvider,\n useTamboRegistry,\n} from \"../tambo-registry-provider\";\n\n// Shared tool registry for all tests\nconst createMockTools = (): TamboTool[] => [\n {\n name: \"test-tool-1\",\n description: \"First test tool\",\n tool: jest.fn().mockResolvedValue(\"test-tool-1-result\"),\n toolSchema: z\n .function()\n .args(z.string().describe(\"input parameter\"))\n .returns(z.string()),\n },\n {\n name: \"test-tool-2\",\n description: \"Second test tool\",\n tool: jest.fn().mockResolvedValue(\"test-tool-2-result\"),\n toolSchema: z\n .function()\n .args(z.number().describe(\"number parameter\"))\n .returns(z.string()),\n },\n];\n\nconst createMockComponents = (tools: TamboTool[]): TamboComponent[] => [\n {\n name: \"TestComponent\",\n component: () => <div>TestComponent</div>,\n description: \"Test component\",\n propsSchema: z.object({\n test: z.string(),\n }),\n associatedTools: tools,\n },\n];\n\ndescribe(\"TamboRegistryProvider\", () => {\n const mockTools = createMockTools();\n const mockComponents = createMockComponents(mockTools);\n\n beforeEach(() => {\n jest.clearAllMocks();\n });\n\n describe(\"Component and tool registration\", () => {\n it(\"should register components and tools correctly\", () => {\n const wrapper = ({ children }: { children: React.ReactNode }) => (\n <TamboRegistryProvider components={mockComponents}>\n {children}\n </TamboRegistryProvider>\n );\n\n const { result } = renderHook(() => useTamboRegistry(), { wrapper });\n\n expect(result.current.componentList).toHaveProperty(\"TestComponent\");\n expect(result.current.toolRegistry).toHaveProperty(\"test-tool-1\");\n expect(result.current.toolRegistry).toHaveProperty(\"test-tool-2\");\n expect(result.current.componentToolAssociations).toHaveProperty(\n \"TestComponent\",\n );\n expect(result.current.componentToolAssociations.TestComponent).toEqual([\n \"test-tool-1\",\n \"test-tool-2\",\n ]);\n });\n\n it(\"should provide onCallUnregisteredTool in context\", () => {\n const mockonCallUnregisteredTool = jest\n .fn()\n .mockResolvedValue(\"test-result\");\n\n const wrapper = ({ children }: { children: React.ReactNode }) => (\n <TamboRegistryProvider\n components={mockComponents}\n onCallUnregisteredTool={mockonCallUnregisteredTool}\n >\n {children}\n </TamboRegistryProvider>\n );\n\n const { result } = renderHook(() => useTamboRegistry(), { wrapper });\n\n // The onCallUnregisteredTool should be available in the context\n expect(result.current.onCallUnregisteredTool).toBeDefined();\n expect(typeof result.current.onCallUnregisteredTool).toBe(\"function\");\n });\n\n it(\"should handle tool registration and association\", () => {\n const wrapper = ({ children }: { children: React.ReactNode }) => (\n <TamboRegistryProvider>{children}</TamboRegistryProvider>\n );\n\n const { result } = renderHook(() => useTamboRegistry(), { wrapper });\n\n // Register a new tool\n act(() => {\n result.current.registerTool(mockTools[0]);\n });\n\n expect(result.current.toolRegistry).toHaveProperty(\"test-tool-1\");\n\n // Register a new component\n act(() => {\n result.current.registerComponent(mockComponents[0]);\n });\n\n expect(result.current.componentList).toHaveProperty(\"TestComponent\");\n expect(result.current.componentToolAssociations).toHaveProperty(\n \"TestComponent\",\n );\n });\n\n it(\"should handle multiple tool registration\", () => {\n const wrapper = ({ children }: { children: React.ReactNode }) => (\n <TamboRegistryProvider>{children}</TamboRegistryProvider>\n );\n\n const { result } = renderHook(() => useTamboRegistry(), { wrapper });\n\n // Register multiple tools\n act(() => {\n result.current.registerTools(mockTools);\n });\n\n expect(result.current.toolRegistry).toHaveProperty(\"test-tool-1\");\n expect(result.current.toolRegistry).toHaveProperty(\"test-tool-2\");\n expect(Object.keys(result.current.toolRegistry)).toHaveLength(2);\n });\n\n it(\"should handle tool association with components\", () => {\n const wrapper = ({ children }: { children: React.ReactNode }) => (\n <TamboRegistryProvider components={mockComponents}>\n {children}\n </TamboRegistryProvider>\n );\n\n const { result } = renderHook(() => useTamboRegistry(), { wrapper });\n\n // Add a new tool association\n act(() => {\n const newTool: TamboTool = {\n name: \"new-tool\",\n description: \"New tool\",\n tool: jest.fn().mockResolvedValue(\"new-tool-result\"),\n toolSchema: z\n .function()\n .args(z.string().describe(\"input\"))\n .returns(z.string()),\n };\n result.current.addToolAssociation(\"TestComponent\", newTool);\n });\n\n expect(result.current.componentToolAssociations.TestComponent).toContain(\n \"new-tool\",\n );\n });\n\n it(\"should throw error when adding tool association to non-existent component\", () => {\n const wrapper = ({ children }: { children: React.ReactNode }) => (\n <TamboRegistryProvider>{children}</TamboRegistryProvider>\n );\n\n const { result } = renderHook(() => useTamboRegistry(), { wrapper });\n\n const newTool: TamboTool = {\n name: \"new-tool\",\n description: \"New tool\",\n tool: jest.fn().mockResolvedValue(\"new-tool-result\"),\n toolSchema: z\n .function()\n .args(z.string().describe(\"input\"))\n .returns(z.string()),\n };\n\n expect(() => {\n act(() => {\n result.current.addToolAssociation(\"NonExistentComponent\", newTool);\n });\n }).toThrow(\"Component NonExistentComponent not found in registry\");\n });\n\n it(\"should validate tool schemas and throw error for invalid schemas\", () => {\n const wrapper = ({ children }: { children: React.ReactNode }) => (\n <TamboRegistryProvider>{children}</TamboRegistryProvider>\n );\n\n const { result } = renderHook(() => useTamboRegistry(), { wrapper });\n\n const invalidTool: TamboTool = {\n name: \"invalid-tool\",\n description: \"Invalid tool\",\n tool: jest.fn().mockResolvedValue(\"result\"),\n toolSchema: z.record(z.string()), // This should cause validation to fail\n };\n\n // This should throw during registration due to invalid schema\n expect(() => {\n act(() => {\n result.current.registerTool(invalidTool);\n });\n }).toThrow(\n 'z.record() is not supported in toolSchema of tool \"invalid-tool\"',\n );\n });\n\n it(\"should validate component schemas and throw error for invalid schemas\", () => {\n const invalidComponent: TamboComponent = {\n name: \"InvalidComponent\",\n component: () => <div>Invalid</div>,\n description: \"Invalid component\",\n propsSchema: z.record(z.string()), // This should cause validation to fail\n };\n\n const wrapper = ({ children }: { children: React.ReactNode }) => (\n <TamboRegistryProvider>{children}</TamboRegistryProvider>\n );\n\n const { result } = renderHook(() => useTamboRegistry(), { wrapper });\n\n // This should throw during registration due to invalid schema\n expect(() => {\n act(() => {\n result.current.registerComponent(invalidComponent);\n });\n }).toThrow(\n 'z.record() is not supported in propsSchema of component \"InvalidComponent\"',\n );\n });\n\n it(\"should throw error when component has both propsSchema and propsDefinition\", () => {\n const invalidComponent: TamboComponent = {\n name: \"InvalidComponent\",\n component: () => <div>Invalid</div>,\n description: \"Invalid component\",\n propsSchema: z.object({ test: z.string() }),\n propsDefinition: { test: \"string\" }, // Both defined - should throw\n };\n\n const wrapper = ({ children }: { children: React.ReactNode }) => (\n <TamboRegistryProvider>{children}</TamboRegistryProvider>\n );\n\n const { result } = renderHook(() => useTamboRegistry(), { wrapper });\n\n expect(() => {\n act(() => {\n result.current.registerComponent(invalidComponent);\n });\n }).toThrow(\n \"Component InvalidComponent cannot have both propsSchema and propsDefinition defined\",\n );\n });\n\n it(\"should throw error when component has neither propsSchema nor propsDefinition\", () => {\n const invalidComponent: TamboComponent = {\n name: \"InvalidComponent\",\n component: () => <div>Invalid</div>,\n description: \"Invalid component\",\n // Neither propsSchema nor propsDefinition defined - should throw\n };\n\n const wrapper = ({ children }: { children: React.ReactNode }) => (\n <TamboRegistryProvider>{children}</TamboRegistryProvider>\n );\n\n const { result } = renderHook(() => useTamboRegistry(), { wrapper });\n\n expect(() => {\n act(() => {\n result.current.registerComponent(invalidComponent);\n });\n }).toThrow(\n \"Component InvalidComponent must have either propsSchema (recommended) or propsDefinition defined\",\n );\n });\n });\n\n describe(\"Tool call handling\", () => {\n it(\"should provide onCallUnregisteredTool callback for handling unknown tools\", async () => {\n const mockonCallUnregisteredTool = jest\n .fn()\n .mockResolvedValue(\"unknown-tool-result\");\n\n const wrapper = ({ children }: { children: React.ReactNode }) => (\n <TamboRegistryProvider\n components={mockComponents}\n onCallUnregisteredTool={mockonCallUnregisteredTool}\n >\n {children}\n </TamboRegistryProvider>\n );\n\n const { result } = renderHook(() => useTamboRegistry(), { wrapper });\n\n // Verify the callback is available\n expect(result.current.onCallUnregisteredTool).toBeDefined();\n expect(typeof result.current.onCallUnregisteredTool).toBe(\"function\");\n\n // Simulate calling the unknown tool handler\n const toolName = \"unknown-tool\";\n const args = [{ parameterName: \"input\", parameterValue: \"test-input\" }];\n\n await act(async () => {\n if (result.current.onCallUnregisteredTool) {\n await result.current.onCallUnregisteredTool(toolName, args);\n }\n });\n\n expect(mockonCallUnregisteredTool).toHaveBeenCalledWith(toolName, args);\n });\n\n it(\"should handle onCallUnregisteredTool being undefined\", () => {\n const wrapper = ({ children }: { children: React.ReactNode }) => (\n <TamboRegistryProvider components={mockComponents}>\n {children}\n </TamboRegistryProvider>\n );\n\n const { result } = renderHook(() => useTamboRegistry(), { wrapper });\n\n expect(result.current.onCallUnregisteredTool).toBeUndefined();\n });\n });\n});\n"]}
|
|
@@ -304,6 +304,105 @@ describe("TamboThreadProvider", () => {
|
|
|
304
304
|
expect(result.current.generationStage).toBe(generate_component_response_1.GenerationStage.COMPLETE);
|
|
305
305
|
expect(mockRegistry[0]?.associatedTools?.[0]?.tool).toHaveBeenCalledWith("test");
|
|
306
306
|
});
|
|
307
|
+
it("should handle unregistered tool calls with onCallUnregisteredTool", async () => {
|
|
308
|
+
const mockOnCallUnregisteredTool = jest
|
|
309
|
+
.fn()
|
|
310
|
+
.mockResolvedValue("unregistered-tool-result");
|
|
311
|
+
const wrapperWithUnregisteredTool = ({ children, }) => (react_2.default.createElement(tambo_registry_provider_1.TamboRegistryProvider, { components: mockRegistry, onCallUnregisteredTool: mockOnCallUnregisteredTool },
|
|
312
|
+
react_2.default.createElement(tambo_context_helpers_provider_1.TamboContextHelpersProvider, { contextHelpers: {
|
|
313
|
+
currentTimeContextHelper: () => null,
|
|
314
|
+
currentPageContextHelper: () => null,
|
|
315
|
+
} },
|
|
316
|
+
react_2.default.createElement(tambo_thread_provider_1.TamboThreadProvider, { streaming: false }, children))));
|
|
317
|
+
const mockUnregisteredToolCallResponse = {
|
|
318
|
+
responseMessageDto: {
|
|
319
|
+
id: "unregistered-tool-call-1",
|
|
320
|
+
content: [{ type: "text", text: "Unregistered tool response" }],
|
|
321
|
+
role: "tool",
|
|
322
|
+
threadId: "test-thread-1",
|
|
323
|
+
toolCallRequest: {
|
|
324
|
+
toolName: "unregistered-tool",
|
|
325
|
+
parameters: [
|
|
326
|
+
{ parameterName: "input", parameterValue: "test-input" },
|
|
327
|
+
],
|
|
328
|
+
},
|
|
329
|
+
componentState: {},
|
|
330
|
+
createdAt: new Date().toISOString(),
|
|
331
|
+
},
|
|
332
|
+
generationStage: generate_component_response_1.GenerationStage.COMPLETE,
|
|
333
|
+
mcpAccessToken: "test-mcp-access-token",
|
|
334
|
+
};
|
|
335
|
+
jest
|
|
336
|
+
.mocked(mockThreadsApi.advanceById)
|
|
337
|
+
.mockResolvedValueOnce(mockUnregisteredToolCallResponse)
|
|
338
|
+
.mockResolvedValueOnce({
|
|
339
|
+
responseMessageDto: {
|
|
340
|
+
id: "advance-response2",
|
|
341
|
+
content: [{ type: "text", text: "response 2" }],
|
|
342
|
+
role: "user",
|
|
343
|
+
threadId: "test-thread-1",
|
|
344
|
+
componentState: {},
|
|
345
|
+
createdAt: new Date().toISOString(),
|
|
346
|
+
},
|
|
347
|
+
generationStage: generate_component_response_1.GenerationStage.COMPLETE,
|
|
348
|
+
mcpAccessToken: "test-mcp-access-token",
|
|
349
|
+
});
|
|
350
|
+
const { result } = (0, react_1.renderHook)(() => (0, tambo_thread_provider_1.useTamboThread)(), {
|
|
351
|
+
wrapper: wrapperWithUnregisteredTool,
|
|
352
|
+
});
|
|
353
|
+
await (0, react_1.act)(async () => {
|
|
354
|
+
await result.current.sendThreadMessage("Use unregistered tool", {
|
|
355
|
+
threadId: "test-thread-1",
|
|
356
|
+
streamResponse: false,
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
expect(result.current.generationStage).toBe(generate_component_response_1.GenerationStage.COMPLETE);
|
|
360
|
+
expect(mockOnCallUnregisteredTool).toHaveBeenCalledWith("unregistered-tool", [{ parameterName: "input", parameterValue: "test-input" }]);
|
|
361
|
+
});
|
|
362
|
+
it("should handle unregistered tool calls without onCallUnregisteredTool", async () => {
|
|
363
|
+
const mockUnregisteredToolCallResponse = {
|
|
364
|
+
responseMessageDto: {
|
|
365
|
+
id: "unregistered-tool-call-1",
|
|
366
|
+
content: [{ type: "text", text: "Unregistered tool response" }],
|
|
367
|
+
role: "tool",
|
|
368
|
+
threadId: "test-thread-1",
|
|
369
|
+
toolCallRequest: {
|
|
370
|
+
toolName: "unregistered-tool",
|
|
371
|
+
parameters: [
|
|
372
|
+
{ parameterName: "input", parameterValue: "test-input" },
|
|
373
|
+
],
|
|
374
|
+
},
|
|
375
|
+
componentState: {},
|
|
376
|
+
createdAt: new Date().toISOString(),
|
|
377
|
+
},
|
|
378
|
+
generationStage: generate_component_response_1.GenerationStage.COMPLETE,
|
|
379
|
+
mcpAccessToken: "test-mcp-access-token",
|
|
380
|
+
};
|
|
381
|
+
jest
|
|
382
|
+
.mocked(mockThreadsApi.advanceById)
|
|
383
|
+
.mockResolvedValueOnce(mockUnregisteredToolCallResponse)
|
|
384
|
+
.mockResolvedValueOnce({
|
|
385
|
+
responseMessageDto: {
|
|
386
|
+
id: "advance-response2",
|
|
387
|
+
content: [{ type: "text", text: "response 2" }],
|
|
388
|
+
role: "user",
|
|
389
|
+
threadId: "test-thread-1",
|
|
390
|
+
componentState: {},
|
|
391
|
+
createdAt: new Date().toISOString(),
|
|
392
|
+
},
|
|
393
|
+
generationStage: generate_component_response_1.GenerationStage.COMPLETE,
|
|
394
|
+
mcpAccessToken: "test-mcp-access-token",
|
|
395
|
+
});
|
|
396
|
+
const { result } = (0, react_1.renderHook)(() => (0, tambo_thread_provider_1.useTamboThread)(), { wrapper });
|
|
397
|
+
await (0, react_1.act)(async () => {
|
|
398
|
+
await result.current.sendThreadMessage("Use unregistered tool", {
|
|
399
|
+
threadId: "test-thread-1",
|
|
400
|
+
streamResponse: false,
|
|
401
|
+
});
|
|
402
|
+
});
|
|
403
|
+
expect(result.current.generationStage).toBe(generate_component_response_1.GenerationStage.COMPLETE);
|
|
404
|
+
// Should not throw an error, but the tool call should fail gracefully
|
|
405
|
+
});
|
|
307
406
|
describe("streaming behavior", () => {
|
|
308
407
|
it("should call advanceStream when streamResponse=true", async () => {
|
|
309
408
|
// Use wrapper with streaming=true to show that explicit streamResponse=true works
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tambo-thread-provider.test.js","sourceRoot":"","sources":["../../../src/providers/__tests__/tambo-thread-provider.test.tsx"],"names":[],"mappings":";;;;;AAAA,6DAAkE;AAClE,kDAAyD;AACzD,kDAA0B;AAE1B,6BAAwB;AAExB,yFAGiD;AACjD,+CAAwD;AACxD,oEAA0D;AAC1D,sFAAgF;AAChF,wEAAmE;AACnE,oEAA+E;AAI/E,yBAAyB;AACzB,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE;IACtC,KAAK,EAAE;QACL,UAAU,EAAE,IAAI,CA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,OAAO,EAAE;oBACxC,QAAQ,EAAE,aAAa;oBACvB,cAAc,EAAE,KAAK;iBACtB,CAAC,CACH,CAAC,OAAO,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;YAC/C,CAAC,CAAC,CAAC;YAEH,0CAA0C;YAC1C,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,6CAAe,CAAC,KAAK,CAAC,CAAC;QACrE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import TamboAI, { advanceStream } from \"@tambo-ai/typescript-sdk\";\nimport { act, renderHook } from \"@testing-library/react\";\nimport React from \"react\";\nimport { DeepPartial } from \"ts-essentials\";\nimport { z } from \"zod\";\nimport { TamboComponent } from \"../../model/component-metadata\";\nimport {\n GenerationStage,\n TamboThreadMessage,\n} from \"../../model/generate-component-response\";\nimport { serializeRegistry } from \"../../testing/tools\";\nimport { useTamboClient } from \"../tambo-client-provider\";\nimport { TamboContextHelpersProvider } from \"../tambo-context-helpers-provider\";\nimport { TamboRegistryProvider } from \"../tambo-registry-provider\";\nimport { TamboThreadProvider, useTamboThread } from \"../tambo-thread-provider\";\n\ntype PartialTamboAI = DeepPartial<TamboAI>;\n\n// Mock crypto.randomUUID\nObject.defineProperty(global, \"crypto\", {\n value: {\n randomUUID: jest.fn().mockReturnValue(\"test-uuid\"),\n },\n});\n\n// Mock the required providers\njest.mock(\"../tambo-client-provider\", () => ({\n useTamboClient: jest.fn(),\n}));\njest.mock(\"@tambo-ai/typescript-sdk\", () => ({\n advanceStream: jest.fn(),\n}));\n\n// Mock the getCustomContext\njest.mock(\"../../util/registry\", () => ({\n ...jest.requireActual(\"../../util/registry\"),\n getCustomContext: () => ({\n message: \"additional instructions\",\n }),\n}));\n\n// Test utilities\nconst createMockMessage = (\n overrides: Partial<TamboThreadMessage> = {},\n): TamboThreadMessage => ({\n id: \"test-message-1\",\n content: [{ type: \"text\", text: \"Hello\" }],\n role: \"user\",\n threadId: \"test-thread-1\",\n createdAt: new Date().toISOString(),\n componentState: {},\n ...overrides,\n});\n\nconst createMockThread = (\n overrides: Partial<TamboAI.Beta.Threads.Thread> = {},\n) => ({\n id: \"test-thread-1\",\n messages: [],\n createdAt: \"2024-01-01T00:00:00Z\",\n projectId: \"test-project\",\n updatedAt: \"2024-01-01T00:00:00Z\",\n metadata: {},\n ...overrides,\n});\n\nconst createMockAdvanceResponse = (\n overrides: Partial<TamboAI.Beta.Threads.ThreadAdvanceResponse> = {},\n): TamboAI.Beta.Threads.ThreadAdvanceResponse => ({\n responseMessageDto: {\n id: \"test-uuid\",\n content: [{ type: \"text\" as const, text: \"Default response\" }],\n role: \"assistant\",\n threadId: \"test-thread-1\",\n component: undefined,\n componentState: {},\n createdAt: new Date().toISOString(),\n },\n generationStage: GenerationStage.COMPLETE,\n mcpAccessToken: \"test-mcp-access-token\",\n ...overrides,\n});\n\ndescribe(\"TamboThreadProvider\", () => {\n const mockThread = createMockThread();\n\n const mockThreadsApi = {\n messages: {\n create: jest.fn(),\n },\n retrieve: jest.fn(),\n advance: jest.fn(),\n advanceById: jest.fn(),\n } satisfies DeepPartial<\n TamboAI[\"beta\"][\"threads\"]\n > as unknown as TamboAI.Beta.Threads;\n\n const mockBeta = {\n threads: mockThreadsApi,\n } satisfies PartialTamboAI[\"beta\"];\n\n const mockTamboAI = {\n apiKey: \"\",\n beta: mockBeta,\n } satisfies PartialTamboAI as unknown as TamboAI;\n\n const mockRegistry: TamboComponent[] = [\n {\n name: \"TestOnly\",\n component: () => <div>TestOnly</div>,\n description: \"TestOnly\",\n propsSchema: z.object({\n test: z.string(),\n }),\n associatedTools: [\n {\n name: \"test-tool\",\n tool: jest.fn().mockResolvedValue(\"test-tool\"),\n description: \"test-tool\",\n toolSchema: z\n .function()\n .args(z.string().describe(\"test-param-description\"))\n .returns(z.string()),\n },\n ],\n },\n ];\n\n // Use helpers that explicitly return null so they don't appear in additionalContext\n const wrapper = ({ children }: { children: React.ReactNode }) => (\n <TamboRegistryProvider components={mockRegistry}>\n <TamboContextHelpersProvider\n contextHelpers={{\n currentTimeContextHelper: () => null,\n currentPageContextHelper: () => null,\n }}\n >\n <TamboThreadProvider streaming={false}>{children}</TamboThreadProvider>\n </TamboContextHelpersProvider>\n </TamboRegistryProvider>\n );\n\n beforeEach(() => {\n jest.clearAllMocks();\n jest.mocked(mockThreadsApi.retrieve).mockResolvedValue(mockThread);\n jest\n .mocked(mockThreadsApi.messages.create)\n .mockResolvedValue(createMockMessage());\n jest\n .mocked(mockThreadsApi.advance)\n .mockResolvedValue(createMockAdvanceResponse());\n jest\n .mocked(mockThreadsApi.advanceById)\n .mockResolvedValue(createMockAdvanceResponse());\n jest.mocked(useTamboClient).mockReturnValue(mockTamboAI);\n });\n\n it(\"should initialize with placeholder thread\", () => {\n const { result } = renderHook(() => useTamboThread(), { wrapper });\n\n expect(result.current.thread.id).toBe(\"placeholder\");\n expect(result.current.isIdle).toBe(true);\n expect(result.current.generationStage).toBe(GenerationStage.IDLE);\n });\n\n it(\"should switch to a new thread\", async () => {\n const { result } = renderHook(() => useTamboThread(), { wrapper });\n\n await act(async () => {\n await result.current.switchCurrentThread(\"test-thread-1\");\n });\n\n expect(mockThreadsApi.retrieve).toHaveBeenCalledWith(\"test-thread-1\", {\n includeInternal: true,\n });\n expect(result.current.thread.id).toBe(\"test-thread-1\");\n });\n\n it(\"should start a new thread\", async () => {\n const { result } = renderHook(() => useTamboThread(), { wrapper });\n\n await act(async () => {\n result.current.startNewThread();\n });\n\n expect(result.current.thread.id).toBe(\"placeholder\");\n expect(result.current.isIdle).toBe(true);\n });\n\n it(\"should add a message to the thread\", async () => {\n const { result } = renderHook(() => useTamboThread(), { wrapper });\n const testMessage: TamboThreadMessage = {\n id: \"test-message-1\",\n content: [{ type: \"text\", text: \"Hello\" }],\n role: \"user\",\n threadId: \"test-thread-1\",\n createdAt: new Date().toISOString(),\n componentState: {},\n };\n\n await act(async () => {\n await result.current.addThreadMessage(testMessage, true);\n });\n\n expect(mockThreadsApi.messages.create).toHaveBeenCalledWith(\n \"test-thread-1\",\n {\n content: testMessage.content,\n role: testMessage.role,\n },\n );\n });\n\n it(\"should update a message in the thread\", async () => {\n const { result } = renderHook(() => useTamboThread(), { wrapper });\n const testMessage: TamboThreadMessage = {\n id: \"test-message-1\",\n content: [{ type: \"text\", text: \"Updated message\" }],\n role: \"user\",\n threadId: \"test-thread-1\",\n createdAt: new Date().toISOString(),\n componentState: {},\n };\n\n await act(async () => {\n await result.current.updateThreadMessage(\n \"test-message-1\",\n testMessage,\n true,\n );\n });\n\n expect(mockThreadsApi.messages.create).toHaveBeenCalledWith(\n \"test-thread-1\",\n {\n content: testMessage.content,\n role: testMessage.role,\n },\n );\n });\n\n it(\"should send a message and update thread state\", async () => {\n const mockAdvanceResponse: TamboAI.Beta.Threads.ThreadAdvanceResponse = {\n responseMessageDto: {\n id: \"response-1\",\n content: [{ type: \"text\", text: \"Response\" }],\n role: \"assistant\",\n threadId: \"test-thread-1\",\n component: undefined,\n componentState: {},\n createdAt: new Date().toISOString(),\n },\n generationStage: GenerationStage.COMPLETE,\n mcpAccessToken: \"test-mcp-access-token\",\n };\n\n jest\n .mocked(mockThreadsApi.advanceById)\n .mockResolvedValue(mockAdvanceResponse);\n\n const { result } = renderHook(() => useTamboThread(), { wrapper });\n\n await act(async () => {\n await result.current.sendThreadMessage(\"Hello\", {\n threadId: \"test-thread-1\",\n streamResponse: false,\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n });\n });\n\n expect(mockThreadsApi.advanceById).toHaveBeenCalledWith(\"test-thread-1\", {\n messageToAppend: {\n content: [{ type: \"text\", text: \"Hello\" }],\n role: \"user\",\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n },\n availableComponents: serializeRegistry(mockRegistry),\n contextKey: undefined,\n clientTools: [],\n toolCallCounts: {},\n });\n expect(result.current.generationStage).toBe(GenerationStage.COMPLETE);\n });\n\n it(\"should handle streaming responses\", async () => {\n const mockStreamResponse: TamboAI.Beta.Threads.ThreadAdvanceResponse = {\n responseMessageDto: {\n id: \"stream-1\",\n content: [{ type: \"text\", text: \"Streaming response\" }],\n role: \"assistant\",\n threadId: \"test-thread-1\",\n component: undefined,\n componentState: {},\n createdAt: new Date().toISOString(),\n },\n generationStage: GenerationStage.COMPLETE,\n mcpAccessToken: \"test-mcp-access-token\",\n };\n\n // Create an async iterator mock\n const mockAsyncIterator = {\n [Symbol.asyncIterator]: async function* () {\n yield mockStreamResponse;\n },\n };\n\n // Mock advanceStream to return our async iterator\n jest.mocked(advanceStream).mockResolvedValue(mockAsyncIterator);\n\n const { result } = renderHook(() => useTamboThread(), { wrapper });\n\n await act(async () => {\n await result.current.sendThreadMessage(\"Hello\", {\n threadId: \"test-thread-1\",\n streamResponse: true,\n });\n });\n\n expect(result.current.generationStage).toBe(GenerationStage.COMPLETE);\n });\n\n it(\"should handle tool calls during message processing.\", async () => {\n const mockToolCallResponse: TamboAI.Beta.Threads.ThreadAdvanceResponse = {\n responseMessageDto: {\n id: \"tool-call-1\",\n content: [{ type: \"text\", text: \"Tool response\" }],\n role: \"tool\",\n threadId: \"test-thread-1\",\n toolCallRequest: {\n toolName: \"test-tool\",\n parameters: [{ parameterName: \"test\", parameterValue: \"test\" }],\n },\n componentState: {},\n createdAt: new Date().toISOString(),\n },\n generationStage: GenerationStage.COMPLETE,\n mcpAccessToken: \"test-mcp-access-token\",\n };\n\n jest\n .mocked(mockThreadsApi.advanceById)\n .mockResolvedValueOnce(mockToolCallResponse)\n .mockResolvedValueOnce({\n responseMessageDto: {\n id: \"advance-response2\",\n content: [{ type: \"text\", text: \"response 2\" }],\n role: \"user\",\n threadId: \"test-thread-1\",\n componentState: {},\n createdAt: new Date().toISOString(),\n },\n generationStage: GenerationStage.COMPLETE,\n mcpAccessToken: \"test-mcp-access-token\",\n });\n\n const { result } = renderHook(() => useTamboThread(), { wrapper });\n\n await act(async () => {\n await result.current.sendThreadMessage(\"Use tool\", {\n threadId: \"test-thread-1\",\n streamResponse: false,\n });\n });\n expect(result.current.generationStage).toBe(GenerationStage.COMPLETE);\n expect(mockRegistry[0]?.associatedTools?.[0]?.tool).toHaveBeenCalledWith(\n \"test\",\n );\n });\n\n describe(\"streaming behavior\", () => {\n it(\"should call advanceStream when streamResponse=true\", async () => {\n // Use wrapper with streaming=true to show that explicit streamResponse=true works\n const wrapperWithStreaming = ({\n children,\n }: {\n children: React.ReactNode;\n }) => (\n <TamboRegistryProvider components={mockRegistry}>\n <TamboContextHelpersProvider\n contextHelpers={{\n currentTimeContextHelper: () => null,\n currentPageContextHelper: () => null,\n }}\n >\n <TamboThreadProvider streaming={true}>\n {children}\n </TamboThreadProvider>\n </TamboContextHelpersProvider>\n </TamboRegistryProvider>\n );\n\n const mockStreamResponse: TamboAI.Beta.Threads.ThreadAdvanceResponse = {\n responseMessageDto: {\n id: \"stream-response\",\n content: [{ type: \"text\", text: \"Streaming response\" }],\n role: \"assistant\",\n threadId: \"test-thread-1\",\n component: undefined,\n componentState: {},\n createdAt: new Date().toISOString(),\n },\n generationStage: GenerationStage.COMPLETE,\n mcpAccessToken: \"test-mcp-access-token\",\n };\n\n const mockAsyncIterator = {\n [Symbol.asyncIterator]: async function* () {\n yield mockStreamResponse;\n },\n };\n\n jest.mocked(advanceStream).mockResolvedValue(mockAsyncIterator);\n\n const { result } = renderHook(() => useTamboThread(), {\n wrapper: wrapperWithStreaming,\n });\n\n await act(async () => {\n await result.current.sendThreadMessage(\"Hello streaming\", {\n threadId: \"test-thread-1\",\n streamResponse: true,\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n });\n });\n\n expect(advanceStream).toHaveBeenCalledWith(\n mockTamboAI,\n {\n messageToAppend: {\n content: [{ type: \"text\", text: \"Hello streaming\" }],\n role: \"user\",\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n },\n availableComponents: serializeRegistry(mockRegistry),\n contextKey: undefined,\n clientTools: [],\n forceToolChoice: undefined,\n toolCallCounts: {},\n },\n \"test-thread-1\",\n );\n\n // Should not call advance or advanceById\n expect(mockThreadsApi.advance).not.toHaveBeenCalled();\n expect(mockThreadsApi.advanceById).not.toHaveBeenCalled();\n });\n\n it(\"should call advanceById when streamResponse=false for existing thread\", async () => {\n // Use wrapper with streaming=true to show that explicit streamResponse=false overrides provider setting\n const wrapperWithStreaming = ({\n children,\n }: {\n children: React.ReactNode;\n }) => (\n <TamboRegistryProvider components={mockRegistry}>\n <TamboContextHelpersProvider\n contextHelpers={{\n currentTimeContextHelper: () => null,\n currentPageContextHelper: () => null,\n }}\n >\n <TamboThreadProvider streaming={true}>\n {children}\n </TamboThreadProvider>\n </TamboContextHelpersProvider>\n </TamboRegistryProvider>\n );\n\n const { result } = renderHook(() => useTamboThread(), {\n wrapper: wrapperWithStreaming,\n });\n\n await act(async () => {\n await result.current.sendThreadMessage(\"Hello non-streaming\", {\n threadId: \"test-thread-1\",\n streamResponse: false,\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n });\n });\n\n expect(mockThreadsApi.advanceById).toHaveBeenCalledWith(\"test-thread-1\", {\n messageToAppend: {\n content: [{ type: \"text\", text: \"Hello non-streaming\" }],\n role: \"user\",\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n },\n availableComponents: serializeRegistry(mockRegistry),\n contextKey: undefined,\n clientTools: [],\n forceToolChoice: undefined,\n toolCallCounts: {},\n });\n\n // Should not call advance or advanceStream\n expect(mockThreadsApi.advance).not.toHaveBeenCalled();\n expect(advanceStream).not.toHaveBeenCalled();\n });\n\n it(\"should call advanceById when streamResponse is undefined and provider streaming=false\", async () => {\n // Use wrapper with streaming=false to test that undefined streamResponse respects provider setting\n const wrapperWithoutStreaming = ({\n children,\n }: {\n children: React.ReactNode;\n }) => (\n <TamboRegistryProvider components={mockRegistry}>\n <TamboContextHelpersProvider\n contextHelpers={{\n currentTimeContextHelper: () => null,\n currentPageContextHelper: () => null,\n }}\n >\n <TamboThreadProvider streaming={false}>\n {children}\n </TamboThreadProvider>\n </TamboContextHelpersProvider>\n </TamboRegistryProvider>\n );\n\n const { result } = renderHook(() => useTamboThread(), {\n wrapper: wrapperWithoutStreaming,\n });\n\n await act(async () => {\n await result.current.sendThreadMessage(\"Hello default\", {\n threadId: \"test-thread-1\",\n // streamResponse is undefined, should use provider's streaming=false\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n });\n });\n\n expect(mockThreadsApi.advanceById).toHaveBeenCalledWith(\"test-thread-1\", {\n messageToAppend: {\n content: [{ type: \"text\", text: \"Hello default\" }],\n role: \"user\",\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n },\n availableComponents: serializeRegistry(mockRegistry),\n contextKey: undefined,\n clientTools: [],\n forceToolChoice: undefined,\n toolCallCounts: {},\n });\n\n // Should not call advance or advanceStream\n expect(mockThreadsApi.advance).not.toHaveBeenCalled();\n expect(advanceStream).not.toHaveBeenCalled();\n });\n\n it(\"should call advanceStream when streamResponse is undefined and provider streaming=true (default)\", async () => {\n // Use wrapper with streaming=true (default) to test that undefined streamResponse respects provider setting\n const wrapperWithDefaultStreaming = ({\n children,\n }: {\n children: React.ReactNode;\n }) => (\n <TamboRegistryProvider components={mockRegistry}>\n <TamboContextHelpersProvider\n contextHelpers={{\n currentTimeContextHelper: () => null,\n currentPageContextHelper: () => null,\n }}\n >\n <TamboThreadProvider>{children}</TamboThreadProvider>\n </TamboContextHelpersProvider>\n </TamboRegistryProvider>\n );\n\n const mockStreamResponse: TamboAI.Beta.Threads.ThreadAdvanceResponse = {\n responseMessageDto: {\n id: \"stream-response\",\n content: [{ type: \"text\", text: \"Streaming response\" }],\n role: \"assistant\",\n threadId: \"test-thread-1\",\n component: undefined,\n componentState: {},\n createdAt: new Date().toISOString(),\n },\n generationStage: GenerationStage.COMPLETE,\n mcpAccessToken: \"test-mcp-access-token\",\n };\n\n const mockAsyncIterator = {\n [Symbol.asyncIterator]: async function* () {\n yield mockStreamResponse;\n },\n };\n\n jest.mocked(advanceStream).mockResolvedValue(mockAsyncIterator);\n\n const { result } = renderHook(() => useTamboThread(), {\n wrapper: wrapperWithDefaultStreaming,\n });\n\n await act(async () => {\n await result.current.sendThreadMessage(\"Hello default streaming\", {\n threadId: \"test-thread-1\",\n // streamResponse is undefined, should use provider's streaming=true (default)\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n });\n });\n\n expect(advanceStream).toHaveBeenCalledWith(\n mockTamboAI,\n {\n messageToAppend: {\n content: [{ type: \"text\", text: \"Hello default streaming\" }],\n role: \"user\",\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n },\n availableComponents: serializeRegistry(mockRegistry),\n contextKey: undefined,\n clientTools: [],\n forceToolChoice: undefined,\n toolCallCounts: {},\n },\n \"test-thread-1\",\n );\n\n // Should not call advance or advanceById\n expect(mockThreadsApi.advance).not.toHaveBeenCalled();\n expect(mockThreadsApi.advanceById).not.toHaveBeenCalled();\n });\n\n it(\"should call advance when streamResponse=false for placeholder thread\", async () => {\n // Use wrapper with streaming=true to show that explicit streamResponse=false overrides provider setting\n const wrapperWithStreaming = ({\n children,\n }: {\n children: React.ReactNode;\n }) => (\n <TamboRegistryProvider components={mockRegistry}>\n <TamboContextHelpersProvider\n contextHelpers={{\n currentTimeContextHelper: () => null,\n currentPageContextHelper: () => null,\n }}\n >\n <TamboThreadProvider streaming={true}>\n {children}\n </TamboThreadProvider>\n </TamboContextHelpersProvider>\n </TamboRegistryProvider>\n );\n\n const { result } = renderHook(() => useTamboThread(), {\n wrapper: wrapperWithStreaming,\n });\n\n // Start with placeholder thread (which is the default state)\n expect(result.current.thread.id).toBe(\"placeholder\");\n\n await act(async () => {\n await result.current.sendThreadMessage(\"Hello new thread\", {\n threadId: \"placeholder\",\n streamResponse: false,\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n });\n });\n\n expect(mockThreadsApi.advance).toHaveBeenCalledWith({\n messageToAppend: {\n content: [{ type: \"text\", text: \"Hello new thread\" }],\n role: \"user\",\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n },\n availableComponents: serializeRegistry(mockRegistry),\n contextKey: undefined,\n clientTools: [],\n forceToolChoice: undefined,\n toolCallCounts: {},\n });\n\n // Should not call advanceById or advanceStream\n expect(mockThreadsApi.advanceById).not.toHaveBeenCalled();\n expect(advanceStream).not.toHaveBeenCalled();\n });\n\n it(\"should call advanceStream when streamResponse=true for placeholder thread\", async () => {\n // Use wrapper with streaming=false to show that explicit streamResponse=true overrides provider setting\n const wrapperWithoutStreaming = ({\n children,\n }: {\n children: React.ReactNode;\n }) => (\n <TamboRegistryProvider components={mockRegistry}>\n <TamboContextHelpersProvider\n contextHelpers={{\n currentTimeContextHelper: () => null,\n currentPageContextHelper: () => null,\n }}\n >\n <TamboThreadProvider streaming={false}>\n {children}\n </TamboThreadProvider>\n </TamboContextHelpersProvider>\n </TamboRegistryProvider>\n );\n\n const mockStreamResponse: TamboAI.Beta.Threads.ThreadAdvanceResponse = {\n responseMessageDto: {\n id: \"stream-response\",\n content: [{ type: \"text\", text: \"Streaming response\" }],\n role: \"assistant\",\n threadId: \"new-thread-1\",\n component: undefined,\n componentState: {},\n createdAt: new Date().toISOString(),\n },\n generationStage: GenerationStage.COMPLETE,\n mcpAccessToken: \"test-mcp-access-token\",\n };\n\n const mockAsyncIterator = {\n [Symbol.asyncIterator]: async function* () {\n yield mockStreamResponse;\n },\n };\n\n jest.mocked(advanceStream).mockResolvedValue(mockAsyncIterator);\n\n const { result } = renderHook(() => useTamboThread(), {\n wrapper: wrapperWithoutStreaming,\n });\n\n // Start with placeholder thread (which is the default state)\n expect(result.current.thread.id).toBe(\"placeholder\");\n\n await act(async () => {\n await result.current.sendThreadMessage(\"Hello streaming new thread\", {\n threadId: \"placeholder\",\n streamResponse: true,\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n });\n });\n\n expect(advanceStream).toHaveBeenCalledWith(\n mockTamboAI,\n {\n messageToAppend: {\n content: [{ type: \"text\", text: \"Hello streaming new thread\" }],\n role: \"user\",\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n },\n availableComponents: serializeRegistry(mockRegistry),\n contextKey: undefined,\n clientTools: [],\n forceToolChoice: undefined,\n toolCallCounts: {},\n },\n undefined, // threadId is undefined for placeholder thread\n );\n\n // Should not call advance or advanceById\n expect(mockThreadsApi.advance).not.toHaveBeenCalled();\n expect(mockThreadsApi.advanceById).not.toHaveBeenCalled();\n });\n });\n\n describe(\"error handling\", () => {\n it(\"should set generation stage to ERROR when non-streaming sendThreadMessage fails\", async () => {\n const testError = new Error(\"API call failed\");\n\n // Mock advanceById to throw an error\n jest.mocked(mockThreadsApi.advanceById).mockRejectedValue(testError);\n\n const { result } = renderHook(() => useTamboThread(), { wrapper });\n\n // Expect the error to be thrown\n await act(async () => {\n await result.current.switchCurrentThread(\"test-thread-1\");\n await expect(\n result.current.sendThreadMessage(\"Hello\", {\n threadId: \"test-thread-1\",\n streamResponse: false,\n }),\n ).rejects.toThrow(\"API call failed\");\n });\n\n // Verify generation stage is set to ERROR\n expect(result.current.generationStage).toBe(GenerationStage.ERROR);\n });\n\n it(\"should set generation stage to ERROR when streaming sendThreadMessage fails\", async () => {\n const testError = new Error(\"Streaming API call failed\");\n\n // Mock advanceStream to throw an error\n jest.mocked(advanceStream).mockRejectedValue(testError);\n\n const { result } = renderHook(() => useTamboThread(), { wrapper });\n\n // Expect the error to be thrown\n await act(async () => {\n await result.current.switchCurrentThread(\"test-thread-1\");\n await expect(\n result.current.sendThreadMessage(\"Hello\", {\n threadId: \"test-thread-1\",\n streamResponse: true,\n }),\n ).rejects.toThrow(\"Streaming API call failed\");\n });\n\n // Verify generation stage is set to ERROR\n expect(result.current.generationStage).toBe(GenerationStage.ERROR);\n });\n\n it(\"should set generation stage to ERROR when advance API call fails for placeholder thread\", async () => {\n const testError = new Error(\"Advance API call failed\");\n\n // Mock advance to throw an error\n jest.mocked(mockThreadsApi.advance).mockRejectedValue(testError);\n\n const { result } = renderHook(() => useTamboThread(), { wrapper });\n\n // Start with placeholder thread (which is the default state)\n expect(result.current.thread.id).toBe(\"placeholder\");\n\n // Expect the error to be thrown\n await act(async () => {\n await expect(\n result.current.sendThreadMessage(\"Hello\", {\n threadId: \"placeholder\",\n streamResponse: false,\n }),\n ).rejects.toThrow(\"Advance API call failed\");\n });\n\n // Verify generation stage is set to ERROR\n expect(result.current.generationStage).toBe(GenerationStage.ERROR);\n });\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"tambo-thread-provider.test.js","sourceRoot":"","sources":["../../../src/providers/__tests__/tambo-thread-provider.test.tsx"],"names":[],"mappings":";;;;;AAAA,6DAAkE;AAClE,kDAAyD;AACzD,kDAA0B;AAE1B,6BAAwB;AAExB,yFAGiD;AACjD,+CAAwD;AACxD,oEAA0D;AAC1D,sFAAgF;AAChF,wEAAmE;AACnE,oEAA+E;AAI/E,yBAAyB;AACzB,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE;IACtC,KAAK,EAAE;QACL,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,WAAW,CAAC;KACnD;CACF,CAAC,CAAC;AAEH,8BAA8B;AAC9B,IAAI,CAAC,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE,CAAC,CAAC;IAC3C,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE;CAC1B,CAAC,CAAC,CAAC;AACJ,IAAI,CAAC,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE,CAAC,CAAC;IAC3C,aAAa,EAAE,IAAI,CAAC,EAAE,EAAE;CACzB,CAAC,CAAC,CAAC;AAEJ,4BAA4B;AAC5B,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,GAAG,EAAE,CAAC,CAAC;IACtC,GAAG,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC;IAC5C,gBAAgB,EAAE,GAAG,EAAE,CAAC,C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K,CAAC,CAAC;QACrE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,yFAAyF,EAAE,KAAK,IAAI,EAAE;YACvG,MAAM,SAAS,GAAG,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;YAEvD,iCAAiC;YACjC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;YAEjE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,kBAAU,EAAC,GAAG,EAAE,CAAC,IAAA,sCAAc,GAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;YAEnE,6DAA6D;YAC7D,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAErD,gCAAgC;YAChC,MAAM,IAAA,WAAG,EAAC,KAAK,IAAI,EAAE;gBACnB,MAAM,MAAM,CACV,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,OAAO,EAAE;oBACxC,QAAQ,EAAE,aAAa;oBACvB,cAAc,EAAE,KAAK;iBACtB,CAAC,CACH,CAAC,OAAO,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;YAC/C,CAAC,CAAC,CAAC;YAEH,0CAA0C;YAC1C,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,6CAAe,CAAC,KAAK,CAAC,CAAC;QACrE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import TamboAI, { advanceStream } from \"@tambo-ai/typescript-sdk\";\nimport { act, renderHook } from \"@testing-library/react\";\nimport React from \"react\";\nimport { DeepPartial } from \"ts-essentials\";\nimport { z } from \"zod\";\nimport { TamboComponent } from \"../../model/component-metadata\";\nimport {\n GenerationStage,\n TamboThreadMessage,\n} from \"../../model/generate-component-response\";\nimport { serializeRegistry } from \"../../testing/tools\";\nimport { useTamboClient } from \"../tambo-client-provider\";\nimport { TamboContextHelpersProvider } from \"../tambo-context-helpers-provider\";\nimport { TamboRegistryProvider } from \"../tambo-registry-provider\";\nimport { TamboThreadProvider, useTamboThread } from \"../tambo-thread-provider\";\n\ntype PartialTamboAI = DeepPartial<TamboAI>;\n\n// Mock crypto.randomUUID\nObject.defineProperty(global, \"crypto\", {\n value: {\n randomUUID: jest.fn().mockReturnValue(\"test-uuid\"),\n },\n});\n\n// Mock the required providers\njest.mock(\"../tambo-client-provider\", () => ({\n useTamboClient: jest.fn(),\n}));\njest.mock(\"@tambo-ai/typescript-sdk\", () => ({\n advanceStream: jest.fn(),\n}));\n\n// Mock the getCustomContext\njest.mock(\"../../util/registry\", () => ({\n ...jest.requireActual(\"../../util/registry\"),\n getCustomContext: () => ({\n message: \"additional instructions\",\n }),\n}));\n\n// Test utilities\nconst createMockMessage = (\n overrides: Partial<TamboThreadMessage> = {},\n): TamboThreadMessage => ({\n id: \"test-message-1\",\n content: [{ type: \"text\", text: \"Hello\" }],\n role: \"user\",\n threadId: \"test-thread-1\",\n createdAt: new Date().toISOString(),\n componentState: {},\n ...overrides,\n});\n\nconst createMockThread = (\n overrides: Partial<TamboAI.Beta.Threads.Thread> = {},\n) => ({\n id: \"test-thread-1\",\n messages: [],\n createdAt: \"2024-01-01T00:00:00Z\",\n projectId: \"test-project\",\n updatedAt: \"2024-01-01T00:00:00Z\",\n metadata: {},\n ...overrides,\n});\n\nconst createMockAdvanceResponse = (\n overrides: Partial<TamboAI.Beta.Threads.ThreadAdvanceResponse> = {},\n): TamboAI.Beta.Threads.ThreadAdvanceResponse => ({\n responseMessageDto: {\n id: \"test-uuid\",\n content: [{ type: \"text\" as const, text: \"Default response\" }],\n role: \"assistant\",\n threadId: \"test-thread-1\",\n component: undefined,\n componentState: {},\n createdAt: new Date().toISOString(),\n },\n generationStage: GenerationStage.COMPLETE,\n mcpAccessToken: \"test-mcp-access-token\",\n ...overrides,\n});\n\ndescribe(\"TamboThreadProvider\", () => {\n const mockThread = createMockThread();\n\n const mockThreadsApi = {\n messages: {\n create: jest.fn(),\n },\n retrieve: jest.fn(),\n advance: jest.fn(),\n advanceById: jest.fn(),\n } satisfies DeepPartial<\n TamboAI[\"beta\"][\"threads\"]\n > as unknown as TamboAI.Beta.Threads;\n\n const mockBeta = {\n threads: mockThreadsApi,\n } satisfies PartialTamboAI[\"beta\"];\n\n const mockTamboAI = {\n apiKey: \"\",\n beta: mockBeta,\n } satisfies PartialTamboAI as unknown as TamboAI;\n\n const mockRegistry: TamboComponent[] = [\n {\n name: \"TestOnly\",\n component: () => <div>TestOnly</div>,\n description: \"TestOnly\",\n propsSchema: z.object({\n test: z.string(),\n }),\n associatedTools: [\n {\n name: \"test-tool\",\n tool: jest.fn().mockResolvedValue(\"test-tool\"),\n description: \"test-tool\",\n toolSchema: z\n .function()\n .args(z.string().describe(\"test-param-description\"))\n .returns(z.string()),\n },\n ],\n },\n ];\n\n // Use helpers that explicitly return null so they don't appear in additionalContext\n const wrapper = ({ children }: { children: React.ReactNode }) => (\n <TamboRegistryProvider components={mockRegistry}>\n <TamboContextHelpersProvider\n contextHelpers={{\n currentTimeContextHelper: () => null,\n currentPageContextHelper: () => null,\n }}\n >\n <TamboThreadProvider streaming={false}>{children}</TamboThreadProvider>\n </TamboContextHelpersProvider>\n </TamboRegistryProvider>\n );\n\n beforeEach(() => {\n jest.clearAllMocks();\n jest.mocked(mockThreadsApi.retrieve).mockResolvedValue(mockThread);\n jest\n .mocked(mockThreadsApi.messages.create)\n .mockResolvedValue(createMockMessage());\n jest\n .mocked(mockThreadsApi.advance)\n .mockResolvedValue(createMockAdvanceResponse());\n jest\n .mocked(mockThreadsApi.advanceById)\n .mockResolvedValue(createMockAdvanceResponse());\n jest.mocked(useTamboClient).mockReturnValue(mockTamboAI);\n });\n\n it(\"should initialize with placeholder thread\", () => {\n const { result } = renderHook(() => useTamboThread(), { wrapper });\n\n expect(result.current.thread.id).toBe(\"placeholder\");\n expect(result.current.isIdle).toBe(true);\n expect(result.current.generationStage).toBe(GenerationStage.IDLE);\n });\n\n it(\"should switch to a new thread\", async () => {\n const { result } = renderHook(() => useTamboThread(), { wrapper });\n\n await act(async () => {\n await result.current.switchCurrentThread(\"test-thread-1\");\n });\n\n expect(mockThreadsApi.retrieve).toHaveBeenCalledWith(\"test-thread-1\", {\n includeInternal: true,\n });\n expect(result.current.thread.id).toBe(\"test-thread-1\");\n });\n\n it(\"should start a new thread\", async () => {\n const { result } = renderHook(() => useTamboThread(), { wrapper });\n\n await act(async () => {\n result.current.startNewThread();\n });\n\n expect(result.current.thread.id).toBe(\"placeholder\");\n expect(result.current.isIdle).toBe(true);\n });\n\n it(\"should add a message to the thread\", async () => {\n const { result } = renderHook(() => useTamboThread(), { wrapper });\n const testMessage: TamboThreadMessage = {\n id: \"test-message-1\",\n content: [{ type: \"text\", text: \"Hello\" }],\n role: \"user\",\n threadId: \"test-thread-1\",\n createdAt: new Date().toISOString(),\n componentState: {},\n };\n\n await act(async () => {\n await result.current.addThreadMessage(testMessage, true);\n });\n\n expect(mockThreadsApi.messages.create).toHaveBeenCalledWith(\n \"test-thread-1\",\n {\n content: testMessage.content,\n role: testMessage.role,\n },\n );\n });\n\n it(\"should update a message in the thread\", async () => {\n const { result } = renderHook(() => useTamboThread(), { wrapper });\n const testMessage: TamboThreadMessage = {\n id: \"test-message-1\",\n content: [{ type: \"text\", text: \"Updated message\" }],\n role: \"user\",\n threadId: \"test-thread-1\",\n createdAt: new Date().toISOString(),\n componentState: {},\n };\n\n await act(async () => {\n await result.current.updateThreadMessage(\n \"test-message-1\",\n testMessage,\n true,\n );\n });\n\n expect(mockThreadsApi.messages.create).toHaveBeenCalledWith(\n \"test-thread-1\",\n {\n content: testMessage.content,\n role: testMessage.role,\n },\n );\n });\n\n it(\"should send a message and update thread state\", async () => {\n const mockAdvanceResponse: TamboAI.Beta.Threads.ThreadAdvanceResponse = {\n responseMessageDto: {\n id: \"response-1\",\n content: [{ type: \"text\", text: \"Response\" }],\n role: \"assistant\",\n threadId: \"test-thread-1\",\n component: undefined,\n componentState: {},\n createdAt: new Date().toISOString(),\n },\n generationStage: GenerationStage.COMPLETE,\n mcpAccessToken: \"test-mcp-access-token\",\n };\n\n jest\n .mocked(mockThreadsApi.advanceById)\n .mockResolvedValue(mockAdvanceResponse);\n\n const { result } = renderHook(() => useTamboThread(), { wrapper });\n\n await act(async () => {\n await result.current.sendThreadMessage(\"Hello\", {\n threadId: \"test-thread-1\",\n streamResponse: false,\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n });\n });\n\n expect(mockThreadsApi.advanceById).toHaveBeenCalledWith(\"test-thread-1\", {\n messageToAppend: {\n content: [{ type: \"text\", text: \"Hello\" }],\n role: \"user\",\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n },\n availableComponents: serializeRegistry(mockRegistry),\n contextKey: undefined,\n clientTools: [],\n toolCallCounts: {},\n });\n expect(result.current.generationStage).toBe(GenerationStage.COMPLETE);\n });\n\n it(\"should handle streaming responses\", async () => {\n const mockStreamResponse: TamboAI.Beta.Threads.ThreadAdvanceResponse = {\n responseMessageDto: {\n id: \"stream-1\",\n content: [{ type: \"text\", text: \"Streaming response\" }],\n role: \"assistant\",\n threadId: \"test-thread-1\",\n component: undefined,\n componentState: {},\n createdAt: new Date().toISOString(),\n },\n generationStage: GenerationStage.COMPLETE,\n mcpAccessToken: \"test-mcp-access-token\",\n };\n\n // Create an async iterator mock\n const mockAsyncIterator = {\n [Symbol.asyncIterator]: async function* () {\n yield mockStreamResponse;\n },\n };\n\n // Mock advanceStream to return our async iterator\n jest.mocked(advanceStream).mockResolvedValue(mockAsyncIterator);\n\n const { result } = renderHook(() => useTamboThread(), { wrapper });\n\n await act(async () => {\n await result.current.sendThreadMessage(\"Hello\", {\n threadId: \"test-thread-1\",\n streamResponse: true,\n });\n });\n\n expect(result.current.generationStage).toBe(GenerationStage.COMPLETE);\n });\n\n it(\"should handle tool calls during message processing.\", async () => {\n const mockToolCallResponse: TamboAI.Beta.Threads.ThreadAdvanceResponse = {\n responseMessageDto: {\n id: \"tool-call-1\",\n content: [{ type: \"text\", text: \"Tool response\" }],\n role: \"tool\",\n threadId: \"test-thread-1\",\n toolCallRequest: {\n toolName: \"test-tool\",\n parameters: [{ parameterName: \"test\", parameterValue: \"test\" }],\n },\n componentState: {},\n createdAt: new Date().toISOString(),\n },\n generationStage: GenerationStage.COMPLETE,\n mcpAccessToken: \"test-mcp-access-token\",\n };\n\n jest\n .mocked(mockThreadsApi.advanceById)\n .mockResolvedValueOnce(mockToolCallResponse)\n .mockResolvedValueOnce({\n responseMessageDto: {\n id: \"advance-response2\",\n content: [{ type: \"text\", text: \"response 2\" }],\n role: \"user\",\n threadId: \"test-thread-1\",\n componentState: {},\n createdAt: new Date().toISOString(),\n },\n generationStage: GenerationStage.COMPLETE,\n mcpAccessToken: \"test-mcp-access-token\",\n });\n\n const { result } = renderHook(() => useTamboThread(), { wrapper });\n\n await act(async () => {\n await result.current.sendThreadMessage(\"Use tool\", {\n threadId: \"test-thread-1\",\n streamResponse: false,\n });\n });\n expect(result.current.generationStage).toBe(GenerationStage.COMPLETE);\n expect(mockRegistry[0]?.associatedTools?.[0]?.tool).toHaveBeenCalledWith(\n \"test\",\n );\n });\n\n it(\"should handle unregistered tool calls with onCallUnregisteredTool\", async () => {\n const mockOnCallUnregisteredTool = jest\n .fn()\n .mockResolvedValue(\"unregistered-tool-result\");\n\n const wrapperWithUnregisteredTool = ({\n children,\n }: {\n children: React.ReactNode;\n }) => (\n <TamboRegistryProvider\n components={mockRegistry}\n onCallUnregisteredTool={mockOnCallUnregisteredTool}\n >\n <TamboContextHelpersProvider\n contextHelpers={{\n currentTimeContextHelper: () => null,\n currentPageContextHelper: () => null,\n }}\n >\n <TamboThreadProvider streaming={false}>\n {children}\n </TamboThreadProvider>\n </TamboContextHelpersProvider>\n </TamboRegistryProvider>\n );\n\n const mockUnregisteredToolCallResponse: TamboAI.Beta.Threads.ThreadAdvanceResponse =\n {\n responseMessageDto: {\n id: \"unregistered-tool-call-1\",\n content: [{ type: \"text\", text: \"Unregistered tool response\" }],\n role: \"tool\",\n threadId: \"test-thread-1\",\n toolCallRequest: {\n toolName: \"unregistered-tool\",\n parameters: [\n { parameterName: \"input\", parameterValue: \"test-input\" },\n ],\n },\n componentState: {},\n createdAt: new Date().toISOString(),\n },\n generationStage: GenerationStage.COMPLETE,\n mcpAccessToken: \"test-mcp-access-token\",\n };\n\n jest\n .mocked(mockThreadsApi.advanceById)\n .mockResolvedValueOnce(mockUnregisteredToolCallResponse)\n .mockResolvedValueOnce({\n responseMessageDto: {\n id: \"advance-response2\",\n content: [{ type: \"text\", text: \"response 2\" }],\n role: \"user\",\n threadId: \"test-thread-1\",\n componentState: {},\n createdAt: new Date().toISOString(),\n },\n generationStage: GenerationStage.COMPLETE,\n mcpAccessToken: \"test-mcp-access-token\",\n });\n\n const { result } = renderHook(() => useTamboThread(), {\n wrapper: wrapperWithUnregisteredTool,\n });\n\n await act(async () => {\n await result.current.sendThreadMessage(\"Use unregistered tool\", {\n threadId: \"test-thread-1\",\n streamResponse: false,\n });\n });\n\n expect(result.current.generationStage).toBe(GenerationStage.COMPLETE);\n expect(mockOnCallUnregisteredTool).toHaveBeenCalledWith(\n \"unregistered-tool\",\n [{ parameterName: \"input\", parameterValue: \"test-input\" }],\n );\n });\n\n it(\"should handle unregistered tool calls without onCallUnregisteredTool\", async () => {\n const mockUnregisteredToolCallResponse: TamboAI.Beta.Threads.ThreadAdvanceResponse =\n {\n responseMessageDto: {\n id: \"unregistered-tool-call-1\",\n content: [{ type: \"text\", text: \"Unregistered tool response\" }],\n role: \"tool\",\n threadId: \"test-thread-1\",\n toolCallRequest: {\n toolName: \"unregistered-tool\",\n parameters: [\n { parameterName: \"input\", parameterValue: \"test-input\" },\n ],\n },\n componentState: {},\n createdAt: new Date().toISOString(),\n },\n generationStage: GenerationStage.COMPLETE,\n mcpAccessToken: \"test-mcp-access-token\",\n };\n\n jest\n .mocked(mockThreadsApi.advanceById)\n .mockResolvedValueOnce(mockUnregisteredToolCallResponse)\n .mockResolvedValueOnce({\n responseMessageDto: {\n id: \"advance-response2\",\n content: [{ type: \"text\", text: \"response 2\" }],\n role: \"user\",\n threadId: \"test-thread-1\",\n componentState: {},\n createdAt: new Date().toISOString(),\n },\n generationStage: GenerationStage.COMPLETE,\n mcpAccessToken: \"test-mcp-access-token\",\n });\n\n const { result } = renderHook(() => useTamboThread(), { wrapper });\n\n await act(async () => {\n await result.current.sendThreadMessage(\"Use unregistered tool\", {\n threadId: \"test-thread-1\",\n streamResponse: false,\n });\n });\n\n expect(result.current.generationStage).toBe(GenerationStage.COMPLETE);\n // Should not throw an error, but the tool call should fail gracefully\n });\n\n describe(\"streaming behavior\", () => {\n it(\"should call advanceStream when streamResponse=true\", async () => {\n // Use wrapper with streaming=true to show that explicit streamResponse=true works\n const wrapperWithStreaming = ({\n children,\n }: {\n children: React.ReactNode;\n }) => (\n <TamboRegistryProvider components={mockRegistry}>\n <TamboContextHelpersProvider\n contextHelpers={{\n currentTimeContextHelper: () => null,\n currentPageContextHelper: () => null,\n }}\n >\n <TamboThreadProvider streaming={true}>\n {children}\n </TamboThreadProvider>\n </TamboContextHelpersProvider>\n </TamboRegistryProvider>\n );\n\n const mockStreamResponse: TamboAI.Beta.Threads.ThreadAdvanceResponse = {\n responseMessageDto: {\n id: \"stream-response\",\n content: [{ type: \"text\", text: \"Streaming response\" }],\n role: \"assistant\",\n threadId: \"test-thread-1\",\n component: undefined,\n componentState: {},\n createdAt: new Date().toISOString(),\n },\n generationStage: GenerationStage.COMPLETE,\n mcpAccessToken: \"test-mcp-access-token\",\n };\n\n const mockAsyncIterator = {\n [Symbol.asyncIterator]: async function* () {\n yield mockStreamResponse;\n },\n };\n\n jest.mocked(advanceStream).mockResolvedValue(mockAsyncIterator);\n\n const { result } = renderHook(() => useTamboThread(), {\n wrapper: wrapperWithStreaming,\n });\n\n await act(async () => {\n await result.current.sendThreadMessage(\"Hello streaming\", {\n threadId: \"test-thread-1\",\n streamResponse: true,\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n });\n });\n\n expect(advanceStream).toHaveBeenCalledWith(\n mockTamboAI,\n {\n messageToAppend: {\n content: [{ type: \"text\", text: \"Hello streaming\" }],\n role: \"user\",\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n },\n availableComponents: serializeRegistry(mockRegistry),\n contextKey: undefined,\n clientTools: [],\n forceToolChoice: undefined,\n toolCallCounts: {},\n },\n \"test-thread-1\",\n );\n\n // Should not call advance or advanceById\n expect(mockThreadsApi.advance).not.toHaveBeenCalled();\n expect(mockThreadsApi.advanceById).not.toHaveBeenCalled();\n });\n\n it(\"should call advanceById when streamResponse=false for existing thread\", async () => {\n // Use wrapper with streaming=true to show that explicit streamResponse=false overrides provider setting\n const wrapperWithStreaming = ({\n children,\n }: {\n children: React.ReactNode;\n }) => (\n <TamboRegistryProvider components={mockRegistry}>\n <TamboContextHelpersProvider\n contextHelpers={{\n currentTimeContextHelper: () => null,\n currentPageContextHelper: () => null,\n }}\n >\n <TamboThreadProvider streaming={true}>\n {children}\n </TamboThreadProvider>\n </TamboContextHelpersProvider>\n </TamboRegistryProvider>\n );\n\n const { result } = renderHook(() => useTamboThread(), {\n wrapper: wrapperWithStreaming,\n });\n\n await act(async () => {\n await result.current.sendThreadMessage(\"Hello non-streaming\", {\n threadId: \"test-thread-1\",\n streamResponse: false,\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n });\n });\n\n expect(mockThreadsApi.advanceById).toHaveBeenCalledWith(\"test-thread-1\", {\n messageToAppend: {\n content: [{ type: \"text\", text: \"Hello non-streaming\" }],\n role: \"user\",\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n },\n availableComponents: serializeRegistry(mockRegistry),\n contextKey: undefined,\n clientTools: [],\n forceToolChoice: undefined,\n toolCallCounts: {},\n });\n\n // Should not call advance or advanceStream\n expect(mockThreadsApi.advance).not.toHaveBeenCalled();\n expect(advanceStream).not.toHaveBeenCalled();\n });\n\n it(\"should call advanceById when streamResponse is undefined and provider streaming=false\", async () => {\n // Use wrapper with streaming=false to test that undefined streamResponse respects provider setting\n const wrapperWithoutStreaming = ({\n children,\n }: {\n children: React.ReactNode;\n }) => (\n <TamboRegistryProvider components={mockRegistry}>\n <TamboContextHelpersProvider\n contextHelpers={{\n currentTimeContextHelper: () => null,\n currentPageContextHelper: () => null,\n }}\n >\n <TamboThreadProvider streaming={false}>\n {children}\n </TamboThreadProvider>\n </TamboContextHelpersProvider>\n </TamboRegistryProvider>\n );\n\n const { result } = renderHook(() => useTamboThread(), {\n wrapper: wrapperWithoutStreaming,\n });\n\n await act(async () => {\n await result.current.sendThreadMessage(\"Hello default\", {\n threadId: \"test-thread-1\",\n // streamResponse is undefined, should use provider's streaming=false\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n });\n });\n\n expect(mockThreadsApi.advanceById).toHaveBeenCalledWith(\"test-thread-1\", {\n messageToAppend: {\n content: [{ type: \"text\", text: \"Hello default\" }],\n role: \"user\",\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n },\n availableComponents: serializeRegistry(mockRegistry),\n contextKey: undefined,\n clientTools: [],\n forceToolChoice: undefined,\n toolCallCounts: {},\n });\n\n // Should not call advance or advanceStream\n expect(mockThreadsApi.advance).not.toHaveBeenCalled();\n expect(advanceStream).not.toHaveBeenCalled();\n });\n\n it(\"should call advanceStream when streamResponse is undefined and provider streaming=true (default)\", async () => {\n // Use wrapper with streaming=true (default) to test that undefined streamResponse respects provider setting\n const wrapperWithDefaultStreaming = ({\n children,\n }: {\n children: React.ReactNode;\n }) => (\n <TamboRegistryProvider components={mockRegistry}>\n <TamboContextHelpersProvider\n contextHelpers={{\n currentTimeContextHelper: () => null,\n currentPageContextHelper: () => null,\n }}\n >\n <TamboThreadProvider>{children}</TamboThreadProvider>\n </TamboContextHelpersProvider>\n </TamboRegistryProvider>\n );\n\n const mockStreamResponse: TamboAI.Beta.Threads.ThreadAdvanceResponse = {\n responseMessageDto: {\n id: \"stream-response\",\n content: [{ type: \"text\", text: \"Streaming response\" }],\n role: \"assistant\",\n threadId: \"test-thread-1\",\n component: undefined,\n componentState: {},\n createdAt: new Date().toISOString(),\n },\n generationStage: GenerationStage.COMPLETE,\n mcpAccessToken: \"test-mcp-access-token\",\n };\n\n const mockAsyncIterator = {\n [Symbol.asyncIterator]: async function* () {\n yield mockStreamResponse;\n },\n };\n\n jest.mocked(advanceStream).mockResolvedValue(mockAsyncIterator);\n\n const { result } = renderHook(() => useTamboThread(), {\n wrapper: wrapperWithDefaultStreaming,\n });\n\n await act(async () => {\n await result.current.sendThreadMessage(\"Hello default streaming\", {\n threadId: \"test-thread-1\",\n // streamResponse is undefined, should use provider's streaming=true (default)\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n });\n });\n\n expect(advanceStream).toHaveBeenCalledWith(\n mockTamboAI,\n {\n messageToAppend: {\n content: [{ type: \"text\", text: \"Hello default streaming\" }],\n role: \"user\",\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n },\n availableComponents: serializeRegistry(mockRegistry),\n contextKey: undefined,\n clientTools: [],\n forceToolChoice: undefined,\n toolCallCounts: {},\n },\n \"test-thread-1\",\n );\n\n // Should not call advance or advanceById\n expect(mockThreadsApi.advance).not.toHaveBeenCalled();\n expect(mockThreadsApi.advanceById).not.toHaveBeenCalled();\n });\n\n it(\"should call advance when streamResponse=false for placeholder thread\", async () => {\n // Use wrapper with streaming=true to show that explicit streamResponse=false overrides provider setting\n const wrapperWithStreaming = ({\n children,\n }: {\n children: React.ReactNode;\n }) => (\n <TamboRegistryProvider components={mockRegistry}>\n <TamboContextHelpersProvider\n contextHelpers={{\n currentTimeContextHelper: () => null,\n currentPageContextHelper: () => null,\n }}\n >\n <TamboThreadProvider streaming={true}>\n {children}\n </TamboThreadProvider>\n </TamboContextHelpersProvider>\n </TamboRegistryProvider>\n );\n\n const { result } = renderHook(() => useTamboThread(), {\n wrapper: wrapperWithStreaming,\n });\n\n // Start with placeholder thread (which is the default state)\n expect(result.current.thread.id).toBe(\"placeholder\");\n\n await act(async () => {\n await result.current.sendThreadMessage(\"Hello new thread\", {\n threadId: \"placeholder\",\n streamResponse: false,\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n });\n });\n\n expect(mockThreadsApi.advance).toHaveBeenCalledWith({\n messageToAppend: {\n content: [{ type: \"text\", text: \"Hello new thread\" }],\n role: \"user\",\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n },\n availableComponents: serializeRegistry(mockRegistry),\n contextKey: undefined,\n clientTools: [],\n forceToolChoice: undefined,\n toolCallCounts: {},\n });\n\n // Should not call advanceById or advanceStream\n expect(mockThreadsApi.advanceById).not.toHaveBeenCalled();\n expect(advanceStream).not.toHaveBeenCalled();\n });\n\n it(\"should call advanceStream when streamResponse=true for placeholder thread\", async () => {\n // Use wrapper with streaming=false to show that explicit streamResponse=true overrides provider setting\n const wrapperWithoutStreaming = ({\n children,\n }: {\n children: React.ReactNode;\n }) => (\n <TamboRegistryProvider components={mockRegistry}>\n <TamboContextHelpersProvider\n contextHelpers={{\n currentTimeContextHelper: () => null,\n currentPageContextHelper: () => null,\n }}\n >\n <TamboThreadProvider streaming={false}>\n {children}\n </TamboThreadProvider>\n </TamboContextHelpersProvider>\n </TamboRegistryProvider>\n );\n\n const mockStreamResponse: TamboAI.Beta.Threads.ThreadAdvanceResponse = {\n responseMessageDto: {\n id: \"stream-response\",\n content: [{ type: \"text\", text: \"Streaming response\" }],\n role: \"assistant\",\n threadId: \"new-thread-1\",\n component: undefined,\n componentState: {},\n createdAt: new Date().toISOString(),\n },\n generationStage: GenerationStage.COMPLETE,\n mcpAccessToken: \"test-mcp-access-token\",\n };\n\n const mockAsyncIterator = {\n [Symbol.asyncIterator]: async function* () {\n yield mockStreamResponse;\n },\n };\n\n jest.mocked(advanceStream).mockResolvedValue(mockAsyncIterator);\n\n const { result } = renderHook(() => useTamboThread(), {\n wrapper: wrapperWithoutStreaming,\n });\n\n // Start with placeholder thread (which is the default state)\n expect(result.current.thread.id).toBe(\"placeholder\");\n\n await act(async () => {\n await result.current.sendThreadMessage(\"Hello streaming new thread\", {\n threadId: \"placeholder\",\n streamResponse: true,\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n });\n });\n\n expect(advanceStream).toHaveBeenCalledWith(\n mockTamboAI,\n {\n messageToAppend: {\n content: [{ type: \"text\", text: \"Hello streaming new thread\" }],\n role: \"user\",\n additionalContext: {\n custom: {\n message: \"additional instructions\",\n },\n },\n },\n availableComponents: serializeRegistry(mockRegistry),\n contextKey: undefined,\n clientTools: [],\n forceToolChoice: undefined,\n toolCallCounts: {},\n },\n undefined, // threadId is undefined for placeholder thread\n );\n\n // Should not call advance or advanceById\n expect(mockThreadsApi.advance).not.toHaveBeenCalled();\n expect(mockThreadsApi.advanceById).not.toHaveBeenCalled();\n });\n });\n\n describe(\"error handling\", () => {\n it(\"should set generation stage to ERROR when non-streaming sendThreadMessage fails\", async () => {\n const testError = new Error(\"API call failed\");\n\n // Mock advanceById to throw an error\n jest.mocked(mockThreadsApi.advanceById).mockRejectedValue(testError);\n\n const { result } = renderHook(() => useTamboThread(), { wrapper });\n\n // Expect the error to be thrown\n await act(async () => {\n await result.current.switchCurrentThread(\"test-thread-1\");\n await expect(\n result.current.sendThreadMessage(\"Hello\", {\n threadId: \"test-thread-1\",\n streamResponse: false,\n }),\n ).rejects.toThrow(\"API call failed\");\n });\n\n // Verify generation stage is set to ERROR\n expect(result.current.generationStage).toBe(GenerationStage.ERROR);\n });\n\n it(\"should set generation stage to ERROR when streaming sendThreadMessage fails\", async () => {\n const testError = new Error(\"Streaming API call failed\");\n\n // Mock advanceStream to throw an error\n jest.mocked(advanceStream).mockRejectedValue(testError);\n\n const { result } = renderHook(() => useTamboThread(), { wrapper });\n\n // Expect the error to be thrown\n await act(async () => {\n await result.current.switchCurrentThread(\"test-thread-1\");\n await expect(\n result.current.sendThreadMessage(\"Hello\", {\n threadId: \"test-thread-1\",\n streamResponse: true,\n }),\n ).rejects.toThrow(\"Streaming API call failed\");\n });\n\n // Verify generation stage is set to ERROR\n expect(result.current.generationStage).toBe(GenerationStage.ERROR);\n });\n\n it(\"should set generation stage to ERROR when advance API call fails for placeholder thread\", async () => {\n const testError = new Error(\"Advance API call failed\");\n\n // Mock advance to throw an error\n jest.mocked(mockThreadsApi.advance).mockRejectedValue(testError);\n\n const { result } = renderHook(() => useTamboThread(), { wrapper });\n\n // Start with placeholder thread (which is the default state)\n expect(result.current.thread.id).toBe(\"placeholder\");\n\n // Expect the error to be thrown\n await act(async () => {\n await expect(\n result.current.sendThreadMessage(\"Hello\", {\n threadId: \"placeholder\",\n streamResponse: false,\n }),\n ).rejects.toThrow(\"Advance API call failed\");\n });\n\n // Verify generation stage is set to ERROR\n expect(result.current.generationStage).toBe(GenerationStage.ERROR);\n });\n });\n});\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from "react";
|
|
2
|
+
import { z } from "zod";
|
|
2
3
|
import { type TamboInteractableContext } from "../model/tambo-interactable";
|
|
3
4
|
declare const TamboInteractableContext: React.Context<TamboInteractableContext>;
|
|
4
5
|
/**
|
|
@@ -16,5 +17,24 @@ export declare const TamboInteractableProvider: React.FC<PropsWithChildren>;
|
|
|
16
17
|
* @returns The interactable component management functions
|
|
17
18
|
*/
|
|
18
19
|
export declare const useTamboInteractable: () => TamboInteractableContext;
|
|
20
|
+
/**
|
|
21
|
+
* Hook to get a cloned snapshot of the current interactables.
|
|
22
|
+
* Returns a shallow copy of the array with cloned items and props to prevent
|
|
23
|
+
* external mutation from affecting internal state.
|
|
24
|
+
* @returns The current interactables snapshot (cloned).
|
|
25
|
+
*/
|
|
26
|
+
export declare const useCurrentInteractablesSnapshot: () => {
|
|
27
|
+
props: {
|
|
28
|
+
[x: string]: any;
|
|
29
|
+
};
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
description: string;
|
|
33
|
+
component: React.ComponentType<any>;
|
|
34
|
+
propsSchema?: z.ZodTypeAny | import("json-schema").JSONSchema7;
|
|
35
|
+
propsDefinition?: any;
|
|
36
|
+
loadingComponent?: React.ComponentType<any>;
|
|
37
|
+
associatedTools?: import(".").TamboTool[];
|
|
38
|
+
}[];
|
|
19
39
|
export {};
|
|
20
40
|
//# sourceMappingURL=tambo-interactable-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tambo-interactable-provider.d.ts","sourceRoot":"","sources":["../../src/providers/tambo-interactable-provider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAEZ,iBAAiB,EAKlB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"tambo-interactable-provider.d.ts","sourceRoot":"","sources":["../../src/providers/tambo-interactable-provider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAEZ,iBAAiB,EAKlB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,6BAA6B,CAAC;AAKrC,QAAA,MAAM,wBAAwB,yCAQ5B,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA6QjE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,gCAEhC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;GAU3C,CAAC"}
|
|
@@ -35,10 +35,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
};
|
|
36
36
|
})();
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.useTamboInteractable = exports.TamboInteractableProvider = void 0;
|
|
38
|
+
exports.useCurrentInteractablesSnapshot = exports.useTamboInteractable = exports.TamboInteractableProvider = void 0;
|
|
39
39
|
const react_1 = __importStar(require("react"));
|
|
40
40
|
const zod_1 = require("zod");
|
|
41
41
|
const tambo_component_provider_1 = require("./tambo-component-provider");
|
|
42
|
+
const tambo_context_helpers_provider_1 = require("./tambo-context-helpers-provider");
|
|
43
|
+
const current_interactables_context_helper_1 = require("../context-helpers/current-interactables-context-helper");
|
|
42
44
|
const TamboInteractableContext = (0, react_1.createContext)({
|
|
43
45
|
interactableComponents: [],
|
|
44
46
|
addInteractableComponent: () => "",
|
|
@@ -59,6 +61,18 @@ const TamboInteractableContext = (0, react_1.createContext)({
|
|
|
59
61
|
const TamboInteractableProvider = ({ children, }) => {
|
|
60
62
|
const [interactableComponents, setInteractableComponents] = (0, react_1.useState)([]);
|
|
61
63
|
const { registerTool } = (0, tambo_component_provider_1.useTamboComponent)();
|
|
64
|
+
const { addContextHelper, removeContextHelper } = (0, tambo_context_helpers_provider_1.useTamboContextHelpers)();
|
|
65
|
+
// Create a stable context helper function
|
|
66
|
+
const contextHelper = (0, react_1.useCallback)(() => {
|
|
67
|
+
return (0, current_interactables_context_helper_1.createInteractablesContextHelper)(() => interactableComponents)();
|
|
68
|
+
}, [interactableComponents]);
|
|
69
|
+
// Register the default interactables context helper
|
|
70
|
+
(0, react_1.useEffect)(() => {
|
|
71
|
+
addContextHelper("interactables", contextHelper);
|
|
72
|
+
return () => {
|
|
73
|
+
removeContextHelper("interactables");
|
|
74
|
+
};
|
|
75
|
+
}, [contextHelper, addContextHelper, removeContextHelper]);
|
|
62
76
|
(0, react_1.useEffect)(() => {
|
|
63
77
|
if (interactableComponents.length > 0) {
|
|
64
78
|
registerTool({
|
|
@@ -198,7 +212,7 @@ const TamboInteractableProvider = ({ children, }) => {
|
|
|
198
212
|
});
|
|
199
213
|
}, [registerTool, updateInteractableComponentProps]);
|
|
200
214
|
const addInteractableComponent = (0, react_1.useCallback)((component) => {
|
|
201
|
-
const id = `${component.name}-${Math.random().toString(36).
|
|
215
|
+
const id = `${component.name}-${Math.random().toString(36).slice(2, 11)}`;
|
|
202
216
|
const newComponent = {
|
|
203
217
|
...component,
|
|
204
218
|
id,
|
|
@@ -242,4 +256,20 @@ const useTamboInteractable = () => {
|
|
|
242
256
|
return (0, react_1.useContext)(TamboInteractableContext);
|
|
243
257
|
};
|
|
244
258
|
exports.useTamboInteractable = useTamboInteractable;
|
|
259
|
+
/**
|
|
260
|
+
* Hook to get a cloned snapshot of the current interactables.
|
|
261
|
+
* Returns a shallow copy of the array with cloned items and props to prevent
|
|
262
|
+
* external mutation from affecting internal state.
|
|
263
|
+
* @returns The current interactables snapshot (cloned).
|
|
264
|
+
*/
|
|
265
|
+
const useCurrentInteractablesSnapshot = () => {
|
|
266
|
+
const { interactableComponents } = (0, exports.useTamboInteractable)();
|
|
267
|
+
// Clone the array and each item/props to prevent mutation
|
|
268
|
+
const copy = interactableComponents.map((c) => ({
|
|
269
|
+
...c,
|
|
270
|
+
props: { ...c.props },
|
|
271
|
+
}));
|
|
272
|
+
return copy;
|
|
273
|
+
};
|
|
274
|
+
exports.useCurrentInteractablesSnapshot = useCurrentInteractablesSnapshot;
|
|
245
275
|
//# sourceMappingURL=tambo-interactable-provider.js.map
|