@composio/core 0.15.0 → 0.17.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/{CustomTool-zjeDpZ91.d.mts → CustomTool-Uip-fhPw.d.mts} +1 -1
- package/dist/{cancellation-BbJ-UQ__.mjs → cancellation-NVtGf3St.mjs} +69 -1
- package/dist/{composio-Bf8hnBBq.d.mts → composio-B27X6i6A.d.mts} +253 -247
- package/dist/{BaseProvider-BN2-Nktx.d.mts → customTool.types-B2Ava_j5.d.mts} +3020 -126
- package/dist/experimental/index.d.mts +2 -2
- package/dist/{fileUtils.node-BQ0fWge3.mjs → fileUtils.node-B1Wn848p.mjs} +2 -2
- package/dist/index.d.mts +18 -7
- package/dist/index.mjs +91 -120
- package/dist/models/Files.node.mjs +1 -1
- package/dist/{types-CePuCfD-.d.mts → types-DdZJuMm2.d.mts} +2 -2
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -1
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.mjs +2 -2
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
- package/dist/utils/ssrfGuard.node.d.mts +11 -1
- package/dist/utils/ssrfGuard.node.mjs +11 -1
- package/dist/utils/ssrfGuard.workerd.d.mts +13 -1
- package/dist/utils/ssrfGuard.workerd.mjs +13 -1
- package/package.json +3 -3
- package/src/index.ts +1 -0
- package/src/models/RemoteFile.ts +7 -2
- package/src/models/ToolRouterSessionFileMount.ts +14 -8
- package/src/models/Tools.ts +108 -77
- package/src/provider/BaseProvider.ts +53 -1
- package/src/provider/OpenAIProvider.ts +43 -15
- package/src/types/provider.types.ts +15 -0
- package/src/types/tool.types.ts +8 -2
- package/src/utils/fileUtils.node.ts +8 -2
- package/src/utils/jsonSchema.ts +86 -1
- package/src/utils/ssrfGuard.node.ts +11 -0
- package/src/utils/ssrfGuard.workerd.ts +16 -0
- package/dist/customTool.types-Bhom9a2R.d.mts +0 -2859
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as CreateCustomToolkitParams, f as CustomToolkit, o as CustomTool, r as CreateCustomToolParams, t as AnyZodSchema } from "./customTool.types-
|
|
1
|
+
import { a as CreateCustomToolkitParams, f as CustomToolkit, o as CustomTool, r as CreateCustomToolParams, t as AnyZodSchema } from "./customTool.types-B2Ava_j5.mjs";
|
|
2
2
|
import { SessionCreateResponse } from "@composio/client/resources/tool-router/session/session.mjs";
|
|
3
3
|
//#region src/models/CustomTool.d.ts
|
|
4
4
|
/**
|
|
@@ -172,6 +172,74 @@ function dereferenceJsonSchema(schema, options) {
|
|
|
172
172
|
return out;
|
|
173
173
|
}
|
|
174
174
|
/**
|
|
175
|
+
* Returns a deep-cloned JSON Schema in which every node that carries a
|
|
176
|
+
* `properties` keyword also carries `type: "object"` when it has no explicit
|
|
177
|
+
* `type`. OpenAI tolerates the omission, but Google Gemini enforces OpenAPI
|
|
178
|
+
* 3.0 strictly and rejects function declarations whose nested objects are
|
|
179
|
+
* missing the `type` (see https://github.com/ComposioHQ/composio/issues/4022).
|
|
180
|
+
*
|
|
181
|
+
* The function follows JSON Schema's schema-bearing keywords while keeping
|
|
182
|
+
* property maps and instance values as containers. Nodes that already declare
|
|
183
|
+
* a `type` are left untouched.
|
|
184
|
+
*/
|
|
185
|
+
function ensureObjectTypeOnProperties(schema) {
|
|
186
|
+
const schemaKeywords = /* @__PURE__ */ new Set([
|
|
187
|
+
"additionalItems",
|
|
188
|
+
"additionalProperties",
|
|
189
|
+
"contains",
|
|
190
|
+
"contentSchema",
|
|
191
|
+
"else",
|
|
192
|
+
"if",
|
|
193
|
+
"not",
|
|
194
|
+
"propertyNames",
|
|
195
|
+
"then",
|
|
196
|
+
"unevaluatedItems",
|
|
197
|
+
"unevaluatedProperties"
|
|
198
|
+
]);
|
|
199
|
+
const schemaArrayKeywords = /* @__PURE__ */ new Set([
|
|
200
|
+
"allOf",
|
|
201
|
+
"anyOf",
|
|
202
|
+
"oneOf",
|
|
203
|
+
"prefixItems"
|
|
204
|
+
]);
|
|
205
|
+
const schemaMapKeywords = /* @__PURE__ */ new Set([
|
|
206
|
+
"$defs",
|
|
207
|
+
"definitions",
|
|
208
|
+
"dependentSchemas",
|
|
209
|
+
"patternProperties",
|
|
210
|
+
"properties"
|
|
211
|
+
]);
|
|
212
|
+
function walk(value, mode, depth = 0) {
|
|
213
|
+
if (depth > MAX_NODE_DEPTH) throw new RangeError(`JSON Schema exceeds maximum nesting depth of ${MAX_NODE_DEPTH}`);
|
|
214
|
+
if (Array.isArray(value)) {
|
|
215
|
+
const itemMode = mode === "schema-array" ? "schema" : "value";
|
|
216
|
+
return value.map((item) => walk(item, itemMode, depth + 1));
|
|
217
|
+
}
|
|
218
|
+
if (!isPlainObject(value)) return value;
|
|
219
|
+
const clone = {};
|
|
220
|
+
for (const [key, child] of Object.entries(value)) {
|
|
221
|
+
let childMode = "value";
|
|
222
|
+
if (mode === "schema-map") childMode = "schema";
|
|
223
|
+
else if (mode === "dependencies-map") childMode = Array.isArray(child) ? "value" : "schema";
|
|
224
|
+
else if (mode === "schema") {
|
|
225
|
+
if (schemaMapKeywords.has(key)) childMode = "schema-map";
|
|
226
|
+
else if (schemaArrayKeywords.has(key) || key === "items" && Array.isArray(child)) childMode = "schema-array";
|
|
227
|
+
else if (schemaKeywords.has(key) || key === "items") childMode = "schema";
|
|
228
|
+
else if (key === "dependencies") childMode = "dependencies-map";
|
|
229
|
+
}
|
|
230
|
+
Object.defineProperty(clone, key, {
|
|
231
|
+
configurable: true,
|
|
232
|
+
enumerable: true,
|
|
233
|
+
value: walk(child, childMode, depth + 1),
|
|
234
|
+
writable: true
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
if (mode === "schema" && clone.properties !== void 0 && clone.type === void 0) clone.type = "object";
|
|
238
|
+
return clone;
|
|
239
|
+
}
|
|
240
|
+
return walk(schema, "schema");
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
175
243
|
* Returns a deep-cloned JSON Schema whose `required` arrays contain each entry
|
|
176
244
|
* at most once. Duplicate entries are invalid in JSON Schema 2020-12 but do
|
|
177
245
|
* not change the schema's meaning, so preserving the first occurrence is safe.
|
|
@@ -293,4 +361,4 @@ async function withCancellation(call, signal) {
|
|
|
293
361
|
}
|
|
294
362
|
|
|
295
363
|
//#endregion
|
|
296
|
-
export {
|
|
364
|
+
export { jsonSchemaToZodSchema as a, ensureObjectTypeOnProperties as i, deduplicateJsonSchemaRequiredArrays as n, removeNonRequiredProperties as o, dereferenceJsonSchema as r, withCancellation as t };
|