@composio/core 0.5.3 → 0.5.5
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/{fileUtils-BbE-aKW0.cjs → fileUtils-2bnnG7dq.cjs} +12 -16
- package/dist/{fileUtils-BxTR8M_c.mjs → fileUtils-Dbn-fnh5.mjs} +12 -16
- package/dist/index.cjs +40 -13
- package/dist/index.d.cts +278 -215
- package/dist/index.d.mts +278 -215
- package/dist/index.mjs +40 -14
- package/dist/models/Files.node.cjs +1 -1
- package/dist/models/Files.node.mjs +1 -1
- package/package.json +2 -2
|
@@ -784,28 +784,24 @@ const readFileContentFromURL = async (path) => {
|
|
|
784
784
|
};
|
|
785
785
|
};
|
|
786
786
|
const uploadFileToS3 = async (fileName, content, toolSlug, toolkitSlug, mimeType, client) => {
|
|
787
|
-
const
|
|
787
|
+
const { key, new_presigned_url } = await client.files.createPresignedURL({
|
|
788
788
|
filename: fileName,
|
|
789
789
|
mimetype: mimeType,
|
|
790
790
|
md5: node_crypto.default.createHash("md5").update(Buffer.from(content, "base64")).digest("hex"),
|
|
791
791
|
tool_slug: toolSlug,
|
|
792
792
|
toolkit_slug: toolkitSlug
|
|
793
793
|
});
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
}
|
|
806
|
-
});
|
|
807
|
-
if (!uploadResponse.ok) throw new Error(`Failed to upload file to S3: ${uploadResponse.statusText}`);
|
|
808
|
-
} else logger_default.debug(`File already exists in S3: ${key}`);
|
|
794
|
+
logger_default.debug(`Uploading ${key} file to S3: ${key}`);
|
|
795
|
+
const buffer = Buffer.from(content, "base64");
|
|
796
|
+
const uploadResponse = await fetch(new_presigned_url, {
|
|
797
|
+
method: "PUT",
|
|
798
|
+
body: buffer,
|
|
799
|
+
headers: {
|
|
800
|
+
"Content-Type": mimeType,
|
|
801
|
+
"Content-Length": buffer.length.toString()
|
|
802
|
+
}
|
|
803
|
+
});
|
|
804
|
+
if (!uploadResponse.ok) throw new Error(`Failed to upload file to S3: ${uploadResponse.statusText}`);
|
|
809
805
|
return key;
|
|
810
806
|
};
|
|
811
807
|
const readFile = async (file) => {
|
|
@@ -782,28 +782,24 @@ const readFileContentFromURL = async (path) => {
|
|
|
782
782
|
};
|
|
783
783
|
};
|
|
784
784
|
const uploadFileToS3 = async (fileName, content, toolSlug, toolkitSlug, mimeType, client) => {
|
|
785
|
-
const
|
|
785
|
+
const { key, new_presigned_url } = await client.files.createPresignedURL({
|
|
786
786
|
filename: fileName,
|
|
787
787
|
mimetype: mimeType,
|
|
788
788
|
md5: crypto.createHash("md5").update(Buffer.from(content, "base64")).digest("hex"),
|
|
789
789
|
tool_slug: toolSlug,
|
|
790
790
|
toolkit_slug: toolkitSlug
|
|
791
791
|
});
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
}
|
|
804
|
-
});
|
|
805
|
-
if (!uploadResponse.ok) throw new Error(`Failed to upload file to S3: ${uploadResponse.statusText}`);
|
|
806
|
-
} else logger_default.debug(`File already exists in S3: ${key}`);
|
|
792
|
+
logger_default.debug(`Uploading ${key} file to S3: ${key}`);
|
|
793
|
+
const buffer = Buffer.from(content, "base64");
|
|
794
|
+
const uploadResponse = await fetch(new_presigned_url, {
|
|
795
|
+
method: "PUT",
|
|
796
|
+
body: buffer,
|
|
797
|
+
headers: {
|
|
798
|
+
"Content-Type": mimeType,
|
|
799
|
+
"Content-Length": buffer.length.toString()
|
|
800
|
+
}
|
|
801
|
+
});
|
|
802
|
+
if (!uploadResponse.ok) throw new Error(`Failed to upload file to S3: ${uploadResponse.statusText}`);
|
|
807
803
|
return key;
|
|
808
804
|
};
|
|
809
805
|
const readFile = async (file) => {
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CQwRTUmo.cjs');
|
|
2
|
-
const require_fileUtils = require('./fileUtils-
|
|
2
|
+
const require_fileUtils = require('./fileUtils-2bnnG7dq.cjs');
|
|
3
3
|
let _composio_client = require("@composio/client");
|
|
4
4
|
_composio_client = require_chunk.__toESM(_composio_client);
|
|
5
5
|
let zod_v3 = require("zod/v3");
|
|
@@ -832,7 +832,8 @@ const ToolListParamsSchema = zod_v3.z.object({
|
|
|
832
832
|
tags: zod_v3.z.array(zod_v3.z.string()).optional(),
|
|
833
833
|
limit: zod_v3.z.number().optional(),
|
|
834
834
|
search: zod_v3.z.string().optional(),
|
|
835
|
-
authConfigIds: zod_v3.z.array(zod_v3.z.string()).optional()
|
|
835
|
+
authConfigIds: zod_v3.z.array(zod_v3.z.string()).optional(),
|
|
836
|
+
important: zod_v3.z.boolean().optional()
|
|
836
837
|
});
|
|
837
838
|
/**
|
|
838
839
|
* CustomAuthParams is the parameters for the custom authentication.
|
|
@@ -1453,6 +1454,10 @@ const ConnectedAccountListResponseSchema = zod_v3.z.object({
|
|
|
1453
1454
|
});
|
|
1454
1455
|
const CreateConnectedAccountLinkOptionsSchema = zod_v3.z.object({ callbackUrl: zod_v3.z.string().optional() });
|
|
1455
1456
|
const CreateConnectedAccountLinkResponseSchema = zod_v3.z.object({ redirectUrl: zod_v3.z.string() });
|
|
1457
|
+
const ConnectedAccountRefreshOptionsSchema = zod_v3.z.object({
|
|
1458
|
+
redirectUrl: zod_v3.z.string().optional(),
|
|
1459
|
+
validateCredentials: zod_v3.z.boolean().optional()
|
|
1460
|
+
});
|
|
1456
1461
|
|
|
1457
1462
|
//#endregion
|
|
1458
1463
|
//#region src/utils/transform.ts
|
|
@@ -2199,6 +2204,8 @@ var Tools = class {
|
|
|
2199
2204
|
if ("tools" in query && "toolkits" in query) throw new ValidationError("Invalid tool list parameters. You should not use tools and toolkits filter together.");
|
|
2200
2205
|
const queryParams = ToolListParamsSchema.safeParse(query);
|
|
2201
2206
|
if (queryParams.error) throw new ValidationError("Invalid tool list parameters", { cause: queryParams.error });
|
|
2207
|
+
const shouldAutoApplyImportant = "toolkits" in queryParams.data && !("tools" in queryParams.data) && !("tags" in queryParams.data) && !("search" in queryParams.data) && queryParams.data.important !== false;
|
|
2208
|
+
const effectiveImportant = "important" in queryParams.data ? queryParams.data.important : shouldAutoApplyImportant;
|
|
2202
2209
|
if (!("tools" in queryParams.data || "toolkits" in queryParams.data || "search" in queryParams.data || "authConfigIds" in queryParams.data)) throw new ValidationError("Invalid tool list parameters, atleast one of the following parameters is required: tools, toolkits, search, authConfigIds");
|
|
2203
2210
|
let limit = "limit" in queryParams.data ? queryParams.data.limit : void 0;
|
|
2204
2211
|
if ("tools" in queryParams.data) limit = 9999;
|
|
@@ -2210,6 +2217,7 @@ var Tools = class {
|
|
|
2210
2217
|
..."scopes" in queryParams.data ? { scopes: queryParams.data.scopes } : {},
|
|
2211
2218
|
..."search" in queryParams.data ? { search: queryParams.data.search } : {},
|
|
2212
2219
|
..."authConfigIds" in queryParams.data ? { auth_config_ids: queryParams.data.authConfigIds } : {},
|
|
2220
|
+
...effectiveImportant ? { important: "true" } : {},
|
|
2213
2221
|
toolkit_versions: this.toolkitVersions
|
|
2214
2222
|
};
|
|
2215
2223
|
require_fileUtils.logger_default.debug(`Fetching tools with filters: ${JSON.stringify(filters, null, 2)}`);
|
|
@@ -2803,7 +2811,8 @@ const ToolkitRetrieveResponseSchema = zod_v3.z.object({
|
|
|
2803
2811
|
composioManagedAuthSchemes: zod_v3.z.array(zod_v3.z.string()).optional(),
|
|
2804
2812
|
authConfigDetails: zod_v3.z.array(ToolkitAuthConfigDetailsSchema).optional(),
|
|
2805
2813
|
baseUrl: zod_v3.z.string().optional(),
|
|
2806
|
-
getCurrentUserEndpoint: zod_v3.z.string().optional()
|
|
2814
|
+
getCurrentUserEndpoint: zod_v3.z.string().optional(),
|
|
2815
|
+
getCurrentUserEndpointMethod: zod_v3.z.string().optional()
|
|
2807
2816
|
});
|
|
2808
2817
|
/**
|
|
2809
2818
|
* Toolkit categories response
|
|
@@ -3353,7 +3362,8 @@ var ConnectedAccounts = class {
|
|
|
3353
3362
|
async initiate(userId, authConfigId, options) {
|
|
3354
3363
|
const connectedAccount = await this.list({
|
|
3355
3364
|
userIds: [userId],
|
|
3356
|
-
authConfigIds: [authConfigId]
|
|
3365
|
+
authConfigIds: [authConfigId],
|
|
3366
|
+
statuses: [ConnectedAccountStatuses.ACTIVE]
|
|
3357
3367
|
});
|
|
3358
3368
|
if (connectedAccount.items.length > 0 && !options?.allowMultiple) throw new ComposioMultipleConnectedAccountsError(`Multiple connected accounts found for user ${userId} in auth config ${authConfigId}. Please use the allowMultiple option to allow multiple connected accounts.`);
|
|
3359
3369
|
else if (connectedAccount.items.length > 0) require_fileUtils.logger_default.warn(`[Warn:AllowMultiple] Multiple connected accounts found for user ${userId} in auth config ${authConfigId}`);
|
|
@@ -3499,8 +3509,17 @@ var ConnectedAccounts = class {
|
|
|
3499
3509
|
* const refreshedAccount = await composio.connectedAccounts.refresh('conn_abc123');
|
|
3500
3510
|
* ```
|
|
3501
3511
|
*/
|
|
3502
|
-
async refresh(nanoid) {
|
|
3503
|
-
|
|
3512
|
+
async refresh(nanoid, options) {
|
|
3513
|
+
let params = void 0;
|
|
3514
|
+
if (options) {
|
|
3515
|
+
const parsedOptions = ConnectedAccountRefreshOptionsSchema.safeParse(options);
|
|
3516
|
+
if (!parsedOptions.success) throw new ValidationError("Failed to parse connected account refresh options", { cause: parsedOptions.error });
|
|
3517
|
+
params = {
|
|
3518
|
+
body_redirect_url: parsedOptions.data.redirectUrl,
|
|
3519
|
+
validate_credentials: parsedOptions.data.validateCredentials
|
|
3520
|
+
};
|
|
3521
|
+
}
|
|
3522
|
+
return this.client.connectedAccounts.refresh(nanoid, params);
|
|
3504
3523
|
}
|
|
3505
3524
|
/**
|
|
3506
3525
|
* Update the status of a connected account
|
|
@@ -3617,7 +3636,8 @@ const transformToolkitRetrieveResponse = (response) => {
|
|
|
3617
3636
|
proxy: { baseUrl: authConfig.proxy?.base_url }
|
|
3618
3637
|
})),
|
|
3619
3638
|
baseUrl: response$1.base_url,
|
|
3620
|
-
getCurrentUserEndpoint: response$1.get_current_user_endpoint
|
|
3639
|
+
getCurrentUserEndpoint: response$1.get_current_user_endpoint,
|
|
3640
|
+
getCurrentUserEndpointMethod: response$1.get_current_user_endpoint_method
|
|
3621
3641
|
}));
|
|
3622
3642
|
};
|
|
3623
3643
|
const transformToolkitRetrieveCategoriesResponse = (response) => {
|
|
@@ -3823,7 +3843,7 @@ const TriggerInstanceListActiveParamsSchema = zod_v3.z.object({
|
|
|
3823
3843
|
authConfigIds: zod_v3.z.array(zod_v3.z.string()).nullable().optional(),
|
|
3824
3844
|
connectedAccountIds: zod_v3.z.array(zod_v3.z.string()).nullable().optional(),
|
|
3825
3845
|
limit: zod_v3.z.number().optional(),
|
|
3826
|
-
|
|
3846
|
+
cursor: zod_v3.z.string().optional(),
|
|
3827
3847
|
showDisabled: zod_v3.z.boolean().nullable().optional(),
|
|
3828
3848
|
triggerIds: zod_v3.z.array(zod_v3.z.string()).nullable().optional(),
|
|
3829
3849
|
triggerNames: zod_v3.z.array(zod_v3.z.string()).nullable().optional()
|
|
@@ -4267,8 +4287,8 @@ var Triggers = class {
|
|
|
4267
4287
|
return transformTriggerInstanceListActiveResponse(await this.client.triggerInstances.listActive(query ? {
|
|
4268
4288
|
auth_config_ids: parsedParams.data.authConfigIds,
|
|
4269
4289
|
connected_account_ids: parsedParams.data.connectedAccountIds,
|
|
4290
|
+
cursor: parsedParams.data.cursor,
|
|
4270
4291
|
limit: parsedParams.data.limit,
|
|
4271
|
-
page: parsedParams.data.page,
|
|
4272
4292
|
show_disabled: parsedParams.data.showDisabled,
|
|
4273
4293
|
trigger_ids: parsedParams.data.triggerIds,
|
|
4274
4294
|
trigger_names: parsedParams.data.triggerNames
|
|
@@ -5708,7 +5728,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
5708
5728
|
|
|
5709
5729
|
//#endregion
|
|
5710
5730
|
//#region package.json
|
|
5711
|
-
var version = "0.5.
|
|
5731
|
+
var version = "0.5.5";
|
|
5712
5732
|
|
|
5713
5733
|
//#endregion
|
|
5714
5734
|
//#region src/utils/session.ts
|
|
@@ -5827,7 +5847,8 @@ const ToolRouterCreateSessionConfigSchema = zod_v3.default.object({
|
|
|
5827
5847
|
workbench: zod_v3.default.object({
|
|
5828
5848
|
enableProxyExecution: zod_v3.default.boolean().optional().describe("Whether to enable proxy execution in the tool router session"),
|
|
5829
5849
|
autoOffloadThreshold: zod_v3.default.number().optional().describe("The auto offload threshold in characters for the tool execution to be moved into workbench")
|
|
5830
|
-
}).optional().describe("The execution config for the tool router session")
|
|
5850
|
+
}).optional().describe("The execution config for the tool router session"),
|
|
5851
|
+
experimental: zod_v3.default.object({ assistivePrompt: zod_v3.default.object({ userTimezone: zod_v3.default.string().optional().describe("IANA timezone identifier (e.g., \"America/New_York\", \"Europe/London\") for timezone-aware assistive prompts") }).optional().describe("Configuration for assistive prompt generation") }).optional().describe("Experimental features configuration - not stable, may be modified or removed")
|
|
5831
5852
|
}).partial().describe("The config for the tool router session");
|
|
5832
5853
|
const ToolkitConnectionStateSchema = zod_v3.default.object({
|
|
5833
5854
|
slug: zod_v3.default.string().describe("The slug of a toolkit"),
|
|
@@ -6071,15 +6092,18 @@ var ToolRouter = class {
|
|
|
6071
6092
|
tools: transformToolRouterToolsParams(routerConfig.tools),
|
|
6072
6093
|
tags: transformToolRouterTagsParams(routerConfig.tags),
|
|
6073
6094
|
manage_connections: transformToolRouterManageConnectionsParams(routerConfig.manageConnections),
|
|
6074
|
-
workbench: transformToolRouterWorkbenchParams(routerConfig.workbench)
|
|
6095
|
+
workbench: transformToolRouterWorkbenchParams(routerConfig.workbench),
|
|
6096
|
+
experimental: routerConfig.experimental?.assistivePrompt?.userTimezone ? { assistive_prompt_config: { user_timezone: routerConfig.experimental.assistivePrompt.userTimezone } } : void 0
|
|
6075
6097
|
};
|
|
6076
6098
|
const session = await this.client.toolRouter.session.create(payload);
|
|
6099
|
+
const experimental = session.experimental ? { assistivePrompt: session.experimental.assistive_prompt } : void 0;
|
|
6077
6100
|
return {
|
|
6078
6101
|
sessionId: session.session_id,
|
|
6079
6102
|
mcp: this.createMCPServerConfig(session.mcp),
|
|
6080
6103
|
tools: this.createToolsFn(session.session_id),
|
|
6081
6104
|
authorize: this.createAuthorizeFn(session.session_id),
|
|
6082
|
-
toolkits: this.createToolkitsFn(session.session_id)
|
|
6105
|
+
toolkits: this.createToolkitsFn(session.session_id),
|
|
6106
|
+
experimental
|
|
6083
6107
|
};
|
|
6084
6108
|
}
|
|
6085
6109
|
/**
|
|
@@ -6298,6 +6322,8 @@ var Composio = class Composio {
|
|
|
6298
6322
|
* The new instance inherits all configuration from the parent instance (apiKey, baseURL, provider, etc.)
|
|
6299
6323
|
* but allows you to specify custom request options that will be used for all API calls made through this session.
|
|
6300
6324
|
*
|
|
6325
|
+
* @deprecated DEPRECATED: This method will be removed in a future version of the SDK.
|
|
6326
|
+
*
|
|
6301
6327
|
* @param {MergedRequestInit} fetchOptions - Custom request options to be used for all API calls in this session.
|
|
6302
6328
|
* This follows the Fetch API RequestInit interface with additional options.
|
|
6303
6329
|
* @returns {Composio<TProvider>} A new Composio instance with the custom request options applied.
|
|
@@ -6830,6 +6856,7 @@ exports.ConnectedAccountAuthConfigSchema = ConnectedAccountAuthConfigSchema;
|
|
|
6830
6856
|
exports.ConnectedAccountErrorCodes = ConnectedAccountErrorCodes;
|
|
6831
6857
|
exports.ConnectedAccountListParamsSchema = ConnectedAccountListParamsSchema;
|
|
6832
6858
|
exports.ConnectedAccountListResponseSchema = ConnectedAccountListResponseSchema;
|
|
6859
|
+
exports.ConnectedAccountRefreshOptionsSchema = ConnectedAccountRefreshOptionsSchema;
|
|
6833
6860
|
exports.ConnectedAccountRetrieveResponseSchema = ConnectedAccountRetrieveResponseSchema;
|
|
6834
6861
|
exports.ConnectedAccountStatusSchema = ConnectedAccountStatusSchema;
|
|
6835
6862
|
exports.ConnectedAccountStatuses = ConnectedAccountStatuses;
|