@devries-cameron20 / composio Mirror · read-only / commits / eb7691e53
Fork 0

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 22, 20:45 UTC

Adds strict mode in Vercel AI SDK + Minor bug fixes (#1842)

Musthaq Ahamad committed Aug 12, 2025 at 14:33 UTC eb7691e53e24f7881e2aec9e2319891ccfe63037
7 files changed +80 -13
.changeset/proud-snails-search.md new
+13
@@ -0,0 +1,13 @@
1 +---
2 +'@composio/core': patch
3 +'@composio/anthropic': patch
4 +'@composio/cloudflare': patch
5 +'@composio/google': patch
6 +'@composio/langchain': patch
7 +'@composio/mastra': patch
8 +'@composio/openai': patch
9 +'@composio/openai-agents': patch
10 +'@composio/vercel': patch
11 +---
12 +
13 +Add strict mode to vercel provider
pnpm-lock.yaml
+44 -3
@@ -116,7 +116,7 @@ importers:
116 version: 4.3.16(react@18.3.1)(zod@3.25.67)
117 composio-core:
118 specifier: ^0.5.39
119 - version: 0.5.39(@ai-sdk/openai@1.3.22(zod@3.25.67))(@cloudflare/workers-types@4.20250619.0)(@langchain/core@0.3.63(openai@4.104.0(ws@8.18.2)(zod@3.25.67)))(@langchain/openai@0.5.13(@langchain/core@0.3.63(openai@4.104.0(ws@8.18.2)(zod@3.25.67)))(ws@8.18.2))(ai@4.3.16(react@18.3.1)(zod@3.25.67))(langchain@0.3.28(@langchain/core@0.3.63(openai@4.104.0(ws@8.18.2)(zod@3.25.67)))(axios@1.10.0)(openai@4.104.0(ws@8.18.2)(zod@3.25.67))(ws@8.18.2))(openai@4.104.0(ws@8.18.2)(zod@3.25.67))
119 + version: 0.5.39(@ai-sdk/openai@2.0.10(zod@3.25.67))(@cloudflare/workers-types@4.20250619.0)(@langchain/core@0.3.63(openai@4.104.0(ws@8.18.2)(zod@3.25.67)))(@langchain/openai@0.5.13(@langchain/core@0.3.63(openai@4.104.0(ws@8.18.2)(zod@3.25.67)))(ws@8.18.2))(ai@4.3.16(react@18.3.1)(zod@3.25.67))(langchain@0.3.28(@langchain/core@0.3.63(openai@4.104.0(ws@8.18.2)(zod@3.25.67)))(axios@1.10.0)(openai@4.104.0(ws@8.18.2)(zod@3.25.67))(ws@8.18.2))(openai@4.104.0(ws@8.18.2)(zod@3.25.67))
120 hono:
121 specifier: ^4.7.11
122 version: 4.8.0
@@ -868,16 +868,32 @@ packages:
868 peerDependencies:
869 zod: ^3.0.0
870
871 + '@ai-sdk/openai@2.0.10':
872 + resolution: {integrity: sha512-vnB6Jk2Qb245fajaWjG3q6N0QQy/uej7kZ0QR9xxq09x++3Tx/UPOcgAKMhFFA2fnuGpkFSRKoiDCyp/E3RARQ==}
873 + engines: {node: '>=18'}
874 + peerDependencies:
875 + zod: ^3.25.76 || ^4
876 +
877 '@ai-sdk/provider-utils@2.2.8':
878 resolution: {integrity: sha512-fqhG+4sCVv8x7nFzYnFo19ryhAa3w096Kmc3hWxMQfW/TubPOmt3A6tYZhl4mUfQWWQMsuSkLrtjlWuXBVSGQA==}
879 engines: {node: '>=18'}
880 peerDependencies:
881 zod: ^3.23.8
882
883 + '@ai-sdk/provider-utils@3.0.1':
884 + resolution: {integrity: sha512-/iP1sKc6UdJgGH98OCly7sWJKv+J9G47PnTjIj40IJMUQKwDrUMyf7zOOfRtPwSuNifYhSoJQ4s1WltI65gJ/g==}
885 + engines: {node: '>=18'}
886 + peerDependencies:
887 + zod: ^3.25.76 || ^4
888 +
889 '@ai-sdk/provider@1.1.3':
890 resolution: {integrity: sha512-qZMxYJ0qqX/RfnuIaab+zp8UAeJn/ygXXAffR5I4N0n1IrvA6qBsjc8hXLmBiMV2zoXlifkacF7sEFnYnjBcqg==}
891 engines: {node: '>=18'}
892
893 + '@ai-sdk/provider@2.0.0':
894 + resolution: {integrity: sha512-6o7Y2SeO9vFKB8lArHXehNuusnpddKPk7xqL7T2/b+OvXMRIXUO1rR4wcv1hAFUAT9avGZshty3Wlua/XA7TvA==}
895 + engines: {node: '>=18'}
896 +
897 '@ai-sdk/react@1.2.12':
898 resolution: {integrity: sha512-jK1IZZ22evPZoQW3vlkZ7wvjYGYF+tRBKXtrcolduIkQ/m/sOAVcVeVDUDvh1T91xCnWCdUGCPZg2avZ90mv3g==}
899 engines: {node: '>=18'}
@@ -4167,6 +4183,10 @@ packages:
4183 resolution: {integrity: sha512-6RxOBZ/cYgd8usLwsEl+EC09Au/9BcmCKYF2/xbml6DNczf7nv0MQb+7BA2F+li6//I+28VNlQR37XfQtcAJuA==}
4184 engines: {node: '>=18.0.0'}
4185
4186 + eventsource-parser@3.0.3:
4187 + resolution: {integrity: sha512-nVpZkTMM9rF6AQ9gPJpFsNAMt48wIzB5TQgiTLdHiuO8XEDhUgZEhqKlZWXbIzo9VmJ/HvysHqEaVeD5v9TPvA==}
4188 + engines: {node: '>=20.0.0'}
4189 +
4190 eventsource@3.0.7:
4191 resolution: {integrity: sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==}
4192 engines: {node: '>=18.0.0'}
@@ -5863,6 +5883,7 @@ packages:
5883 source-map@0.8.0-beta.0:
5884 resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==}
5885 engines: {node: '>= 8'}
5886 + deprecated: The work that was done in this beta branch won't be included in future versions
5887
5888 spawndamnit@3.0.1:
5889 resolution: {integrity: sha512-MmnduQUuHCoFckZoWnXsTg7JaiLBJrKFj9UI2MbRPGaJeVpsLcVBu6P/IGZovziM/YBsellCmsprgNA+w0CzVg==}
@@ -6569,6 +6590,12 @@ snapshots:
6590 '@ai-sdk/provider-utils': 2.2.8(zod@3.25.67)
6591 zod: 3.25.67
6592
6593 + '@ai-sdk/openai@2.0.10(zod@3.25.67)':
6594 + dependencies:
6595 + '@ai-sdk/provider': 2.0.0
6596 + '@ai-sdk/provider-utils': 3.0.1(zod@3.25.67)
6597 + zod: 3.25.67
6598 +
6599 '@ai-sdk/provider-utils@2.2.8(zod@3.25.67)':
6600 dependencies:
6601 '@ai-sdk/provider': 1.1.3
@@ -6576,10 +6603,22 @@ snapshots:
6603 secure-json-parse: 2.7.0
6604 zod: 3.25.67
6605
6606 + '@ai-sdk/provider-utils@3.0.1(zod@3.25.67)':
6607 + dependencies:
6608 + '@ai-sdk/provider': 2.0.0
6609 + '@standard-schema/spec': 1.0.0
6610 + eventsource-parser: 3.0.3
6611 + zod: 3.25.67
6612 + zod-to-json-schema: 3.24.5(zod@3.25.67)
6613 +
6614 '@ai-sdk/provider@1.1.3':
6615 dependencies:
6616 json-schema: 0.4.0
6617
6618 + '@ai-sdk/provider@2.0.0':
6619 + dependencies:
6620 + json-schema: 0.4.0
6621 +
6622 '@ai-sdk/react@1.2.12(react@18.3.1)(zod@3.25.67)':
6623 dependencies:
6624 '@ai-sdk/provider-utils': 2.2.8(zod@3.25.67)
@@ -10162,9 +10201,9 @@ snapshots:
10201 has-own-prop: 2.0.0
10202 repeat-string: 1.6.1
10203
10165 - composio-core@0.5.39(@ai-sdk/openai@1.3.22(zod@3.25.67))(@cloudflare/workers-types@4.20250619.0)(@langchain/core@0.3.63(openai@4.104.0(ws@8.18.2)(zod@3.25.67)))(@langchain/openai@0.5.13(@langchain/core@0.3.63(openai@4.104.0(ws@8.18.2)(zod@3.25.67)))(ws@8.18.2))(ai@4.3.16(react@18.3.1)(zod@3.25.67))(langchain@0.3.28(@langchain/core@0.3.63(openai@4.104.0(ws@8.18.2)(zod@3.25.67)))(axios@1.10.0)(openai@4.104.0(ws@8.18.2)(zod@3.25.67))(ws@8.18.2))(openai@4.104.0(ws@8.18.2)(zod@3.25.67)):
10204 + composio-core@0.5.39(@ai-sdk/openai@2.0.10(zod@3.25.67))(@cloudflare/workers-types@4.20250619.0)(@langchain/core@0.3.63(openai@4.104.0(ws@8.18.2)(zod@3.25.67)))(@langchain/openai@0.5.13(@langchain/core@0.3.63(openai@4.104.0(ws@8.18.2)(zod@3.25.67)))(ws@8.18.2))(ai@4.3.16(react@18.3.1)(zod@3.25.67))(langchain@0.3.28(@langchain/core@0.3.63(openai@4.104.0(ws@8.18.2)(zod@3.25.67)))(axios@1.10.0)(openai@4.104.0(ws@8.18.2)(zod@3.25.67))(ws@8.18.2))(openai@4.104.0(ws@8.18.2)(zod@3.25.67)):
10205 dependencies:
10167 - '@ai-sdk/openai': 1.3.22(zod@3.25.67)
10206 + '@ai-sdk/openai': 2.0.10(zod@3.25.67)
10207 '@cloudflare/workers-types': 4.20250619.0
10208 '@composio/mcp': 1.0.3-0
10209 '@hey-api/client-axios': 0.2.12(axios@1.10.0)
@@ -10566,6 +10605,8 @@ snapshots:
10605
10606 eventsource-parser@3.0.2: {}
10607
10608 + eventsource-parser@3.0.3: {}
10609 +
10610 eventsource@3.0.7:
10611 dependencies:
10612 eventsource-parser: 3.0.2
ts/examples/vercel/src/index.ts
+3 -3
@@ -1,9 +1,9 @@
1 import { Composio } from '@composio/core';
2 -import { generateText } from 'ai';
2 +import { generateText, CoreMessage } from 'ai';
3 import { openai } from '@ai-sdk/openai';
4 import { VercelProvider } from '@composio/vercel';
5 import dotenv from 'dotenv';
6 -import { Message, MessageRoles } from './types';
6 +import { MessageRoles } from './types';
7 dotenv.config();
8
9 /**
@@ -21,7 +21,7 @@ const composio = new Composio({
21 async function run() {
22 const tools = await composio.tools.get('test-user-id', 'HACKERNEWS_GET_FRONTPAGE');
23
24 - const messages: Message[] = [
24 + const messages: CoreMessage[] = [
25 {
26 role: MessageRoles.USER,
27 content: 'Summarize the front page of HackerNews',
ts/examples/vercel/src/types.ts
-1
@@ -5,4 +5,3 @@ export const MessageRoles = {
5 } as const;
6
7 export type MessageRole = (typeof MessageRoles)[keyof typeof MessageRoles];
8 -export type Message = { role: MessageRole; content: string | unknown };
ts/packages/core/src/types/authConfigs.types.ts
+1 -1
@@ -133,7 +133,7 @@ export const AuthCustomConfigUpdateParamsSchema = z.object({
133 });
134
135 export const AuthDefaultConfigUpdateParamsSchema = z.object({
136 - scopes: z.string(),
136 + scopes: z.string().optional(),
137 type: z.literal('default'),
138 /**
139 * @deprecated - use tool access config to determine the tools that the user can perform on the auth config.
ts/packages/core/src/utils/jsonSchema.ts
+1 -1
@@ -26,7 +26,7 @@ export const removeNonRequiredProperties = <
26 )
27 );
28 }
29 - schema.additionalProperties = false;
29 + schema.additionalProperties = schema.additionalProperties ?? false;
30 return schema as T;
31 };
32
ts/packages/providers/vercel/src/index.ts
+18 -4
@@ -16,15 +16,15 @@ import {
16 ExecuteToolFn,
17 McpUrlResponse,
18 McpServerGetResponse,
19 + removeNonRequiredProperties,
20 } from '@composio/core';
21 import type { Tool as VercelTool } from 'ai';
22 import { jsonSchema, tool } from 'ai';
22 -import { z } from 'zod';
23
24 export type VercelToolCollection = Record<string, VercelTool>;
25 export class VercelProvider extends BaseAgenticProvider<VercelToolCollection, VercelTool> {
26 readonly name = 'vercel';
27 -
27 + private strict: boolean | null;
28 /**
29 * Creates a new instance of the VercelProvider.
30 *
@@ -46,8 +46,9 @@ export class VercelProvider extends BaseAgenticProvider<VercelToolCollection, Ve
46 * const vercelTools = provider.wrapTools(composioTools, composio.tools.execute);
47 * ```
48 */
49 - constructor() {
49 + constructor({ strict = false }: { strict?: boolean } = {}) {
50 super();
51 + this.strict = strict;
52 }
53
54 /**
@@ -100,9 +101,22 @@ export class VercelProvider extends BaseAgenticProvider<VercelToolCollection, Ve
101 * ```
102 */
103 wrapTool(composioTool: Tool, executeTool: ExecuteToolFn): VercelTool {
104 + const inputParams = composioTool.inputParameters;
105 +
106 + const parameters =
107 + this.strict && inputParams?.type === 'object'
108 + ? removeNonRequiredProperties(
109 + inputParams as {
110 + type: 'object';
111 + properties: Record<string, unknown>;
112 + required?: string[];
113 + }
114 + )
115 + : (inputParams ?? {});
116 +
117 return tool({
118 description: composioTool.description,
105 - parameters: jsonSchema((composioTool.inputParameters as Record<string, unknown>) ?? {}),
119 + parameters: jsonSchema(parameters),
120 execute: async params => {
121 const input = typeof params === 'string' ? JSON.parse(params) : params;
122 return await executeTool(composioTool.slug, input);