@composio/vercel 0.11.2-beta.0 → 0.11.2

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
@@ -45,7 +45,7 @@ For multi-turn conversations, store `session.sessionId` and reuse it with `compo
45
45
 
46
46
  ## Strict mode
47
47
 
48
- Some models reject tool schemas that contain optional parameters. Pass `strict: true` to drop every non-required property from each tool's input schema before it reaches the AI SDK:
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:
49
49
 
50
50
  ```typescript
51
51
  const composio = new Composio({ provider: new VercelProvider({ strict: true }) });
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { BaseAgenticProvider, jsonSchemaToZodSchema, normalizeToolArguments, removeNonRequiredProperties } from "@composio/core";
1
+ import { BaseAgenticProvider, deduplicateJsonSchemaRequiredArrays, dereferenceJsonSchema, jsonSchemaToZodSchema, logger, normalizeToolArguments, omitNullToolArguments, toStrictJsonSchema } from "@composio/core";
2
2
  import { tool } from "ai";
3
3
 
4
4
  //#region src/index.ts
@@ -93,12 +93,26 @@ var VercelProvider = class extends BaseAgenticProvider {
93
93
  */
94
94
  wrapTool(composioTool, executeTool) {
95
95
  const inputParams = composioTool.inputParameters;
96
- const inputParametersSchema = jsonSchemaToZodSchema(this.strict && inputParams?.type === "object" ? removeNonRequiredProperties(inputParams) : inputParams ?? {});
96
+ let parameters = deduplicateJsonSchemaRequiredArrays(inputParams ?? {});
97
+ let strictSource;
98
+ if (this.strict && inputParams) {
99
+ const strict = toStrictJsonSchema(inputParams);
100
+ if (strict.unsupported.length > 0) {
101
+ const reasons = strict.unsupported.map((entry) => `${entry.path || "<root>"}: ${entry.keyword} (${entry.detail})`).join("; ");
102
+ logger.warn(`VercelProvider: tool "${composioTool.slug}" keeps its non-strict schema because it cannot be expressed as strict structured outputs: ${reasons}`);
103
+ } else {
104
+ if (strict.totalChanges > 0) logger.debug(`VercelProvider: strict mode rewrote ${strict.totalChanges} node(s) of tool "${composioTool.slug}": ${strict.changes.map((change) => `${change.path}: ${change.reason}`).join("; ")}`);
105
+ parameters = strict.schema;
106
+ strictSource = strict.source;
107
+ }
108
+ }
109
+ const inputParametersSchema = jsonSchemaToZodSchema(strictSource ? dereferenceJsonSchema(parameters, { onUnresolved: "sentinel" }) : parameters);
97
110
  return tool({
98
111
  description: composioTool.description,
99
112
  inputSchema: inputParametersSchema,
100
113
  execute: async (params) => {
101
- return await executeTool(composioTool.slug, normalizeToolArguments(params, composioTool.slug));
114
+ const normalized = normalizeToolArguments(params, composioTool.slug);
115
+ return await executeTool(composioTool.slug, strictSource ? omitNullToolArguments(normalized, strictSource) : normalized);
102
116
  }
103
117
  });
104
118
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@composio/vercel",
3
- "version": "0.11.2-beta.0",
3
+ "version": "0.11.2",
4
4
  "description": "",
5
5
  "main": "dist/index.mjs",
6
6
  "type": "module",
@@ -33,7 +33,7 @@
33
33
  "author": "",
34
34
  "license": "ISC",
35
35
  "peerDependencies": {
36
- "@composio/core": ">=1.0.0-beta.0 <2.0.0",
36
+ "@composio/core": ">=0.10.0 <1.0.0",
37
37
  "ai": "^6.0.0 || ^7.0.0"
38
38
  },
39
39
  "devDependencies": {
@@ -42,7 +42,7 @@
42
42
  "typescript": "^7.0.2",
43
43
  "vitest": "^4.1.11",
44
44
  "zod": "^4.4.3",
45
- "@composio/core": "1.0.0-beta.0"
45
+ "@composio/core": "0.18.0"
46
46
  },
47
47
  "gitHead": "4fae6e54d5c150fba955cc5fa314281da5a1e064",
48
48
  "scripts": {