@composio/vercel 0.11.2-beta.0 → 0.12.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/README.md +1 -1
- package/dist/index.mjs +17 -3
- package/package.json +4 -4
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
|
|
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,
|
|
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
|
-
|
|
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(dereferenceJsonSchema(parameters, { onUnresolved: "sentinel" }));
|
|
97
110
|
return tool({
|
|
98
111
|
description: composioTool.description,
|
|
99
112
|
inputSchema: inputParametersSchema,
|
|
100
113
|
execute: async (params) => {
|
|
101
|
-
|
|
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.
|
|
3
|
+
"version": "0.12.0",
|
|
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": ">=
|
|
36
|
+
"@composio/core": ">=0.10.0 <1.0.0",
|
|
37
37
|
"ai": "^6.0.0 || ^7.0.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"ai": "^7.0.
|
|
40
|
+
"ai": "^7.0.79",
|
|
41
41
|
"tsdown": "^0.22.14",
|
|
42
42
|
"typescript": "^7.0.2",
|
|
43
43
|
"vitest": "^4.1.11",
|
|
44
44
|
"zod": "^4.4.3",
|
|
45
|
-
"@composio/core": "
|
|
45
|
+
"@composio/core": "0.18.1"
|
|
46
46
|
},
|
|
47
47
|
"gitHead": "4fae6e54d5c150fba955cc5fa314281da5a1e064",
|
|
48
48
|
"scripts": {
|