Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 06:00 UTC
| 1 | /** |
| 2 | * Simple test script to verify @composio/core works with openai@7 and zod@4 |
| 3 | * |
| 4 | * This test verifies that the packages can be imported and instantiated together |
| 5 | * without peer dependency conflicts. It doesn't make actual API calls. |
| 6 | * |
| 7 | * @see https://github.com/ComposioHQ/composio/issues/2336 |
| 8 | */ |
| 9 | import { z } from 'zod'; |
| 10 | import OpenAI from 'openai'; |
| 11 | import { Composio, OpenAIProvider } from '@composio/core'; |
| 12 | import { OpenAIResponsesProvider } from '@composio/openai'; |
| 13 | |
| 14 | // Verify zod@4 works |
| 15 | const schema = z.object({ name: z.string() }); |
| 16 | schema.parse({ name: 'OpenAI 7' }); |
| 17 | console.log('✅ zod@4 works'); |
| 18 | |
| 19 | // Verify openai@7 works without making a network request. |
| 20 | const openai = new OpenAI({ apiKey: 'test-key' }); |
| 21 | if (!openai.responses) { |
| 22 | throw new Error('OpenAI client does not expose the Responses API'); |
| 23 | } |
| 24 | console.log('✅ openai@7 works'); |
| 25 | |
| 26 | // Verify @composio/core works |
| 27 | const provider = new OpenAIProvider(); |
| 28 | const composio = new Composio({ |
| 29 | provider, |
| 30 | apiKey: 'test-key', |
| 31 | }); |
| 32 | if (!composio) { |
| 33 | throw new Error('Composio client construction failed'); |
| 34 | } |
| 35 | console.log('✅ @composio/core works'); |
| 36 | |
| 37 | const composioTool = { |
| 38 | slug: 'TEST', |
| 39 | description: 'Test tool', |
| 40 | inputParameters: { type: 'object', properties: {} }, |
| 41 | }; |
| 42 | |
| 43 | // Verify both published provider surfaces wrap tools without API calls. |
| 44 | const chatTool = provider.wrapTool(composioTool); |
| 45 | if (chatTool.type !== 'function' || chatTool.function.name !== 'TEST') { |
| 46 | throw new Error('Core OpenAI provider returned an invalid tool'); |
| 47 | } |
| 48 | console.log('✅ core wrapTool works'); |
| 49 | |
| 50 | const responsesProvider = new OpenAIResponsesProvider(); |
| 51 | const responsesTool = responsesProvider.wrapTool(composioTool); |
| 52 | if (responsesTool.type !== 'function' || responsesTool.name !== 'TEST') { |
| 53 | throw new Error('Responses provider returned an invalid tool'); |
| 54 | } |
| 55 | console.log('✅ responses wrapTool works'); |
| 56 | |
| 57 | console.log('\n🎉 All packages work together!'); |
| 58 | process.exit(0); |