@composio/vercel 0.9.3 → 0.10.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/index.d.mts CHANGED
@@ -2,7 +2,6 @@ import { BaseAgenticProvider, ExecuteToolFn, McpServerGetResponse, McpUrlRespons
2
2
  import { Tool as Tool$1, ToolSet } from "ai";
3
3
 
4
4
  //#region src/index.d.ts
5
-
6
5
  type VercelToolCollection = ToolSet;
7
6
  declare class VercelProvider extends BaseAgenticProvider<VercelToolCollection, Tool$1, McpServerGetResponse> {
8
7
  readonly name = "vercel";
package/dist/index.mjs CHANGED
@@ -166,8 +166,8 @@ var VercelProvider = class extends BaseAgenticProvider {
166
166
  * ```
167
167
  */
168
168
  wrapTools(tools, executeTool) {
169
- return tools.reduce((acc, tool$1) => {
170
- acc[tool$1.slug] = this.wrapTool(tool$1, executeTool);
169
+ return tools.reduce((acc, tool) => {
170
+ acc[tool.slug] = this.wrapTool(tool, executeTool);
171
171
  return acc;
172
172
  }, {});
173
173
  }
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@composio/vercel",
3
- "version": "0.9.3",
3
+ "version": "0.10.0",
4
4
  "description": "",
5
5
  "main": "dist/index.mjs",
6
+ "type": "module",
6
7
  "repository": {
7
8
  "type": "git",
8
9
  "url": "https://github.com/ComposioHQ/composio.git",
@@ -17,18 +18,8 @@
17
18
  },
18
19
  "exports": {
19
20
  ".": {
20
- "import": {
21
- "types": "./dist/index.d.mts",
22
- "default": "./dist/index.mjs"
23
- },
24
- "require": {
25
- "types": "./dist/index.d.cts",
26
- "default": "./dist/index.cjs"
27
- },
28
- "default": {
29
- "types": "./dist/index.d.cts",
30
- "default": "./dist/index.cjs"
31
- }
21
+ "types": "./dist/index.d.mts",
22
+ "default": "./dist/index.mjs"
32
23
  }
33
24
  },
34
25
  "files": [
@@ -43,17 +34,17 @@
43
34
  "ai": "^5.0.0 || ^6.0.0"
44
35
  },
45
36
  "devDependencies": {
46
- "ai": "^6.0.27",
47
- "tsdown": "^0.18.4",
48
- "typescript": "^5.9.2",
49
- "vitest": "^4.1.0",
50
- "zod": "^4.1.0",
51
- "@composio/core": "0.11.0"
37
+ "ai": "^6.0.206",
38
+ "tsdown": "^0.22.3",
39
+ "typescript": "^6.0.3",
40
+ "vitest": "^4.1.9",
41
+ "zod": "^4.4.3",
42
+ "@composio/core": "0.12.0"
52
43
  },
53
44
  "gitHead": "4fae6e54d5c150fba955cc5fa314281da5a1e064",
54
45
  "scripts": {
55
46
  "clean": "git clean -xdf node_modules",
56
- "build": "pnpm exec tsdown",
47
+ "build": "tsdown",
57
48
  "test": "vitest run"
58
49
  },
59
50
  "types": "dist/index.d.mts"
package/dist/index.cjs DELETED
@@ -1,191 +0,0 @@
1
- let _composio_core = require("@composio/core");
2
- let ai = require("ai");
3
-
4
- //#region src/index.ts
5
- /**
6
- * Vercel AI Provider
7
- * To be used with the Vercel AI SDK
8
- *
9
- * Author: Musthaq Ahamad <musthaq@composio.dev>
10
- * Legacy Reference: https://github.com/ComposioHQ/composio/blob/master/js/src/frameworks/vercel.ts
11
- *
12
- * This provider provides a set of tools for interacting with Vercel AI SDK.
13
- *
14
- * @packageDocumentation
15
- * @module providers/vercel
16
- */
17
- var VercelProvider = class extends _composio_core.BaseAgenticProvider {
18
- name = "vercel";
19
- strict;
20
- /**
21
- * Creates a new instance of the VercelProvider.
22
- *
23
- * This provider enables integration with the Vercel AI SDK,
24
- * allowing Composio tools to be used with Vercel AI applications.
25
- *
26
- * @example
27
- * ```typescript
28
- * // Initialize the Vercel provider
29
- * const provider = new VercelProvider();
30
- *
31
- * // Use with Composio
32
- * const composio = new Composio({
33
- * apiKey: 'your-api-key',
34
- * provider: new VercelProvider()
35
- * });
36
- *
37
- * // Use the provider to wrap tools for Vercel AI SDK
38
- * const vercelTools = provider.wrapTools(composioTools, composio.tools.execute);
39
- * ```
40
- */
41
- constructor({ strict = false } = {}) {
42
- super();
43
- this.strict = strict;
44
- }
45
- /**
46
- * Wraps a Composio tool in a Vercel AI SDK tool format.
47
- *
48
- * This method transforms a Composio tool definition into the format
49
- * expected by Vercel's AI SDK for function calling.
50
- *
51
- * @param {ComposioTool} composioTool - The Composio tool to wrap
52
- * @param {ExecuteToolFn} executeTool - Function to execute the tool
53
- * @returns {VercelTool} The wrapped Vercel tool
54
- *
55
- * @example
56
- * ```typescript
57
- * // Wrap a single tool for use with Vercel AI SDK
58
- * const composioTool = {
59
- * slug: 'SEARCH_TOOL',
60
- * description: 'Search for information',
61
- * inputParameters: {
62
- * type: 'object',
63
- * properties: {
64
- * query: { type: 'string' }
65
- * },
66
- * required: ['query']
67
- * }
68
- * };
69
- *
70
- * // Create a Vercel tool using the provider
71
- * const vercelTool = provider.wrapTool(
72
- * composioTool,
73
- * composio.tools.execute
74
- * );
75
- *
76
- * // Use with Vercel AI SDK
77
- * import { StreamingTextResponse, Message } from 'ai';
78
- * import { OpenAI } from 'openai';
79
- *
80
- * export async function POST(req: Request) {
81
- * const { messages } = await req.json();
82
- * const openai = new OpenAI();
83
- *
84
- * const response = await openai.chat.completions.create({
85
- * model: 'gpt-4',
86
- * messages,
87
- * tools: [vercelTool]
88
- * });
89
- *
90
- * return new StreamingTextResponse(response.choices[0].message);
91
- * }
92
- * ```
93
- */
94
- wrapTool(composioTool, executeTool) {
95
- const inputParams = composioTool.inputParameters;
96
- const inputParametersSchema = (0, _composio_core.jsonSchemaToZodSchema)(this.strict && inputParams?.type === "object" ? (0, _composio_core.removeNonRequiredProperties)(inputParams) : inputParams ?? {});
97
- return (0, ai.tool)({
98
- description: composioTool.description,
99
- inputSchema: inputParametersSchema,
100
- execute: async (params) => {
101
- return await executeTool(composioTool.slug, (0, _composio_core.normalizeToolArguments)(params, composioTool.slug));
102
- }
103
- });
104
- }
105
- /**
106
- * Wraps a list of Composio tools as a Vercel AI SDK tool collection.
107
- *
108
- * This method transforms multiple Composio tool definitions into the format
109
- * expected by Vercel's AI SDK for function calling, organizing them
110
- * into a dictionary keyed by tool slug.
111
- *
112
- * @param {ComposioTool[]} tools - Array of Composio tools to wrap
113
- * @param {ExecuteToolFn} executeTool - Function to execute the tools
114
- * @returns {VercelToolCollection} Dictionary of wrapped tools in Vercel AI SDK format
115
- *
116
- * @example
117
- * ```typescript
118
- * // Wrap multiple tools for use with Vercel AI SDK
119
- * const composioTools = [
120
- * {
121
- * slug: 'SEARCH_TOOL',
122
- * description: 'Search for information',
123
- * inputParameters: {
124
- * type: 'object',
125
- * properties: {
126
- * query: { type: 'string' }
127
- * },
128
- * required: ['query']
129
- * }
130
- * },
131
- * {
132
- * slug: 'WEATHER_TOOL',
133
- * description: 'Get weather information',
134
- * inputParameters: {
135
- * type: 'object',
136
- * properties: {
137
- * location: { type: 'string' }
138
- * },
139
- * required: ['location']
140
- * }
141
- * }
142
- * ];
143
- *
144
- * // Create Vercel tools using the provider
145
- * const vercelTools = provider.wrapTools(
146
- * composioTools,
147
- * composio.tools.execute
148
- * );
149
- *
150
- * // Use with Vercel AI SDK in a Next.js API route
151
- * import { StreamingTextResponse } from 'ai';
152
- * import { OpenAI } from 'openai';
153
- *
154
- * export async function POST(req: Request) {
155
- * const { messages } = await req.json();
156
- * const openai = new OpenAI();
157
- *
158
- * const response = await openai.chat.completions.create({
159
- * model: 'gpt-4',
160
- * messages,
161
- * tools: Object.values(vercelTools)
162
- * });
163
- *
164
- * return new StreamingTextResponse(response.choices[0].message);
165
- * }
166
- * ```
167
- */
168
- wrapTools(tools, executeTool) {
169
- return tools.reduce((acc, tool$1) => {
170
- acc[tool$1.slug] = this.wrapTool(tool$1, executeTool);
171
- return acc;
172
- }, {});
173
- }
174
- /**
175
- * Transform MCP URL response into Anthropic-specific format.
176
- * By default, Anthropic uses the standard format (same as default),
177
- * but this method is here to show providers can customize if needed.
178
- *
179
- * @param data - The MCP URL response data
180
- * @returns Standard MCP server response format
181
- */
182
- wrapMcpServerResponse(data) {
183
- return data.map((item) => ({
184
- url: new URL(item.url),
185
- name: item.name
186
- }));
187
- }
188
- };
189
-
190
- //#endregion
191
- exports.VercelProvider = VercelProvider;
package/dist/index.d.cts DELETED
@@ -1,161 +0,0 @@
1
- import { BaseAgenticProvider, ExecuteToolFn, McpServerGetResponse, McpUrlResponse, Tool } from "@composio/core";
2
- import { Tool as Tool$1, ToolSet } from "ai";
3
-
4
- //#region src/index.d.ts
5
-
6
- type VercelToolCollection = ToolSet;
7
- declare class VercelProvider extends BaseAgenticProvider<VercelToolCollection, Tool$1, McpServerGetResponse> {
8
- readonly name = "vercel";
9
- private strict;
10
- /**
11
- * Creates a new instance of the VercelProvider.
12
- *
13
- * This provider enables integration with the Vercel AI SDK,
14
- * allowing Composio tools to be used with Vercel AI applications.
15
- *
16
- * @example
17
- * ```typescript
18
- * // Initialize the Vercel provider
19
- * const provider = new VercelProvider();
20
- *
21
- * // Use with Composio
22
- * const composio = new Composio({
23
- * apiKey: 'your-api-key',
24
- * provider: new VercelProvider()
25
- * });
26
- *
27
- * // Use the provider to wrap tools for Vercel AI SDK
28
- * const vercelTools = provider.wrapTools(composioTools, composio.tools.execute);
29
- * ```
30
- */
31
- constructor({
32
- strict
33
- }?: {
34
- strict?: boolean;
35
- });
36
- /**
37
- * Wraps a Composio tool in a Vercel AI SDK tool format.
38
- *
39
- * This method transforms a Composio tool definition into the format
40
- * expected by Vercel's AI SDK for function calling.
41
- *
42
- * @param {ComposioTool} composioTool - The Composio tool to wrap
43
- * @param {ExecuteToolFn} executeTool - Function to execute the tool
44
- * @returns {VercelTool} The wrapped Vercel tool
45
- *
46
- * @example
47
- * ```typescript
48
- * // Wrap a single tool for use with Vercel AI SDK
49
- * const composioTool = {
50
- * slug: 'SEARCH_TOOL',
51
- * description: 'Search for information',
52
- * inputParameters: {
53
- * type: 'object',
54
- * properties: {
55
- * query: { type: 'string' }
56
- * },
57
- * required: ['query']
58
- * }
59
- * };
60
- *
61
- * // Create a Vercel tool using the provider
62
- * const vercelTool = provider.wrapTool(
63
- * composioTool,
64
- * composio.tools.execute
65
- * );
66
- *
67
- * // Use with Vercel AI SDK
68
- * import { StreamingTextResponse, Message } from 'ai';
69
- * import { OpenAI } from 'openai';
70
- *
71
- * export async function POST(req: Request) {
72
- * const { messages } = await req.json();
73
- * const openai = new OpenAI();
74
- *
75
- * const response = await openai.chat.completions.create({
76
- * model: 'gpt-4',
77
- * messages,
78
- * tools: [vercelTool]
79
- * });
80
- *
81
- * return new StreamingTextResponse(response.choices[0].message);
82
- * }
83
- * ```
84
- */
85
- wrapTool(composioTool: Tool, executeTool: ExecuteToolFn): Tool$1;
86
- /**
87
- * Wraps a list of Composio tools as a Vercel AI SDK tool collection.
88
- *
89
- * This method transforms multiple Composio tool definitions into the format
90
- * expected by Vercel's AI SDK for function calling, organizing them
91
- * into a dictionary keyed by tool slug.
92
- *
93
- * @param {ComposioTool[]} tools - Array of Composio tools to wrap
94
- * @param {ExecuteToolFn} executeTool - Function to execute the tools
95
- * @returns {VercelToolCollection} Dictionary of wrapped tools in Vercel AI SDK format
96
- *
97
- * @example
98
- * ```typescript
99
- * // Wrap multiple tools for use with Vercel AI SDK
100
- * const composioTools = [
101
- * {
102
- * slug: 'SEARCH_TOOL',
103
- * description: 'Search for information',
104
- * inputParameters: {
105
- * type: 'object',
106
- * properties: {
107
- * query: { type: 'string' }
108
- * },
109
- * required: ['query']
110
- * }
111
- * },
112
- * {
113
- * slug: 'WEATHER_TOOL',
114
- * description: 'Get weather information',
115
- * inputParameters: {
116
- * type: 'object',
117
- * properties: {
118
- * location: { type: 'string' }
119
- * },
120
- * required: ['location']
121
- * }
122
- * }
123
- * ];
124
- *
125
- * // Create Vercel tools using the provider
126
- * const vercelTools = provider.wrapTools(
127
- * composioTools,
128
- * composio.tools.execute
129
- * );
130
- *
131
- * // Use with Vercel AI SDK in a Next.js API route
132
- * import { StreamingTextResponse } from 'ai';
133
- * import { OpenAI } from 'openai';
134
- *
135
- * export async function POST(req: Request) {
136
- * const { messages } = await req.json();
137
- * const openai = new OpenAI();
138
- *
139
- * const response = await openai.chat.completions.create({
140
- * model: 'gpt-4',
141
- * messages,
142
- * tools: Object.values(vercelTools)
143
- * });
144
- *
145
- * return new StreamingTextResponse(response.choices[0].message);
146
- * }
147
- * ```
148
- */
149
- wrapTools(tools: Tool[], executeTool: ExecuteToolFn): VercelToolCollection;
150
- /**
151
- * Transform MCP URL response into Anthropic-specific format.
152
- * By default, Anthropic uses the standard format (same as default),
153
- * but this method is here to show providers can customize if needed.
154
- *
155
- * @param data - The MCP URL response data
156
- * @returns Standard MCP server response format
157
- */
158
- wrapMcpServerResponse(data: McpUrlResponse): McpServerGetResponse;
159
- }
160
- //#endregion
161
- export { VercelProvider, VercelToolCollection };