@composio/core 0.1.3-alpha.0 → 0.1.6-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
@@ -1,26 +1,15 @@
1
1
  # @composio/core
2
2
 
3
- The core package of Composio SDK, providing essential functionality for building and managing AI-powered tools and toolsets.
3
+ The core Composio SDK which allows users to interact with the Composio Platform. It provides a powerful and flexible way to manage and execute tools, handle authentication, and integrate with various platforms and frameworks.
4
4
 
5
- ## Features
5
+ ## Core Features
6
6
 
7
- ### 1. Core Functionality
8
- - **Composio Client Integration**: Seamless integration with Composio API
9
- - **Tool Management**: Create, manage, and execute tools
10
- - **Toolkit Support**: Organize tools into toolsets
11
- - **Authentication & Authorization**: Built-in auth configuration and management
12
- - **Connected Accounts**: Manage multiple account connections
13
-
14
- ### 2. Toolsets
15
- - **Default OpenAI Toolset**: Ships with built-in OpenAI integration
16
- - **Extensible Base Toolset**: Create custom toolsets by extending `BaseComposioToolset`
17
- - **Tool Wrapping**: Standardized tool wrapping and execution
18
-
19
- ### 3. Advanced Features
20
- - **Telemetry**: Built-in telemetry for monitoring and debugging
21
- - **Logging**: Configurable logging system with multiple levels
22
- - **Environment Management**: Flexible configuration through environment variables
23
- - **Version Management**: Automatic version checking and updates
7
+ - **Tools**: Manage and execute tools within the Composio ecosystem. Includes functionality to list, retrieve, and execute tools.
8
+ - **Toolkits**: Organize and manage collections of tools for specific use cases.
9
+ - **Triggers**: Create and manage event triggers that can execute tools based on specific conditions.
10
+ - **AuthConfigs**: Configure authentication providers and settings.
11
+ - **ConnectedAccounts**: Manage third-party service connections.
12
+ - **ActionExecution**: Track and manage the execution of actions within the platform.
24
13
 
25
14
  ## Installation
26
15
 
@@ -32,23 +21,27 @@ yarn add @composio/core
32
21
  pnpm add @composio/core
33
22
  ```
34
23
 
35
- ## Quick Start
24
+ ## Getting Started
25
+
26
+ ### Basic Usage with OpenAI Toolset
36
27
 
37
28
  ```typescript
38
29
  import { Composio } from '@composio/core';
30
+ import { OpenAIToolset } from '@composio/openai-toolset';
39
31
 
40
- // Initialize Composio with default OpenAI toolset
41
32
  const composio = new Composio({
42
- apiKey: 'your-api-key',
43
- baseURL: 'https://api.composio.dev', // optional
33
+ apiKey: process.env.COMPOSIO_API_KEY,
34
+ // OpenAIToolset is the default, so this is optional
35
+ toolset: new OpenAIToolset(),
44
36
  });
45
37
 
46
- // Get available tools
47
- const tools = await composio.getTools();
38
+ // Fetch a single tool
39
+ const searchTool = await composio.tools.get('user123', 'HACKERNEWS_SEARCH_POSTS');
48
40
 
49
- // Execute a specific tool
50
- const result = await composio.tools.execute('tool-slug', {
51
- // tool parameters
41
+ // Fetch multiple tools
42
+ const tools = await composio.tools.get('user123', {
43
+ category: 'search',
44
+ limit: 10,
52
45
  });
53
46
  ```
54
47
 
@@ -58,53 +51,146 @@ The Composio constructor accepts the following configuration options:
58
51
 
59
52
  ```typescript
60
53
  interface ComposioConfig {
61
- apiKey?: string; // Your Composio API key
62
- baseURL?: string; // Custom API base URL (optional)
63
- allowTracking?: boolean; // Enable/disable telemetry (default: true)
64
- allowTracing?: boolean; // Enable/disable tracing (default: true)
65
- toolset?: TToolset; // Custom toolset (default: OpenAIToolset)
66
- userId?: string; // Custom user ID
67
- connectedAccountIds?: Record<string, string>; // Connected account mappings
54
+ apiKey?: string; // Your Composio API key
55
+ baseURL?: string; // Custom API base URL (optional)
56
+ allowTracking?: boolean; // Enable/disable telemetry (default: true)
57
+ allowTracing?: boolean; // Enable/disable tracing (default: true)
58
+ toolset?: TToolset; // Custom toolset (default: OpenAIToolset)
68
59
  telemetryTransport?: BaseTelemetryTransport; // Custom telemetry transport
69
60
  }
70
61
  ```
71
62
 
72
- ## Toolsets
63
+ ## Modifiers
64
+
65
+ Composio SDK supports powerful modifiers to transform tool schemas and execution behavior.
66
+
67
+ ### Schema Modifiers
68
+
69
+ Schema modifiers allow you to transform tool schemas before they are used:
70
+
71
+ ```typescript
72
+ const tool = await composio.tools.get('user123', 'HACKERNEWS_SEARCH_POSTS', {
73
+ modifyToolSchema: (toolSlug: string, tool: Tool) => ({
74
+ ...tool,
75
+ description: 'Enhanced HackerNews search with additional features',
76
+ inputParameters: {
77
+ ...tool.inputParameters,
78
+ limit: {
79
+ type: 'number',
80
+ description: 'Maximum number of posts to return',
81
+ default: 10,
82
+ },
83
+ },
84
+ }),
85
+ });
86
+ ```
87
+
88
+ ### Execution Modifiers
73
89
 
74
- ### Default OpenAI Toolset
90
+ For agentic toolsets (like Vercel AI and Langchain), you can also modify tool execution behavior:
75
91
 
76
- The core package ships with OpenAI toolset by default. For more information about the OpenAI toolset and its capabilities, check out the [OpenAI Toolset Documentation](./toolset/OpenAIToolset.md).
92
+ ```typescript
93
+ const tool = await composio.tools.get('user123', 'HACKERNEWS_SEARCH_POSTS', {
94
+ // Transform input before execution
95
+ beforeToolExecute: (toolSlug: string, params: ToolExecuteParams) => ({
96
+ ...params,
97
+ arguments: {
98
+ ...params.arguments,
99
+ limit: Math.min((params.arguments?.limit as number) || 10, 100),
100
+ },
101
+ }),
102
+
103
+ // Transform output after execution
104
+ afterToolExecute: (toolSlug: string, response: ToolExecuteResponse) => ({
105
+ ...response,
106
+ data: {
107
+ ...response.data,
108
+ posts: (response.data?.posts as any[]).map(post => ({
109
+ ...post,
110
+ url: post.url || `https://news.ycombinator.com/item?id=${post.id}`,
111
+ })),
112
+ },
113
+ }),
114
+ });
115
+ ```
77
116
 
78
- ### Creating Custom Toolsets
117
+ ## Connected Accounts
79
118
 
80
- You can create custom toolsets by extending the `BaseComposioToolset`:
119
+ Composio SDK provides a powerful way to manage third-party service connections through Connected Accounts. This feature allows you to authenticate with various services and maintain those connections.
120
+
121
+ ### Creating a Connected Account
81
122
 
82
123
  ```typescript
83
- import { BaseComposioToolset, Tool } from '@composio/core';
124
+ import { Composio } from '@composio/core';
84
125
 
85
- interface CustomTool {
86
- name: string;
87
- // ... custom tool properties
88
- }
126
+ const composio = new Composio({
127
+ apiKey: process.env.COMPOSIO_API_KEY,
128
+ });
89
129
 
90
- class CustomToolset extends BaseComposioToolset<CustomTool[], CustomTool> {
91
- readonly FILE_NAME = 'custom/toolset.ts';
92
-
93
- _wrapTool = (tool: Tool): CustomTool => {
94
- // Implement tool wrapping logic
95
- return {
96
- name: tool.name,
97
- // ... map other properties
98
- };
99
- };
100
-
101
- async getTools() {
102
- const tools = await this.client?.tools.list();
103
- return tools?.items.map(tool => this._wrapTool(tool)) ?? [];
130
+ // Create a connected account
131
+ const connectionRequest = await composio.createConnectedAccount(
132
+ 'user123', // userId
133
+ 'HACKERNEWS', // authConfigId
134
+ {
135
+ redirectUrl: 'https://your-app.com/callback',
136
+ data: {
137
+ // Additional data for the connection
138
+ scope: ['read', 'write'],
139
+ },
104
140
  }
105
- }
141
+ );
142
+
143
+ // Wait for the connection to be established
144
+ // Default timeout is 60 seconds
145
+ const connectedAccount = await connectionRequest.waitForConnection();
146
+ ```
147
+
148
+ ### Managing Connected Accounts
149
+
150
+ ```typescript
151
+ // List all connected accounts
152
+ const accounts = await composio.connectedAccounts.list({
153
+ userId: 'user123',
154
+ });
155
+
156
+ // Get a specific connected account
157
+ const account = await composio.connectedAccounts.get('account_id');
158
+
159
+ // Enable/Disable a connected account
160
+ await composio.connectedAccounts.enable('account_id');
161
+ await composio.connectedAccounts.disable('account_id');
162
+
163
+ // Refresh credentials
164
+ await composio.connectedAccounts.refresh('account_id');
165
+
166
+ // Delete a connected account
167
+ await composio.connectedAccounts.delete('account_id');
106
168
  ```
107
169
 
170
+ ### Connection Statuses
171
+
172
+ Connected accounts can have the following statuses:
173
+
174
+ - `ACTIVE`: Connection is established and working
175
+ - `INACTIVE`: Connection is temporarily disabled
176
+ - `PENDING`: Connection is being processed
177
+ - `INITIATED`: Connection request has started
178
+ - `EXPIRED`: Connection credentials have expired
179
+ - `FAILED`: Connection attempt failed
180
+
181
+ ### Authentication Schemes
182
+
183
+ Composio supports various authentication schemes:
184
+
185
+ - OAuth2
186
+ - OAuth1
187
+ - OAuth1a
188
+ - API Key
189
+ - Basic Auth
190
+ - Bearer Token
191
+ - Google Service Account
192
+ - And more...
193
+
108
194
  ## Environment Variables
109
195
 
110
196
  - `COMPOSIO_API_KEY`: Your Composio API key
package/dist/index.cjs CHANGED
@@ -71,7 +71,7 @@ var ToolListParamsSchema = import_zod.z.object({
71
71
  important: import_zod.z.string().optional(),
72
72
  limit: import_zod.z.string().optional(),
73
73
  search: import_zod.z.string().optional(),
74
- toolkits: import_zod.z.string().optional(),
74
+ toolkits: import_zod.z.array(import_zod.z.string()).optional(),
75
75
  tools: import_zod.z.array(import_zod.z.string()).optional()
76
76
  });
77
77
  var CustomAuthParamsSchema = import_zod.z.object({
@@ -436,7 +436,7 @@ var Tools = class {
436
436
  important: queryParams.data.important,
437
437
  limit: queryParams.data.limit,
438
438
  search: queryParams.data.search,
439
- toolkit_slug: queryParams.data.toolkits,
439
+ toolkit_slug: queryParams.data.toolkits?.join(","),
440
440
  tool_slugs: queryParams.data.tools?.join(",")
441
441
  });
442
442
  if (!tools) {
@@ -1181,7 +1181,6 @@ var ConnectedAccountAuthConfigSchema = import_zod3.z.object({
1181
1181
  });
1182
1182
  var ConnectedAccountRetrieveResponseSchema = import_zod3.z.object({
1183
1183
  id: import_zod3.z.string(),
1184
- uuid: import_zod3.z.string(),
1185
1184
  authConfig: ConnectedAccountAuthConfigSchema,
1186
1185
  userId: import_zod3.z.string(),
1187
1186
  data: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()),
@@ -1198,8 +1197,8 @@ var ConnectedAccountRetrieveResponseSchema = import_zod3.z.object({
1198
1197
  });
1199
1198
 
1200
1199
  // src/models/ConnectionRequest.ts
1200
+ var import_zod4 = require("zod");
1201
1201
  var ConnectionRequest = class {
1202
- FILE_NAME = "core/models/ConnectionRequest.ts";
1203
1202
  client;
1204
1203
  connectedAccountId;
1205
1204
  connectedAccountStatus;
@@ -1214,23 +1213,31 @@ var ConnectionRequest = class {
1214
1213
  * @returns
1215
1214
  */
1216
1215
  async transformResponse(response) {
1217
- const parsedResponse = ConnectedAccountRetrieveResponseSchema.parse({
1218
- ...response,
1219
- userId: response.user_id,
1220
- // Add the missing userId property
1221
- authConfig: {
1222
- ...response.auth_config,
1223
- authScheme: response.auth_config.auth_scheme,
1224
- isComposioManaged: response.auth_config.is_composio_managed,
1225
- isDisabled: response.auth_config.is_disabled
1226
- },
1227
- statusReason: response.status_reason,
1228
- isDisabled: response.is_disabled,
1229
- createdAt: response.created_at,
1230
- updatedAt: response.updated_at,
1231
- testRequestEndpoint: response.test_request_endpoint
1232
- });
1233
- return parsedResponse;
1216
+ try {
1217
+ const parsedResponse = ConnectedAccountRetrieveResponseSchema.parse({
1218
+ ...response,
1219
+ userId: response.user_id,
1220
+ // Add the missing userId property
1221
+ authConfig: {
1222
+ ...response.auth_config,
1223
+ authScheme: response.auth_config.auth_scheme,
1224
+ isComposioManaged: response.auth_config.is_composio_managed,
1225
+ isDisabled: response.auth_config.is_disabled
1226
+ },
1227
+ statusReason: response.status_reason,
1228
+ isDisabled: response.is_disabled,
1229
+ createdAt: response.created_at,
1230
+ updatedAt: response.updated_at,
1231
+ testRequestEndpoint: response.test_request_endpoint
1232
+ });
1233
+ return parsedResponse;
1234
+ } catch (error) {
1235
+ logger_default.error("Error transforming response", error);
1236
+ if (error instanceof import_zod4.ZodError) {
1237
+ logger_default.error(JSON.stringify(error.errors, null, 2));
1238
+ }
1239
+ throw error;
1240
+ }
1234
1241
  }
1235
1242
  /**
1236
1243
  * Wait for the connection to be established.
@@ -1351,14 +1358,13 @@ var ConnectedAccounts = class {
1351
1358
  * @returns {Promise<ConnectionRequest>} Connection request object
1352
1359
  */
1353
1360
  async createConnectedAccount(userId, authConfigId, options) {
1354
- const { redirectUrl, data } = options;
1355
1361
  const response = await this.create({
1356
1362
  auth_config: {
1357
1363
  id: authConfigId
1358
1364
  },
1359
1365
  connection: {
1360
- data,
1361
- redirect_uri: redirectUrl,
1366
+ data: options?.data,
1367
+ redirect_uri: options?.redirectUrl,
1362
1368
  user_id: userId
1363
1369
  }
1364
1370
  });
@@ -1850,7 +1856,7 @@ var OpenAIToolset = class extends BaseNonAgenticToolset {
1850
1856
  };
1851
1857
 
1852
1858
  // package.json
1853
- var version = "0.1.1-alpha.0";
1859
+ var version = "0.1.6-alpha.0";
1854
1860
 
1855
1861
  // src/utils/uuid.ts
1856
1862
  var import_uuid = require("uuid");
@@ -1914,7 +1920,9 @@ var Composio = class {
1914
1920
  this.triggers = new Triggers(this.client);
1915
1921
  this.authConfigs = new AuthConfigs(this.client);
1916
1922
  this.connectedAccounts = new ConnectedAccounts(this.client);
1917
- this.createConnectedAccount = this.connectedAccounts.createConnectedAccount;
1923
+ this.createConnectedAccount = this.connectedAccounts.createConnectedAccount.bind(
1924
+ this.connectedAccounts
1925
+ );
1918
1926
  if (this.config.allowTracking ?? true) {
1919
1927
  this.initializeTelemetry(
1920
1928
  {
@@ -1994,39 +2002,39 @@ var BaseTelemetryTransport = class {
1994
2002
  };
1995
2003
 
1996
2004
  // src/utils/jsonSchema.ts
1997
- var import_zod4 = require("zod");
2005
+ var import_zod5 = require("zod");
1998
2006
  function jsonSchemaPropertiesToTSTypes(value) {
1999
2007
  if (!value.type) {
2000
- return import_zod4.z.object({});
2008
+ return import_zod5.z.object({});
2001
2009
  }
2002
2010
  let zodType;
2003
2011
  switch (value.type) {
2004
2012
  case "string":
2005
- zodType = import_zod4.z.string().describe(
2013
+ zodType = import_zod5.z.string().describe(
2006
2014
  (value.description || "") + (value.examples ? `
2007
2015
  Examples: ${value.examples.join(", ")}` : "")
2008
2016
  );
2009
2017
  break;
2010
2018
  case "number":
2011
- zodType = import_zod4.z.number().describe(
2019
+ zodType = import_zod5.z.number().describe(
2012
2020
  (value.description || "") + (value.examples ? `
2013
2021
  Examples: ${value.examples.join(", ")}` : "")
2014
2022
  );
2015
2023
  break;
2016
2024
  case "integer":
2017
- zodType = import_zod4.z.number().int().describe(
2025
+ zodType = import_zod5.z.number().int().describe(
2018
2026
  (value.description || "") + (value.examples ? `
2019
2027
  Examples: ${value.examples.join(", ")}` : "")
2020
2028
  );
2021
2029
  break;
2022
2030
  case "boolean":
2023
- zodType = import_zod4.z.boolean().describe(
2031
+ zodType = import_zod5.z.boolean().describe(
2024
2032
  (value.description || "") + (value.examples ? `
2025
2033
  Examples: ${value.examples.join(", ")}` : "")
2026
2034
  );
2027
2035
  break;
2028
2036
  case "array":
2029
- zodType = import_zod4.z.array(
2037
+ zodType = import_zod5.z.array(
2030
2038
  jsonSchemaPropertiesToTSTypes(
2031
2039
  value.items
2032
2040
  )
@@ -2042,7 +2050,7 @@ Examples: ${value.examples.join(", ")}` : "")
2042
2050
  );
2043
2051
  break;
2044
2052
  case "null":
2045
- zodType = import_zod4.z.null().describe(value.description || "");
2053
+ zodType = import_zod5.z.null().describe(value.description || "");
2046
2054
  break;
2047
2055
  default:
2048
2056
  throw new Error(`Unsupported JSON schema type: ${value.type}`);
@@ -2053,7 +2061,7 @@ function jsonSchemaToModel(jsonSchema) {
2053
2061
  const properties = jsonSchema.properties;
2054
2062
  const requiredFields = jsonSchema.required || [];
2055
2063
  if (!properties) {
2056
- return import_zod4.z.object({});
2064
+ return import_zod5.z.object({});
2057
2065
  }
2058
2066
  const zodSchema = {};
2059
2067
  for (const [key, _] of Object.entries(properties)) {
@@ -2065,7 +2073,7 @@ function jsonSchemaToModel(jsonSchema) {
2065
2073
  schema
2066
2074
  )
2067
2075
  );
2068
- zodType = import_zod4.z.union(anyOfTypes).describe(
2076
+ zodType = import_zod5.z.union(anyOfTypes).describe(
2069
2077
  (value.description || "") + (value.examples ? `
2070
2078
  Examples: ${value.examples.join(", ")}` : "")
2071
2079
  );
@@ -2075,7 +2083,7 @@ Examples: ${value.examples.join(", ")}` : "")
2075
2083
  schema
2076
2084
  )
2077
2085
  );
2078
- zodType = import_zod4.z.intersection(
2086
+ zodType = import_zod5.z.intersection(
2079
2087
  allOfTypes[0],
2080
2088
  allOfTypes.slice(1).reduce((acc, schema) => acc.and(schema), allOfTypes[0])
2081
2089
  ).describe(
@@ -2099,7 +2107,7 @@ Examples: ${value.examples.join(", ")}` : "")
2099
2107
  zodSchema[key] = zodType.optional();
2100
2108
  }
2101
2109
  }
2102
- return import_zod4.z.object(zodSchema);
2110
+ return import_zod5.z.object(zodSchema);
2103
2111
  }
2104
2112
  // Annotate the CommonJS export names for ESM import in node:
2105
2113
  0 && (module.exports = {
package/dist/index.d.cts CHANGED
@@ -75,21 +75,21 @@ declare const ToolListParamsSchema: z.ZodObject<{
75
75
  important: z.ZodOptional<z.ZodString>;
76
76
  limit: z.ZodOptional<z.ZodString>;
77
77
  search: z.ZodOptional<z.ZodString>;
78
- toolkits: z.ZodOptional<z.ZodString>;
78
+ toolkits: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
79
79
  tools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
80
80
  }, "strip", z.ZodTypeAny, {
81
81
  cursor?: string | undefined;
82
82
  important?: string | undefined;
83
83
  limit?: string | undefined;
84
84
  search?: string | undefined;
85
- toolkits?: string | undefined;
85
+ toolkits?: string[] | undefined;
86
86
  tools?: string[] | undefined;
87
87
  }, {
88
88
  cursor?: string | undefined;
89
89
  important?: string | undefined;
90
90
  limit?: string | undefined;
91
91
  search?: string | undefined;
92
- toolkits?: string | undefined;
92
+ toolkits?: string[] | undefined;
93
93
  tools?: string[] | undefined;
94
94
  }>;
95
95
  type ToolListParams = z.infer<typeof ToolListParamsSchema>;
@@ -1442,7 +1442,6 @@ declare const CreateConnectedAccountOptionsSchema: z.ZodObject<{
1442
1442
  type CreateConnectedAccountOptionsSchema = z.infer<typeof CreateConnectedAccountOptionsSchema>;
1443
1443
  declare const ConnectedAccountRetrieveResponseSchema: z.ZodObject<{
1444
1444
  id: z.ZodString;
1445
- uuid: z.ZodString;
1446
1445
  authConfig: z.ZodObject<{
1447
1446
  id: z.ZodString;
1448
1447
  authScheme: z.ZodEnum<["OAUTH2", "OAUTH1", "OAUTH1A", "API_KEY", "BASIC", "BILLCOM_AUTH", "BEARER_TOKEN", "GOOGLE_SERVICE_ACCOUNT", "NO_AUTH", "BASIC_WITH_JWT", "COMPOSIO_LINK", "CALCOM_AUTH", "SNOWFLAKE"]>;
@@ -1493,7 +1492,6 @@ declare const ConnectedAccountRetrieveResponseSchema: z.ZodObject<{
1493
1492
  isDisabled: boolean;
1494
1493
  };
1495
1494
  isDisabled: boolean;
1496
- uuid: string;
1497
1495
  statusReason: string | null;
1498
1496
  testRequestEndpoint?: string | undefined;
1499
1497
  }, {
@@ -1514,7 +1512,6 @@ declare const ConnectedAccountRetrieveResponseSchema: z.ZodObject<{
1514
1512
  isDisabled: boolean;
1515
1513
  };
1516
1514
  isDisabled: boolean;
1517
- uuid: string;
1518
1515
  statusReason: string | null;
1519
1516
  testRequestEndpoint?: string | undefined;
1520
1517
  }>;
@@ -1529,7 +1526,6 @@ type ConnectedAccountRetrieveResponse = z.infer<typeof ConnectedAccountRetrieveR
1529
1526
  */
1530
1527
 
1531
1528
  declare class ConnectionRequest {
1532
- readonly FILE_NAME: string;
1533
1529
  private client;
1534
1530
  private connectedAccountId;
1535
1531
  private connectedAccountStatus;
@@ -1630,7 +1626,7 @@ declare class ConnectedAccounts {
1630
1626
  * @param {CreateConnectedAccountParams} data - Data for creating a new connected account
1631
1627
  * @returns {Promise<ConnectionRequest>} Connection request object
1632
1628
  */
1633
- createConnectedAccount(userId: string, authConfigId: string, options: CreateConnectedAccountOptions): Promise<ConnectionRequest>;
1629
+ createConnectedAccount(userId: string, authConfigId: string, options?: CreateConnectedAccountOptions): Promise<ConnectionRequest>;
1634
1630
  }
1635
1631
 
1636
1632
  type AcceptableJSONValue = Record<string, unknown> | Array<Record<string, unknown>> | string | number | boolean | null | undefined;
package/dist/index.d.ts CHANGED
@@ -75,21 +75,21 @@ declare const ToolListParamsSchema: z.ZodObject<{
75
75
  important: z.ZodOptional<z.ZodString>;
76
76
  limit: z.ZodOptional<z.ZodString>;
77
77
  search: z.ZodOptional<z.ZodString>;
78
- toolkits: z.ZodOptional<z.ZodString>;
78
+ toolkits: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
79
79
  tools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
80
80
  }, "strip", z.ZodTypeAny, {
81
81
  cursor?: string | undefined;
82
82
  important?: string | undefined;
83
83
  limit?: string | undefined;
84
84
  search?: string | undefined;
85
- toolkits?: string | undefined;
85
+ toolkits?: string[] | undefined;
86
86
  tools?: string[] | undefined;
87
87
  }, {
88
88
  cursor?: string | undefined;
89
89
  important?: string | undefined;
90
90
  limit?: string | undefined;
91
91
  search?: string | undefined;
92
- toolkits?: string | undefined;
92
+ toolkits?: string[] | undefined;
93
93
  tools?: string[] | undefined;
94
94
  }>;
95
95
  type ToolListParams = z.infer<typeof ToolListParamsSchema>;
@@ -1442,7 +1442,6 @@ declare const CreateConnectedAccountOptionsSchema: z.ZodObject<{
1442
1442
  type CreateConnectedAccountOptionsSchema = z.infer<typeof CreateConnectedAccountOptionsSchema>;
1443
1443
  declare const ConnectedAccountRetrieveResponseSchema: z.ZodObject<{
1444
1444
  id: z.ZodString;
1445
- uuid: z.ZodString;
1446
1445
  authConfig: z.ZodObject<{
1447
1446
  id: z.ZodString;
1448
1447
  authScheme: z.ZodEnum<["OAUTH2", "OAUTH1", "OAUTH1A", "API_KEY", "BASIC", "BILLCOM_AUTH", "BEARER_TOKEN", "GOOGLE_SERVICE_ACCOUNT", "NO_AUTH", "BASIC_WITH_JWT", "COMPOSIO_LINK", "CALCOM_AUTH", "SNOWFLAKE"]>;
@@ -1493,7 +1492,6 @@ declare const ConnectedAccountRetrieveResponseSchema: z.ZodObject<{
1493
1492
  isDisabled: boolean;
1494
1493
  };
1495
1494
  isDisabled: boolean;
1496
- uuid: string;
1497
1495
  statusReason: string | null;
1498
1496
  testRequestEndpoint?: string | undefined;
1499
1497
  }, {
@@ -1514,7 +1512,6 @@ declare const ConnectedAccountRetrieveResponseSchema: z.ZodObject<{
1514
1512
  isDisabled: boolean;
1515
1513
  };
1516
1514
  isDisabled: boolean;
1517
- uuid: string;
1518
1515
  statusReason: string | null;
1519
1516
  testRequestEndpoint?: string | undefined;
1520
1517
  }>;
@@ -1529,7 +1526,6 @@ type ConnectedAccountRetrieveResponse = z.infer<typeof ConnectedAccountRetrieveR
1529
1526
  */
1530
1527
 
1531
1528
  declare class ConnectionRequest {
1532
- readonly FILE_NAME: string;
1533
1529
  private client;
1534
1530
  private connectedAccountId;
1535
1531
  private connectedAccountStatus;
@@ -1630,7 +1626,7 @@ declare class ConnectedAccounts {
1630
1626
  * @param {CreateConnectedAccountParams} data - Data for creating a new connected account
1631
1627
  * @returns {Promise<ConnectionRequest>} Connection request object
1632
1628
  */
1633
- createConnectedAccount(userId: string, authConfigId: string, options: CreateConnectedAccountOptions): Promise<ConnectionRequest>;
1629
+ createConnectedAccount(userId: string, authConfigId: string, options?: CreateConnectedAccountOptions): Promise<ConnectionRequest>;
1634
1630
  }
1635
1631
 
1636
1632
  type AcceptableJSONValue = Record<string, unknown> | Array<Record<string, unknown>> | string | number | boolean | null | undefined;
package/dist/index.js CHANGED
@@ -35,7 +35,7 @@ var ToolListParamsSchema = z.object({
35
35
  important: z.string().optional(),
36
36
  limit: z.string().optional(),
37
37
  search: z.string().optional(),
38
- toolkits: z.string().optional(),
38
+ toolkits: z.array(z.string()).optional(),
39
39
  tools: z.array(z.string()).optional()
40
40
  });
41
41
  var CustomAuthParamsSchema = z.object({
@@ -400,7 +400,7 @@ var Tools = class {
400
400
  important: queryParams.data.important,
401
401
  limit: queryParams.data.limit,
402
402
  search: queryParams.data.search,
403
- toolkit_slug: queryParams.data.toolkits,
403
+ toolkit_slug: queryParams.data.toolkits?.join(","),
404
404
  tool_slugs: queryParams.data.tools?.join(",")
405
405
  });
406
406
  if (!tools) {
@@ -1145,7 +1145,6 @@ var ConnectedAccountAuthConfigSchema = z3.object({
1145
1145
  });
1146
1146
  var ConnectedAccountRetrieveResponseSchema = z3.object({
1147
1147
  id: z3.string(),
1148
- uuid: z3.string(),
1149
1148
  authConfig: ConnectedAccountAuthConfigSchema,
1150
1149
  userId: z3.string(),
1151
1150
  data: z3.record(z3.string(), z3.unknown()),
@@ -1162,8 +1161,8 @@ var ConnectedAccountRetrieveResponseSchema = z3.object({
1162
1161
  });
1163
1162
 
1164
1163
  // src/models/ConnectionRequest.ts
1164
+ import { ZodError } from "zod";
1165
1165
  var ConnectionRequest = class {
1166
- FILE_NAME = "core/models/ConnectionRequest.ts";
1167
1166
  client;
1168
1167
  connectedAccountId;
1169
1168
  connectedAccountStatus;
@@ -1178,23 +1177,31 @@ var ConnectionRequest = class {
1178
1177
  * @returns
1179
1178
  */
1180
1179
  async transformResponse(response) {
1181
- const parsedResponse = ConnectedAccountRetrieveResponseSchema.parse({
1182
- ...response,
1183
- userId: response.user_id,
1184
- // Add the missing userId property
1185
- authConfig: {
1186
- ...response.auth_config,
1187
- authScheme: response.auth_config.auth_scheme,
1188
- isComposioManaged: response.auth_config.is_composio_managed,
1189
- isDisabled: response.auth_config.is_disabled
1190
- },
1191
- statusReason: response.status_reason,
1192
- isDisabled: response.is_disabled,
1193
- createdAt: response.created_at,
1194
- updatedAt: response.updated_at,
1195
- testRequestEndpoint: response.test_request_endpoint
1196
- });
1197
- return parsedResponse;
1180
+ try {
1181
+ const parsedResponse = ConnectedAccountRetrieveResponseSchema.parse({
1182
+ ...response,
1183
+ userId: response.user_id,
1184
+ // Add the missing userId property
1185
+ authConfig: {
1186
+ ...response.auth_config,
1187
+ authScheme: response.auth_config.auth_scheme,
1188
+ isComposioManaged: response.auth_config.is_composio_managed,
1189
+ isDisabled: response.auth_config.is_disabled
1190
+ },
1191
+ statusReason: response.status_reason,
1192
+ isDisabled: response.is_disabled,
1193
+ createdAt: response.created_at,
1194
+ updatedAt: response.updated_at,
1195
+ testRequestEndpoint: response.test_request_endpoint
1196
+ });
1197
+ return parsedResponse;
1198
+ } catch (error) {
1199
+ logger_default.error("Error transforming response", error);
1200
+ if (error instanceof ZodError) {
1201
+ logger_default.error(JSON.stringify(error.errors, null, 2));
1202
+ }
1203
+ throw error;
1204
+ }
1198
1205
  }
1199
1206
  /**
1200
1207
  * Wait for the connection to be established.
@@ -1315,14 +1322,13 @@ var ConnectedAccounts = class {
1315
1322
  * @returns {Promise<ConnectionRequest>} Connection request object
1316
1323
  */
1317
1324
  async createConnectedAccount(userId, authConfigId, options) {
1318
- const { redirectUrl, data } = options;
1319
1325
  const response = await this.create({
1320
1326
  auth_config: {
1321
1327
  id: authConfigId
1322
1328
  },
1323
1329
  connection: {
1324
- data,
1325
- redirect_uri: redirectUrl,
1330
+ data: options?.data,
1331
+ redirect_uri: options?.redirectUrl,
1326
1332
  user_id: userId
1327
1333
  }
1328
1334
  });
@@ -1814,7 +1820,7 @@ var OpenAIToolset = class extends BaseNonAgenticToolset {
1814
1820
  };
1815
1821
 
1816
1822
  // package.json
1817
- var version = "0.1.1-alpha.0";
1823
+ var version = "0.1.6-alpha.0";
1818
1824
 
1819
1825
  // src/utils/uuid.ts
1820
1826
  import { v4 as uuidv4 } from "uuid";
@@ -1878,7 +1884,9 @@ var Composio = class {
1878
1884
  this.triggers = new Triggers(this.client);
1879
1885
  this.authConfigs = new AuthConfigs(this.client);
1880
1886
  this.connectedAccounts = new ConnectedAccounts(this.client);
1881
- this.createConnectedAccount = this.connectedAccounts.createConnectedAccount;
1887
+ this.createConnectedAccount = this.connectedAccounts.createConnectedAccount.bind(
1888
+ this.connectedAccounts
1889
+ );
1882
1890
  if (this.config.allowTracking ?? true) {
1883
1891
  this.initializeTelemetry(
1884
1892
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@composio/core",
3
- "version": "0.1.3-alpha.0",
3
+ "version": "0.1.6-alpha.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -43,5 +43,5 @@
43
43
  "zod": "^3.24.2",
44
44
  "zod-to-json-schema": "^3.24.5"
45
45
  },
46
- "gitHead": "84ce22190d205c3846bc29fd63b88462e0eaa3bb"
46
+ "gitHead": "34bd931298ebfaa2bc901f26f328983796e090f6"
47
47
  }