@composio/vercel 0.12.1 → 0.13.1-canary.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,6 +4,8 @@ Composio provider for the [Vercel AI SDK](https://sdk.vercel.ai) (`ai`). It conv
4
4
 
5
5
  ## Installation
6
6
 
7
+ You need **Node.js 22.22.3 or newer**. The SDK is **ESM-only**: use `import` rather than CommonJS `require()`, and set `"type": "module"` in your project's `package.json`.
8
+
7
9
  ```bash
8
10
  npm install @composio/core @composio/vercel ai @ai-sdk/anthropic
9
11
  ```
@@ -15,6 +17,10 @@ Set two environment variables:
15
17
  - `COMPOSIO_API_KEY` from the [Composio dashboard](https://dashboard.composio.dev/settings)
16
18
  - `ANTHROPIC_API_KEY` from [Anthropic](https://console.anthropic.com/settings/keys) (or the key for your chosen model provider)
17
19
 
20
+ ### Verified SDK versions
21
+
22
+ The published packages `@composio/core@0.28.0`, `@composio/vercel@0.13.0`, and `ai@7.0.162` pass a consumer typecheck on Node.js 24.22.1 with TypeScript 6.0.2. The check passes session tools to both `generateText` and `streamText` and loads the compiled ESM imports. This verifies the TypeScript integration, not live model or tool execution.
23
+
18
24
  ## Quickstart
19
25
 
20
26
  Create a session for your user, pass its tools to the AI SDK, and cap the run with `stopWhen`:
@@ -45,12 +51,18 @@ For multi-turn conversations, store `session.sessionId` and reuse it with `compo
45
51
 
46
52
  ## Strict mode
47
53
 
48
- Some models reject tool schemas that contain optional parameters. Pass `strict: true` to normalize each tool's input schema for OpenAI structured outputs before it reaches the AI SDK: every object lists all of its properties in `required` and is closed, and optional properties stay available but accept `null`. A `null` is dropped before the tool runs unless the tool's own schema accepts `null` for that parameter, so nullable fields still receive an explicit `null`. Tools whose schema cannot be expressed in strict mode, such as objects that accept arbitrary keys, `allOf`, `prefixItems`, or unresolved `$ref`s, keep their original schema and log a warning:
54
+ Pass `strict: true` to rewrite each tool's input schema into the form OpenAI strict mode (structured outputs) accepts before it reaches the AI SDK: every object lists all of its properties in `required` and is closed, and optional properties stay available but accept `null`. A `null` is dropped before the tool runs unless the tool's own schema accepts `null` for that parameter, so nullable fields still receive an explicit `null`. Tools whose schema cannot be expressed in strict mode, such as objects that accept arbitrary keys, `allOf`, `prefixItems`, or unresolved `$ref`s, keep their original schema and log a warning:
49
55
 
50
56
  ```typescript
51
57
  const composio = new Composio({ provider: new VercelProvider({ strict: true }) });
52
58
  ```
53
59
 
60
+ The option does not set the AI SDK's per-tool `strict` flag, so the model provider does not enforce the schema. It does change what the provider accepts locally: tool-call arguments are validated against the rewritten schema, so a call that leaves out an optional parameter instead of sending `null` fails validation, and those `null`s are dropped before the tool runs, as described above. If you set that flag yourself, use it only with OpenAI models and only on tools that did not log the warning above, since OpenAI rejects a tool that kept its original schema. Don't set it for Anthropic models: Anthropic strict mode allows at most 16 parameters with union types and 24 optional parameters across all strict tools in a request, and the rewrite turns every optional parameter into a union, so a request with about ten Composio tools is rejected. Anthropic strict mode also rejects recursive definitions and keywords such as `minimum` and `maximum` that some Composio tools use.
61
+
62
+ ## Tool schemas
63
+
64
+ The provider passes each tool's JSON Schema to the AI SDK with `jsonSchema()`, so the model sees it as is, including keywords such as `format`, `contentEncoding`, and `contentMediaType`. Internal `$ref`s are inlined first. Tool-call arguments are validated with a Zod schema built from the same JSON Schema. In strict mode the model sees the strict rewrite instead, which drops string formats strict structured outputs reject.
65
+
54
66
  ## Links
55
67
 
56
68
  - [Vercel AI SDK provider docs](https://docs.composio.dev/docs/providers/vercel)
package/dist/index.d.mts CHANGED
@@ -1,6 +1,17 @@
1
+ /**
2
+ * Vercel AI Provider
3
+ * To be used with the Vercel AI SDK
4
+ *
5
+ * Author: Musthaq Ahamad <musthaq@composio.dev>
6
+ * Legacy Reference: https://github.com/ComposioHQ/composio/blob/master/js/src/frameworks/vercel.ts
7
+ *
8
+ * This provider provides a set of tools for interacting with Vercel AI SDK.
9
+ *
10
+ * @packageDocumentation
11
+ * @module providers/vercel
12
+ */
1
13
  import { BaseAgenticProvider, ExecuteToolFn, McpServerGetResponse, McpUrlResponse, Tool } from "@composio/core";
2
14
  import { Tool as Tool$1, ToolSet } from "ai";
3
- //#region src/index.d.ts
4
15
  export type VercelToolCollection = ToolSet;
5
16
  export declare class VercelProvider extends BaseAgenticProvider<VercelToolCollection, Tool$1, McpServerGetResponse> {
6
17
  readonly name = "vercel";
@@ -25,6 +36,12 @@ export declare class VercelProvider extends BaseAgenticProvider<VercelToolCollec
25
36
  * // Use the provider to wrap tools for Vercel AI SDK
26
37
  * const vercelTools = provider.wrapTools(composioTools, composio.tools.execute);
27
38
  * ```
39
+ *
40
+ * @param options.strict - Rewrites each tool's input schema into the form
41
+ * OpenAI strict mode accepts, and validates tool-call arguments against it.
42
+ * It does not set the AI SDK's per-tool `strict` flag, so the model provider
43
+ * does not enforce the schema. Anthropic strict mode rejects requests with
44
+ * typical sets of rewritten tools; see the README.
28
45
  */
29
46
  constructor({ strict }?: {
30
47
  strict?: boolean;
@@ -152,5 +169,4 @@ export declare class VercelProvider extends BaseAgenticProvider<VercelToolCollec
152
169
  * @returns Standard MCP server response format
153
170
  */
154
171
  wrapMcpServerResponse(data: McpUrlResponse): McpServerGetResponse;
155
- }
156
- //#endregion
172
+ }
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { BaseAgenticProvider, deduplicateJsonSchemaRequiredArrays, dereferenceJsonSchema, jsonSchemaToZodSchema, logger, normalizeToolArguments, omitNullToolArguments, toStrictJsonSchema } from "@composio/core";
2
- import { tool } from "ai";
2
+ import { jsonSchema, tool } from "ai";
3
3
 
4
- //#region src/index.ts
4
+ // src/index.ts
5
5
  /**
6
6
  * Vercel AI Provider
7
7
  * To be used with the Vercel AI SDK
@@ -14,6 +14,23 @@ import { tool } from "ai";
14
14
  * @packageDocumentation
15
15
  * @module providers/vercel
16
16
  */
17
+ /**
18
+ * The AI SDK schema for a tool input: the model is shown `schema` itself, and
19
+ * tool-call arguments are validated with the Zod schema built from it.
20
+ */
21
+ const toolInputSchema = (schema) => {
22
+ const validator = jsonSchemaToZodSchema(schema);
23
+ return jsonSchema(schema, { validate: async (value) => {
24
+ const result = await validator.safeParseAsync(value);
25
+ return result.success ? {
26
+ success: true,
27
+ value: result.data
28
+ } : {
29
+ success: false,
30
+ error: result.error
31
+ };
32
+ } });
33
+ };
17
34
  var VercelProvider = class extends BaseAgenticProvider {
18
35
  name = "vercel";
19
36
  strict;
@@ -37,6 +54,12 @@ var VercelProvider = class extends BaseAgenticProvider {
37
54
  * // Use the provider to wrap tools for Vercel AI SDK
38
55
  * const vercelTools = provider.wrapTools(composioTools, composio.tools.execute);
39
56
  * ```
57
+ *
58
+ * @param options.strict - Rewrites each tool's input schema into the form
59
+ * OpenAI strict mode accepts, and validates tool-call arguments against it.
60
+ * It does not set the AI SDK's per-tool `strict` flag, so the model provider
61
+ * does not enforce the schema. Anthropic strict mode rejects requests with
62
+ * typical sets of rewritten tools; see the README.
40
63
  */
41
64
  constructor({ strict = false } = {}) {
42
65
  super();
@@ -106,10 +129,10 @@ var VercelProvider = class extends BaseAgenticProvider {
106
129
  strictSource = strict.source;
107
130
  }
108
131
  }
109
- const inputParametersSchema = jsonSchemaToZodSchema(dereferenceJsonSchema(parameters, { onUnresolved: "sentinel" }));
132
+ const inputSchema = toolInputSchema(dereferenceJsonSchema(parameters, { onUnresolved: "sentinel" }));
110
133
  return tool({
111
134
  description: composioTool.description,
112
- inputSchema: inputParametersSchema,
135
+ inputSchema,
113
136
  execute: async (params) => {
114
137
  const normalized = normalizeToolArguments(params, composioTool.slug);
115
138
  return await executeTool(composioTool.slug, strictSource ? omitNullToolArguments(normalized, strictSource) : normalized);
@@ -201,5 +224,4 @@ var VercelProvider = class extends BaseAgenticProvider {
201
224
  }
202
225
  };
203
226
 
204
- //#endregion
205
227
  export { VercelProvider };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@composio/vercel",
3
- "version": "0.12.1",
3
+ "version": "0.13.1-canary.1",
4
4
  "description": "",
5
5
  "main": "dist/index.mjs",
6
6
  "type": "module",
@@ -33,16 +33,16 @@
33
33
  "author": "",
34
34
  "license": "ISC",
35
35
  "peerDependencies": {
36
- "@composio/core": ">=0.10.0 <1.0.0 || >=1.0.0-beta.0 <1.0.0",
36
+ "@composio/core": "0.33.1-canary.1",
37
37
  "ai": "^6.0.0 || ^7.0.0"
38
38
  },
39
39
  "devDependencies": {
40
- "ai": "^7.0.101",
41
- "tsdown": "^0.23.0",
40
+ "ai": "7.0.187",
41
+ "tsdown": "^0.23.7",
42
42
  "typescript": "^7.0.2",
43
- "vitest": "^5.0.1",
44
- "zod": "^4.5.4",
45
- "@composio/core": "0.19.0"
43
+ "vitest": "^5.1.0",
44
+ "zod": "^4.6.7",
45
+ "@composio/core": "0.33.1-canary.1"
46
46
  },
47
47
  "gitHead": "4fae6e54d5c150fba955cc5fa314281da5a1e064",
48
48
  "scripts": {