@composio/mastra 0.10.3 → 0.10.4
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 +15 -3
- package/package.json +9 -6
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ Each tool gets both an input and an output schema, so Mastra can validate tool r
|
|
|
51
51
|
|
|
52
52
|
## Strict mode
|
|
53
53
|
|
|
54
|
-
Pass `strict: true` to
|
|
54
|
+
Pass `strict: true` to normalize each tool's input schema for OpenAI structured outputs before Mastra compiles it: 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:
|
|
55
55
|
|
|
56
56
|
```typescript
|
|
57
57
|
const composio = new Composio({
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseAgenticProvider, dereferenceJsonSchema, logger, normalizeToolArguments,
|
|
1
|
+
import { BaseAgenticProvider, dereferenceJsonSchema, logger, normalizeToolArguments, omitNullToolArguments, telemetry, toStrictJsonSchema } from "@composio/core";
|
|
2
2
|
import { applyCompatLayer } from "@mastra/schema-compat";
|
|
3
3
|
import { createTool } from "@mastra/core/tools";
|
|
4
4
|
|
|
@@ -140,7 +140,18 @@ var MastraProvider = class extends BaseAgenticProvider {
|
|
|
140
140
|
}
|
|
141
141
|
wrapTool(tool, executeTool) {
|
|
142
142
|
const inputParams = tool.inputParameters;
|
|
143
|
-
|
|
143
|
+
let parameters = inputParams;
|
|
144
|
+
let strictSource;
|
|
145
|
+
if (this.strict && inputParams) {
|
|
146
|
+
const strict = toStrictJsonSchema(inputParams);
|
|
147
|
+
if (strict.unsupported.length > 0) {
|
|
148
|
+
const reasons = strict.unsupported.map((entry) => `${entry.path || "<root>"}: ${entry.keyword} (${entry.detail})`).join("; ");
|
|
149
|
+
logger.warn(`[composio/mastra] Tool ${JSON.stringify(tool.slug)} keeps its non-strict schema because it cannot be expressed as strict structured outputs: ${reasons}`);
|
|
150
|
+
} else {
|
|
151
|
+
parameters = strict.schema;
|
|
152
|
+
strictSource = strict.source;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
144
155
|
const onReplace = (ref, reason) => this.warnDanglingRefOnce(tool, ref, reason);
|
|
145
156
|
const inputSchema = applyCompatLayer({
|
|
146
157
|
schema: dereferenceJsonSchema(parameters ?? {}, {
|
|
@@ -164,7 +175,8 @@ var MastraProvider = class extends BaseAgenticProvider {
|
|
|
164
175
|
inputSchema,
|
|
165
176
|
outputSchema,
|
|
166
177
|
execute: async (inputData, _context) => {
|
|
167
|
-
|
|
178
|
+
const normalized = normalizeToolArguments(inputData, tool.slug);
|
|
179
|
+
return await executeTool(tool.slug, strictSource ? omitNullToolArguments(normalized, strictSource) : normalized);
|
|
168
180
|
}
|
|
169
181
|
});
|
|
170
182
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@composio/mastra",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.4",
|
|
4
4
|
"description": "Agentic Provider for mastra in Composio SDK",
|
|
5
5
|
"main": "dist/index.mjs",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=22.22.3"
|
|
9
|
+
},
|
|
7
10
|
"repository": {
|
|
8
11
|
"type": "git",
|
|
9
12
|
"url": "https://github.com/ComposioHQ/composio.git",
|
|
@@ -39,16 +42,16 @@
|
|
|
39
42
|
"zod": "^3.25 || ^4"
|
|
40
43
|
},
|
|
41
44
|
"devDependencies": {
|
|
42
|
-
"@mastra/core": "
|
|
43
|
-
"ai": "^6.0.
|
|
45
|
+
"@mastra/core": "1.52.1",
|
|
46
|
+
"ai": "^6.0.263",
|
|
44
47
|
"tsdown": "^0.22.14",
|
|
45
48
|
"typescript": "^7.0.2",
|
|
46
|
-
"vitest": "^4.1.
|
|
49
|
+
"vitest": "^4.1.11",
|
|
47
50
|
"zod": "^4.4.3",
|
|
48
|
-
"@composio/core": "0.
|
|
51
|
+
"@composio/core": "0.18.0"
|
|
49
52
|
},
|
|
50
53
|
"dependencies": {
|
|
51
|
-
"@mastra/schema-compat": "^1.3.
|
|
54
|
+
"@mastra/schema-compat": "^1.3.7"
|
|
52
55
|
},
|
|
53
56
|
"scripts": {
|
|
54
57
|
"clean": "git clean -xdf node_modules",
|