@composio/core 0.1.14 → 0.1.15
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/index.cjs +47 -16
- package/dist/index.d.cts +32 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.js +47 -16
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -128,13 +128,19 @@ var ToolListFilterByToolkitsSchema = import_zod.z.object({
|
|
|
128
128
|
important: import_zod.z.boolean().optional(),
|
|
129
129
|
cursor: import_zod.z.string().optional(),
|
|
130
130
|
limit: import_zod.z.number().optional(),
|
|
131
|
-
search: import_zod.z.string().optional()
|
|
131
|
+
search: import_zod.z.string().optional(),
|
|
132
|
+
strict: import_zod.z.boolean().optional().describe(
|
|
133
|
+
"If true, all the non-required fields will be removed from the input/output params of the tool"
|
|
134
|
+
)
|
|
132
135
|
});
|
|
133
136
|
var ToolListFilterBySearchSchema = import_zod.z.object({
|
|
134
137
|
search: import_zod.z.string(),
|
|
135
138
|
toolkits: import_zod.z.array(import_zod.z.string()).optional(),
|
|
136
139
|
cursor: import_zod.z.string().optional(),
|
|
137
|
-
limit: import_zod.z.number().optional()
|
|
140
|
+
limit: import_zod.z.number().optional(),
|
|
141
|
+
strict: import_zod.z.boolean().optional().describe(
|
|
142
|
+
"If true, all the non-required fields will be removed from the input/output params of the tool"
|
|
143
|
+
)
|
|
138
144
|
});
|
|
139
145
|
var ToolListParamsSchema = import_zod.z.union([
|
|
140
146
|
ToolListFilterByToolsSchema,
|
|
@@ -1890,6 +1896,36 @@ var CustomTools = class {
|
|
|
1890
1896
|
}
|
|
1891
1897
|
};
|
|
1892
1898
|
|
|
1899
|
+
// src/utils/jsonSchema.ts
|
|
1900
|
+
var import_json_schema_to_zod = require("@composio/json-schema-to-zod");
|
|
1901
|
+
var removeNonRequiredProperties = (schema) => {
|
|
1902
|
+
if (schema && schema.type === "object" && schema.required?.length) {
|
|
1903
|
+
schema.properties = Object.fromEntries(
|
|
1904
|
+
Object.entries(schema.properties || {}).filter(
|
|
1905
|
+
([key]) => schema.required.includes(key)
|
|
1906
|
+
)
|
|
1907
|
+
);
|
|
1908
|
+
}
|
|
1909
|
+
return schema;
|
|
1910
|
+
};
|
|
1911
|
+
function jsonSchemaToZodSchema(jsonSchema, { strict } = {
|
|
1912
|
+
strict: false
|
|
1913
|
+
}) {
|
|
1914
|
+
try {
|
|
1915
|
+
let schema = jsonSchema;
|
|
1916
|
+
if (strict && schema) {
|
|
1917
|
+
schema = removeNonRequiredProperties(
|
|
1918
|
+
schema
|
|
1919
|
+
);
|
|
1920
|
+
}
|
|
1921
|
+
return (0, import_json_schema_to_zod.jsonSchemaToZod)(schema);
|
|
1922
|
+
} catch (error) {
|
|
1923
|
+
throw new JsonSchemaToZodError("Failed to convert JSON Schema to Zod Schema", {
|
|
1924
|
+
cause: error
|
|
1925
|
+
});
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1893
1929
|
// src/models/Tools.ts
|
|
1894
1930
|
var Tools = class {
|
|
1895
1931
|
client;
|
|
@@ -2150,7 +2186,14 @@ var Tools = class {
|
|
|
2150
2186
|
const tool = await this.getRawComposioToolBySlug(userId, arg2, options?.modifySchema);
|
|
2151
2187
|
return this.provider.wrapTools([tool], executeToolFn);
|
|
2152
2188
|
} else {
|
|
2153
|
-
|
|
2189
|
+
let tools = await this.getRawComposioTools(userId, arg2, options?.modifySchema);
|
|
2190
|
+
if (arg2?.strict) {
|
|
2191
|
+
tools = tools.map((tool) => ({
|
|
2192
|
+
...tool,
|
|
2193
|
+
inputParameters: tool.inputParameters ? removeNonRequiredProperties(tool.inputParameters) : void 0,
|
|
2194
|
+
outputParameters: tool.outputParameters ? removeNonRequiredProperties(tool.outputParameters) : void 0
|
|
2195
|
+
}));
|
|
2196
|
+
}
|
|
2154
2197
|
return this.provider.wrapTools(tools, executeToolFn);
|
|
2155
2198
|
}
|
|
2156
2199
|
}
|
|
@@ -4714,7 +4757,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
4714
4757
|
};
|
|
4715
4758
|
|
|
4716
4759
|
// package.json
|
|
4717
|
-
var version = "0.1.
|
|
4760
|
+
var version = "0.1.15";
|
|
4718
4761
|
|
|
4719
4762
|
// src/composio.ts
|
|
4720
4763
|
var Composio = class _Composio {
|
|
@@ -4892,18 +4935,6 @@ var ConsoleTelemetryTransport = class {
|
|
|
4892
4935
|
return Promise.resolve();
|
|
4893
4936
|
}
|
|
4894
4937
|
};
|
|
4895
|
-
|
|
4896
|
-
// src/utils/jsonSchema.ts
|
|
4897
|
-
var import_json_schema_to_zod = require("@composio/json-schema-to-zod");
|
|
4898
|
-
function jsonSchemaToZodSchema(jsonSchema) {
|
|
4899
|
-
try {
|
|
4900
|
-
return (0, import_json_schema_to_zod.jsonSchemaToZod)(jsonSchema);
|
|
4901
|
-
} catch (error) {
|
|
4902
|
-
throw new JsonSchemaToZodError("Failed to convert JSON Schema to Zod Schema", {
|
|
4903
|
-
cause: error
|
|
4904
|
-
});
|
|
4905
|
-
}
|
|
4906
|
-
}
|
|
4907
4938
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4908
4939
|
0 && (module.exports = {
|
|
4909
4940
|
AuthConfigErrorCodes,
|
package/dist/index.d.cts
CHANGED
|
@@ -143,6 +143,7 @@ type ToolsOnlyParams = {
|
|
|
143
143
|
cursor?: never;
|
|
144
144
|
limit?: never;
|
|
145
145
|
search?: never;
|
|
146
|
+
strict?: boolean;
|
|
146
147
|
};
|
|
147
148
|
type ToolkitsOnlyParams = {
|
|
148
149
|
tools?: never;
|
|
@@ -151,6 +152,7 @@ type ToolkitsOnlyParams = {
|
|
|
151
152
|
cursor?: string;
|
|
152
153
|
limit?: number;
|
|
153
154
|
search?: never;
|
|
155
|
+
strict?: boolean;
|
|
154
156
|
};
|
|
155
157
|
type ToolkitSearchOnlyParams = {
|
|
156
158
|
tools?: never;
|
|
@@ -159,6 +161,7 @@ type ToolkitSearchOnlyParams = {
|
|
|
159
161
|
cursor?: string;
|
|
160
162
|
limit?: number;
|
|
161
163
|
search?: string;
|
|
164
|
+
strict?: boolean;
|
|
162
165
|
};
|
|
163
166
|
/**
|
|
164
167
|
* ToolListParams is the parameters for the list of tools.
|
|
@@ -177,33 +180,39 @@ declare const ToolListParamsSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
177
180
|
cursor: z.ZodOptional<z.ZodString>;
|
|
178
181
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
179
182
|
search: z.ZodOptional<z.ZodString>;
|
|
183
|
+
strict: z.ZodOptional<z.ZodBoolean>;
|
|
180
184
|
}, "strip", z.ZodTypeAny, {
|
|
181
185
|
toolkits: string[];
|
|
182
186
|
important?: boolean | undefined;
|
|
183
187
|
cursor?: string | undefined;
|
|
184
188
|
limit?: number | undefined;
|
|
185
189
|
search?: string | undefined;
|
|
190
|
+
strict?: boolean | undefined;
|
|
186
191
|
}, {
|
|
187
192
|
toolkits: string[];
|
|
188
193
|
important?: boolean | undefined;
|
|
189
194
|
cursor?: string | undefined;
|
|
190
195
|
limit?: number | undefined;
|
|
191
196
|
search?: string | undefined;
|
|
197
|
+
strict?: boolean | undefined;
|
|
192
198
|
}>, z.ZodObject<{
|
|
193
199
|
search: z.ZodString;
|
|
194
200
|
toolkits: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
195
201
|
cursor: z.ZodOptional<z.ZodString>;
|
|
196
202
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
203
|
+
strict: z.ZodOptional<z.ZodBoolean>;
|
|
197
204
|
}, "strip", z.ZodTypeAny, {
|
|
198
205
|
search: string;
|
|
199
206
|
toolkits?: string[] | undefined;
|
|
200
207
|
cursor?: string | undefined;
|
|
201
208
|
limit?: number | undefined;
|
|
209
|
+
strict?: boolean | undefined;
|
|
202
210
|
}, {
|
|
203
211
|
search: string;
|
|
204
212
|
toolkits?: string[] | undefined;
|
|
205
213
|
cursor?: string | undefined;
|
|
206
214
|
limit?: number | undefined;
|
|
215
|
+
strict?: boolean | undefined;
|
|
207
216
|
}>]>;
|
|
208
217
|
/**
|
|
209
218
|
* CustomAuthParams is the parameters for the custom authentication.
|
|
@@ -31729,6 +31738,7 @@ declare class ComposioProvider extends BaseNonAgenticProvider<Array<CustomTool>,
|
|
|
31729
31738
|
/**
|
|
31730
31739
|
* Convert a JSON schema to a Zod schema
|
|
31731
31740
|
* @param jsonSchema - The JSON schema to convert
|
|
31741
|
+
* @param strict - Eliminates all non-required properties from the schema
|
|
31732
31742
|
* @returns The Zod schema
|
|
31733
31743
|
*
|
|
31734
31744
|
* @throws {JsonSchemaToZodError} If the JSON schema is invalid
|
|
@@ -31744,8 +31754,29 @@ declare class ComposioProvider extends BaseNonAgenticProvider<Array<CustomTool>,
|
|
|
31744
31754
|
*
|
|
31745
31755
|
* console.log(zodSchema);
|
|
31746
31756
|
* ```
|
|
31757
|
+
*
|
|
31758
|
+
* @example
|
|
31759
|
+
* ```ts
|
|
31760
|
+
* const zodSchema = jsonSchemaToZodSchema({
|
|
31761
|
+
* type: 'object',
|
|
31762
|
+
* properties: {
|
|
31763
|
+
* name: { type: 'string' },
|
|
31764
|
+
* age: { type: 'number' },
|
|
31765
|
+
* },
|
|
31766
|
+
* required: ['name'],
|
|
31767
|
+
* }, { strict: true });
|
|
31768
|
+
*
|
|
31769
|
+
* console.log(zodSchema);
|
|
31770
|
+
*
|
|
31771
|
+
* // Output:
|
|
31772
|
+
* // z.object({
|
|
31773
|
+
* // name: z.string(),
|
|
31774
|
+
* // })
|
|
31775
|
+
* ```
|
|
31747
31776
|
*/
|
|
31748
|
-
declare function jsonSchemaToZodSchema(jsonSchema: Record<string, unknown
|
|
31777
|
+
declare function jsonSchemaToZodSchema(jsonSchema: Record<string, unknown>, { strict }?: {
|
|
31778
|
+
strict?: boolean;
|
|
31779
|
+
}): z.ZodObject<Record<string, z.ZodTypeAny>>;
|
|
31749
31780
|
|
|
31750
31781
|
declare const LOG_LEVELS: {
|
|
31751
31782
|
readonly silent: -1;
|
package/dist/index.d.ts
CHANGED
|
@@ -143,6 +143,7 @@ type ToolsOnlyParams = {
|
|
|
143
143
|
cursor?: never;
|
|
144
144
|
limit?: never;
|
|
145
145
|
search?: never;
|
|
146
|
+
strict?: boolean;
|
|
146
147
|
};
|
|
147
148
|
type ToolkitsOnlyParams = {
|
|
148
149
|
tools?: never;
|
|
@@ -151,6 +152,7 @@ type ToolkitsOnlyParams = {
|
|
|
151
152
|
cursor?: string;
|
|
152
153
|
limit?: number;
|
|
153
154
|
search?: never;
|
|
155
|
+
strict?: boolean;
|
|
154
156
|
};
|
|
155
157
|
type ToolkitSearchOnlyParams = {
|
|
156
158
|
tools?: never;
|
|
@@ -159,6 +161,7 @@ type ToolkitSearchOnlyParams = {
|
|
|
159
161
|
cursor?: string;
|
|
160
162
|
limit?: number;
|
|
161
163
|
search?: string;
|
|
164
|
+
strict?: boolean;
|
|
162
165
|
};
|
|
163
166
|
/**
|
|
164
167
|
* ToolListParams is the parameters for the list of tools.
|
|
@@ -177,33 +180,39 @@ declare const ToolListParamsSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
177
180
|
cursor: z.ZodOptional<z.ZodString>;
|
|
178
181
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
179
182
|
search: z.ZodOptional<z.ZodString>;
|
|
183
|
+
strict: z.ZodOptional<z.ZodBoolean>;
|
|
180
184
|
}, "strip", z.ZodTypeAny, {
|
|
181
185
|
toolkits: string[];
|
|
182
186
|
important?: boolean | undefined;
|
|
183
187
|
cursor?: string | undefined;
|
|
184
188
|
limit?: number | undefined;
|
|
185
189
|
search?: string | undefined;
|
|
190
|
+
strict?: boolean | undefined;
|
|
186
191
|
}, {
|
|
187
192
|
toolkits: string[];
|
|
188
193
|
important?: boolean | undefined;
|
|
189
194
|
cursor?: string | undefined;
|
|
190
195
|
limit?: number | undefined;
|
|
191
196
|
search?: string | undefined;
|
|
197
|
+
strict?: boolean | undefined;
|
|
192
198
|
}>, z.ZodObject<{
|
|
193
199
|
search: z.ZodString;
|
|
194
200
|
toolkits: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
195
201
|
cursor: z.ZodOptional<z.ZodString>;
|
|
196
202
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
203
|
+
strict: z.ZodOptional<z.ZodBoolean>;
|
|
197
204
|
}, "strip", z.ZodTypeAny, {
|
|
198
205
|
search: string;
|
|
199
206
|
toolkits?: string[] | undefined;
|
|
200
207
|
cursor?: string | undefined;
|
|
201
208
|
limit?: number | undefined;
|
|
209
|
+
strict?: boolean | undefined;
|
|
202
210
|
}, {
|
|
203
211
|
search: string;
|
|
204
212
|
toolkits?: string[] | undefined;
|
|
205
213
|
cursor?: string | undefined;
|
|
206
214
|
limit?: number | undefined;
|
|
215
|
+
strict?: boolean | undefined;
|
|
207
216
|
}>]>;
|
|
208
217
|
/**
|
|
209
218
|
* CustomAuthParams is the parameters for the custom authentication.
|
|
@@ -31729,6 +31738,7 @@ declare class ComposioProvider extends BaseNonAgenticProvider<Array<CustomTool>,
|
|
|
31729
31738
|
/**
|
|
31730
31739
|
* Convert a JSON schema to a Zod schema
|
|
31731
31740
|
* @param jsonSchema - The JSON schema to convert
|
|
31741
|
+
* @param strict - Eliminates all non-required properties from the schema
|
|
31732
31742
|
* @returns The Zod schema
|
|
31733
31743
|
*
|
|
31734
31744
|
* @throws {JsonSchemaToZodError} If the JSON schema is invalid
|
|
@@ -31744,8 +31754,29 @@ declare class ComposioProvider extends BaseNonAgenticProvider<Array<CustomTool>,
|
|
|
31744
31754
|
*
|
|
31745
31755
|
* console.log(zodSchema);
|
|
31746
31756
|
* ```
|
|
31757
|
+
*
|
|
31758
|
+
* @example
|
|
31759
|
+
* ```ts
|
|
31760
|
+
* const zodSchema = jsonSchemaToZodSchema({
|
|
31761
|
+
* type: 'object',
|
|
31762
|
+
* properties: {
|
|
31763
|
+
* name: { type: 'string' },
|
|
31764
|
+
* age: { type: 'number' },
|
|
31765
|
+
* },
|
|
31766
|
+
* required: ['name'],
|
|
31767
|
+
* }, { strict: true });
|
|
31768
|
+
*
|
|
31769
|
+
* console.log(zodSchema);
|
|
31770
|
+
*
|
|
31771
|
+
* // Output:
|
|
31772
|
+
* // z.object({
|
|
31773
|
+
* // name: z.string(),
|
|
31774
|
+
* // })
|
|
31775
|
+
* ```
|
|
31747
31776
|
*/
|
|
31748
|
-
declare function jsonSchemaToZodSchema(jsonSchema: Record<string, unknown
|
|
31777
|
+
declare function jsonSchemaToZodSchema(jsonSchema: Record<string, unknown>, { strict }?: {
|
|
31778
|
+
strict?: boolean;
|
|
31779
|
+
}): z.ZodObject<Record<string, z.ZodTypeAny>>;
|
|
31749
31780
|
|
|
31750
31781
|
declare const LOG_LEVELS: {
|
|
31751
31782
|
readonly silent: -1;
|
package/dist/index.js
CHANGED
|
@@ -64,13 +64,19 @@ var ToolListFilterByToolkitsSchema = z.object({
|
|
|
64
64
|
important: z.boolean().optional(),
|
|
65
65
|
cursor: z.string().optional(),
|
|
66
66
|
limit: z.number().optional(),
|
|
67
|
-
search: z.string().optional()
|
|
67
|
+
search: z.string().optional(),
|
|
68
|
+
strict: z.boolean().optional().describe(
|
|
69
|
+
"If true, all the non-required fields will be removed from the input/output params of the tool"
|
|
70
|
+
)
|
|
68
71
|
});
|
|
69
72
|
var ToolListFilterBySearchSchema = z.object({
|
|
70
73
|
search: z.string(),
|
|
71
74
|
toolkits: z.array(z.string()).optional(),
|
|
72
75
|
cursor: z.string().optional(),
|
|
73
|
-
limit: z.number().optional()
|
|
76
|
+
limit: z.number().optional(),
|
|
77
|
+
strict: z.boolean().optional().describe(
|
|
78
|
+
"If true, all the non-required fields will be removed from the input/output params of the tool"
|
|
79
|
+
)
|
|
74
80
|
});
|
|
75
81
|
var ToolListParamsSchema = z.union([
|
|
76
82
|
ToolListFilterByToolsSchema,
|
|
@@ -1826,6 +1832,36 @@ var CustomTools = class {
|
|
|
1826
1832
|
}
|
|
1827
1833
|
};
|
|
1828
1834
|
|
|
1835
|
+
// src/utils/jsonSchema.ts
|
|
1836
|
+
import { jsonSchemaToZod } from "@composio/json-schema-to-zod";
|
|
1837
|
+
var removeNonRequiredProperties = (schema) => {
|
|
1838
|
+
if (schema && schema.type === "object" && schema.required?.length) {
|
|
1839
|
+
schema.properties = Object.fromEntries(
|
|
1840
|
+
Object.entries(schema.properties || {}).filter(
|
|
1841
|
+
([key]) => schema.required.includes(key)
|
|
1842
|
+
)
|
|
1843
|
+
);
|
|
1844
|
+
}
|
|
1845
|
+
return schema;
|
|
1846
|
+
};
|
|
1847
|
+
function jsonSchemaToZodSchema(jsonSchema, { strict } = {
|
|
1848
|
+
strict: false
|
|
1849
|
+
}) {
|
|
1850
|
+
try {
|
|
1851
|
+
let schema = jsonSchema;
|
|
1852
|
+
if (strict && schema) {
|
|
1853
|
+
schema = removeNonRequiredProperties(
|
|
1854
|
+
schema
|
|
1855
|
+
);
|
|
1856
|
+
}
|
|
1857
|
+
return jsonSchemaToZod(schema);
|
|
1858
|
+
} catch (error) {
|
|
1859
|
+
throw new JsonSchemaToZodError("Failed to convert JSON Schema to Zod Schema", {
|
|
1860
|
+
cause: error
|
|
1861
|
+
});
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1829
1865
|
// src/models/Tools.ts
|
|
1830
1866
|
var Tools = class {
|
|
1831
1867
|
client;
|
|
@@ -2086,7 +2122,14 @@ var Tools = class {
|
|
|
2086
2122
|
const tool = await this.getRawComposioToolBySlug(userId, arg2, options?.modifySchema);
|
|
2087
2123
|
return this.provider.wrapTools([tool], executeToolFn);
|
|
2088
2124
|
} else {
|
|
2089
|
-
|
|
2125
|
+
let tools = await this.getRawComposioTools(userId, arg2, options?.modifySchema);
|
|
2126
|
+
if (arg2?.strict) {
|
|
2127
|
+
tools = tools.map((tool) => ({
|
|
2128
|
+
...tool,
|
|
2129
|
+
inputParameters: tool.inputParameters ? removeNonRequiredProperties(tool.inputParameters) : void 0,
|
|
2130
|
+
outputParameters: tool.outputParameters ? removeNonRequiredProperties(tool.outputParameters) : void 0
|
|
2131
|
+
}));
|
|
2132
|
+
}
|
|
2090
2133
|
return this.provider.wrapTools(tools, executeToolFn);
|
|
2091
2134
|
}
|
|
2092
2135
|
}
|
|
@@ -4650,7 +4693,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
4650
4693
|
};
|
|
4651
4694
|
|
|
4652
4695
|
// package.json
|
|
4653
|
-
var version = "0.1.
|
|
4696
|
+
var version = "0.1.15";
|
|
4654
4697
|
|
|
4655
4698
|
// src/composio.ts
|
|
4656
4699
|
var Composio = class _Composio {
|
|
@@ -4828,18 +4871,6 @@ var ConsoleTelemetryTransport = class {
|
|
|
4828
4871
|
return Promise.resolve();
|
|
4829
4872
|
}
|
|
4830
4873
|
};
|
|
4831
|
-
|
|
4832
|
-
// src/utils/jsonSchema.ts
|
|
4833
|
-
import { jsonSchemaToZod } from "@composio/json-schema-to-zod";
|
|
4834
|
-
function jsonSchemaToZodSchema(jsonSchema) {
|
|
4835
|
-
try {
|
|
4836
|
-
return jsonSchemaToZod(jsonSchema);
|
|
4837
|
-
} catch (error) {
|
|
4838
|
-
throw new JsonSchemaToZodError("Failed to convert JSON Schema to Zod Schema", {
|
|
4839
|
-
cause: error
|
|
4840
|
-
});
|
|
4841
|
-
}
|
|
4842
|
-
}
|
|
4843
4874
|
export {
|
|
4844
4875
|
AuthConfigErrorCodes,
|
|
4845
4876
|
AuthConfigTypes,
|