@composio/core 0.11.0 → 0.13.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.
Files changed (193) hide show
  1. package/dist/BaseProvider-BBnsv9kS.d.mts +29425 -0
  2. package/dist/{BaseProvider-CVbQxTNa.d.cts → BaseProvider-Brb3o86-.d.mts} +91 -44
  3. package/dist/CustomTool-D9qwyMrv.mjs +468 -0
  4. package/dist/{CustomTool-C-IUByoU.d.cts → CustomTool-Dmi6ti3I.d.mts} +2 -4
  5. package/dist/{CustomTool-CChQSp44.d.mts → CustomTool-DrJpOhY2.d.mts} +2 -4
  6. package/dist/{FileModifierErrors-C7z16Dfi.mjs → FileModifierErrors-3fSwIWoa.mjs} +35 -36
  7. package/dist/{Telemetry-DQax33Gh.mjs → Telemetry-DhGI_J4G.mjs} +15 -15
  8. package/dist/{composio-pcA13w87.d.cts → composio-DHIKRdeG.d.mts} +641 -380
  9. package/dist/{composio-BlASKqjQ.d.mts → composio-vMwhASRc.d.mts} +1390 -1129
  10. package/dist/{customTool.types-QtkAZQma.d.cts → customTool.types-CKH2R2ia.d.mts} +487 -189
  11. package/dist/{customTool.types-DLIORcYN.d.mts → customTool.types-DXin7Cfc.d.mts} +924 -626
  12. package/dist/docs/error-consistency.md +97 -0
  13. package/dist/docs/reference/sdk-reference/typescript/auth-configs.mdx +306 -0
  14. package/dist/docs/reference/sdk-reference/typescript/composio.mdx +205 -0
  15. package/dist/docs/reference/sdk-reference/typescript/connected-accounts.mdx +488 -0
  16. package/dist/docs/reference/sdk-reference/typescript/experimental.mdx +94 -0
  17. package/dist/docs/reference/sdk-reference/typescript/index.mdx +67 -0
  18. package/dist/docs/reference/sdk-reference/typescript/mcp.mdx +304 -0
  19. package/dist/docs/reference/sdk-reference/typescript/meta.json +17 -0
  20. package/dist/docs/reference/sdk-reference/typescript/remote-file.mdx +107 -0
  21. package/dist/docs/reference/sdk-reference/typescript/session-files.mdx +163 -0
  22. package/dist/docs/reference/sdk-reference/typescript/session.mdx +229 -0
  23. package/dist/docs/reference/sdk-reference/typescript/sessions.mdx +131 -0
  24. package/dist/docs/reference/sdk-reference/typescript/toolkits.mdx +169 -0
  25. package/dist/docs/reference/sdk-reference/typescript/tools.mdx +453 -0
  26. package/dist/docs/reference/sdk-reference/typescript/triggers.mdx +434 -0
  27. package/dist/{CustomTool-D5s-aADw.mjs → errors-DSIlYfl5.mjs} +72 -459
  28. package/dist/experimental/index.d.mts +2 -3
  29. package/dist/experimental/index.mjs +1 -3
  30. package/dist/{fileUtils.node-Dq7ebZPC.mjs → fileUtils.node-BiO1JQsJ.mjs} +26 -25
  31. package/dist/index.d.mts +1708 -2400
  32. package/dist/index.mjs +2632 -2006
  33. package/dist/jsonSchema-CFKdONpP.mjs +251 -0
  34. package/dist/models/Files.node.d.mts +1 -2
  35. package/dist/models/Files.node.mjs +3 -4
  36. package/dist/models/Files.workerd.d.mts +0 -1
  37. package/dist/platform/node.d.mts +1 -2
  38. package/dist/platform/workerd.d.mts +1 -2
  39. package/dist/{chunk-CWQeghP5.mjs → rolldown-runtime-w6R9maHv.mjs} +3 -5
  40. package/dist/{types-J2KCXP8R.d.mts → types-D4Id3wXA.d.mts} +2 -3
  41. package/dist/{types-DRG5qLxI.d.cts → types-qTbYYBJw.d.mts} +2 -3
  42. package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -4
  43. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -4
  44. package/dist/utils/config-defaults/ConfigDefaults.workerd.mjs +3 -0
  45. package/dist/utils/json-schema.d.mts +2 -0
  46. package/dist/utils/json-schema.mjs +3 -0
  47. package/dist/utils/modifiers/FileToolModifier.node.d.mts +3 -1
  48. package/dist/utils/modifiers/FileToolModifier.node.mjs +44 -24
  49. package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +3 -1
  50. package/dist/utils/modifiers/FileToolModifier.workerd.mjs +1 -1
  51. package/docs/error-consistency.md +97 -0
  52. package/package.json +40 -88
  53. package/src/composio.ts +509 -0
  54. package/src/errors/AuthConfigErrors.ts +23 -0
  55. package/src/errors/ComposioError.ts +408 -0
  56. package/src/errors/ConnectedAccountsErrors.ts +158 -0
  57. package/src/errors/ConnectionRequestErrors.ts +32 -0
  58. package/src/errors/FileModifierErrors.ts +100 -0
  59. package/src/errors/PusherErrors.ts +28 -0
  60. package/src/errors/RemoteFileErrors.ts +62 -0
  61. package/src/errors/SDKErrors.ts +92 -0
  62. package/src/errors/ToolErrors.ts +244 -0
  63. package/src/errors/ToolkitErrors.ts +39 -0
  64. package/src/errors/TriggerErrors.ts +120 -0
  65. package/src/errors/ValidationErrors.ts +99 -0
  66. package/src/errors/index.ts +41 -0
  67. package/src/experimental/index.ts +28 -0
  68. package/src/index.ts +64 -0
  69. package/src/lib/toolRouterConstants.ts +1 -0
  70. package/src/lib/toolRouterParams.ts +306 -0
  71. package/src/models/AuthConfigs.ts +398 -0
  72. package/src/models/AuthScheme.ts +206 -0
  73. package/src/models/ConnectedAccounts.ts +735 -0
  74. package/src/models/ConnectionRequest.ts +150 -0
  75. package/src/models/CustomTool.ts +676 -0
  76. package/src/models/Experimental.ts +202 -0
  77. package/src/models/Files.node.ts +93 -0
  78. package/src/models/Files.workerd.ts +49 -0
  79. package/src/models/MCP.ts +478 -0
  80. package/src/models/RemoteFile.ts +172 -0
  81. package/src/models/SessionContext.ts +147 -0
  82. package/src/models/Sessions.ts +21 -0
  83. package/src/models/ToolRouter.ts +391 -0
  84. package/src/models/ToolRouterSession.ts +827 -0
  85. package/src/models/ToolRouterSessionFileMount.ts +389 -0
  86. package/src/models/Toolkits.ts +412 -0
  87. package/src/models/Tools.ts +1260 -0
  88. package/src/models/Triggers.ts +1381 -0
  89. package/src/models/customToolExecution.ts +118 -0
  90. package/src/models/inlineCustomToolsPayload.ts +17 -0
  91. package/src/models/proxyParamsTransform.ts +26 -0
  92. package/src/provider/BaseProvider.ts +138 -0
  93. package/src/provider/ComposioProvider.ts +29 -0
  94. package/src/provider/OpenAIProvider.ts +547 -0
  95. package/src/services/internal/InternalService.ts +50 -0
  96. package/src/services/internal/InternalService.types.ts +14 -0
  97. package/src/services/pusher/Pusher.ts +230 -0
  98. package/src/services/telemetry/TelemetryService.ts +48 -0
  99. package/src/services/telemetry/TelemetryService.types.ts +67 -0
  100. package/src/telemetry/BatchProcessor.ts +77 -0
  101. package/src/telemetry/README.md +123 -0
  102. package/src/telemetry/Telemetry.ts +356 -0
  103. package/src/types/ToolRouterSessionFilesMount.types.ts +96 -0
  104. package/src/types/authConfigs.types.ts +174 -0
  105. package/src/types/composio.types.ts +1 -0
  106. package/src/types/connectedAccountAuthStates.types.ts +852 -0
  107. package/src/types/connectedAccounts.types.ts +395 -0
  108. package/src/types/connectionRequest.types.ts +16 -0
  109. package/src/types/customTool.types.ts +261 -0
  110. package/{dist/files.types-lo4zZd87.d.cts → src/types/files.types.ts} +3 -5
  111. package/src/types/mcp.experimental.types.ts +163 -0
  112. package/src/types/mcp.types.ts +362 -0
  113. package/src/types/modifiers.types.ts +663 -0
  114. package/src/types/org.types.ts +0 -0
  115. package/src/types/provider.types.ts +41 -0
  116. package/src/types/pusher.types.ts +18 -0
  117. package/src/types/requestOptions.types.ts +62 -0
  118. package/src/types/telemetry.types.ts +89 -0
  119. package/src/types/tool.types.ts +408 -0
  120. package/src/types/toolRouter.types.ts +761 -0
  121. package/src/types/toolkit.types.ts +130 -0
  122. package/src/types/triggers.types.ts +401 -0
  123. package/src/types/webhookEvents.types.ts +219 -0
  124. package/src/utils/buffer.ts +30 -0
  125. package/src/utils/cancellation.ts +22 -0
  126. package/src/utils/config-defaults/ConfigDefaults.node.ts +7 -0
  127. package/src/utils/config-defaults/ConfigDefaults.workerd.ts +10 -0
  128. package/src/utils/config-defaults/index.ts +1 -0
  129. package/src/utils/config-defaults/types.ts +14 -0
  130. package/src/utils/constants.ts +22 -0
  131. package/src/utils/crypto.ts +34 -0
  132. package/src/utils/env.ts +34 -0
  133. package/src/utils/fileDirs.ts +81 -0
  134. package/src/utils/fileUtils.node.ts +458 -0
  135. package/src/utils/json-schema.ts +1 -0
  136. package/src/utils/jsonSchema.ts +355 -0
  137. package/src/utils/logger.ts +99 -0
  138. package/src/utils/mime.ts +75 -0
  139. package/src/utils/modifiers/FileToolModifier.node.ts +477 -0
  140. package/src/utils/modifiers/FileToolModifier.utils.neutral.ts +132 -0
  141. package/src/utils/modifiers/FileToolModifier.workerd.ts +51 -0
  142. package/src/utils/pagination.ts +73 -0
  143. package/src/utils/pusher.ts +286 -0
  144. package/src/utils/schemaPropertyKeys.ts +433 -0
  145. package/src/utils/sdk.ts +110 -0
  146. package/src/utils/sensitiveFileUploadPaths.node.ts +105 -0
  147. package/src/utils/session.ts +114 -0
  148. package/src/utils/toolArguments.ts +73 -0
  149. package/src/utils/toolkitVersion.ts +26 -0
  150. package/src/utils/transform.ts +42 -0
  151. package/src/utils/transformers/authConfigs.ts +107 -0
  152. package/src/utils/transformers/connectedAccounts.ts +119 -0
  153. package/src/utils/transformers/mcp.ts +164 -0
  154. package/src/utils/transformers/toolRouterResponseTransform.ts +160 -0
  155. package/src/utils/transformers/toolkits.ts +100 -0
  156. package/src/utils/transformers/triggers.ts +118 -0
  157. package/src/utils/uploadDirAllowlist.node.ts +178 -0
  158. package/src/utils/uuid.ts +7 -0
  159. package/src/utils/version.ts +58 -0
  160. package/src/utils/zodSchema.ts +90 -0
  161. package/dist/BaseProvider-BvHvJLXc.d.mts +0 -29378
  162. package/dist/CustomTool-D3-NreIm.cjs +0 -1341
  163. package/dist/FileModifierErrors-BYJBHiay.cjs +0 -554
  164. package/dist/FileToolModifier.utils.neutral-DSBQs9-i.cjs +0 -96
  165. package/dist/Telemetry-BQ_pl5AK.cjs +0 -360
  166. package/dist/buffer-BjWptbNH.cjs +0 -63
  167. package/dist/chunk-CQwRTUmo.cjs +0 -53
  168. package/dist/experimental/index.cjs +0 -5
  169. package/dist/experimental/index.d.cts +0 -3
  170. package/dist/fileUtils.node-DtnSRMWa.cjs +0 -462
  171. package/dist/index.cjs +0 -8523
  172. package/dist/index.d.cts +0 -6065
  173. package/dist/models/Files.node.cjs +0 -55
  174. package/dist/models/Files.node.d.cts +0 -56
  175. package/dist/models/Files.workerd.cjs +0 -29
  176. package/dist/models/Files.workerd.d.cts +0 -13
  177. package/dist/platform/node.cjs +0 -55
  178. package/dist/platform/node.d.cts +0 -11
  179. package/dist/platform/workerd.cjs +0 -42
  180. package/dist/platform/workerd.d.cts +0 -12
  181. package/dist/types-pDNm1lYs.d.cts +0 -69
  182. package/dist/utils/config-defaults/ConfigDefaults.node.cjs +0 -10
  183. package/dist/utils/config-defaults/ConfigDefaults.node.d.cts +0 -7
  184. package/dist/utils/config-defaults/ConfigDefaults.workerd.cjs +0 -10
  185. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.cts +0 -7
  186. package/dist/utils/modifiers/FileToolModifier.node.cjs +0 -224
  187. package/dist/utils/modifiers/FileToolModifier.node.d.cts +0 -22
  188. package/dist/utils/modifiers/FileToolModifier.workerd.cjs +0 -27
  189. package/dist/utils/modifiers/FileToolModifier.workerd.d.cts +0 -20
  190. /package/dist/{FileToolModifier.utils.neutral-BpSceNK8.mjs → FileToolModifier.utils.neutral-B5rT711M.mjs} +0 -0
  191. /package/dist/{buffer-yOtEsT4J.mjs → buffer-PcbMMsgm.mjs} +0 -0
  192. /package/dist/{files.types-BXDWA_zS.d.mts → files.types-DeMC_mAW.d.mts} +0 -0
  193. /package/dist/{types-HpJQ8K9l.d.mts → types-DdoCRzLj.d.mts} +0 -0
@@ -0,0 +1,468 @@
1
+ import { T as ValidationError } from "./errors-DSIlYfl5.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 CustomTool, d as CustomToolkit, i as CreateCustomToolkitParams, n as CreateCustomToolParams } from "./customTool.types-QtkAZQma.cjs";
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-CKH2R2ia.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 z.ZodType>(slug: string, options: CreateCustomToolParams<T>): CustomTool;
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,9 +1,7 @@
1
- import { a as CustomTool, d as CustomToolkit, i as CreateCustomToolkitParams, n as CreateCustomToolParams } from "./customTool.types-DLIORcYN.mjs";
2
- import { z as z$1 } from "zod/v3";
1
+ import { a as CreateCustomToolkitParams, f as CustomToolkit, o as CustomTool, r as CreateCustomToolParams, t as AnyZodSchema } from "./customTool.types-DXin7Cfc.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 z$1.ZodType>(slug: string, options: CreateCustomToolParams<T>): CustomTool;
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 "./chunk-CWQeghP5.mjs";
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 chalk from "chalk";
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 chalk.yellow(`${arg}`);
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 `${chalk.gray(timestamp)} - ${formattedArgs}`;
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" + chalk.bgRed.white.bold(" ERROR ") + " " + chalk.white.bold(data.message) + "\n";
221
- if (data.code) output += chalk.yellow(`Error Code: ${data.code}`) + "\n";
222
- if (data.statusCode !== void 0) output += chalk.yellow(`Status: ${data.statusCode}`) + "\n";
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 += chalk.gray("Reason:") + "\n";
225
- output += " " + chalk.white(data.cause) + "\n";
223
+ output += pc.gray("Reason:") + "\n";
224
+ output += " " + pc.white(data.cause) + "\n";
226
225
  }
227
226
  if (data.meta) {
228
- output += chalk.gray("Additional Information:") + "\n";
229
- output += " " + chalk.white(JSON.stringify(data.meta, null, 2).replace(/\n/g, "\n ")) + "\n";
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" + chalk.cyan.bold("Try the following:") + "\n";
233
- const fixes = data.possibleFixes?.map((fix, index) => ` ${index + 1}. ` + chalk.white(fix));
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" + chalk.gray("Stack Trace:") + "\n";
238
- output += chalk.gray(data.stack.join("\n")) + "\n";
236
+ output += "\n" + pc.gray("Stack Trace:") + "\n";
237
+ output += pc.gray(data.stack.join("\n")) + "\n";
239
238
  }
240
239
  output += "\n";
241
- logger_default.error(output);
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
- logger_default.error("\n" + chalk.bgRed.white.bold(" ERROR ") + " " + chalk.white.bold(error.message));
299
- logger_default.error(chalk.gray("Invalid parameters:"));
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
- logger_default.error(chalk.yellow(err.path.join(".")) + " " + chalk.white(err.message));
300
+ logger.error(pc.yellow(err.path.join(".")) + " " + pc.white(err.message));
302
301
  });
303
- logger_default.error(chalk.gray("Expected parameters:"));
302
+ logger.error(pc.gray("Expected parameters:"));
304
303
  error.errors.forEach((err) => {
305
- logger_default.error(chalk.yellow(err.path.join(".")) + " " + chalk.white(err.message));
304
+ logger.error(pc.yellow(err.path.join(".")) + " " + pc.white(err.message));
306
305
  });
307
306
  if (includeStack) {
308
- logger_default.error("\n" + chalk.gray("Validation Errors:"));
307
+ logger.error("\n" + pc.gray("Validation Errors:"));
309
308
  error.errors.forEach((err) => {
310
309
  const path = err.path.join(".");
311
- logger_default.error(chalk.gray(" • ") + chalk.yellow(path ? `${path}: ` : "") + chalk.white(err.message));
310
+ logger.error(pc.gray(" • ") + pc.yellow(path ? `${path}: ` : "") + pc.white(err.message));
312
311
  });
313
312
  if (error.stack) {
314
- logger_default.error("\n" + chalk.gray("Stack Trace:"));
313
+ logger.error("\n" + pc.gray("Stack Trace:"));
315
314
  const stackLines = error.stack.split("\n").slice(1);
316
- logger_default.error(chalk.gray(stackLines.join("\n")));
315
+ logger.error(pc.gray(stackLines.join("\n")));
317
316
  }
318
317
  }
319
- logger_default.error("");
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
- logger_default.error("\n" + chalk.bgRed.white.bold(" ERROR ") + " " + chalk.white.bold(error.message));
327
+ logger.error("\n" + pc.bgRed(pc.white(pc.bold(" ERROR "))) + " " + pc.white(pc.bold(error.message)));
329
328
  if (includeStack && error.stack) {
330
- logger_default.error("\n" + chalk.gray("Stack Trace:"));
329
+ logger.error("\n" + pc.gray("Stack Trace:"));
331
330
  const stackLines = error.stack.split("\n").slice(1);
332
- logger_default.error(chalk.gray(stackLines.join("\n")));
331
+ logger.error(pc.gray(stackLines.join("\n")));
333
332
  }
334
- logger_default.error("");
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
- logger_default.error("\n" + chalk.bgRed.white.bold(" ERROR ") + " " + chalk.white.bold("Unknown error occurred"));
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
- logger_default.error(chalk.gray("Error details:"));
345
- logger_default.error(" " + chalk.white(String(error)));
343
+ logger.error(pc.gray("Error details:"));
344
+ logger.error(" " + pc.white(String(error)));
346
345
  }
347
- logger_default.error("");
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, logger_default 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 };
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 };