@composio/core 0.1.9-alpha.0 → 0.1.11-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -23,16 +23,16 @@ pnpm add @composio/core
23
23
 
24
24
  ## Getting Started
25
25
 
26
- ### Basic Usage with OpenAI Toolset
26
+ ### Basic Usage with OpenAI Provider
27
27
 
28
28
  ```typescript
29
29
  import { Composio } from '@composio/core';
30
- import { OpenAIToolset } from '@composio/openai-toolset';
30
+ import { OpenAIProvider } from '@composio/openai';
31
31
 
32
32
  const composio = new Composio({
33
33
  apiKey: process.env.COMPOSIO_API_KEY,
34
- // OpenAIToolset is the default, so this is optional
35
- toolset: new OpenAIToolset(),
34
+ // OpenAIProvider is the default, so this is optional
35
+ provider: new OpenAIProvider(),
36
36
  });
37
37
 
38
38
  // Fetch a single tool
@@ -55,7 +55,7 @@ interface ComposioConfig {
55
55
  baseURL?: string; // Custom API base URL (optional)
56
56
  allowTracking?: boolean; // Enable/disable telemetry (default: true)
57
57
  allowTracing?: boolean; // Enable/disable tracing (default: true)
58
- toolset?: TToolset; // Custom toolset (default: OpenAIToolset)
58
+ provider?: TProvider; // Custom provider (default: OpenAIProvider)
59
59
  telemetryTransport?: BaseTelemetryTransport; // Custom telemetry transport
60
60
  }
61
61
  ```
@@ -87,7 +87,7 @@ const tool = await composio.tools.get('user123', 'HACKERNEWS_SEARCH_POSTS', {
87
87
 
88
88
  ### Execution Modifiers
89
89
 
90
- For agentic toolsets (like Vercel AI and Langchain), you can also modify tool execution behavior:
90
+ For agentic providers (like Vercel AI and Langchain), you can also modify tool execution behavior:
91
91
 
92
92
  ```typescript
93
93
  const tool = await composio.tools.get('user123', 'HACKERNEWS_SEARCH_POSTS', {
package/dist/index.cjs CHANGED
@@ -32,12 +32,12 @@ var index_exports = {};
32
32
  __export(index_exports, {
33
33
  AuthConfigTypes: () => AuthConfigTypes,
34
34
  AuthSchemeTypes: () => AuthSchemeTypes,
35
- BaseAgenticToolset: () => BaseAgenticToolset,
36
- BaseNonAgenticToolset: () => BaseNonAgenticToolset,
35
+ BaseAgenticProvider: () => BaseAgenticProvider,
36
+ BaseNonAgenticProvider: () => BaseNonAgenticProvider,
37
37
  BaseTelemetryTransport: () => BaseTelemetryTransport,
38
38
  Composio: () => Composio,
39
- ComposioToolset: () => ComposioToolset,
40
- OpenAIToolset: () => OpenAIToolset,
39
+ ComposioProvider: () => ComposioProvider,
40
+ OpenAIProvider: () => OpenAIProvider,
41
41
  ToolListParamsSchema: () => ToolListParamsSchema,
42
42
  jsonSchemaToModel: () => jsonSchemaToModel
43
43
  });
@@ -217,18 +217,19 @@ var ToolErrorCodes = {
217
217
  INVALID_MODIFIER: "INVALID_MODIFIER",
218
218
  CUSTOM_TOOLS_NOT_INITIALIZED: "CUSTOM_TOOLS_NOT_INITIALIZED",
219
219
  TOOL_EXECUTION_ERROR: "TOOL_EXECUTION_ERROR",
220
- INVALID_EXECUTE_FUNCTION: "INVALID_EXECUTE_FUNCTION"
220
+ INVALID_EXECUTE_FUNCTION: "INVALID_EXECUTE_FUNCTION",
221
+ GLOBAL_EXECUTE_TOOL_FN_NOT_SET: "GLOBAL_EXECUTE_TOOL_FN_NOT_SET"
221
222
  };
222
- var ComposioToolsetNotDefinedError = class extends ComposioError {
223
- constructor(message = "Toolset not defined", meta = {}) {
223
+ var ComposioProviderNotDefinedError = class extends ComposioError {
224
+ constructor(message = "Provider not defined", meta = {}) {
224
225
  super(message, {
225
226
  code: ToolErrorCodes.TOOLSET_NOT_DEFINED,
226
227
  meta,
227
228
  possibleFixes: [
228
- "Ensure that the toolset is defined in the Composio project and passed into the tool instance"
229
+ "Ensure that the provider is defined in the Composio project and passed into the tool instance"
229
230
  ]
230
231
  });
231
- this.name = "ComposioToolsetNotDefinedError";
232
+ this.name = "ComposioProviderNotDefinedError";
232
233
  }
233
234
  };
234
235
  var ComposioToolNotFoundError = class extends ComposioError {
@@ -284,6 +285,16 @@ var ComposioInvalidExecuteFunctionError = class extends ComposioError {
284
285
  this.name = "ComposioInvalidExecuteFunctionError";
285
286
  }
286
287
  };
288
+ var ComposioGlobalExecuteToolFnNotSetError = class extends ComposioError {
289
+ constructor(message = "Global execute tool function not set", meta = {}) {
290
+ super(message, {
291
+ code: ToolErrorCodes.GLOBAL_EXECUTE_TOOL_FN_NOT_SET,
292
+ meta,
293
+ possibleFixes: ["Ensure the global execute tool function is set in the provider"]
294
+ });
295
+ this.name = "ComposioGlobalExecuteToolFnNotSetError";
296
+ }
297
+ };
287
298
 
288
299
  // src/errors/ConnectedAccountsError.ts
289
300
  var ConnectedAccountErrorCodes = {
@@ -508,20 +519,20 @@ var ValidationError = class extends ComposioError {
508
519
  var Tools = class {
509
520
  client;
510
521
  customTools;
511
- toolset;
512
- constructor(client, toolset) {
522
+ provider;
523
+ constructor(client, provider) {
513
524
  if (!client) {
514
525
  throw new Error("ComposioClient is required");
515
526
  }
516
- if (!toolset) {
517
- throw new ComposioToolsetNotDefinedError("Toolset not passed into Tools instance");
527
+ if (!provider) {
528
+ throw new ComposioProviderNotDefinedError("Provider not passed into Tools instance");
518
529
  }
519
530
  this.client = client;
520
531
  this.customTools = new CustomTools(client);
521
- this.toolset = toolset;
532
+ this.provider = provider;
522
533
  this.execute = this.execute.bind(this);
523
- this.getComposioToolBySlug = this.getComposioToolBySlug.bind(this);
524
- this.getComposioTools = this.getComposioTools.bind(this);
534
+ this.getRawComposioToolBySlug = this.getRawComposioToolBySlug.bind(this);
535
+ this.getRawComposioTools = this.getRawComposioTools.bind(this);
525
536
  }
526
537
  /**
527
538
  * Transform the tool cases
@@ -555,12 +566,12 @@ var Tools = class {
555
566
  * @param {ToolList} tools - The tools to check.
556
567
  * @returns {Promise<boolean>} True if the connected account exists for the given tools, false otherwise.
557
568
  */
558
- async checkIfConnectedAccountExistsForTools(userId, tools) {
569
+ async checkIfConnectedAccountExistsForTools(userIds, tools) {
559
570
  if (!tools.length) {
560
571
  return true;
561
572
  }
562
573
  const connectedAccounts = await this.client.connectedAccounts.list({
563
- user_id: userId
574
+ user_ids: userIds
564
575
  });
565
576
  if (connectedAccounts.items.length === 0) {
566
577
  return false;
@@ -596,7 +607,7 @@ var Tools = class {
596
607
  * @returns {Promise<string | null>} The connected account id or null if the toolkit is a no auth app
597
608
  */
598
609
  async getConnectedAccountIdForTool(userId, toolSlug) {
599
- const tool = await this.getComposioToolBySlug(userId, toolSlug);
610
+ const tool = await this.getRawComposioToolBySlug(userId, toolSlug);
600
611
  if (!tool.toolkit) {
601
612
  throw new Error(`Unable to find toolkit for tool ${toolSlug}`);
602
613
  }
@@ -609,8 +620,8 @@ var Tools = class {
609
620
  );
610
621
  if (!isNoAuthApp) {
611
622
  const connectedAccounts = await this.client.connectedAccounts.list({
612
- user_id: userId,
613
- toolkit_slug: tool.toolkit.slug
623
+ user_ids: [userId],
624
+ toolkit_slugs: [tool.toolkit.slug]
614
625
  });
615
626
  if (connectedAccounts.items.length === 0) {
616
627
  throw new Error("No connected accounts found");
@@ -624,16 +635,16 @@ var Tools = class {
624
635
  }
625
636
  /**
626
637
  * Lists all tools available in the Composio SDK as well as custom tools.
627
- * This method fetches the tools from the Composio API and wraps them using the toolset.
638
+ * This method fetches the tools from the Composio API and wraps them using the provider.
628
639
  * @returns {ToolList} List of tools
629
640
  */
630
- async getComposioTools(userId, query = {}, modifier) {
641
+ async getRawComposioTools(userId, query = {}, modifier) {
631
642
  const queryParams = ToolListParamsSchema.safeParse(query);
632
643
  if (queryParams.error) {
633
644
  throw new ValidationError(queryParams.error);
634
645
  }
635
646
  const tools = await this.client.tools.list({
636
- tool_slugs: queryParams.data.tools?.join(","),
647
+ tool_slugs: queryParams.data.tools,
637
648
  toolkit_slug: queryParams.data.toolkits?.join(","),
638
649
  cursor: queryParams.data.cursor,
639
650
  important: queryParams.data.important,
@@ -663,15 +674,22 @@ var Tools = class {
663
674
  * Retrieves a tool by its Slug.
664
675
  * @param slug The ID of the tool to be retrieved
665
676
  * @returns {Promise<Tool>} The tool
677
+ *
678
+ * @example
679
+ * ```ts
680
+ * const tool = await composio.tools.getRawComposioToolBySlug('default', 'github');
681
+ * ```
666
682
  */
667
- async getComposioToolBySlug(userId, slug, modifier) {
683
+ async getRawComposioToolBySlug(userId, slug, modifier) {
668
684
  const customTool = await this.customTools.getCustomToolBySlug(slug);
669
685
  if (customTool) {
670
686
  return customTool;
671
687
  }
672
688
  const tool = await this.client.tools.retrieve(slug);
673
689
  if (!tool) {
674
- throw new ComposioToolNotFoundError(`Tool with slug ${slug} not found`);
690
+ throw new ComposioToolNotFoundError(
691
+ `[getRawComposioToolBySlug] Tool with slug ${slug} not found`
692
+ );
675
693
  }
676
694
  let modifiedToool = this.transformToolCases(tool);
677
695
  if (modifier) {
@@ -683,17 +701,25 @@ var Tools = class {
683
701
  }
684
702
  return modifiedToool;
685
703
  }
704
+ /**
705
+ * Get a tool by its slug
706
+ * @param userId - The user id
707
+ * @param arg2 - The slug of the tool or the filters for the tools
708
+ * @param options - The options for the tools
709
+ * @returns The tool or the tools
710
+ */
686
711
  async get(userId, arg2, options) {
687
712
  const executeToolFn = this.createExecuteToolFn(userId, options);
688
713
  if (typeof arg2 === "string") {
689
- const tool = await this.getComposioToolBySlug(userId, arg2, options?.modifyToolSchema);
690
- return this.toolset.wrapTool(tool, executeToolFn);
714
+ const tool = await this.getRawComposioToolBySlug(userId, arg2, options?.modifyToolSchema);
715
+ return this.provider.wrapTool(tool, executeToolFn);
691
716
  } else {
692
- const tools = await this.getComposioTools(userId, arg2, options?.modifyToolSchema);
693
- return this.toolset.wrapTools(tools, executeToolFn);
717
+ const tools = await this.getRawComposioTools(userId, arg2, options?.modifyToolSchema);
718
+ return this.provider.wrapTools(tools, executeToolFn);
694
719
  }
695
720
  }
696
721
  /**
722
+ * @internal
697
723
  * Creates a function that executes a tool.
698
724
  * This function is used by agentic the toolsets to execute the tool
699
725
  * @param {string} userId - The user id
@@ -713,6 +739,14 @@ var Tools = class {
713
739
  };
714
740
  return executeToolFn;
715
741
  }
742
+ /**
743
+ * @internal
744
+ * Handles the execution of a custom tool
745
+ * @param tool - The tool to execute
746
+ * @param body - The body of the tool execution
747
+ * @param modifiers - The modifiers to be applied to the tool execution
748
+ * @returns The response from the tool execution
749
+ */
716
750
  async handleCustomToolExecution(tool, body, modifiers) {
717
751
  if (modifiers?.beforeToolExecute) {
718
752
  if (typeof modifiers.beforeToolExecute === "function") {
@@ -738,6 +772,14 @@ var Tools = class {
738
772
  }
739
773
  return result;
740
774
  }
775
+ /**
776
+ * @internal
777
+ * Handles the execution of a composio tool
778
+ * @param tool - The tool to execute
779
+ * @param body - The body of the tool execution
780
+ * @param modifiers - The modifiers to be applied to the tool execution
781
+ * @returns The response from the tool execution
782
+ */
741
783
  async handleComposioToolExecution(tool, body, modifiers) {
742
784
  if (modifiers?.beforeToolExecute) {
743
785
  if (typeof modifiers.beforeToolExecute === "function") {
@@ -793,7 +835,7 @@ var Tools = class {
793
835
  if (customTool) {
794
836
  return this.handleCustomToolExecution(customTool, body, modifiers);
795
837
  } else {
796
- const composioTool = await this.getComposioToolBySlug(body.userId, slug);
838
+ const composioTool = await this.getRawComposioToolBySlug(body.userId, slug);
797
839
  if (!composioTool) {
798
840
  throw new ComposioToolNotFoundError(`Tool with slug ${slug} not found`);
799
841
  }
@@ -848,7 +890,7 @@ var Tools = class {
848
890
 
849
891
  // src/types/toolkit.types.ts
850
892
  var import_zod3 = require("zod");
851
- var ToolkitMangedByEnumSchema = import_zod3.z.enum(["all", "composio_managed", "project_managed"]);
893
+ var ToolkitMangedByEnumSchema = import_zod3.z.enum(["all", "composio", "project"]);
852
894
  var ToolkitSortByEnumSchema = import_zod3.z.enum(["usage", "alphabetically"]);
853
895
  var ToolkitsListParamsSchema = import_zod3.z.object({
854
896
  category: import_zod3.z.string().optional(),
@@ -905,8 +947,8 @@ var ToolkitAuthConfigDetailsSchema = import_zod3.z.object({
905
947
  })
906
948
  }),
907
949
  proxy: import_zod3.z.object({
908
- baseUrl: import_zod3.z.string()
909
- })
950
+ baseUrl: import_zod3.z.string().optional()
951
+ }).optional()
910
952
  });
911
953
  var ToolkitRetrieveResponseSchema = import_zod3.z.object({
912
954
  name: import_zod3.z.string(),
@@ -1015,9 +1057,20 @@ var AuthConfigListResponseSchema = import_zod4.z.object({
1015
1057
  nextCursor: import_zod4.z.string().optional(),
1016
1058
  totalPages: import_zod4.z.number()
1017
1059
  });
1018
- var AuthConfigUpdateParamsSchema = import_zod4.z.object({
1019
- credentials: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.union([import_zod4.z.string(), import_zod4.z.number(), import_zod4.z.boolean()]))
1060
+ var AuthCustomConfigUpdateParamsSchema = import_zod4.z.object({
1061
+ credentials: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.union([import_zod4.z.string(), import_zod4.z.unknown()])),
1062
+ type: import_zod4.z.literal("custom"),
1063
+ restrictToFollowingTools: import_zod4.z.array(import_zod4.z.string()).optional()
1064
+ });
1065
+ var AuthDefaultConfigUpdateParamsSchema = import_zod4.z.object({
1066
+ scopes: import_zod4.z.string(),
1067
+ type: import_zod4.z.literal("default"),
1068
+ restrictToFollowingTools: import_zod4.z.array(import_zod4.z.string()).optional()
1020
1069
  });
1070
+ var AuthConfigUpdateParamsSchema = import_zod4.z.discriminatedUnion("type", [
1071
+ AuthCustomConfigUpdateParamsSchema,
1072
+ AuthDefaultConfigUpdateParamsSchema
1073
+ ]);
1021
1074
 
1022
1075
  // src/models/AuthConfigs.ts
1023
1076
  var AuthConfigs = class {
@@ -1025,6 +1078,14 @@ var AuthConfigs = class {
1025
1078
  constructor(client) {
1026
1079
  this.client = client;
1027
1080
  }
1081
+ /**
1082
+ * Protected getter for the client instance.
1083
+ * This is primarily used for testing purposes.
1084
+ * @protected
1085
+ */
1086
+ getClient() {
1087
+ return this.client;
1088
+ }
1028
1089
  parseAuthConfigRetrieveResponse(authConfig) {
1029
1090
  const result = AuthConfigRetrieveResponseSchema.safeParse({
1030
1091
  id: authConfig.id,
@@ -1131,11 +1192,22 @@ var AuthConfigs = class {
1131
1192
  * @returns {Promise<AuthConfigUpdateResponse>} Updated auth config
1132
1193
  */
1133
1194
  async update(nanoid, data) {
1134
- return this.client.authConfigs.update(nanoid, {
1135
- auth_config: {
1136
- credentials: data.credentials
1195
+ const parsedData = AuthConfigUpdateParamsSchema.safeParse(data);
1196
+ if (parsedData.error) {
1197
+ throw new ValidationError(parsedData.error);
1198
+ }
1199
+ return this.client.authConfigs.update(
1200
+ nanoid,
1201
+ parsedData.data.type === "custom" ? {
1202
+ type: "custom",
1203
+ credentials: parsedData.data.credentials,
1204
+ restrict_to_following_tools: parsedData.data.restrictToFollowingTools
1205
+ } : {
1206
+ type: "default",
1207
+ scopes: parsedData.data.scopes,
1208
+ restrict_to_following_tools: parsedData.data.restrictToFollowingTools
1137
1209
  }
1138
- });
1210
+ );
1139
1211
  }
1140
1212
  /**
1141
1213
  * Delete an auth config
@@ -1200,7 +1272,7 @@ var import_zod5 = require("zod");
1200
1272
  var ConnectedAccountStatuses = {
1201
1273
  ACTIVE: "ACTIVE",
1202
1274
  INACTIVE: "INACTIVE",
1203
- PENDING: "DELETED",
1275
+ DELETED: "DELETED",
1204
1276
  INITIATED: "INITIATED",
1205
1277
  EXPIRED: "EXPIRED",
1206
1278
  FAILED: "FAILED"
@@ -1208,7 +1280,7 @@ var ConnectedAccountStatuses = {
1208
1280
  var ConnectedAccountStatusSchema = import_zod5.z.enum([
1209
1281
  ConnectedAccountStatuses.ACTIVE,
1210
1282
  ConnectedAccountStatuses.INACTIVE,
1211
- ConnectedAccountStatuses.PENDING,
1283
+ ConnectedAccountStatuses.DELETED,
1212
1284
  ConnectedAccountStatuses.INITIATED,
1213
1285
  ConnectedAccountStatuses.EXPIRED,
1214
1286
  ConnectedAccountStatuses.FAILED
@@ -1300,7 +1372,8 @@ var import_zod6 = require("zod");
1300
1372
 
1301
1373
  // src/errors/ConnectionRequestError.ts
1302
1374
  var ConnectionRequestErrorCodes = {
1303
- CONNECTION_REQUEST_TIMEOUT: "CONNECTION_REQUEST_TIMEOUT"
1375
+ CONNECTION_REQUEST_TIMEOUT: "CONNECTION_REQUEST_TIMEOUT",
1376
+ CONNECTION_REQUEST_FAILED: "CONNECTION_REQUEST_FAILED"
1304
1377
  };
1305
1378
  var ConnectionRequestTimeoutError = class extends ComposioError {
1306
1379
  constructor(message = "Connection request timed out", meta = {}) {
@@ -1308,6 +1381,16 @@ var ConnectionRequestTimeoutError = class extends ComposioError {
1308
1381
  code: ConnectionRequestErrorCodes.CONNECTION_REQUEST_TIMEOUT,
1309
1382
  meta
1310
1383
  });
1384
+ this.name = "ConnectionRequestTimeoutError";
1385
+ }
1386
+ };
1387
+ var ConnectionRequestFailedError = class extends ComposioError {
1388
+ constructor(message = "Connection request failed", meta = {}) {
1389
+ super(message, {
1390
+ code: ConnectionRequestErrorCodes.CONNECTION_REQUEST_FAILED,
1391
+ meta
1392
+ });
1393
+ this.name = "ConnectionRequestFailedError";
1311
1394
  }
1312
1395
  };
1313
1396
 
@@ -1364,30 +1447,40 @@ var ConnectionRequest = class {
1364
1447
  async waitForConnection(timeout = 6e4) {
1365
1448
  if (this.connectedAccountStatus === ConnectedAccountStatuses.ACTIVE) {
1366
1449
  const response = await this.client.connectedAccounts.retrieve(this.connectedAccountId);
1367
- return Promise.resolve(this.transformResponse(response));
1368
- }
1369
- return new Promise((resolve, reject) => {
1370
- const interval = setInterval(async () => {
1371
- try {
1372
- const response = await this.client.connectedAccounts.retrieve(this.connectedAccountId);
1373
- if (response.status === ConnectedAccountStatuses.ACTIVE) {
1374
- clearInterval(interval);
1375
- resolve(this.transformResponse(response));
1376
- }
1377
- } catch (error) {
1378
- clearInterval(interval);
1379
- reject(error);
1450
+ return this.transformResponse(response);
1451
+ }
1452
+ const terminalErrorStates = [
1453
+ ConnectedAccountStatuses.FAILED,
1454
+ ConnectedAccountStatuses.EXPIRED,
1455
+ ConnectedAccountStatuses.DELETED
1456
+ ];
1457
+ const start = Date.now();
1458
+ const pollInterval = 1e3;
1459
+ while (Date.now() - start < timeout) {
1460
+ try {
1461
+ const response = await this.client.connectedAccounts.retrieve(this.connectedAccountId);
1462
+ if (response.status === ConnectedAccountStatuses.ACTIVE) {
1463
+ return this.transformResponse(response);
1380
1464
  }
1381
- }, 1e3);
1382
- setTimeout(() => {
1383
- clearInterval(interval);
1384
- reject(
1385
- new ConnectionRequestTimeoutError(
1386
- `Connection request timed out for ${this.connectedAccountId}`
1387
- )
1388
- );
1389
- }, timeout);
1390
- });
1465
+ if (terminalErrorStates.includes(response.status)) {
1466
+ throw new ConnectionRequestFailedError(
1467
+ `Connection request failed with status: ${response.status}${response.status_reason ? `, reason: ${response.status_reason}` : ""}`,
1468
+ {
1469
+ userId: response.user_id,
1470
+ connectedAccountId: this.connectedAccountId,
1471
+ status: response.status,
1472
+ statusReason: response.status_reason
1473
+ }
1474
+ );
1475
+ }
1476
+ await new Promise((resolve) => setTimeout(resolve, pollInterval));
1477
+ } catch (error) {
1478
+ throw error;
1479
+ }
1480
+ }
1481
+ throw new ConnectionRequestTimeoutError(
1482
+ `Connection request timed out for ${this.connectedAccountId}`
1483
+ );
1391
1484
  }
1392
1485
  };
1393
1486
 
@@ -1617,20 +1710,21 @@ var Toolkits = class {
1617
1710
  * @param {string} authConfigId - The id of the auth config to use
1618
1711
  * @returns {Promise<ConnectionRequest>} The connection request object
1619
1712
  */
1620
- async authorize(userId, toolkitSlug, authConfigId) {
1713
+ async authorize(userId, toolkitSlug) {
1621
1714
  const toolkit = await this.getToolkitBySlug(toolkitSlug);
1622
1715
  const composioAuthConfig = new AuthConfigs(this.client);
1623
1716
  let authConfigIdToUse;
1624
- if (authConfigId) {
1625
- const authConfig = await composioAuthConfig.get(authConfigId);
1626
- authConfigIdToUse = authConfig.id;
1627
- } else {
1717
+ const authConfig = await composioAuthConfig.list({
1718
+ toolkitSlug
1719
+ });
1720
+ authConfigIdToUse = authConfig.items[0]?.id;
1721
+ if (!authConfigIdToUse) {
1628
1722
  if (toolkit.authConfigDetails && toolkit.authConfigDetails.length > 0) {
1629
- const authConfig = await composioAuthConfig.create(toolkitSlug, {
1723
+ const authConfig2 = await composioAuthConfig.create(toolkitSlug, {
1630
1724
  type: "use_composio_managed_auth",
1631
1725
  name: `${toolkit.name} Auth Config`
1632
1726
  });
1633
- authConfigIdToUse = authConfig.id;
1727
+ authConfigIdToUse = authConfig2.id;
1634
1728
  } else {
1635
1729
  throw new ComposioAuthConfigNotFoundError("No auth config found for toolkit", {
1636
1730
  toolkitSlug
@@ -1860,6 +1954,7 @@ var Triggers = class {
1860
1954
  const sessionInfo = await session.getInfo();
1861
1955
  const clientId = sessionInfo.project?.id;
1862
1956
  if (!clientId) throw new Error("Client ID not found");
1957
+ if (!this.client.apiKey) throw new Error("API key not found");
1863
1958
  await PusherUtils.getPusherClient(this.client.baseURL, this.client.apiKey);
1864
1959
  const shouldSendTrigger = (data) => {
1865
1960
  if (Object.keys(filters).length === 0) return true;
@@ -2165,8 +2260,8 @@ async function checkForLatestVersionFromNPM(currentVersion) {
2165
2260
  }
2166
2261
  }
2167
2262
 
2168
- // src/toolset/BaseToolset.ts
2169
- var BaseToolset = class {
2263
+ // src/provider/BaseProvider.ts
2264
+ var BaseProvider = class {
2170
2265
  /**
2171
2266
  * @internal
2172
2267
  * The function to execute a tool.
@@ -2176,7 +2271,7 @@ var BaseToolset = class {
2176
2271
  /**
2177
2272
  * @internal
2178
2273
  * Set the function to execute a tool.
2179
- * This is set automatically injected by the core SDK.
2274
+ * This is set automatically and injected by the core SDK.
2180
2275
  */
2181
2276
  _setExecuteToolFn(executeToolFn) {
2182
2277
  this._globalExecuteToolFn = executeToolFn;
@@ -2184,29 +2279,32 @@ var BaseToolset = class {
2184
2279
  /**
2185
2280
  * @public
2186
2281
  * Gloabl function to execute a tool.
2187
- * This function is used by toolset providers to implement helper functions to execute tools.
2282
+ * This function is used by provider providers to implement helper functions to execute tools.
2188
2283
  * This is a 1:1 mapping of the `execute` method in the `Tools` class.
2189
2284
  * @param {string} toolSlug - The slug of the tool to execute.
2190
2285
  * @param {Record<string, unknown>} input - The input to the tool.
2191
2286
  * @returns {Promise<string>} The result of the tool execution.
2192
2287
  */
2193
2288
  executeTool(toolSlug, body, modifers) {
2289
+ if (!this._globalExecuteToolFn) {
2290
+ throw new ComposioGlobalExecuteToolFnNotSetError("executeToolFn is not set");
2291
+ }
2194
2292
  return this._globalExecuteToolFn(toolSlug, body, modifers);
2195
2293
  }
2196
2294
  };
2197
- var BaseNonAgenticToolset = class extends BaseToolset {
2295
+ var BaseNonAgenticProvider = class extends BaseProvider {
2198
2296
  _isAgentic = false;
2199
2297
  };
2200
- var BaseAgenticToolset = class extends BaseToolset {
2298
+ var BaseAgenticProvider = class extends BaseProvider {
2201
2299
  _isAgentic = true;
2202
2300
  };
2203
2301
 
2204
- // src/toolset/OpenAIToolset.ts
2205
- var OpenAIToolset = class extends BaseNonAgenticToolset {
2302
+ // src/provider/OpenAIProvider.ts
2303
+ var OpenAIProvider = class extends BaseNonAgenticProvider {
2206
2304
  name = "openai";
2207
2305
  /**
2208
- * Absract method to wrap a tool in the toolset.
2209
- * This method is implemented by the toolset.
2306
+ * Absract method to wrap a tool in the provider.
2307
+ * This method is implemented by the provider.
2210
2308
  * @param tool - The tool to wrap.
2211
2309
  * @returns The wrapped tool.
2212
2310
  */
@@ -2367,7 +2465,7 @@ var OpenAIToolset = class extends BaseNonAgenticToolset {
2367
2465
  };
2368
2466
 
2369
2467
  // package.json
2370
- var version = "0.1.9-alpha.0";
2468
+ var version = "0.1.11-alpha.0";
2371
2469
 
2372
2470
  // src/utils/uuid.ts
2373
2471
  var import_uuid = require("uuid");
@@ -2384,7 +2482,7 @@ var Composio = class {
2384
2482
  client;
2385
2483
  /**
2386
2484
  * The configuration for the Composio SDK.
2387
- * @type {ComposioConfig<TToolset>}
2485
+ * @type {ComposioConfig<TProvider>}
2388
2486
  */
2389
2487
  config;
2390
2488
  telemetry;
@@ -2394,7 +2492,7 @@ var Composio = class {
2394
2492
  tools;
2395
2493
  toolkits;
2396
2494
  triggers;
2397
- toolset;
2495
+ provider;
2398
2496
  // auth configs
2399
2497
  authConfigs;
2400
2498
  createAuthConfig;
@@ -2408,7 +2506,7 @@ var Composio = class {
2408
2506
  * @param {string} config.runtime The runtime for the Composio SDK.
2409
2507
  * @param {boolean} config.allowTracking Whether to allow analytics / tracking. Defaults to true.
2410
2508
  * @param {boolean} config.allowTracing Whether to allow tracing. Defaults to true.
2411
- * @param {TToolset} config.toolset The toolset to use for this Composio instance.
2509
+ * @param {TProvider} config.provider The provider to use for this Composio instance.
2412
2510
  */
2413
2511
  constructor(config) {
2414
2512
  const { baseURL: baseURLParsed, apiKey: apiKeyParsed } = getSDKConfig(
@@ -2426,9 +2524,9 @@ var Composio = class {
2426
2524
  ...config,
2427
2525
  allowTracking: config.allowTracking ?? true
2428
2526
  };
2429
- this.toolset = config.toolset ?? new OpenAIToolset();
2430
- this.tools = new Tools(this.client, this.toolset);
2431
- this.toolset._setExecuteToolFn(this.tools.execute);
2527
+ this.provider = config.provider ?? new OpenAIProvider();
2528
+ this.tools = new Tools(this.client, this.provider);
2529
+ this.provider._setExecuteToolFn(this.tools.execute);
2432
2530
  this.toolkits = new Toolkits(this.client);
2433
2531
  this.triggers = new Triggers(this.client);
2434
2532
  this.authConfigs = new AuthConfigs(this.client);
@@ -2466,7 +2564,7 @@ var Composio = class {
2466
2564
  this.telemetry.instrumentTelemetry(this.triggers);
2467
2565
  this.telemetry.instrumentTelemetry(this.authConfigs);
2468
2566
  this.telemetry.instrumentTelemetry(this.connectedAccounts);
2469
- this.telemetry.instrumentTelemetry(this.toolset);
2567
+ this.telemetry.instrumentTelemetry(this.provider);
2470
2568
  }
2471
2569
  /**
2472
2570
  * Get the Composio SDK client.
@@ -2481,8 +2579,8 @@ var Composio = class {
2481
2579
  /**
2482
2580
  * Fetch all the tools from Composio.
2483
2581
  * @param {ToolListParams} params Parameters to fetch the tools.
2484
- * @param {ToolsetOptions<TToolset>} modifiers Modifiers to apply to the tools.
2485
- * @returns {Promise<ReturnType<TToolset['getTools']>>} The tools from the toolset.
2582
+ * @param {ProviderOptions<TProvider>} modifiers Modifiers to apply to the tools.
2583
+ * @returns {Promise<ReturnType<TProvider['getTools']>>} The tools from the provider.
2486
2584
  */
2487
2585
  getTools(userId, filters, modifiers) {
2488
2586
  return this.tools.get(userId, filters, modifiers);
@@ -2490,17 +2588,17 @@ var Composio = class {
2490
2588
  /**
2491
2589
  * Fetch a tool from Composio by its slug.
2492
2590
  * @param {string} slug slug of the tool
2493
- * @param {ToolsetOptions<TToolset>} modifiers to be applied to the tool
2494
- * @returns {Promise<ReturnType<TToolset['getToolBySlug']>>} The tool from the toolset.
2591
+ * @param {ProviderOptions<TProvider>} modifiers to be applied to the tool
2592
+ * @returns {Promise<ReturnType<TProvider['getToolBySlug']>>} The tool from the provider.
2495
2593
  */
2496
2594
  getToolBySlug(userId, slug, modifiers) {
2497
2595
  return this.tools.get(userId, slug, modifiers);
2498
2596
  }
2499
2597
  };
2500
2598
 
2501
- // src/toolset/ComposioToolset.ts
2502
- var ComposioToolset = class extends BaseNonAgenticToolset {
2503
- name = "ComposioToolset";
2599
+ // src/provider/ComposioProvider.ts
2600
+ var ComposioProvider = class extends BaseNonAgenticProvider {
2601
+ name = "ComposioProvider";
2504
2602
  wrapTool = (tool) => {
2505
2603
  return tool;
2506
2604
  };
@@ -2625,12 +2723,12 @@ Examples: ${value.examples.join(", ")}` : "")
2625
2723
  0 && (module.exports = {
2626
2724
  AuthConfigTypes,
2627
2725
  AuthSchemeTypes,
2628
- BaseAgenticToolset,
2629
- BaseNonAgenticToolset,
2726
+ BaseAgenticProvider,
2727
+ BaseNonAgenticProvider,
2630
2728
  BaseTelemetryTransport,
2631
2729
  Composio,
2632
- ComposioToolset,
2633
- OpenAIToolset,
2730
+ ComposioProvider,
2731
+ OpenAIProvider,
2634
2732
  ToolListParamsSchema,
2635
2733
  jsonSchemaToModel
2636
2734
  });