@composio/core 0.10.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/dist/{tool.types-CwbAy9l_.d.cts → BaseProvider-BBnsv9kS.d.mts} +23683 -23635
- package/dist/CustomTool-DEB4BQPl.mjs +468 -0
- package/dist/{CustomTool-aber890o.d.cts → CustomTool-DH18rVQu.d.mts} +2 -4
- package/dist/{FileModifierErrors-C7z16Dfi.mjs → FileModifierErrors-3fSwIWoa.mjs} +35 -36
- package/dist/{FileToolModifier.utils.neutral-B7P7wn-b.mjs → FileToolModifier.utils.neutral-B5rT711M.mjs} +1 -7
- package/dist/{Telemetry-kgWlkavX.mjs → Telemetry-DhGI_J4G.mjs} +48 -23
- package/dist/{composio-CSMCZZgj.d.cts → composio-CHnEggnv.d.mts} +433 -435
- package/dist/{customTool.types-BzEWHa0w.d.cts → customTool.types-DpIdOJjL.d.mts} +177 -236
- package/dist/{CustomTool-D7-1S2at.mjs → errors-D5f4pfvI.mjs} +132 -519
- package/dist/experimental/index.d.mts +2 -3
- package/dist/experimental/index.mjs +1 -3
- package/dist/{fileUtils.node-Dq7ebZPC.mjs → fileUtils.node-BiO1JQsJ.mjs} +26 -25
- package/dist/index.d.mts +2034 -2356
- package/dist/index.mjs +2546 -2335
- package/dist/jsonSchema-daqF3S3d.mjs +251 -0
- package/dist/models/Files.node.d.mts +1 -2
- package/dist/models/Files.node.mjs +3 -4
- package/dist/models/Files.workerd.d.mts +0 -1
- package/dist/platform/node.d.mts +1 -2
- package/dist/platform/workerd.d.mts +1 -2
- package/dist/{chunk-CWQeghP5.mjs → rolldown-runtime-w6R9maHv.mjs} +3 -5
- package/dist/{types-DE7O6Z6S.d.cts → types-CaI5Z4PA.d.mts} +2 -3
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -4
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -4
- package/dist/utils/config-defaults/ConfigDefaults.workerd.mjs +3 -0
- package/dist/utils/json-schema.d.mts +2 -0
- package/dist/utils/json-schema.mjs +3 -0
- package/dist/utils/modifiers/FileToolModifier.node.d.mts +3 -1
- package/dist/utils/modifiers/FileToolModifier.node.mjs +81 -44
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +3 -1
- package/dist/utils/modifiers/FileToolModifier.workerd.mjs +1 -1
- package/package.json +48 -88
- package/dist/CustomTool-CQ_YjABZ.cjs +0 -1341
- package/dist/CustomTool-DJUGNOer.d.mts +0 -76
- package/dist/FileModifierErrors-BYJBHiay.cjs +0 -554
- package/dist/FileToolModifier.utils.neutral-Dfwqgimk.cjs +0 -102
- package/dist/Telemetry-Dm-0sewu.cjs +0 -335
- package/dist/buffer-BjWptbNH.cjs +0 -63
- package/dist/chunk-CQwRTUmo.cjs +0 -53
- package/dist/composio-DRl6WCI9.d.mts +0 -5484
- package/dist/customTool.types-CMOMgxoM.d.mts +0 -2513
- package/dist/experimental/index.cjs +0 -5
- package/dist/experimental/index.d.cts +0 -3
- package/dist/fileUtils.node-DtnSRMWa.cjs +0 -462
- package/dist/files.types-lo4zZd87.d.cts +0 -17
- package/dist/index.cjs +0 -8637
- package/dist/index.d.cts +0 -5672
- package/dist/models/Files.node.cjs +0 -55
- package/dist/models/Files.node.d.cts +0 -56
- package/dist/models/Files.workerd.cjs +0 -29
- package/dist/models/Files.workerd.d.cts +0 -13
- package/dist/platform/node.cjs +0 -55
- package/dist/platform/node.d.cts +0 -11
- package/dist/platform/workerd.cjs +0 -42
- package/dist/platform/workerd.d.cts +0 -12
- package/dist/tool.types-CB_4JKhV.d.mts +0 -29377
- package/dist/types-BTOPdg4d.d.mts +0 -13
- package/dist/types-pDNm1lYs.d.cts +0 -69
- package/dist/utils/config-defaults/ConfigDefaults.node.cjs +0 -10
- package/dist/utils/config-defaults/ConfigDefaults.node.d.cts +0 -7
- package/dist/utils/config-defaults/ConfigDefaults.workerd.cjs +0 -10
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.cts +0 -7
- package/dist/utils/modifiers/FileToolModifier.node.cjs +0 -207
- package/dist/utils/modifiers/FileToolModifier.node.d.cts +0 -22
- package/dist/utils/modifiers/FileToolModifier.workerd.cjs +0 -27
- package/dist/utils/modifiers/FileToolModifier.workerd.d.cts +0 -20
- /package/dist/{buffer-yOtEsT4J.mjs → buffer-PcbMMsgm.mjs} +0 -0
- /package/dist/{files.types-BXDWA_zS.d.mts → files.types-DeMC_mAW.d.mts} +0 -0
- /package/dist/{types-HpJQ8K9l.d.mts → types-DdoCRzLj.d.mts} +0 -0
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
import { T as ValidationError } from "./errors-D5f4pfvI.mjs";
|
|
2
|
+
import { z } from "zod/v3";
|
|
3
|
+
import * as z4 from "zod/v4";
|
|
4
|
+
import * as zodToJsonSchema from "zod-to-json-schema";
|
|
5
|
+
|
|
6
|
+
//#region src/types/customTool.types.ts
|
|
7
|
+
/**
|
|
8
|
+
* Zod schema for validating a custom tool slug.
|
|
9
|
+
* Alphanumeric, underscores, and hyphens only. No `LOCAL_` or `COMPOSIO_` prefix.
|
|
10
|
+
* Length is validated contextually (standalone vs extension vs toolkit) at creation time.
|
|
11
|
+
*/
|
|
12
|
+
const CustomToolSlugSchema = z.string().min(1, "slug is required").regex(/^[A-Za-z0-9_-]+$/, "slug must only contain alphanumeric characters, underscores, and hyphens").refine((s) => !s.toUpperCase().startsWith("LOCAL_"), { message: "slug must not start with \"LOCAL_\" — this prefix is reserved for internal routing." }).refine((s) => !s.toUpperCase().startsWith("COMPOSIO_"), { message: "slug must not start with \"COMPOSIO_\" — this prefix is reserved for Composio meta tools." });
|
|
13
|
+
/**
|
|
14
|
+
* Zod schema for validating the string/scalar fields of createCustomTool() options.
|
|
15
|
+
* Slug is validated separately as the first argument.
|
|
16
|
+
* Used internally for validation — inputParams, outputParams, and execute are checked manually.
|
|
17
|
+
*/
|
|
18
|
+
const CreateCustomToolBaseSchema = z.object({
|
|
19
|
+
name: z.string().min(1, "createCustomTool: name is required"),
|
|
20
|
+
description: z.string().min(1, "createCustomTool: description is required"),
|
|
21
|
+
/**
|
|
22
|
+
* Composio toolkit slug that this tool extends (inherits auth from).
|
|
23
|
+
* Must be a valid Composio toolkit slug (e.g. `'gmail'`, `'github'`, `'meta_ads'`).
|
|
24
|
+
* The backend validates this against the toolkit catalog.
|
|
25
|
+
* Leave empty for tools that don't need any Composio-managed authentication.
|
|
26
|
+
*/
|
|
27
|
+
extendsToolkit: z.string().optional(),
|
|
28
|
+
preload: z.boolean().optional().describe("When true, include this custom tool in session.tools() so it can be called without searching first.")
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* Zod schema for validating the string/scalar fields of createCustomToolkit() options.
|
|
32
|
+
* Slug is validated separately as the first argument.
|
|
33
|
+
*/
|
|
34
|
+
const CreateCustomToolkitBaseSchema = z.object({
|
|
35
|
+
name: z.string().min(1, "createCustomToolkit: name is required"),
|
|
36
|
+
description: z.string().min(1, "createCustomToolkit: description is required"),
|
|
37
|
+
preload: z.boolean().optional().describe("When true, include tools from this custom toolkit in session.tools(). Tool-level preload values override this default.")
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/utils/zodSchema.ts
|
|
42
|
+
const getZodDef = (value) => typeof value === "object" && value !== null ? value._def : void 0;
|
|
43
|
+
const isZodV4Schema = (schema) => typeof getZodDef(schema)?.type === "string";
|
|
44
|
+
const stripSchemaKeyword = (schema) => {
|
|
45
|
+
const { $schema: _schema, ...rest } = schema;
|
|
46
|
+
return rest;
|
|
47
|
+
};
|
|
48
|
+
const getNamedDefinition = (schema, name) => {
|
|
49
|
+
const definition = schema.definitions?.[name];
|
|
50
|
+
if (typeof definition !== "object" || definition === null) throw new Error(`Expected definition "${name}" in the converted JSON schema.`);
|
|
51
|
+
return definition;
|
|
52
|
+
};
|
|
53
|
+
const isZodObjectSchema = (value) => {
|
|
54
|
+
const def = getZodDef(value);
|
|
55
|
+
return def?.typeName === "ZodObject" || def?.type === "object";
|
|
56
|
+
};
|
|
57
|
+
const zodSchemaToJsonSchema = (schema, name = "schema", mode = "output") => {
|
|
58
|
+
if (isZodV4Schema(schema)) return stripSchemaKeyword(z4.toJSONSchema(schema, { io: mode }));
|
|
59
|
+
return stripSchemaKeyword(getNamedDefinition(zodToJsonSchema.default(schema, {
|
|
60
|
+
name,
|
|
61
|
+
pipeStrategy: mode,
|
|
62
|
+
effectStrategy: mode === "input" ? "input" : "any"
|
|
63
|
+
}), name));
|
|
64
|
+
};
|
|
65
|
+
const zodObjectSchemaToJsonSchema = (schema, name = "schema", mode = "input") => {
|
|
66
|
+
if (!isZodObjectSchema(schema)) throw new Error("Expected a z.object() schema.");
|
|
67
|
+
const jsonSchema = zodSchemaToJsonSchema(schema, name, mode);
|
|
68
|
+
return {
|
|
69
|
+
type: "object",
|
|
70
|
+
properties: jsonSchema.properties ?? {},
|
|
71
|
+
...jsonSchema.required ? { required: jsonSchema.required } : {}
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/models/CustomTool.ts
|
|
77
|
+
/**
|
|
78
|
+
* @fileoverview Factory functions for creating custom tools and toolkits.
|
|
79
|
+
*
|
|
80
|
+
* Usage:
|
|
81
|
+
* ```typescript
|
|
82
|
+
* import { experimental_createTool, experimental_createToolkit } from '@composio/core';
|
|
83
|
+
*
|
|
84
|
+
* const grep = createCustomTool('GREP', {
|
|
85
|
+
* name: 'Grep Search',
|
|
86
|
+
* description: 'Search for patterns in files',
|
|
87
|
+
* inputParams: z.object({ pattern: z.string() }),
|
|
88
|
+
* execute: async (input) => ({ matches: [] }),
|
|
89
|
+
* });
|
|
90
|
+
*
|
|
91
|
+
* const devTools = createCustomToolkit('DEV_TOOLS', {
|
|
92
|
+
* name: 'Dev Tools',
|
|
93
|
+
* description: 'Local dev utilities',
|
|
94
|
+
* tools: [grep],
|
|
95
|
+
* });
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
/** Prefix applied by the backend to local tool slugs for disambiguation. */
|
|
99
|
+
const LOCAL_TOOL_PREFIX = "LOCAL_";
|
|
100
|
+
/** Maximum allowed length for the final prefixed slug. */
|
|
101
|
+
const MAX_SLUG_LENGTH = 60;
|
|
102
|
+
/**
|
|
103
|
+
* Compute the final slug length for a tool given its context.
|
|
104
|
+
* Returns the expected length of LOCAL_[TOOLKIT_]SLUG.
|
|
105
|
+
*/
|
|
106
|
+
function computeFinalSlugLength(toolSlug, toolkitSlug) {
|
|
107
|
+
return 6 + (toolkitSlug ? toolkitSlug.length + 1 : 0) + toolSlug.length;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Validate that the final slug won't exceed the max length.
|
|
111
|
+
* Called early in createCustomTool/createCustomToolkit for fast feedback.
|
|
112
|
+
*/
|
|
113
|
+
function validateSlugLength(toolSlug, toolkitSlug, context) {
|
|
114
|
+
const finalLength = computeFinalSlugLength(toolSlug, toolkitSlug);
|
|
115
|
+
if (finalLength > MAX_SLUG_LENGTH) {
|
|
116
|
+
const prefix = LOCAL_TOOL_PREFIX + (toolkitSlug ? `${toolkitSlug.toUpperCase()}_` : "");
|
|
117
|
+
throw new ValidationError(`${context}: slug "${toolSlug}" is too long. With prefix "${prefix}", the final slug would be ${finalLength} characters (max ${MAX_SLUG_LENGTH}). Shorten the slug to at most ${MAX_SLUG_LENGTH - prefix.length} characters.`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Create a custom tool for use in tool router sessions.
|
|
122
|
+
*
|
|
123
|
+
* The returned object is a lightweight reference containing the tool's metadata
|
|
124
|
+
* and execute function. Pass it to `composio.create(userId, { experimental: { customTools: [...] } })`
|
|
125
|
+
* to bind it to a session.
|
|
126
|
+
*
|
|
127
|
+
* Just return the result data from `execute`, or throw an error.
|
|
128
|
+
* The SDK wraps it into the standard response format internally.
|
|
129
|
+
*
|
|
130
|
+
* **Slug naming:** The slug you provide is automatically prefixed with `LOCAL_` when
|
|
131
|
+
* exposed to the agent (e.g. `'GREP'` becomes `LOCAL_GREP`). If the tool is inside a
|
|
132
|
+
* custom toolkit, the toolkit slug is also included (e.g. `LOCAL_DEV_TOOLS_GREP`).
|
|
133
|
+
* The `LOCAL_` prefix is reserved and cannot be used in your slug.
|
|
134
|
+
*
|
|
135
|
+
* @param slug - Unique tool identifier (alphanumeric, underscores, hyphens; no LOCAL_ or COMPOSIO_ prefix)
|
|
136
|
+
* @param options - Tool definition including name, schema, and execute function
|
|
137
|
+
* @returns A CustomTool to pass to session creation
|
|
138
|
+
*
|
|
139
|
+
* @example Standalone tool (no auth)
|
|
140
|
+
* ```typescript
|
|
141
|
+
* const grep = createCustomTool('GREP', {
|
|
142
|
+
* name: 'Grep Search',
|
|
143
|
+
* description: 'Search for patterns in files',
|
|
144
|
+
* inputParams: z.object({ pattern: z.string(), path: z.string() }),
|
|
145
|
+
* execute: async (input) => ({ matches: [] }),
|
|
146
|
+
* });
|
|
147
|
+
* ```
|
|
148
|
+
*
|
|
149
|
+
* @example Tool extending a Composio toolkit (inherits auth)
|
|
150
|
+
* ```typescript
|
|
151
|
+
* const getImportant = createCustomTool('GET_IMPORTANT_EMAILS', {
|
|
152
|
+
* name: 'Get Important Emails',
|
|
153
|
+
* description: 'Fetch high-priority emails',
|
|
154
|
+
* extendsToolkit: 'gmail',
|
|
155
|
+
* inputParams: z.object({ limit: z.number().default(10) }),
|
|
156
|
+
* execute: async (input, ctx) => {
|
|
157
|
+
* // Same response shape as session.execute(): { data, error, logId }
|
|
158
|
+
* const result = await ctx.execute('GMAIL_SEARCH', { query: 'is:important' });
|
|
159
|
+
* return { emails: result.data };
|
|
160
|
+
* },
|
|
161
|
+
* });
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
function createCustomTool(slug, options) {
|
|
165
|
+
const slugResult = CustomToolSlugSchema.safeParse(slug);
|
|
166
|
+
if (!slugResult.success) throw new ValidationError(`createCustomTool: ${slugResult.error.issues[0].message}`, { cause: slugResult.error });
|
|
167
|
+
const validated = CreateCustomToolBaseSchema.parse(options);
|
|
168
|
+
if (!options.inputParams) throw new ValidationError("createCustomTool: inputParams is required");
|
|
169
|
+
if (!isZodObjectSchema(options.inputParams)) throw new ValidationError("createCustomTool: inputParams must be a z.object() schema. Tool input parameters are always an object with named properties.");
|
|
170
|
+
if (typeof options.execute !== "function") throw new ValidationError("createCustomTool: execute must be a function");
|
|
171
|
+
validateSlugLength(slug, validated.extendsToolkit, "createCustomTool");
|
|
172
|
+
const { inputParams, execute } = options;
|
|
173
|
+
const inputSchema = zodObjectSchemaToJsonSchema(inputParams, "input");
|
|
174
|
+
let outputSchema;
|
|
175
|
+
if (options.outputParams) outputSchema = zodSchemaToJsonSchema(options.outputParams, "output");
|
|
176
|
+
return {
|
|
177
|
+
slug: slugResult.data,
|
|
178
|
+
name: validated.name,
|
|
179
|
+
description: validated.description,
|
|
180
|
+
extendsToolkit: validated.extendsToolkit,
|
|
181
|
+
preload: validated.preload,
|
|
182
|
+
inputSchema,
|
|
183
|
+
outputSchema,
|
|
184
|
+
inputParams,
|
|
185
|
+
execute
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Create a custom toolkit that groups related tools.
|
|
190
|
+
*
|
|
191
|
+
* Tools passed here must NOT have `extendsToolkit` set — they inherit the toolkit identity instead.
|
|
192
|
+
*
|
|
193
|
+
* **Slug naming:** The toolkit slug becomes part of the final tool slug exposed to the agent.
|
|
194
|
+
* For example, a toolkit `'DEV_TOOLS'` with a tool `'GREP'` produces `LOCAL_DEV_TOOLS_GREP`.
|
|
195
|
+
* The `LOCAL_` prefix is reserved and cannot be used in your slug.
|
|
196
|
+
*
|
|
197
|
+
* @param slug - Unique toolkit identifier (alphanumeric, underscores, hyphens; no LOCAL_ or COMPOSIO_ prefix)
|
|
198
|
+
* @param options - Toolkit definition including name, description, and tools
|
|
199
|
+
* @returns A CustomToolkit to pass to session creation
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* const devTools = createCustomToolkit('DEV_TOOLS', {
|
|
204
|
+
* name: 'Dev Tools',
|
|
205
|
+
* description: 'Local dev utilities',
|
|
206
|
+
* tools: [grepTool, sedTool],
|
|
207
|
+
* });
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
function createCustomToolkit(slug, options) {
|
|
211
|
+
const slugResult = CustomToolSlugSchema.safeParse(slug);
|
|
212
|
+
if (!slugResult.success) throw new ValidationError(`createCustomToolkit: ${slugResult.error.issues[0].message}`, { cause: slugResult.error });
|
|
213
|
+
const validated = CreateCustomToolkitBaseSchema.parse(options);
|
|
214
|
+
if (!options.tools?.length) throw new ValidationError("createCustomToolkit: at least one tool is required");
|
|
215
|
+
for (const tool of options.tools) {
|
|
216
|
+
if (tool.extendsToolkit) throw new ValidationError(`createCustomToolkit: tool "${tool.slug}" has extendsToolkit set. Tools in a custom toolkit must not use extendsToolkit — they inherit the toolkit identity instead.`);
|
|
217
|
+
validateSlugLength(tool.slug, slug, `createCustomToolkit("${slug}")`);
|
|
218
|
+
}
|
|
219
|
+
return {
|
|
220
|
+
slug: slugResult.data,
|
|
221
|
+
name: validated.name,
|
|
222
|
+
description: validated.description,
|
|
223
|
+
preload: validated.preload,
|
|
224
|
+
tools: options.tools
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Build the final slug for a custom tool given its context.
|
|
229
|
+
* @internal
|
|
230
|
+
*/
|
|
231
|
+
function buildFinalSlug(toolSlug, toolkitSlug) {
|
|
232
|
+
const upper = toolSlug.toUpperCase();
|
|
233
|
+
return toolkitSlug ? `${LOCAL_TOOL_PREFIX}${toolkitSlug.toUpperCase()}_${upper}` : `${LOCAL_TOOL_PREFIX}${upper}`;
|
|
234
|
+
}
|
|
235
|
+
const qualifiedOriginalSlugKey = (toolkit, originalSlug) => `${toolkit?.toUpperCase() ?? ""}::${originalSlug.toUpperCase()}`;
|
|
236
|
+
const canShareOriginalSlug = (existing, next) => !!existing.toolkit && !!next.toolkit && existing.toolkit.toLowerCase() !== next.toolkit.toLowerCase();
|
|
237
|
+
const addOriginalSlugAlias = (params) => {
|
|
238
|
+
const originalSlugKey = params.originalSlug.toUpperCase();
|
|
239
|
+
if (params.ambiguousOriginalSlugs.has(originalSlugKey)) return;
|
|
240
|
+
const existing = params.byOriginalSlug.get(originalSlugKey);
|
|
241
|
+
if (!existing) {
|
|
242
|
+
params.byOriginalSlug.set(originalSlugKey, params.entry);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
if (existing.finalSlug.toUpperCase() === params.entry.finalSlug.toUpperCase()) return;
|
|
246
|
+
if (canShareOriginalSlug(existing, params.entry)) {
|
|
247
|
+
params.byOriginalSlug.delete(originalSlugKey);
|
|
248
|
+
params.ambiguousOriginalSlugs.add(originalSlugKey);
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
throw new ValidationError(`Custom tool slug collision: original slug "${params.originalSlug}" maps to multiple final slugs. "${existing.finalSlug}" and "${params.entry.finalSlug}" both resolve from "${originalSlugKey}".`);
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* Build a CustomToolsMap from custom tools and toolkits.
|
|
255
|
+
* Used internally by ToolRouter.create() to construct the per-session routing map.
|
|
256
|
+
*
|
|
257
|
+
* @internal
|
|
258
|
+
* @param tools - Standalone custom tools
|
|
259
|
+
* @param toolkits - Custom toolkits containing grouped tools
|
|
260
|
+
* @returns Maps for O(1) lookup by both final and original slug
|
|
261
|
+
* @throws If duplicate slugs or cross-group collisions
|
|
262
|
+
*/
|
|
263
|
+
function buildCustomToolsMap(tools, toolkits) {
|
|
264
|
+
const byFinalSlug = /* @__PURE__ */ new Map();
|
|
265
|
+
const byOriginalSlug = /* @__PURE__ */ new Map();
|
|
266
|
+
const byToolkitAndOriginalSlug = /* @__PURE__ */ new Map();
|
|
267
|
+
const ambiguousOriginalSlugs = /* @__PURE__ */ new Set();
|
|
268
|
+
const addEntry = (handle, finalSlug, toolkit) => {
|
|
269
|
+
const originalSlug = handle.slug.toUpperCase();
|
|
270
|
+
const finalSlugKey = finalSlug.toUpperCase();
|
|
271
|
+
if (finalSlug.length > MAX_SLUG_LENGTH) throw new ValidationError(`Custom tool slug "${handle.slug}" produces final slug "${finalSlug}" which exceeds ${MAX_SLUG_LENGTH} characters.`);
|
|
272
|
+
if (byFinalSlug.has(finalSlugKey)) throw new ValidationError(`Custom tool slug collision: "${finalSlug}" is already registered.`);
|
|
273
|
+
const qualifiedKey = qualifiedOriginalSlugKey(toolkit, originalSlug);
|
|
274
|
+
if (byToolkitAndOriginalSlug.has(qualifiedKey)) throw new ValidationError(`Custom tool slug collision: original slug "${handle.slug}" is already registered for toolkit "${toolkit ?? "custom"}".`);
|
|
275
|
+
const entry = {
|
|
276
|
+
handle,
|
|
277
|
+
finalSlug,
|
|
278
|
+
toolkit
|
|
279
|
+
};
|
|
280
|
+
byFinalSlug.set(finalSlugKey, entry);
|
|
281
|
+
byToolkitAndOriginalSlug.set(qualifiedKey, entry);
|
|
282
|
+
addOriginalSlugAlias({
|
|
283
|
+
byOriginalSlug,
|
|
284
|
+
ambiguousOriginalSlugs,
|
|
285
|
+
originalSlug,
|
|
286
|
+
entry
|
|
287
|
+
});
|
|
288
|
+
};
|
|
289
|
+
for (const handle of tools) addEntry(handle, buildFinalSlug(handle.slug, handle.extendsToolkit), handle.extendsToolkit);
|
|
290
|
+
if (toolkits) for (const toolkit of toolkits) for (const handle of toolkit.tools) addEntry(handle, buildFinalSlug(handle.slug, toolkit.slug), toolkit.slug);
|
|
291
|
+
return {
|
|
292
|
+
byFinalSlug,
|
|
293
|
+
byOriginalSlug,
|
|
294
|
+
byToolkitAndOriginalSlug,
|
|
295
|
+
...ambiguousOriginalSlugs.size ? { ambiguousOriginalSlugs } : {},
|
|
296
|
+
toolkits,
|
|
297
|
+
tools: tools.length ? tools : void 0
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
function shouldSerializePreload(preload, inheritedPreload, defaultPreload) {
|
|
301
|
+
const inheritedOrDefault = inheritedPreload ?? defaultPreload;
|
|
302
|
+
if (preload !== void 0) return preload || inheritedOrDefault ? preload : void 0;
|
|
303
|
+
if (inheritedPreload !== void 0) return inheritedPreload || defaultPreload ? inheritedPreload : void 0;
|
|
304
|
+
return defaultPreload ? true : void 0;
|
|
305
|
+
}
|
|
306
|
+
function preloadWireProperty(preload, inheritedPreload, defaultPreload) {
|
|
307
|
+
const serializedPreload = shouldSerializePreload(preload, inheritedPreload, defaultPreload);
|
|
308
|
+
return serializedPreload === void 0 ? {} : { preload: serializedPreload };
|
|
309
|
+
}
|
|
310
|
+
function serializeCustomTools(tools, options = {}) {
|
|
311
|
+
const defaultPreload = options.defaultPreload ?? false;
|
|
312
|
+
return tools.map((handle) => ({
|
|
313
|
+
slug: handle.slug,
|
|
314
|
+
name: handle.name,
|
|
315
|
+
description: handle.description,
|
|
316
|
+
input_schema: handle.inputSchema,
|
|
317
|
+
...handle.outputSchema ? { output_schema: handle.outputSchema } : {},
|
|
318
|
+
...handle.extendsToolkit ? { extends_toolkit: handle.extendsToolkit } : {},
|
|
319
|
+
...preloadWireProperty(handle.preload, void 0, defaultPreload)
|
|
320
|
+
}));
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Serialize custom toolkits into the format expected by the backend session creation API.
|
|
324
|
+
*
|
|
325
|
+
* @internal
|
|
326
|
+
* @param toolkits - The custom toolkits to serialize
|
|
327
|
+
* @returns Array of CustomToolkitDefinition for the API payload
|
|
328
|
+
*/
|
|
329
|
+
function serializeCustomToolkits(toolkits, options = {}) {
|
|
330
|
+
const defaultPreload = options.defaultPreload ?? false;
|
|
331
|
+
return toolkits.map((tk) => ({
|
|
332
|
+
slug: tk.slug,
|
|
333
|
+
name: tk.name,
|
|
334
|
+
description: tk.description,
|
|
335
|
+
...preloadWireProperty(tk.preload, void 0, defaultPreload),
|
|
336
|
+
tools: tk.tools.map((t) => ({
|
|
337
|
+
slug: t.slug,
|
|
338
|
+
name: t.name,
|
|
339
|
+
description: t.description,
|
|
340
|
+
input_schema: t.inputSchema,
|
|
341
|
+
...t.outputSchema ? { output_schema: t.outputSchema } : {},
|
|
342
|
+
...preloadWireProperty(t.preload, tk.preload, defaultPreload)
|
|
343
|
+
}))
|
|
344
|
+
}));
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Build a CustomToolsMap using the slug/original_slug mapping from the session create response.
|
|
348
|
+
* This uses the backend's authoritative prefixed slugs instead of computing them client-side.
|
|
349
|
+
*
|
|
350
|
+
* @internal
|
|
351
|
+
* @param tools - The original custom tools passed to session creation
|
|
352
|
+
* @param toolkits - The original custom toolkits passed to session creation
|
|
353
|
+
* @param experimental - The experimental section from the session create response
|
|
354
|
+
* @returns Maps for O(1) lookup by both final and original slug
|
|
355
|
+
*/
|
|
356
|
+
function buildCustomToolsMapFromResponse(tools, toolkits, experimental) {
|
|
357
|
+
const byFinalSlug = /* @__PURE__ */ new Map();
|
|
358
|
+
const byOriginalSlug = /* @__PURE__ */ new Map();
|
|
359
|
+
const byToolkitAndOriginalSlug = /* @__PURE__ */ new Map();
|
|
360
|
+
const ambiguousOriginalSlugs = /* @__PURE__ */ new Set();
|
|
361
|
+
const handlesByQualifiedOriginalSlug = /* @__PURE__ */ new Map();
|
|
362
|
+
const handlesByOriginalSlug = /* @__PURE__ */ new Map();
|
|
363
|
+
const registerHandle = (handle, toolkit) => {
|
|
364
|
+
const originalSlug = handle.slug.toUpperCase();
|
|
365
|
+
const match = {
|
|
366
|
+
handle,
|
|
367
|
+
toolkit
|
|
368
|
+
};
|
|
369
|
+
handlesByQualifiedOriginalSlug.set(qualifiedOriginalSlugKey(toolkit, originalSlug), match);
|
|
370
|
+
const existing = handlesByOriginalSlug.get(originalSlug) ?? [];
|
|
371
|
+
existing.push(match);
|
|
372
|
+
handlesByOriginalSlug.set(originalSlug, existing);
|
|
373
|
+
};
|
|
374
|
+
for (const handle of tools) registerHandle(handle, handle.extendsToolkit);
|
|
375
|
+
if (toolkits) for (const tk of toolkits) for (const handle of tk.tools) registerHandle(handle, tk.slug);
|
|
376
|
+
const findHandle = (originalSlug, toolkit) => {
|
|
377
|
+
const originalSlugKey = originalSlug.toUpperCase();
|
|
378
|
+
const qualifiedMatch = handlesByQualifiedOriginalSlug.get(qualifiedOriginalSlugKey(toolkit, originalSlugKey));
|
|
379
|
+
if (qualifiedMatch) return qualifiedMatch;
|
|
380
|
+
const bareMatches = handlesByOriginalSlug.get(originalSlugKey) ?? [];
|
|
381
|
+
return bareMatches.length === 1 ? bareMatches[0] : void 0;
|
|
382
|
+
};
|
|
383
|
+
const addEntry = (finalSlug, originalSlug, toolkit) => {
|
|
384
|
+
const resolvedToolkit = toolkit ?? void 0;
|
|
385
|
+
const match = findHandle(originalSlug, resolvedToolkit);
|
|
386
|
+
if (!match) return;
|
|
387
|
+
const finalSlugKey = finalSlug.toUpperCase();
|
|
388
|
+
if (byFinalSlug.has(finalSlugKey)) throw new ValidationError(`Custom tool slug collision: "${finalSlug}" is already registered.`);
|
|
389
|
+
const entry = {
|
|
390
|
+
handle: match.handle,
|
|
391
|
+
finalSlug,
|
|
392
|
+
toolkit: resolvedToolkit ?? match.toolkit
|
|
393
|
+
};
|
|
394
|
+
byFinalSlug.set(finalSlugKey, entry);
|
|
395
|
+
byToolkitAndOriginalSlug.set(qualifiedOriginalSlugKey(entry.toolkit, originalSlug), entry);
|
|
396
|
+
addOriginalSlugAlias({
|
|
397
|
+
byOriginalSlug,
|
|
398
|
+
ambiguousOriginalSlugs,
|
|
399
|
+
originalSlug,
|
|
400
|
+
entry
|
|
401
|
+
});
|
|
402
|
+
};
|
|
403
|
+
if (experimental?.custom_tools) for (const ct of experimental.custom_tools) addEntry(ct.slug, ct.original_slug, ct.extends_toolkit);
|
|
404
|
+
if (experimental?.custom_toolkits) for (const ctk of experimental.custom_toolkits) for (const ct of ctk.tools) addEntry(ct.slug, ct.original_slug, ctk.slug);
|
|
405
|
+
return {
|
|
406
|
+
byFinalSlug,
|
|
407
|
+
byOriginalSlug,
|
|
408
|
+
byToolkitAndOriginalSlug,
|
|
409
|
+
...ambiguousOriginalSlugs.size ? { ambiguousOriginalSlugs } : {},
|
|
410
|
+
toolkits,
|
|
411
|
+
tools: tools.length ? tools : void 0
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Find a custom tool entry by final slug only.
|
|
416
|
+
*
|
|
417
|
+
* @internal
|
|
418
|
+
*/
|
|
419
|
+
function findCustomToolMapEntryByFinalSlug(customToolsMap, slug) {
|
|
420
|
+
return customToolsMap?.byFinalSlug.get(slug.toUpperCase());
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Find a custom toolkit tool entry by toolkit slug and original tool slug.
|
|
424
|
+
*
|
|
425
|
+
* @internal
|
|
426
|
+
*/
|
|
427
|
+
function findCustomToolMapEntryByToolkitAndOriginalSlug(customToolsMap, toolkit, slug) {
|
|
428
|
+
return customToolsMap?.byToolkitAndOriginalSlug?.get(qualifiedOriginalSlugKey(toolkit, slug));
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Reject legacy attempts to preload custom tools through top-level preload.tools.
|
|
432
|
+
*
|
|
433
|
+
* Custom tool direct exposure is controlled by CustomTool.preload /
|
|
434
|
+
* CustomToolkit.preload so it follows the current SDK-provided custom
|
|
435
|
+
* definitions instead of stale session config.
|
|
436
|
+
*
|
|
437
|
+
* @internal
|
|
438
|
+
*/
|
|
439
|
+
function assertNoCustomToolSlugsInPreload(preloadTools, customToolsMap) {
|
|
440
|
+
if (!preloadTools || preloadTools === "all") return;
|
|
441
|
+
const customPreloadSlugs = preloadTools.filter((slug) => {
|
|
442
|
+
const normalized = slug.toUpperCase();
|
|
443
|
+
return normalized.startsWith("LOCAL_") || customToolsMap?.byOriginalSlug.has(normalized) || customToolsMap?.ambiguousOriginalSlugs?.has(normalized) || customToolsMap?.byFinalSlug.has(normalized);
|
|
444
|
+
});
|
|
445
|
+
if (customPreloadSlugs.length) throw new ValidationError(`Custom tool slugs are not supported in preload.tools: ${customPreloadSlugs.join(", ")}. Set preload: true on the SDK custom tool or custom toolkit definition instead.`);
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Resolve custom tools that the SDK should expose directly from session.tools().
|
|
449
|
+
*
|
|
450
|
+
* @internal
|
|
451
|
+
*/
|
|
452
|
+
function getPreloadedCustomToolSlugs(customToolsMap, defaultPreload = false) {
|
|
453
|
+
if (!customToolsMap) return [];
|
|
454
|
+
const seen = /* @__PURE__ */ new Set();
|
|
455
|
+
const customToolSlugs = [];
|
|
456
|
+
for (const entry of customToolsMap.byFinalSlug.values()) {
|
|
457
|
+
const toolkit = customToolsMap.toolkits?.find((tk) => entry.toolkit && tk.slug.toLowerCase() === entry.toolkit.toLowerCase());
|
|
458
|
+
if (!(entry.handle.preload ?? toolkit?.preload ?? defaultPreload)) continue;
|
|
459
|
+
const finalSlugKey = entry.finalSlug.toUpperCase();
|
|
460
|
+
if (seen.has(finalSlugKey)) continue;
|
|
461
|
+
seen.add(finalSlugKey);
|
|
462
|
+
customToolSlugs.push(entry.finalSlug);
|
|
463
|
+
}
|
|
464
|
+
return customToolSlugs;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
//#endregion
|
|
468
|
+
export { createCustomToolkit as a, getPreloadedCustomToolSlugs as c, CreateCustomToolBaseSchema as d, CreateCustomToolkitBaseSchema as f, createCustomTool as i, serializeCustomToolkits as l, buildCustomToolsMap as n, findCustomToolMapEntryByFinalSlug as o, CustomToolSlugSchema as p, buildCustomToolsMapFromResponse as r, findCustomToolMapEntryByToolkitAndOriginalSlug as s, assertNoCustomToolSlugsInPreload as t, serializeCustomTools as u };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { z } from "zod/v3";
|
|
1
|
+
import { a as CreateCustomToolkitParams, f as CustomToolkit, o as CustomTool, r as CreateCustomToolParams, t as AnyZodSchema } from "./customTool.types-DpIdOJjL.mjs";
|
|
3
2
|
import { SessionCreateResponse } from "@composio/client/resources/tool-router/session/session.mjs";
|
|
4
3
|
|
|
5
4
|
//#region src/models/CustomTool.d.ts
|
|
6
|
-
|
|
7
5
|
/**
|
|
8
6
|
* Create a custom tool for use in tool router sessions.
|
|
9
7
|
*
|
|
@@ -48,7 +46,7 @@ import { SessionCreateResponse } from "@composio/client/resources/tool-router/se
|
|
|
48
46
|
* });
|
|
49
47
|
* ```
|
|
50
48
|
*/
|
|
51
|
-
declare function createCustomTool<T extends
|
|
49
|
+
declare function createCustomTool<T extends AnyZodSchema>(slug: string, options: CreateCustomToolParams<T>): CustomTool;
|
|
52
50
|
/**
|
|
53
51
|
* Create a custom toolkit that groups related tools.
|
|
54
52
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as __exportAll } from "./
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-w6R9maHv.mjs";
|
|
2
2
|
import { BadRequestError } from "@composio/client";
|
|
3
3
|
import { ZodError } from "zod/v3";
|
|
4
|
-
import
|
|
4
|
+
import pc from "picocolors";
|
|
5
5
|
|
|
6
6
|
//#region src/utils/env.ts
|
|
7
7
|
const getEnvVariable = (name, defaultValue = void 0) => {
|
|
@@ -86,14 +86,14 @@ var Logger = class {
|
|
|
86
86
|
const formattedArgs = args.map((arg, index) => {
|
|
87
87
|
if (typeof arg === "object") return JSON.stringify(arg);
|
|
88
88
|
else {
|
|
89
|
-
if (index === 0) if (args.length > 1) return
|
|
89
|
+
if (index === 0) if (args.length > 1) return pc.yellow(`${arg}`);
|
|
90
90
|
else return String(arg);
|
|
91
91
|
return String(arg);
|
|
92
92
|
}
|
|
93
93
|
}).join("\n");
|
|
94
94
|
if (!this.includeTimestamp) return formattedArgs;
|
|
95
95
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
96
|
-
return `${
|
|
96
|
+
return `${pc.gray(timestamp)} - ${formattedArgs}`;
|
|
97
97
|
}
|
|
98
98
|
shouldLog(level) {
|
|
99
99
|
return LOG_LEVELS[level] <= LOG_LEVELS[this.level];
|
|
@@ -112,7 +112,6 @@ var Logger = class {
|
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
114
|
const logger = new Logger();
|
|
115
|
-
var logger_default = logger;
|
|
116
115
|
|
|
117
116
|
//#endregion
|
|
118
117
|
//#region src/errors/ComposioError.ts
|
|
@@ -217,28 +216,28 @@ var ComposioError$1 = class ComposioError$1 extends Error {
|
|
|
217
216
|
*/
|
|
218
217
|
prettyPrint(includeStack = false) {
|
|
219
218
|
const data = this.getErrorData(includeStack);
|
|
220
|
-
let output = "\n" +
|
|
221
|
-
if (data.code) output +=
|
|
222
|
-
if (data.statusCode !== void 0) output +=
|
|
219
|
+
let output = "\n" + pc.bgRed(pc.white(pc.bold(" ERROR "))) + " " + pc.white(pc.bold(data.message)) + "\n";
|
|
220
|
+
if (data.code) output += pc.yellow(`Error Code: ${data.code}`) + "\n";
|
|
221
|
+
if (data.statusCode !== void 0) output += pc.yellow(`Status: ${data.statusCode}`) + "\n";
|
|
223
222
|
if (data.cause) {
|
|
224
|
-
output +=
|
|
225
|
-
output += " " +
|
|
223
|
+
output += pc.gray("Reason:") + "\n";
|
|
224
|
+
output += " " + pc.white(data.cause) + "\n";
|
|
226
225
|
}
|
|
227
226
|
if (data.meta) {
|
|
228
|
-
output +=
|
|
229
|
-
output += " " +
|
|
227
|
+
output += pc.gray("Additional Information:") + "\n";
|
|
228
|
+
output += " " + pc.white(JSON.stringify(data.meta, null, 2).replace(/\n/g, "\n ")) + "\n";
|
|
230
229
|
}
|
|
231
230
|
if (data.possibleFixes?.length) {
|
|
232
|
-
output += "\n" +
|
|
233
|
-
const fixes = data.possibleFixes?.map((fix, index) => ` ${index + 1}. ` +
|
|
231
|
+
output += "\n" + pc.cyan(pc.bold("Try the following:")) + "\n";
|
|
232
|
+
const fixes = data.possibleFixes?.map((fix, index) => ` ${index + 1}. ` + pc.white(fix));
|
|
234
233
|
output += fixes?.join("\n") + "\n";
|
|
235
234
|
}
|
|
236
235
|
if (data.stack?.length) {
|
|
237
|
-
output += "\n" +
|
|
238
|
-
output +=
|
|
236
|
+
output += "\n" + pc.gray("Stack Trace:") + "\n";
|
|
237
|
+
output += pc.gray(data.stack.join("\n")) + "\n";
|
|
239
238
|
}
|
|
240
239
|
output += "\n";
|
|
241
|
-
|
|
240
|
+
logger.error(output);
|
|
242
241
|
}
|
|
243
242
|
/**
|
|
244
243
|
* Static factory method to create and pretty print an error in one step
|
|
@@ -295,28 +294,28 @@ var ComposioError$1 = class ComposioError$1 extends Error {
|
|
|
295
294
|
* @private
|
|
296
295
|
*/
|
|
297
296
|
static handleZodError(error, includeStack) {
|
|
298
|
-
|
|
299
|
-
|
|
297
|
+
logger.error("\n" + pc.bgRed(pc.white(pc.bold(" ERROR "))) + " " + pc.white(pc.bold(error.message)));
|
|
298
|
+
logger.error(pc.gray("Invalid parameters:"));
|
|
300
299
|
error.errors.forEach((err) => {
|
|
301
|
-
|
|
300
|
+
logger.error(pc.yellow(err.path.join(".")) + " " + pc.white(err.message));
|
|
302
301
|
});
|
|
303
|
-
|
|
302
|
+
logger.error(pc.gray("Expected parameters:"));
|
|
304
303
|
error.errors.forEach((err) => {
|
|
305
|
-
|
|
304
|
+
logger.error(pc.yellow(err.path.join(".")) + " " + pc.white(err.message));
|
|
306
305
|
});
|
|
307
306
|
if (includeStack) {
|
|
308
|
-
|
|
307
|
+
logger.error("\n" + pc.gray("Validation Errors:"));
|
|
309
308
|
error.errors.forEach((err) => {
|
|
310
309
|
const path = err.path.join(".");
|
|
311
|
-
|
|
310
|
+
logger.error(pc.gray(" • ") + pc.yellow(path ? `${path}: ` : "") + pc.white(err.message));
|
|
312
311
|
});
|
|
313
312
|
if (error.stack) {
|
|
314
|
-
|
|
313
|
+
logger.error("\n" + pc.gray("Stack Trace:"));
|
|
315
314
|
const stackLines = error.stack.split("\n").slice(1);
|
|
316
|
-
|
|
315
|
+
logger.error(pc.gray(stackLines.join("\n")));
|
|
317
316
|
}
|
|
318
317
|
}
|
|
319
|
-
|
|
318
|
+
logger.error("");
|
|
320
319
|
}
|
|
321
320
|
/**
|
|
322
321
|
* Helper method to handle standard Error objects
|
|
@@ -325,13 +324,13 @@ var ComposioError$1 = class ComposioError$1 extends Error {
|
|
|
325
324
|
* @private
|
|
326
325
|
*/
|
|
327
326
|
static handleStandardError(error, includeStack) {
|
|
328
|
-
|
|
327
|
+
logger.error("\n" + pc.bgRed(pc.white(pc.bold(" ERROR "))) + " " + pc.white(pc.bold(error.message)));
|
|
329
328
|
if (includeStack && error.stack) {
|
|
330
|
-
|
|
329
|
+
logger.error("\n" + pc.gray("Stack Trace:"));
|
|
331
330
|
const stackLines = error.stack.split("\n").slice(1);
|
|
332
|
-
|
|
331
|
+
logger.error(pc.gray(stackLines.join("\n")));
|
|
333
332
|
}
|
|
334
|
-
|
|
333
|
+
logger.error("");
|
|
335
334
|
}
|
|
336
335
|
/**
|
|
337
336
|
* Helper method to handle unknown error types
|
|
@@ -339,12 +338,12 @@ var ComposioError$1 = class ComposioError$1 extends Error {
|
|
|
339
338
|
* @private
|
|
340
339
|
*/
|
|
341
340
|
static handleUnknownError(error) {
|
|
342
|
-
|
|
341
|
+
logger.error("\n" + pc.bgRed(pc.white(pc.bold(" ERROR "))) + " " + pc.white(pc.bold("Unknown error occurred")));
|
|
343
342
|
if (error !== null && error !== void 0) {
|
|
344
|
-
|
|
345
|
-
|
|
343
|
+
logger.error(pc.gray("Error details:"));
|
|
344
|
+
logger.error(" " + pc.white(String(error)));
|
|
346
345
|
}
|
|
347
|
-
|
|
346
|
+
logger.error("");
|
|
348
347
|
}
|
|
349
348
|
};
|
|
350
349
|
|
|
@@ -443,4 +442,4 @@ var ComposioFileNotFoundError = class extends ComposioFileUploadError {
|
|
|
443
442
|
};
|
|
444
443
|
|
|
445
444
|
//#endregion
|
|
446
|
-
export { getEnvVariable as _, ComposioSensitiveFilePathBlockedError as a,
|
|
445
|
+
export { getEnvVariable as _, ComposioSensitiveFilePathBlockedError as a, logger as c, DEFAULT_BASE_URL as d, DEFAULT_TOOL_ROUTER_SESSION_FILES_MOUNT_ID as f, constants_exports as g, USER_DATA_FILE_NAME as h, ComposioFileUploadPathNotAllowedError as i, COMPOSIO_DIR as l, TEMP_FILES_DIRECTORY_NAME as m, ComposioFileUploadAbortedError as n, FileModifierErrorCodes as o, IS_DEVELOPMENT_OR_CI as p, ComposioFileUploadError as r, ComposioError$1 as s, ComposioFileNotFoundError as t, COMPOSIO_LOG_LEVEL as u, getEnvsWithPrefix as v };
|
|
@@ -67,12 +67,6 @@ const schemaHasFileProperty = (schema, property) => {
|
|
|
67
67
|
const schemaHasFileUploadable = (schema) => {
|
|
68
68
|
return schemaHasFileProperty(schema, "file_uploadable");
|
|
69
69
|
};
|
|
70
|
-
/**
|
|
71
|
-
* Recursively checks if a schema (or any of its variants) contains file_downloadable properties.
|
|
72
|
-
*/
|
|
73
|
-
const schemaHasFileDownloadable = (schema) => {
|
|
74
|
-
return schemaHasFileProperty(schema, "file_downloadable");
|
|
75
|
-
};
|
|
76
70
|
|
|
77
71
|
//#endregion
|
|
78
|
-
export { transformProperties as i,
|
|
72
|
+
export { transformProperties as i, schemaHasFileProperty as n, schemaHasFileUploadable as r, isPlainObject as t };
|