@composio/core 0.1.12-alpha.15 → 0.1.12-alpha.16

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 CHANGED
@@ -922,6 +922,262 @@ var TelemetryService = class {
922
922
  };
923
923
  var telemetry = new TelemetryService();
924
924
 
925
+ // src/types/connectedAccounts.types.ts
926
+ var import_zod3 = require("zod");
927
+ var ConnectedAccountStatuses = {
928
+ INITIALIZING: "INITIALIZING",
929
+ INITIATED: "INITIATED",
930
+ ACTIVE: "ACTIVE",
931
+ FAILED: "FAILED",
932
+ EXPIRED: "EXPIRED"
933
+ };
934
+ var ConnectedAccountStatusSchema = import_zod3.z.enum([
935
+ ConnectedAccountStatuses.INITIALIZING,
936
+ ConnectedAccountStatuses.INITIATED,
937
+ ConnectedAccountStatuses.ACTIVE,
938
+ ConnectedAccountStatuses.FAILED,
939
+ ConnectedAccountStatuses.EXPIRED
940
+ ]);
941
+ var CreateConnectedAccountParamsSchema = import_zod3.z.object({
942
+ authConfig: import_zod3.z.object({
943
+ id: import_zod3.z.string()
944
+ }),
945
+ connection: import_zod3.z.object({
946
+ data: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional(),
947
+ callbackUrl: import_zod3.z.string().optional(),
948
+ userId: import_zod3.z.string().optional()
949
+ })
950
+ });
951
+ var DefaultCreateConnectedAccountParamsSchema = import_zod3.z.object({
952
+ auth_config: import_zod3.z.object({
953
+ id: import_zod3.z.string()
954
+ }),
955
+ connection: import_zod3.z.object({
956
+ data: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional(),
957
+ callback_url: import_zod3.z.string().optional(),
958
+ user_id: import_zod3.z.string().optional()
959
+ })
960
+ });
961
+ var CreateConnectedAccountOptionsSchema = import_zod3.z.object({
962
+ callbackUrl: import_zod3.z.string().optional(),
963
+ data: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional()
964
+ });
965
+ var CreateConnectedAccountResponseSchema = import_zod3.z.object({
966
+ id: import_zod3.z.string(),
967
+ status: ConnectedAccountStatusSchema,
968
+ redirectUrl: import_zod3.z.string().nullable()
969
+ });
970
+ var ConnectedAccountAuthSchemes = {
971
+ OAUTH2: "OAUTH2",
972
+ OAUTH1: "OAUTH1",
973
+ OAUTH1A: "OAUTH1A",
974
+ API_KEY: "API_KEY",
975
+ BASIC: "BASIC",
976
+ BILLCOM_AUTH: "BILLCOM_AUTH",
977
+ BEARER_TOKEN: "BEARER_TOKEN",
978
+ GOOGLE_SERVICE_ACCOUNT: "GOOGLE_SERVICE_ACCOUNT",
979
+ NO_AUTH: "NO_AUTH",
980
+ BASIC_WITH_JWT: "BASIC_WITH_JWT",
981
+ COMPOSIO_LINK: "COMPOSIO_LINK",
982
+ CALCOM_AUTH: "CALCOM_AUTH",
983
+ SNOWFLAKE: "SNOWFLAKE"
984
+ };
985
+ var ConnectedAccountAuthSchemesSchema = import_zod3.z.enum([
986
+ ConnectedAccountAuthSchemes.OAUTH2,
987
+ ConnectedAccountAuthSchemes.OAUTH1,
988
+ ConnectedAccountAuthSchemes.OAUTH1A,
989
+ ConnectedAccountAuthSchemes.API_KEY,
990
+ ConnectedAccountAuthSchemes.BASIC,
991
+ ConnectedAccountAuthSchemes.BILLCOM_AUTH,
992
+ ConnectedAccountAuthSchemes.BEARER_TOKEN,
993
+ ConnectedAccountAuthSchemes.GOOGLE_SERVICE_ACCOUNT,
994
+ ConnectedAccountAuthSchemes.NO_AUTH,
995
+ ConnectedAccountAuthSchemes.BASIC_WITH_JWT,
996
+ ConnectedAccountAuthSchemes.COMPOSIO_LINK,
997
+ ConnectedAccountAuthSchemes.CALCOM_AUTH,
998
+ ConnectedAccountAuthSchemes.SNOWFLAKE
999
+ ]);
1000
+ var ConnectedAccountAuthConfigSchema = import_zod3.z.object({
1001
+ id: import_zod3.z.string(),
1002
+ authScheme: ConnectedAccountAuthSchemesSchema,
1003
+ isComposioManaged: import_zod3.z.boolean(),
1004
+ isDisabled: import_zod3.z.boolean()
1005
+ });
1006
+ var ConnectedAccountRetrieveResponseSchema = import_zod3.z.object({
1007
+ id: import_zod3.z.string(),
1008
+ authConfig: ConnectedAccountAuthConfigSchema,
1009
+ userId: import_zod3.z.string(),
1010
+ data: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()),
1011
+ params: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional(),
1012
+ status: ConnectedAccountStatusSchema,
1013
+ statusReason: import_zod3.z.string().nullable(),
1014
+ toolkit: import_zod3.z.object({
1015
+ slug: import_zod3.z.string()
1016
+ }),
1017
+ testRequestEndpoint: import_zod3.z.string().optional(),
1018
+ isDisabled: import_zod3.z.boolean(),
1019
+ createdAt: import_zod3.z.string(),
1020
+ updatedAt: import_zod3.z.string()
1021
+ });
1022
+ var ConnectedAccountListParamsSchema = import_zod3.z.object({
1023
+ authConfigIds: import_zod3.z.array(import_zod3.z.string()).nullable().optional().describe("The auth config ids of the connected accounts"),
1024
+ cursor: import_zod3.z.number().nullable().optional().describe("The cursor to paginate through the connected accounts"),
1025
+ labels: import_zod3.z.array(import_zod3.z.string()).nullable().optional().describe("The labels of the connected accounts"),
1026
+ limit: import_zod3.z.number().nullable().optional().describe("The limit of the connected accounts to return"),
1027
+ orderBy: import_zod3.z.enum(["created_at", "updated_at"]).optional().describe("The order by of the connected accounts"),
1028
+ statuses: import_zod3.z.array(ConnectedAccountStatusSchema).nullable().optional().describe("The statuses of the connected accounts"),
1029
+ toolkitSlugs: import_zod3.z.array(import_zod3.z.string()).nullable().optional().describe("The toolkit slugs of the connected accounts"),
1030
+ userIds: import_zod3.z.array(import_zod3.z.string()).nullable().optional().describe("The user ids of the connected accounts")
1031
+ });
1032
+ var ConnectedAccountListResponseSchema = import_zod3.z.object({
1033
+ items: import_zod3.z.array(ConnectedAccountRetrieveResponseSchema).describe("The list of connected accounts"),
1034
+ nextCursor: import_zod3.z.string().nullable().describe("The next cursor to paginate through the connected accounts"),
1035
+ totalPages: import_zod3.z.number().describe("The total number of pages of connected accounts")
1036
+ });
1037
+
1038
+ // src/errors/AuthConfigErrors.ts
1039
+ var AuthConfigErrorCodes = {
1040
+ AUTH_CONFIG_NOT_FOUND: "AUTH_CONFIG_NOT_FOUND"
1041
+ };
1042
+ var ComposioAuthConfigNotFoundError = class extends ComposioError {
1043
+ constructor(message = "Auth config not found", options = {}) {
1044
+ super(message, {
1045
+ ...options,
1046
+ code: AuthConfigErrorCodes.AUTH_CONFIG_NOT_FOUND,
1047
+ possibleFixes: options.possibleFixes || [
1048
+ "Check if the auth config exists",
1049
+ "Check if the auth config id is correct",
1050
+ "Check if the auth config is enabled"
1051
+ ]
1052
+ });
1053
+ this.name = "ComposioAuthConfigNotFoundError";
1054
+ }
1055
+ };
1056
+
1057
+ // src/errors/ConnectionRequestErrors.ts
1058
+ var ConnectionRequestErrorCodes = {
1059
+ CONNECTION_REQUEST_TIMEOUT: "CONNECTION_REQUEST_TIMEOUT",
1060
+ CONNECTION_REQUEST_FAILED: "CONNECTION_REQUEST_FAILED"
1061
+ };
1062
+ var ConnectionRequestTimeoutError = class extends ComposioError {
1063
+ constructor(message = "Connection request timed out", options = {}) {
1064
+ super(message, {
1065
+ ...options,
1066
+ code: ConnectionRequestErrorCodes.CONNECTION_REQUEST_TIMEOUT
1067
+ });
1068
+ this.name = "ConnectionRequestTimeoutError";
1069
+ }
1070
+ };
1071
+ var ConnectionRequestFailedError = class extends ComposioError {
1072
+ constructor(message = "Connection request failed", options = {}) {
1073
+ super(message, {
1074
+ ...options,
1075
+ code: ConnectionRequestErrorCodes.CONNECTION_REQUEST_FAILED
1076
+ });
1077
+ this.name = "ConnectionRequestFailedError";
1078
+ }
1079
+ };
1080
+
1081
+ // src/errors/ToolkitErrors.ts
1082
+ var ToolkitErrorCodes = {
1083
+ TOOLKIT_NOT_FOUND: "TOOLKIT_NOT_FOUND"
1084
+ };
1085
+ var ComposioToolkitNotFoundError = class extends ComposioError {
1086
+ constructor(message = "Toolkit not found", options = {}) {
1087
+ super(message, {
1088
+ ...options,
1089
+ code: "TOOLKIT_NOT_FOUND",
1090
+ possibleFixes: options.possibleFixes || [
1091
+ "Ensure the toolkit is correctly configured and the slug is valid"
1092
+ ]
1093
+ });
1094
+ this.name = "ComposioToolkitNotFoundError";
1095
+ }
1096
+ };
1097
+ var ComposioToolkitFetchError = class extends ComposioError {
1098
+ constructor(message = "Failed to fetch toolkit", options = {}) {
1099
+ super(message, {
1100
+ ...options,
1101
+ code: "TOOLKIT_FETCH_ERROR",
1102
+ possibleFixes: options.possibleFixes || [
1103
+ "Ensure the toolkit slug is valid",
1104
+ "Ensure you are using the correct API key",
1105
+ "Ensure you are using the correct API endpoint / Base URL and it is working"
1106
+ ]
1107
+ });
1108
+ this.name = "ComposioToolkitFetchError";
1109
+ }
1110
+ };
1111
+
1112
+ // src/errors/ValidationErrors.ts
1113
+ var import_zod4 = require("zod");
1114
+ var ValidationErrorCodes = {
1115
+ VALIDATION_ERROR: "VALIDATION_ERROR"
1116
+ };
1117
+ var ValidationError = class extends ComposioError {
1118
+ constructor(message = "Input validation failed", options = {}) {
1119
+ const { cause: providedZodError, ...restOptions } = options;
1120
+ let zodErrorInstance;
1121
+ if (providedZodError instanceof import_zod4.ZodError) {
1122
+ zodErrorInstance = providedZodError;
1123
+ } else {
1124
+ zodErrorInstance = new import_zod4.ZodError([
1125
+ {
1126
+ path: [],
1127
+ message: "Invalid input",
1128
+ code: "custom"
1129
+ }
1130
+ ]);
1131
+ }
1132
+ const issues = zodErrorInstance.issues.map(
1133
+ (issue) => `[${issue.code}] ${issue.path.join(".")} - ${issue.message}`
1134
+ );
1135
+ super(message, {
1136
+ ...restOptions,
1137
+ code: options.code || ValidationErrorCodes.VALIDATION_ERROR,
1138
+ possibleFixes: issues,
1139
+ cause: zodErrorInstance
1140
+ });
1141
+ this.name = "ValidationError";
1142
+ const userFriendlyMessage = this.generateUserFriendlyMessage();
1143
+ this.message = `${message}: ${userFriendlyMessage}`;
1144
+ }
1145
+ generateUserFriendlyMessage() {
1146
+ if (this.cause instanceof import_zod4.ZodError && this.cause.issues.length > 0) {
1147
+ const issue = this.cause.issues[0];
1148
+ const path = issue.path.join(".");
1149
+ const param = path || "parameter";
1150
+ if (issue.code === "invalid_type") {
1151
+ return `The ${param} should be a ${issue.expected}, but you provided a ${issue.received}`;
1152
+ }
1153
+ return issue.message;
1154
+ }
1155
+ return "Please check your input parameters";
1156
+ }
1157
+ };
1158
+
1159
+ // src/errors/SDKErrors.ts
1160
+ var SDKErrorCodes = {
1161
+ NO_API_KEY_PROVIDED: "NO_API_KEY_PROVIDED"
1162
+ };
1163
+ var ComposioNoAPIKeyError = class extends ComposioError {
1164
+ constructor(message = "No Composio API key provided", options = {}) {
1165
+ const defaultCause = "Couldn't find an API key in the params, environment variables or in the user config file";
1166
+ super(message, {
1167
+ ...options,
1168
+ code: "NO_API_KEY",
1169
+ cause: options.cause || defaultCause,
1170
+ possibleFixes: options.possibleFixes || [
1171
+ "Ensure you have an API key passed in the params, or in environment variable (COMPOSIO_API_KEY) or in the user config file",
1172
+ "To get an API key, please sign up at https://composio.dev/signup",
1173
+ "You can also use the Composio CLI to create a project and get an API key"
1174
+ ],
1175
+ statusCode: 401
1176
+ });
1177
+ this.name = "ComposioNoAPIKeyError";
1178
+ }
1179
+ };
1180
+
925
1181
  // src/models/CustomTools.ts
926
1182
  var CustomTools = class {
927
1183
  client;
@@ -939,7 +1195,7 @@ var CustomTools = class {
939
1195
  * This is just an in memory registry and is not persisted.
940
1196
  * @param {CustomToolOptions} toolOptions CustomToolOptions
941
1197
  * @returns {Tool} The tool created
942
- *
1198
+ *
943
1199
  * @example
944
1200
  * ```typescript
945
1201
  * // Create a custom tool with input parameters
@@ -987,6 +1243,8 @@ var CustomTools = class {
987
1243
  properties: {}
988
1244
  },
989
1245
  tags: [],
1246
+ // this is never set to the user provided toolkitslug so that we can differentiate
1247
+ // the toolkitslug is used via the execute function.
990
1248
  toolkit: { name: "custom", slug: "custom" }
991
1249
  };
992
1250
  this.customToolsRegistry.set(slug.toLowerCase(), {
@@ -999,12 +1257,12 @@ var CustomTools = class {
999
1257
  * Get all the custom tools from the registry.
1000
1258
  * @param {string[]} param0.toolSlugs The slugs of the tools to get
1001
1259
  * @returns {ToolList} The list of tools
1002
- *
1260
+ *
1003
1261
  * @example
1004
1262
  * ```typescript
1005
1263
  * // Get all custom tools
1006
1264
  * const allTools = await composio.customTools.getCustomTools({});
1007
- *
1265
+ *
1008
1266
  * // Get specific custom tools by slug
1009
1267
  * const specificTools = await composio.customTools.getCustomTools({
1010
1268
  * toolSlugs: ['MY_CUSTOM_TOOL', 'ANOTHER_CUSTOM_TOOL']
@@ -1029,7 +1287,7 @@ var CustomTools = class {
1029
1287
  * Get a custom tool by slug from the registry.
1030
1288
  * @param {string} slug The slug of the tool to get
1031
1289
  * @returns {Tool} The tool
1032
- *
1290
+ *
1033
1291
  * @example
1034
1292
  * ```typescript
1035
1293
  * // Get a specific custom tool by its slug
@@ -1059,7 +1317,7 @@ var CustomTools = class {
1059
1317
  * @param {ExecuteMetadata} metadata The metadata of the execution
1060
1318
  * @returns {ConnectedAccount} The connected account
1061
1319
  */
1062
- async getConnectedAccount(toolkitSlug, metadata) {
1320
+ async getConnectedAccountForToolkit(toolkitSlug, userId, connectedAccountId) {
1063
1321
  try {
1064
1322
  await this.client.toolkits.retrieve(toolkitSlug);
1065
1323
  } catch (error) {
@@ -1069,43 +1327,92 @@ var CustomTools = class {
1069
1327
  }
1070
1328
  const connectedAccounts = await this.client.connectedAccounts.list({
1071
1329
  toolkit_slugs: [toolkitSlug],
1072
- user_ids: [metadata.userId]
1330
+ user_ids: [userId]
1073
1331
  });
1074
1332
  if (!connectedAccounts.items.length) {
1075
1333
  throw new ComposioConnectedAccountNotFoundError(
1076
1334
  `No connected accounts found for toolkit ${toolkitSlug}`
1077
1335
  );
1078
1336
  }
1079
- return metadata.connectedAccountId ? connectedAccounts.items.find((item) => item.id === metadata.connectedAccountId) : connectedAccounts.items[0];
1337
+ const connectedAccount = connectedAccountId ? connectedAccounts.items.find((item) => item.id === connectedAccountId) : connectedAccounts.items[0];
1338
+ if (!connectedAccount) {
1339
+ throw new ComposioConnectedAccountNotFoundError(
1340
+ `Connected account not found for toolkit ${toolkitSlug} for user ${userId}`
1341
+ );
1342
+ }
1343
+ const connectedAccountResponse = await ConnectedAccountRetrieveResponseSchema.safeParse({
1344
+ id: connectedAccount.id,
1345
+ authConfig: {
1346
+ id: connectedAccount.auth_config.id,
1347
+ authScheme: connectedAccount.auth_config.auth_scheme,
1348
+ isComposioManaged: connectedAccount.auth_config.is_composio_managed,
1349
+ isDisabled: connectedAccount.auth_config.is_disabled
1350
+ },
1351
+ userId: connectedAccount.user_id,
1352
+ data: connectedAccount.data || {},
1353
+ status: connectedAccount.status,
1354
+ statusReason: connectedAccount.status_reason,
1355
+ toolkit: {
1356
+ slug: connectedAccount.toolkit.slug
1357
+ },
1358
+ testRequestEndpoint: connectedAccount.test_request_endpoint,
1359
+ isDisabled: connectedAccount.is_disabled,
1360
+ createdAt: connectedAccount.created_at,
1361
+ updatedAt: connectedAccount.updated_at
1362
+ });
1363
+ if (!connectedAccountResponse.success) {
1364
+ throw new ValidationError(
1365
+ `Validation error for connected account of ${toolkitSlug} for user ${userId}`,
1366
+ {
1367
+ cause: connectedAccountResponse.error
1368
+ }
1369
+ );
1370
+ }
1371
+ return connectedAccountResponse.data;
1080
1372
  }
1081
1373
  /**
1082
1374
  * Execute a custom tool
1375
+ *
1376
+ * @description If a toolkit is used, the connected account id is used to execute the tool.
1377
+ * If a connected account id is provided, it is used to execute the tool.
1378
+ * If a connected account id is not provided, the first connected account for the toolkit is used.
1379
+ *
1083
1380
  * @param {slug} slug The slug of the tool to execute
1084
1381
  * @param {Record<string, unknown>} inputParams The input parameters for the tool
1085
1382
  * @param {ExecuteMetadata} metadata The metadata of the execution
1086
1383
  * @returns {Promise<ToolExecuteResponse>} The response from the tool
1087
1384
  */
1088
- async executeCustomTool(slug, inputParams, metadata) {
1385
+ async executeCustomTool(slug, body) {
1089
1386
  const tool = this.customToolsRegistry.get(slug.toLowerCase());
1090
1387
  if (!tool) {
1091
1388
  throw new ComposioToolNotFoundError(`Tool with slug ${slug} not found`);
1092
1389
  }
1093
1390
  let authCredentials = {};
1094
- const { toolkitSlug, execute } = tool.options;
1391
+ const { toolkitSlug, execute, inputParams } = tool.options;
1392
+ let connectedAccountId = body.connectedAccountId;
1095
1393
  if (toolkitSlug && toolkitSlug !== "custom") {
1096
- const connectedAccount = await this.getConnectedAccount(toolkitSlug, metadata);
1394
+ const connectedAccount = await this.getConnectedAccountForToolkit(
1395
+ toolkitSlug,
1396
+ body.userId,
1397
+ body.connectedAccountId
1398
+ );
1399
+ logger_default.debug(
1400
+ `[CustomTool] Connected account for ${toolkitSlug} found for user ${body.userId}`,
1401
+ JSON.stringify(connectedAccount, null, 2)
1402
+ );
1097
1403
  if (!connectedAccount) {
1098
1404
  throw new ComposioConnectedAccountNotFoundError(
1099
- `Connected account not found for toolkit ${toolkitSlug} for user ${metadata.userId}`,
1405
+ `Connected account not found for toolkit ${toolkitSlug} for user ${body.userId}`,
1100
1406
  {
1101
1407
  meta: {
1102
1408
  toolkitSlug,
1103
- userId: metadata.userId
1409
+ userId: body.userId
1104
1410
  }
1105
1411
  }
1106
1412
  );
1107
1413
  }
1108
- authCredentials = connectedAccount.data?.connectionParams;
1414
+ authCredentials = connectedAccount.data;
1415
+ connectedAccountId = connectedAccount.id;
1109
1416
  }
1110
1417
  if (typeof execute !== "function") {
1111
1418
  throw new ComposioInvalidExecuteFunctionError("Invalid execute function", {
@@ -1115,63 +1422,36 @@ var CustomTools = class {
1115
1422
  });
1116
1423
  }
1117
1424
  const executeToolRequest = async (data) => {
1118
- return this.client.tools.proxy({
1425
+ if (toolkitSlug && toolkitSlug === "custom") {
1426
+ throw new ComposioInvalidExecuteFunctionError(
1427
+ "Custom tools without a toolkit cannot be executed using the executeToolRequest function",
1428
+ {
1429
+ possibleFixes: [
1430
+ "Please manually execute the tool using your logic.",
1431
+ "Pass a toolkit slug to execute the tool on behalf of a toolkit credentials"
1432
+ ]
1433
+ }
1434
+ );
1435
+ }
1436
+ const response = await this.client.tools.proxy({
1119
1437
  ...data,
1120
- connected_account_id: metadata.connectedAccountId
1438
+ connected_account_id: connectedAccountId
1121
1439
  });
1440
+ return {
1441
+ data: response.data,
1442
+ error: null,
1443
+ successful: true,
1444
+ logId: void 0,
1445
+ sessionInfo: void 0
1446
+ };
1122
1447
  };
1123
- return execute(
1124
- inputParams,
1125
- authCredentials,
1126
- executeToolRequest
1127
- );
1128
- }
1129
- };
1130
-
1131
- // src/errors/ValidationErrors.ts
1132
- var import_zod3 = require("zod");
1133
- var ValidationErrorCodes = {
1134
- VALIDATION_ERROR: "VALIDATION_ERROR"
1135
- };
1136
- var ValidationError = class extends ComposioError {
1137
- constructor(message = "Input validation failed", options = {}) {
1138
- const { cause: providedZodError, ...restOptions } = options;
1139
- let zodErrorInstance;
1140
- if (providedZodError instanceof import_zod3.ZodError) {
1141
- zodErrorInstance = providedZodError;
1142
- } else {
1143
- zodErrorInstance = new import_zod3.ZodError([
1144
- {
1145
- path: [],
1146
- message: "Invalid input",
1147
- code: "custom"
1148
- }
1149
- ]);
1150
- }
1151
- const issues = zodErrorInstance.issues.map(
1152
- (issue) => `[${issue.code}] ${issue.path.join(".")} - ${issue.message}`
1153
- );
1154
- super(message, {
1155
- ...restOptions,
1156
- code: options.code || ValidationErrorCodes.VALIDATION_ERROR,
1157
- possibleFixes: issues,
1158
- cause: zodErrorInstance
1159
- });
1160
- this.name = "ValidationError";
1161
- const userFriendlyMessage = this.generateUserFriendlyMessage();
1162
- this.message = `${message}: ${userFriendlyMessage}`;
1163
- }
1164
- generateUserFriendlyMessage() {
1165
- if (this.cause instanceof import_zod3.ZodError && this.cause.issues.length > 0) {
1166
- const issue = this.cause.issues[0];
1167
- const path = issue.path.join(".");
1168
- const param = path || "parameter";
1169
- if (issue.code === "invalid_type") {
1170
- return `The ${param} should be a ${issue.expected}, but you provided a ${issue.received}`;
1171
- }
1172
- return issue.message;
1448
+ const parsedInput = inputParams.safeParse(body.arguments);
1449
+ if (!parsedInput.success) {
1450
+ throw new ValidationError("Invalid input parameters", {
1451
+ cause: parsedInput.error
1452
+ });
1173
1453
  }
1174
- return "Please check your input parameters";
1454
+ return execute(parsedInput.data, authCredentials, executeToolRequest);
1175
1455
  }
1176
1456
  };
1177
1457
 
@@ -1397,7 +1677,10 @@ var Tools = class {
1397
1677
  async getRawComposioToolBySlug(userId, slug, modifier) {
1398
1678
  const customTool = await this.customTools.getCustomToolBySlug(slug);
1399
1679
  if (customTool) {
1680
+ logger_default.debug(`Found ${slug} to be a custom tool`, JSON.stringify(customTool, null, 2));
1400
1681
  return customTool;
1682
+ } else {
1683
+ logger_default.debug(`Tool ${slug} is not a custom tool. Fetching from Composio API`);
1401
1684
  }
1402
1685
  let tool;
1403
1686
  try {
@@ -1475,10 +1758,7 @@ var Tools = class {
1475
1758
  throw new ComposioInvalidModifierError("Invalid beforeExecute modifier. Not a function.");
1476
1759
  }
1477
1760
  }
1478
- let result = await this.customTools.executeCustomTool(tool.slug, body, {
1479
- userId: body.userId || "default",
1480
- connectedAccountId: body.connectedAccountId
1481
- });
1761
+ let result = await this.customTools.executeCustomTool(tool.slug, body);
1482
1762
  if (modifiers?.afterExecute) {
1483
1763
  if (typeof modifiers.afterExecute === "function") {
1484
1764
  result = await modifiers.afterExecute(tool.slug, "unknown", result);
@@ -1618,7 +1898,7 @@ var Tools = class {
1618
1898
  * @param {string} slug - The ID of the tool to find input for
1619
1899
  * @param {ToolGetInputParams} body - The parameters to be passed to the tool
1620
1900
  * @returns {Promise<ToolGetInputResponse>} The input parameters schema for the specified tool
1621
- *
1901
+ *
1622
1902
  * @example
1623
1903
  * ```typescript
1624
1904
  * // Get input parameters for a specific tool
@@ -1633,13 +1913,13 @@ var Tools = class {
1633
1913
  }
1634
1914
  /**
1635
1915
  * Proxies a custom request to a toolkit/integration.
1636
- *
1916
+ *
1637
1917
  * This method allows sending custom requests to a specific toolkit or integration
1638
1918
  * when you need more flexibility than the standard tool execution methods provide.
1639
1919
  *
1640
1920
  * @param {ToolProxyParams} body - The parameters for the proxy request including toolkit slug and custom data
1641
1921
  * @returns {Promise<ToolProxyResponse>} The response from the proxied request
1642
- *
1922
+ *
1643
1923
  * @example
1644
1924
  * ```typescript
1645
1925
  * // Send a custom request to a toolkit
@@ -1668,29 +1948,39 @@ var Tools = class {
1668
1948
  *
1669
1949
  * @example
1670
1950
  * ```typescript
1671
- * const customTool = await composio.tools.createCustomTool({
1951
+ * // creating a custom tool with a toolkit
1952
+ * await composio.tools.createCustomTool({
1672
1953
  * name: 'My Custom Tool',
1673
1954
  * description: 'A custom tool that does something specific',
1674
1955
  * slug: 'MY_CUSTOM_TOOL',
1675
- * inputParameters: {
1676
- * param1: {
1677
- * type: 'string',
1678
- * description: 'First parameter',
1679
- * required: true
1680
- * }
1681
- * },
1682
- * outputParameters: {
1683
- * result: {
1684
- * type: 'string',
1685
- * description: 'The result of the operation'
1686
- * }
1687
- * },
1688
- * handler: async (params, context) => {
1956
+ * userId: 'default',
1957
+ * connectedAccountId: '123',
1958
+ * toolkitSlug: 'github',
1959
+ * inputParameters: z.object({
1960
+ * param1: z.string().describe('First parameter'),
1961
+ * }),
1962
+ * execute: async (input, authCredentials, executeToolRequest) => {
1689
1963
  * // Custom logic here
1690
1964
  * return { data: { result: 'Success!' } };
1691
1965
  * }
1692
1966
  * });
1693
1967
  * ```
1968
+ *
1969
+ * @example
1970
+ * ```typescript
1971
+ * // creating a custom tool without a toolkit
1972
+ * await composio.tools.createCustomTool({
1973
+ * name: 'My Custom Tool',
1974
+ * description: 'A custom tool that does something specific',
1975
+ * slug: 'MY_CUSTOM_TOOL',
1976
+ * inputParameters: z.object({
1977
+ * param1: z.string().describe('First parameter'),
1978
+ * }),
1979
+ * execute: async (input) => {
1980
+ * // Custom logic here
1981
+ * return { data: { result: 'Success!' } };
1982
+ * }
1983
+ * });
1694
1984
  */
1695
1985
  async createCustomTool(body) {
1696
1986
  return this.customTools.createTool(body);
@@ -1701,183 +1991,87 @@ var Tools = class {
1701
1991
  var import_client4 = __toESM(require("@composio/client"), 1);
1702
1992
 
1703
1993
  // src/types/toolkit.types.ts
1704
- var import_zod4 = require("zod");
1705
- var ToolkitMangedByEnumSchema = import_zod4.z.enum(["all", "composio", "project"]);
1706
- var ToolkitSortByEnumSchema = import_zod4.z.enum(["usage", "alphabetically"]);
1707
- var ToolkitsListParamsSchema = import_zod4.z.object({
1708
- category: import_zod4.z.string().optional(),
1709
- isLocal: import_zod4.z.boolean().optional(),
1994
+ var import_zod5 = require("zod");
1995
+ var ToolkitMangedByEnumSchema = import_zod5.z.enum(["all", "composio", "project"]);
1996
+ var ToolkitSortByEnumSchema = import_zod5.z.enum(["usage", "alphabetically"]);
1997
+ var ToolkitsListParamsSchema = import_zod5.z.object({
1998
+ category: import_zod5.z.string().optional(),
1999
+ isLocal: import_zod5.z.boolean().optional(),
1710
2000
  managedBy: ToolkitMangedByEnumSchema.optional(),
1711
2001
  sortBy: ToolkitSortByEnumSchema.optional()
1712
2002
  });
1713
- var ToolKitMetaSchema = import_zod4.z.object({
1714
- categories: import_zod4.z.array(
1715
- import_zod4.z.object({
1716
- slug: import_zod4.z.string(),
1717
- name: import_zod4.z.string()
2003
+ var ToolKitMetaSchema = import_zod5.z.object({
2004
+ categories: import_zod5.z.array(
2005
+ import_zod5.z.object({
2006
+ slug: import_zod5.z.string(),
2007
+ name: import_zod5.z.string()
1718
2008
  })
1719
2009
  ).optional(),
1720
- appUrl: import_zod4.z.string().optional(),
1721
- createdAt: import_zod4.z.string().optional(),
1722
- description: import_zod4.z.string().optional(),
1723
- logo: import_zod4.z.string().optional(),
1724
- toolsCount: import_zod4.z.number().optional(),
1725
- triggersCount: import_zod4.z.number().optional(),
1726
- updatedAt: import_zod4.z.string().optional()
2010
+ appUrl: import_zod5.z.string().optional(),
2011
+ createdAt: import_zod5.z.string().optional(),
2012
+ description: import_zod5.z.string().optional(),
2013
+ logo: import_zod5.z.string().optional(),
2014
+ toolsCount: import_zod5.z.number().optional(),
2015
+ triggersCount: import_zod5.z.number().optional(),
2016
+ updatedAt: import_zod5.z.string().optional()
1727
2017
  });
1728
- var ToolKitItemSchema = import_zod4.z.object({
1729
- name: import_zod4.z.string(),
1730
- slug: import_zod4.z.string(),
2018
+ var ToolKitItemSchema = import_zod5.z.object({
2019
+ name: import_zod5.z.string(),
2020
+ slug: import_zod5.z.string(),
1731
2021
  meta: ToolKitMetaSchema,
1732
- isLocalToolkit: import_zod4.z.boolean(),
1733
- authSchemes: import_zod4.z.array(import_zod4.z.string()).optional(),
1734
- composioManagedAuthSchemes: import_zod4.z.array(import_zod4.z.string()).optional(),
1735
- noAuth: import_zod4.z.boolean().optional()
2022
+ isLocalToolkit: import_zod5.z.boolean(),
2023
+ authSchemes: import_zod5.z.array(import_zod5.z.string()).optional(),
2024
+ composioManagedAuthSchemes: import_zod5.z.array(import_zod5.z.string()).optional(),
2025
+ noAuth: import_zod5.z.boolean().optional()
1736
2026
  });
1737
- var ToolKitListResponseSchema = import_zod4.z.object({
1738
- items: import_zod4.z.array(ToolKitItemSchema),
1739
- nextCursor: import_zod4.z.string().nullable(),
1740
- totalPages: import_zod4.z.number()
2027
+ var ToolKitListResponseSchema = import_zod5.z.object({
2028
+ items: import_zod5.z.array(ToolKitItemSchema),
2029
+ nextCursor: import_zod5.z.string().nullable(),
2030
+ totalPages: import_zod5.z.number()
1741
2031
  });
1742
- var ToolkitAuthFieldSchema = import_zod4.z.object({
1743
- name: import_zod4.z.string(),
1744
- displayName: import_zod4.z.string(),
1745
- type: import_zod4.z.string(),
1746
- default: import_zod4.z.string().nullable().optional()
2032
+ var ToolkitAuthFieldSchema = import_zod5.z.object({
2033
+ name: import_zod5.z.string(),
2034
+ displayName: import_zod5.z.string(),
2035
+ type: import_zod5.z.string(),
2036
+ default: import_zod5.z.string().nullable().optional()
1747
2037
  });
1748
- var ToolkitAuthConfigDetailsSchema = import_zod4.z.object({
1749
- name: import_zod4.z.string(),
1750
- mode: import_zod4.z.string(),
1751
- fields: import_zod4.z.object({
1752
- authConfigCreation: import_zod4.z.object({
1753
- optional: import_zod4.z.array(ToolkitAuthFieldSchema),
1754
- required: import_zod4.z.array(ToolkitAuthFieldSchema)
2038
+ var ToolkitAuthConfigDetailsSchema = import_zod5.z.object({
2039
+ name: import_zod5.z.string(),
2040
+ mode: import_zod5.z.string(),
2041
+ fields: import_zod5.z.object({
2042
+ authConfigCreation: import_zod5.z.object({
2043
+ optional: import_zod5.z.array(ToolkitAuthFieldSchema),
2044
+ required: import_zod5.z.array(ToolkitAuthFieldSchema)
1755
2045
  }),
1756
- connectedAccountInitiation: import_zod4.z.object({
1757
- optional: import_zod4.z.array(ToolkitAuthFieldSchema),
1758
- required: import_zod4.z.array(ToolkitAuthFieldSchema)
2046
+ connectedAccountInitiation: import_zod5.z.object({
2047
+ optional: import_zod5.z.array(ToolkitAuthFieldSchema),
2048
+ required: import_zod5.z.array(ToolkitAuthFieldSchema)
1759
2049
  })
1760
2050
  }),
1761
- proxy: import_zod4.z.object({
1762
- baseUrl: import_zod4.z.string().optional()
2051
+ proxy: import_zod5.z.object({
2052
+ baseUrl: import_zod5.z.string().optional()
1763
2053
  }).optional()
1764
2054
  });
1765
- var ToolkitRetrieveResponseSchema = import_zod4.z.object({
1766
- name: import_zod4.z.string(),
1767
- slug: import_zod4.z.string(),
2055
+ var ToolkitRetrieveResponseSchema = import_zod5.z.object({
2056
+ name: import_zod5.z.string(),
2057
+ slug: import_zod5.z.string(),
1768
2058
  meta: ToolKitMetaSchema,
1769
- isLocalToolkit: import_zod4.z.boolean(),
1770
- composioManagedAuthSchemes: import_zod4.z.array(import_zod4.z.string()).optional(),
1771
- authConfigDetails: import_zod4.z.array(ToolkitAuthConfigDetailsSchema).optional()
2059
+ isLocalToolkit: import_zod5.z.boolean(),
2060
+ composioManagedAuthSchemes: import_zod5.z.array(import_zod5.z.string()).optional(),
2061
+ authConfigDetails: import_zod5.z.array(ToolkitAuthConfigDetailsSchema).optional()
1772
2062
  });
1773
- var ToolkitCategorySchema = import_zod4.z.object({
1774
- id: import_zod4.z.string(),
1775
- name: import_zod4.z.string()
2063
+ var ToolkitCategorySchema = import_zod5.z.object({
2064
+ id: import_zod5.z.string(),
2065
+ name: import_zod5.z.string()
1776
2066
  });
1777
- var ToolkitRetrieveCategoriesResponseSchema = import_zod4.z.object({
1778
- items: import_zod4.z.array(ToolkitCategorySchema),
1779
- nextCursor: import_zod4.z.string().nullable(),
1780
- totalPages: import_zod4.z.number()
2067
+ var ToolkitRetrieveCategoriesResponseSchema = import_zod5.z.object({
2068
+ items: import_zod5.z.array(ToolkitCategorySchema),
2069
+ nextCursor: import_zod5.z.string().nullable(),
2070
+ totalPages: import_zod5.z.number()
1781
2071
  });
1782
2072
 
1783
- // src/errors/AuthConfigErrors.ts
1784
- var AuthConfigErrorCodes = {
1785
- AUTH_CONFIG_NOT_FOUND: "AUTH_CONFIG_NOT_FOUND"
1786
- };
1787
- var ComposioAuthConfigNotFoundError = class extends ComposioError {
1788
- constructor(message = "Auth config not found", options = {}) {
1789
- super(message, {
1790
- ...options,
1791
- code: AuthConfigErrorCodes.AUTH_CONFIG_NOT_FOUND,
1792
- possibleFixes: options.possibleFixes || [
1793
- "Check if the auth config exists",
1794
- "Check if the auth config id is correct",
1795
- "Check if the auth config is enabled"
1796
- ]
1797
- });
1798
- this.name = "ComposioAuthConfigNotFoundError";
1799
- }
1800
- };
1801
-
1802
- // src/errors/ConnectionRequestErrors.ts
1803
- var ConnectionRequestErrorCodes = {
1804
- CONNECTION_REQUEST_TIMEOUT: "CONNECTION_REQUEST_TIMEOUT",
1805
- CONNECTION_REQUEST_FAILED: "CONNECTION_REQUEST_FAILED"
1806
- };
1807
- var ConnectionRequestTimeoutError = class extends ComposioError {
1808
- constructor(message = "Connection request timed out", options = {}) {
1809
- super(message, {
1810
- ...options,
1811
- code: ConnectionRequestErrorCodes.CONNECTION_REQUEST_TIMEOUT
1812
- });
1813
- this.name = "ConnectionRequestTimeoutError";
1814
- }
1815
- };
1816
- var ConnectionRequestFailedError = class extends ComposioError {
1817
- constructor(message = "Connection request failed", options = {}) {
1818
- super(message, {
1819
- ...options,
1820
- code: ConnectionRequestErrorCodes.CONNECTION_REQUEST_FAILED
1821
- });
1822
- this.name = "ConnectionRequestFailedError";
1823
- }
1824
- };
1825
-
1826
- // src/errors/ToolkitErrors.ts
1827
- var ToolkitErrorCodes = {
1828
- TOOLKIT_NOT_FOUND: "TOOLKIT_NOT_FOUND"
1829
- };
1830
- var ComposioToolkitNotFoundError = class extends ComposioError {
1831
- constructor(message = "Toolkit not found", options = {}) {
1832
- super(message, {
1833
- ...options,
1834
- code: "TOOLKIT_NOT_FOUND",
1835
- possibleFixes: options.possibleFixes || [
1836
- "Ensure the toolkit is correctly configured and the slug is valid"
1837
- ]
1838
- });
1839
- this.name = "ComposioToolkitNotFoundError";
1840
- }
1841
- };
1842
- var ComposioToolkitFetchError = class extends ComposioError {
1843
- constructor(message = "Failed to fetch toolkit", options = {}) {
1844
- super(message, {
1845
- ...options,
1846
- code: "TOOLKIT_FETCH_ERROR",
1847
- possibleFixes: options.possibleFixes || [
1848
- "Ensure the toolkit slug is valid",
1849
- "Ensure you are using the correct API key",
1850
- "Ensure you are using the correct API endpoint / Base URL and it is working"
1851
- ]
1852
- });
1853
- this.name = "ComposioToolkitFetchError";
1854
- }
1855
- };
1856
-
1857
- // src/errors/SDKErrors.ts
1858
- var SDKErrorCodes = {
1859
- NO_API_KEY_PROVIDED: "NO_API_KEY_PROVIDED"
1860
- };
1861
- var ComposioNoAPIKeyError = class extends ComposioError {
1862
- constructor(message = "No Composio API key provided", options = {}) {
1863
- const defaultCause = "Couldn't find an API key in the params, environment variables or in the user config file";
1864
- super(message, {
1865
- ...options,
1866
- code: "NO_API_KEY",
1867
- cause: options.cause || defaultCause,
1868
- possibleFixes: options.possibleFixes || [
1869
- "Ensure you have an API key passed in the params, or in environment variable (COMPOSIO_API_KEY) or in the user config file",
1870
- "To get an API key, please sign up at https://composio.dev/signup",
1871
- "You can also use the Composio CLI to create a project and get an API key"
1872
- ],
1873
- statusCode: 401
1874
- });
1875
- this.name = "ComposioNoAPIKeyError";
1876
- }
1877
- };
1878
-
1879
2073
  // src/types/authConfigs.types.ts
1880
- var import_zod5 = require("zod");
2074
+ var import_zod6 = require("zod");
1881
2075
  var AuthConfigTypes = {
1882
2076
  CUSTOM: "use_custom_auth",
1883
2077
  COMPOSIO_MANAGED: "use_composio_managed_auth"
@@ -1897,7 +2091,7 @@ var AuthSchemeTypes = {
1897
2091
  CALCOM_AUTH: "CALCOM_AUTH",
1898
2092
  SNOWFLAKE: "SNOWFLAKE"
1899
2093
  };
1900
- var AuthSchemeEnum = import_zod5.z.enum([
2094
+ var AuthSchemeEnum = import_zod6.z.enum([
1901
2095
  "OAUTH2",
1902
2096
  "OAUTH1",
1903
2097
  "OAUTH1A",
@@ -1912,67 +2106,67 @@ var AuthSchemeEnum = import_zod5.z.enum([
1912
2106
  "CALCOM_AUTH",
1913
2107
  "SNOWFLAKE"
1914
2108
  ]);
1915
- var CreateCustomAuthConfigParamsSchema = import_zod5.z.object({
1916
- type: import_zod5.z.literal("use_custom_auth"),
1917
- name: import_zod5.z.string().optional(),
1918
- credentials: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.union([import_zod5.z.string(), import_zod5.z.number(), import_zod5.z.boolean()])),
2109
+ var CreateCustomAuthConfigParamsSchema = import_zod6.z.object({
2110
+ type: import_zod6.z.literal("use_custom_auth"),
2111
+ name: import_zod6.z.string().optional(),
2112
+ credentials: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.union([import_zod6.z.string(), import_zod6.z.number(), import_zod6.z.boolean()])),
1919
2113
  authScheme: AuthSchemeEnum
1920
2114
  });
1921
- var CreateComposioManagedAuthConfigParamsSchema = import_zod5.z.object({
1922
- type: import_zod5.z.literal("use_composio_managed_auth"),
1923
- name: import_zod5.z.string().optional(),
1924
- credentials: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.union([import_zod5.z.string(), import_zod5.z.number(), import_zod5.z.boolean()])).optional()
2115
+ var CreateComposioManagedAuthConfigParamsSchema = import_zod6.z.object({
2116
+ type: import_zod6.z.literal("use_composio_managed_auth"),
2117
+ name: import_zod6.z.string().optional(),
2118
+ credentials: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.union([import_zod6.z.string(), import_zod6.z.number(), import_zod6.z.boolean()])).optional()
1925
2119
  });
1926
- var CreateAuthConfigParamsSchema = import_zod5.z.discriminatedUnion("type", [
2120
+ var CreateAuthConfigParamsSchema = import_zod6.z.discriminatedUnion("type", [
1927
2121
  CreateCustomAuthConfigParamsSchema,
1928
2122
  CreateComposioManagedAuthConfigParamsSchema
1929
2123
  ]);
1930
- var CreateAuthConfigResponseSchema = import_zod5.z.object({
1931
- id: import_zod5.z.string(),
1932
- authScheme: import_zod5.z.string(),
1933
- isComposioManaged: import_zod5.z.boolean(),
1934
- toolkit: import_zod5.z.string()
2124
+ var CreateAuthConfigResponseSchema = import_zod6.z.object({
2125
+ id: import_zod6.z.string(),
2126
+ authScheme: import_zod6.z.string(),
2127
+ isComposioManaged: import_zod6.z.boolean(),
2128
+ toolkit: import_zod6.z.string()
1935
2129
  });
1936
- var AuthConfigRetrieveResponseSchema = import_zod5.z.object({
1937
- id: import_zod5.z.string(),
1938
- name: import_zod5.z.string(),
1939
- toolkit: import_zod5.z.object({
1940
- logo: import_zod5.z.string(),
1941
- slug: import_zod5.z.string()
2130
+ var AuthConfigRetrieveResponseSchema = import_zod6.z.object({
2131
+ id: import_zod6.z.string(),
2132
+ name: import_zod6.z.string(),
2133
+ toolkit: import_zod6.z.object({
2134
+ logo: import_zod6.z.string(),
2135
+ slug: import_zod6.z.string()
1942
2136
  }),
1943
- noOfConnections: import_zod5.z.number(),
1944
- status: import_zod5.z.enum(["ENABLED", "DISABLED"]),
1945
- uuid: import_zod5.z.string(),
2137
+ noOfConnections: import_zod6.z.number(),
2138
+ status: import_zod6.z.enum(["ENABLED", "DISABLED"]),
2139
+ uuid: import_zod6.z.string(),
1946
2140
  authScheme: AuthSchemeEnum.optional(),
1947
- credentials: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.unknown()).optional(),
1948
- expectedInputFields: import_zod5.z.array(import_zod5.z.unknown()).optional(),
1949
- isComposioManaged: import_zod5.z.boolean().optional(),
1950
- createdBy: import_zod5.z.string().optional(),
1951
- createdAt: import_zod5.z.string().optional(),
1952
- lastUpdatedAt: import_zod5.z.string().optional()
2141
+ credentials: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()).optional(),
2142
+ expectedInputFields: import_zod6.z.array(import_zod6.z.unknown()).optional(),
2143
+ isComposioManaged: import_zod6.z.boolean().optional(),
2144
+ createdBy: import_zod6.z.string().optional(),
2145
+ createdAt: import_zod6.z.string().optional(),
2146
+ lastUpdatedAt: import_zod6.z.string().optional()
1953
2147
  });
1954
- var AuthConfigListParamsSchema = import_zod5.z.object({
1955
- cursor: import_zod5.z.string().optional(),
1956
- isComposioManaged: import_zod5.z.boolean().optional(),
1957
- limit: import_zod5.z.number().optional(),
1958
- toolkit: import_zod5.z.string().optional()
2148
+ var AuthConfigListParamsSchema = import_zod6.z.object({
2149
+ cursor: import_zod6.z.string().optional(),
2150
+ isComposioManaged: import_zod6.z.boolean().optional(),
2151
+ limit: import_zod6.z.number().optional(),
2152
+ toolkit: import_zod6.z.string().optional()
1959
2153
  });
1960
- var AuthConfigListResponseSchema = import_zod5.z.object({
1961
- items: import_zod5.z.array(AuthConfigRetrieveResponseSchema),
1962
- nextCursor: import_zod5.z.string().nullable(),
1963
- totalPages: import_zod5.z.number()
2154
+ var AuthConfigListResponseSchema = import_zod6.z.object({
2155
+ items: import_zod6.z.array(AuthConfigRetrieveResponseSchema),
2156
+ nextCursor: import_zod6.z.string().nullable(),
2157
+ totalPages: import_zod6.z.number()
1964
2158
  });
1965
- var AuthCustomConfigUpdateParamsSchema = import_zod5.z.object({
1966
- credentials: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.union([import_zod5.z.string(), import_zod5.z.unknown()])),
1967
- type: import_zod5.z.literal("custom"),
1968
- restrictToFollowingTools: import_zod5.z.array(import_zod5.z.string()).optional()
2159
+ var AuthCustomConfigUpdateParamsSchema = import_zod6.z.object({
2160
+ credentials: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.union([import_zod6.z.string(), import_zod6.z.unknown()])),
2161
+ type: import_zod6.z.literal("custom"),
2162
+ restrictToFollowingTools: import_zod6.z.array(import_zod6.z.string()).optional()
1969
2163
  });
1970
- var AuthDefaultConfigUpdateParamsSchema = import_zod5.z.object({
1971
- scopes: import_zod5.z.string(),
1972
- type: import_zod5.z.literal("default"),
1973
- restrictToFollowingTools: import_zod5.z.array(import_zod5.z.string()).optional()
2164
+ var AuthDefaultConfigUpdateParamsSchema = import_zod6.z.object({
2165
+ scopes: import_zod6.z.string(),
2166
+ type: import_zod6.z.literal("default"),
2167
+ restrictToFollowingTools: import_zod6.z.array(import_zod6.z.string()).optional()
1974
2168
  });
1975
- var AuthConfigUpdateParamsSchema = import_zod5.z.discriminatedUnion("type", [
2169
+ var AuthConfigUpdateParamsSchema = import_zod6.z.discriminatedUnion("type", [
1976
2170
  AuthCustomConfigUpdateParamsSchema,
1977
2171
  AuthDefaultConfigUpdateParamsSchema
1978
2172
  ]);
@@ -2279,119 +2473,6 @@ var AuthConfigs = class {
2279
2473
  }
2280
2474
  };
2281
2475
 
2282
- // src/types/connectedAccounts.types.ts
2283
- var import_zod6 = require("zod");
2284
- var ConnectedAccountStatuses = {
2285
- INITIALIZING: "INITIALIZING",
2286
- INITIATED: "INITIATED",
2287
- ACTIVE: "ACTIVE",
2288
- FAILED: "FAILED",
2289
- EXPIRED: "EXPIRED"
2290
- };
2291
- var ConnectedAccountStatusSchema = import_zod6.z.enum([
2292
- ConnectedAccountStatuses.INITIALIZING,
2293
- ConnectedAccountStatuses.INITIATED,
2294
- ConnectedAccountStatuses.ACTIVE,
2295
- ConnectedAccountStatuses.FAILED,
2296
- ConnectedAccountStatuses.EXPIRED
2297
- ]);
2298
- var CreateConnectedAccountParamsSchema = import_zod6.z.object({
2299
- authConfig: import_zod6.z.object({
2300
- id: import_zod6.z.string()
2301
- }),
2302
- connection: import_zod6.z.object({
2303
- data: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()).optional(),
2304
- callbackUrl: import_zod6.z.string().optional(),
2305
- userId: import_zod6.z.string().optional()
2306
- })
2307
- });
2308
- var DefaultCreateConnectedAccountParamsSchema = import_zod6.z.object({
2309
- auth_config: import_zod6.z.object({
2310
- id: import_zod6.z.string()
2311
- }),
2312
- connection: import_zod6.z.object({
2313
- data: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()).optional(),
2314
- callback_url: import_zod6.z.string().optional(),
2315
- user_id: import_zod6.z.string().optional()
2316
- })
2317
- });
2318
- var CreateConnectedAccountOptionsSchema = import_zod6.z.object({
2319
- callbackUrl: import_zod6.z.string().optional(),
2320
- data: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()).optional()
2321
- });
2322
- var CreateConnectedAccountResponseSchema = import_zod6.z.object({
2323
- id: import_zod6.z.string(),
2324
- status: ConnectedAccountStatusSchema,
2325
- redirectUrl: import_zod6.z.string().nullable()
2326
- });
2327
- var ConnectedAccountAuthSchemes = {
2328
- OAUTH2: "OAUTH2",
2329
- OAUTH1: "OAUTH1",
2330
- OAUTH1A: "OAUTH1A",
2331
- API_KEY: "API_KEY",
2332
- BASIC: "BASIC",
2333
- BILLCOM_AUTH: "BILLCOM_AUTH",
2334
- BEARER_TOKEN: "BEARER_TOKEN",
2335
- GOOGLE_SERVICE_ACCOUNT: "GOOGLE_SERVICE_ACCOUNT",
2336
- NO_AUTH: "NO_AUTH",
2337
- BASIC_WITH_JWT: "BASIC_WITH_JWT",
2338
- COMPOSIO_LINK: "COMPOSIO_LINK",
2339
- CALCOM_AUTH: "CALCOM_AUTH",
2340
- SNOWFLAKE: "SNOWFLAKE"
2341
- };
2342
- var ConnectedAccountAuthSchemesSchema = import_zod6.z.enum([
2343
- ConnectedAccountAuthSchemes.OAUTH2,
2344
- ConnectedAccountAuthSchemes.OAUTH1,
2345
- ConnectedAccountAuthSchemes.OAUTH1A,
2346
- ConnectedAccountAuthSchemes.API_KEY,
2347
- ConnectedAccountAuthSchemes.BASIC,
2348
- ConnectedAccountAuthSchemes.BILLCOM_AUTH,
2349
- ConnectedAccountAuthSchemes.BEARER_TOKEN,
2350
- ConnectedAccountAuthSchemes.GOOGLE_SERVICE_ACCOUNT,
2351
- ConnectedAccountAuthSchemes.NO_AUTH,
2352
- ConnectedAccountAuthSchemes.BASIC_WITH_JWT,
2353
- ConnectedAccountAuthSchemes.COMPOSIO_LINK,
2354
- ConnectedAccountAuthSchemes.CALCOM_AUTH,
2355
- ConnectedAccountAuthSchemes.SNOWFLAKE
2356
- ]);
2357
- var ConnectedAccountAuthConfigSchema = import_zod6.z.object({
2358
- id: import_zod6.z.string(),
2359
- authScheme: ConnectedAccountAuthSchemesSchema,
2360
- isComposioManaged: import_zod6.z.boolean(),
2361
- isDisabled: import_zod6.z.boolean()
2362
- });
2363
- var ConnectedAccountRetrieveResponseSchema = import_zod6.z.object({
2364
- id: import_zod6.z.string(),
2365
- authConfig: ConnectedAccountAuthConfigSchema,
2366
- userId: import_zod6.z.string(),
2367
- data: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()),
2368
- params: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()).optional(),
2369
- status: ConnectedAccountStatusSchema,
2370
- statusReason: import_zod6.z.string().nullable(),
2371
- toolkit: import_zod6.z.object({
2372
- slug: import_zod6.z.string()
2373
- }),
2374
- testRequestEndpoint: import_zod6.z.string().optional(),
2375
- isDisabled: import_zod6.z.boolean(),
2376
- createdAt: import_zod6.z.string(),
2377
- updatedAt: import_zod6.z.string()
2378
- });
2379
- var ConnectedAccountListParamsSchema = import_zod6.z.object({
2380
- authConfigIds: import_zod6.z.array(import_zod6.z.string()).nullable().optional().describe("The auth config ids of the connected accounts"),
2381
- cursor: import_zod6.z.number().nullable().optional().describe("The cursor to paginate through the connected accounts"),
2382
- labels: import_zod6.z.array(import_zod6.z.string()).nullable().optional().describe("The labels of the connected accounts"),
2383
- limit: import_zod6.z.number().nullable().optional().describe("The limit of the connected accounts to return"),
2384
- orderBy: import_zod6.z.enum(["created_at", "updated_at"]).optional().describe("The order by of the connected accounts"),
2385
- statuses: import_zod6.z.array(ConnectedAccountStatusSchema).nullable().optional().describe("The statuses of the connected accounts"),
2386
- toolkitSlugs: import_zod6.z.array(import_zod6.z.string()).nullable().optional().describe("The toolkit slugs of the connected accounts"),
2387
- userIds: import_zod6.z.array(import_zod6.z.string()).nullable().optional().describe("The user ids of the connected accounts")
2388
- });
2389
- var ConnectedAccountListResponseSchema = import_zod6.z.object({
2390
- items: import_zod6.z.array(ConnectedAccountRetrieveResponseSchema).describe("The list of connected accounts"),
2391
- nextCursor: import_zod6.z.string().nullable().describe("The next cursor to paginate through the connected accounts"),
2392
- totalPages: import_zod6.z.number().describe("The total number of pages of connected accounts")
2393
- });
2394
-
2395
2476
  // src/models/ConnectionRequest.ts
2396
2477
  var import_client3 = __toESM(require("@composio/client"), 1);
2397
2478
  var import_zod7 = require("zod");
@@ -4207,7 +4288,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4207
4288
  };
4208
4289
 
4209
4290
  // package.json
4210
- var version = "0.1.12-alpha.15";
4291
+ var version = "0.1.12-alpha.16";
4211
4292
 
4212
4293
  // src/composio.ts
4213
4294
  var Composio = class {