@composio/core 0.2.2 → 0.2.4
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 +74 -26
- package/dist/index.d.cts +14 -3
- package/dist/index.d.ts +14 -3
- package/dist/index.js +74 -26
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1611,7 +1611,7 @@ var TelemetryTransport = class {
|
|
|
1611
1611
|
const descriptor = Object.getOwnPropertyDescriptor(proto, key);
|
|
1612
1612
|
return key !== "constructor" && descriptor && typeof descriptor.value === "function" && descriptor.value.constructor.name === "AsyncFunction";
|
|
1613
1613
|
});
|
|
1614
|
-
const instrumentedClassName =
|
|
1614
|
+
const instrumentedClassName = fileName ?? instance.constructor?.name ?? "unknown";
|
|
1615
1615
|
for (const name of methodNames) {
|
|
1616
1616
|
const originalMethod = instance[name];
|
|
1617
1617
|
instance[name] = async (...args) => {
|
|
@@ -1952,7 +1952,13 @@ var ConnectedAccountAuthConfigSchema = import_v36.z.object({
|
|
|
1952
1952
|
var ConnectedAccountRetrieveResponseSchema = import_v36.z.object({
|
|
1953
1953
|
id: import_v36.z.string(),
|
|
1954
1954
|
authConfig: ConnectedAccountAuthConfigSchema,
|
|
1955
|
+
/**
|
|
1956
|
+
* @deprecated use connectedAccount.state instead
|
|
1957
|
+
*/
|
|
1955
1958
|
data: import_v36.z.record(import_v36.z.string(), import_v36.z.unknown()).optional(),
|
|
1959
|
+
/**
|
|
1960
|
+
* @deprecated use connectedAccount.state instead
|
|
1961
|
+
*/
|
|
1956
1962
|
params: import_v36.z.record(import_v36.z.string(), import_v36.z.unknown()).optional(),
|
|
1957
1963
|
status: ConnectedAccountStatusSchema,
|
|
1958
1964
|
statusReason: import_v36.z.string().nullable(),
|
|
@@ -2063,7 +2069,7 @@ var CustomTools = class {
|
|
|
2063
2069
|
}
|
|
2064
2070
|
this.client = client;
|
|
2065
2071
|
this.customToolsRegistry = /* @__PURE__ */ new Map();
|
|
2066
|
-
telemetry.instrument(this);
|
|
2072
|
+
telemetry.instrument(this, "CustomTools");
|
|
2067
2073
|
}
|
|
2068
2074
|
/**
|
|
2069
2075
|
* Create a custom tool and registers it in the registry.
|
|
@@ -2771,7 +2777,7 @@ var Tools = class {
|
|
|
2771
2777
|
this.provider._setExecuteToolFn(this.execute);
|
|
2772
2778
|
this.getRawComposioToolBySlug = this.getRawComposioToolBySlug.bind(this);
|
|
2773
2779
|
this.getRawComposioTools = this.getRawComposioTools.bind(this);
|
|
2774
|
-
telemetry.instrument(this);
|
|
2780
|
+
telemetry.instrument(this, "Tools");
|
|
2775
2781
|
}
|
|
2776
2782
|
/**
|
|
2777
2783
|
* Transforms tool data from snake_case API format to camelCase for internal SDK use.
|
|
@@ -2790,7 +2796,7 @@ var Tools = class {
|
|
|
2790
2796
|
inputParameters: tool.input_parameters,
|
|
2791
2797
|
outputParameters: tool.output_parameters,
|
|
2792
2798
|
availableVersions: tool.available_versions,
|
|
2793
|
-
isDeprecated: tool.is_deprecated,
|
|
2799
|
+
isDeprecated: tool.deprecated?.is_deprecated ?? false,
|
|
2794
2800
|
isNoAuth: tool.no_auth
|
|
2795
2801
|
});
|
|
2796
2802
|
}
|
|
@@ -3564,7 +3570,7 @@ var AuthConfigs = class {
|
|
|
3564
3570
|
client;
|
|
3565
3571
|
constructor(client) {
|
|
3566
3572
|
this.client = client;
|
|
3567
|
-
telemetry.instrument(this);
|
|
3573
|
+
telemetry.instrument(this, "AuthConfigs");
|
|
3568
3574
|
}
|
|
3569
3575
|
/**
|
|
3570
3576
|
* Protected getter for the client instance.
|
|
@@ -3835,7 +3841,7 @@ function createConnectionRequest(client, connectedAccountId, status, redirectUrl
|
|
|
3835
3841
|
status: status || ConnectedAccountStatuses.INITIATED,
|
|
3836
3842
|
redirectUrl
|
|
3837
3843
|
};
|
|
3838
|
-
telemetry.instrument(state);
|
|
3844
|
+
telemetry.instrument(state, "ConnectionRequest");
|
|
3839
3845
|
async function waitForConnection(timeout = 6e4) {
|
|
3840
3846
|
try {
|
|
3841
3847
|
const response = await client.connectedAccounts.retrieve(state.id);
|
|
@@ -3902,7 +3908,7 @@ var ConnectedAccounts = class {
|
|
|
3902
3908
|
client;
|
|
3903
3909
|
constructor(client) {
|
|
3904
3910
|
this.client = client;
|
|
3905
|
-
telemetry.instrument(this);
|
|
3911
|
+
telemetry.instrument(this, "ConnectedAccounts");
|
|
3906
3912
|
}
|
|
3907
3913
|
/**
|
|
3908
3914
|
* Lists all connected accounts based on provided filter criteria.
|
|
@@ -4328,7 +4334,7 @@ var Toolkits = class {
|
|
|
4328
4334
|
constructor(client) {
|
|
4329
4335
|
this.client = client;
|
|
4330
4336
|
this.authorize = this.authorize.bind(this);
|
|
4331
|
-
telemetry.instrument(this);
|
|
4337
|
+
telemetry.instrument(this, "Toolkits");
|
|
4332
4338
|
}
|
|
4333
4339
|
/**
|
|
4334
4340
|
* Retrieves a list of toolkits based on the provided query parameters.
|
|
@@ -4781,7 +4787,7 @@ var PusherService = class {
|
|
|
4781
4787
|
this.composioClient = client;
|
|
4782
4788
|
this.pusherBaseURL = client.baseURL;
|
|
4783
4789
|
this.apiKey = client.apiKey ?? process.env.COMPOSIO_API_KEY ?? "";
|
|
4784
|
-
telemetry.instrument(this);
|
|
4790
|
+
telemetry.instrument(this, "PusherService");
|
|
4785
4791
|
}
|
|
4786
4792
|
/**
|
|
4787
4793
|
* Creates a Pusher client
|
|
@@ -5028,7 +5034,7 @@ var Triggers = class {
|
|
|
5028
5034
|
this.client = client;
|
|
5029
5035
|
this.pusherService = new PusherService(client);
|
|
5030
5036
|
this.toolkitVersions = config?.toolkitVersions ?? "latest";
|
|
5031
|
-
telemetry.instrument(this);
|
|
5037
|
+
telemetry.instrument(this, "Triggers");
|
|
5032
5038
|
}
|
|
5033
5039
|
/**
|
|
5034
5040
|
* Fetch list of all the active triggers
|
|
@@ -5094,6 +5100,7 @@ var Triggers = class {
|
|
|
5094
5100
|
cause: error,
|
|
5095
5101
|
possibleFixes: [
|
|
5096
5102
|
`Please check the trigger slug`,
|
|
5103
|
+
`Please check the provided version of toolkit has the trigger`,
|
|
5097
5104
|
`Visit the toolkit page to see the available triggers`
|
|
5098
5105
|
]
|
|
5099
5106
|
});
|
|
@@ -5151,7 +5158,8 @@ var Triggers = class {
|
|
|
5151
5158
|
}
|
|
5152
5159
|
const result = await this.client.triggerInstances.upsert(slug, {
|
|
5153
5160
|
connected_account_id: connectedAccountId,
|
|
5154
|
-
trigger_config: parsedBody.data.triggerConfig
|
|
5161
|
+
trigger_config: parsedBody.data.triggerConfig,
|
|
5162
|
+
toolkit_versions: this.toolkitVersions
|
|
5155
5163
|
});
|
|
5156
5164
|
return {
|
|
5157
5165
|
triggerId: result.trigger_id
|
|
@@ -5222,21 +5230,23 @@ var Triggers = class {
|
|
|
5222
5230
|
return transformTriggerTypeListResponse(result);
|
|
5223
5231
|
}
|
|
5224
5232
|
/**
|
|
5225
|
-
* Retrieve a trigger type by its slug
|
|
5233
|
+
* Retrieve a trigger type by its slug for the provided version of the app
|
|
5234
|
+
* Use the global toolkit versions param when initializing composio to pass a toolkitversion
|
|
5226
5235
|
*
|
|
5227
5236
|
* @param {string} slug - The slug of the trigger type
|
|
5228
|
-
* @param {RequestOptions} options - request options
|
|
5229
5237
|
* @returns {Promise<TriggersTypeRetrieveResponse>} The trigger type object
|
|
5230
5238
|
*/
|
|
5231
5239
|
async getType(slug) {
|
|
5232
|
-
const result = await this.client.triggersTypes.retrieve(slug
|
|
5240
|
+
const result = await this.client.triggersTypes.retrieve(slug, {
|
|
5241
|
+
// if the version is provided override the global version
|
|
5242
|
+
toolkit_versions: this.toolkitVersions
|
|
5243
|
+
});
|
|
5233
5244
|
return transformTriggerTypeRetrieveResponse(result);
|
|
5234
5245
|
}
|
|
5235
5246
|
/**
|
|
5236
5247
|
* Fetches the list of all the available trigger enums
|
|
5237
5248
|
*
|
|
5238
5249
|
* This method is used by the CLI where filters are not required.
|
|
5239
|
-
* @param options
|
|
5240
5250
|
* @returns
|
|
5241
5251
|
*/
|
|
5242
5252
|
async listEnum() {
|
|
@@ -5480,7 +5490,7 @@ var MCP = class {
|
|
|
5480
5490
|
client;
|
|
5481
5491
|
constructor(client) {
|
|
5482
5492
|
this.client = client;
|
|
5483
|
-
telemetry.instrument(this);
|
|
5493
|
+
telemetry.instrument(this, "MCP");
|
|
5484
5494
|
}
|
|
5485
5495
|
/**
|
|
5486
5496
|
* Create a new MCP configuration.
|
|
@@ -6119,7 +6129,7 @@ var MCP2 = class {
|
|
|
6119
6129
|
this.client = client;
|
|
6120
6130
|
this.provider = provider;
|
|
6121
6131
|
this.toolkits = new Toolkits(client);
|
|
6122
|
-
telemetry.instrument(this);
|
|
6132
|
+
telemetry.instrument(this, "MCP");
|
|
6123
6133
|
}
|
|
6124
6134
|
/**
|
|
6125
6135
|
* Validates toolkit configurations using Zod schema
|
|
@@ -6193,7 +6203,6 @@ var MCP2 = class {
|
|
|
6193
6203
|
}
|
|
6194
6204
|
const tools = mcpServer.tools?.sort();
|
|
6195
6205
|
const sortedCurrentTools = serverConfig.flatMap((config) => config.allowedTools).sort();
|
|
6196
|
-
console.log(tools, sortedCurrentTools, "tools");
|
|
6197
6206
|
if (tools?.length > 0 && !tools.every((tool, index) => tool === sortedCurrentTools[index])) {
|
|
6198
6207
|
throw new ValidationError("MCP server with this name already exists with different tools", {
|
|
6199
6208
|
meta: { serverName: name }
|
|
@@ -6749,7 +6758,7 @@ var MCP2 = class {
|
|
|
6749
6758
|
limit: 10
|
|
6750
6759
|
});
|
|
6751
6760
|
} catch (error) {
|
|
6752
|
-
|
|
6761
|
+
logger_default.error(error);
|
|
6753
6762
|
throw new ValidationError("Failed to search MCP servers by name", {
|
|
6754
6763
|
cause: error
|
|
6755
6764
|
});
|
|
@@ -7351,13 +7360,13 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
7351
7360
|
};
|
|
7352
7361
|
|
|
7353
7362
|
// package.json
|
|
7354
|
-
var version = "0.2.
|
|
7363
|
+
var version = "0.2.4";
|
|
7355
7364
|
|
|
7356
7365
|
// src/models/Files.ts
|
|
7357
7366
|
var Files = class {
|
|
7358
7367
|
constructor(client) {
|
|
7359
7368
|
this.client = client;
|
|
7360
|
-
telemetry.instrument(this);
|
|
7369
|
+
telemetry.instrument(this, "Files");
|
|
7361
7370
|
}
|
|
7362
7371
|
/**
|
|
7363
7372
|
* Upload a file to S3 and return the file data.
|
|
@@ -7394,10 +7403,46 @@ var Files = class {
|
|
|
7394
7403
|
};
|
|
7395
7404
|
|
|
7396
7405
|
// src/utils/session.ts
|
|
7406
|
+
function detectRuntime() {
|
|
7407
|
+
const global = globalThis;
|
|
7408
|
+
if ("Bun" in global && typeof global.Bun !== "undefined") {
|
|
7409
|
+
return "BUN";
|
|
7410
|
+
}
|
|
7411
|
+
if ("Deno" in global && typeof global.Deno !== "undefined") {
|
|
7412
|
+
return "DENO";
|
|
7413
|
+
}
|
|
7414
|
+
if (typeof process !== "undefined" && process.versions && process.versions.node) {
|
|
7415
|
+
return "NODEJS";
|
|
7416
|
+
}
|
|
7417
|
+
if ("caches" in global && typeof global.caches !== "undefined" && "WebSocketPair" in global && typeof global.WebSocketPair !== "undefined") {
|
|
7418
|
+
return "CLOUDFLARE_WORKERS";
|
|
7419
|
+
}
|
|
7420
|
+
if ("EdgeRuntime" in global && typeof global.EdgeRuntime !== "undefined") {
|
|
7421
|
+
return "VERCEL_EDGE";
|
|
7422
|
+
}
|
|
7423
|
+
if ("ServiceWorkerGlobalScope" in global && typeof global.ServiceWorkerGlobalScope !== "undefined") {
|
|
7424
|
+
const ServiceWorkerScope = global.ServiceWorkerGlobalScope;
|
|
7425
|
+
if (ServiceWorkerScope && global instanceof ServiceWorkerScope) {
|
|
7426
|
+
return "SERVICE_WORKER";
|
|
7427
|
+
}
|
|
7428
|
+
}
|
|
7429
|
+
if ("WorkerGlobalScope" in global && typeof global.WorkerGlobalScope !== "undefined" && "importScripts" in global && typeof global.importScripts === "function") {
|
|
7430
|
+
return "WEB_WORKER";
|
|
7431
|
+
}
|
|
7432
|
+
if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
7433
|
+
return "REACT_NATIVE";
|
|
7434
|
+
}
|
|
7435
|
+
if (typeof window !== "undefined" && typeof document !== "undefined") {
|
|
7436
|
+
return "BROWSER";
|
|
7437
|
+
}
|
|
7438
|
+
return "UNKNOWN";
|
|
7439
|
+
}
|
|
7440
|
+
var RUNTIME_ENV = detectRuntime();
|
|
7397
7441
|
function getSessionHeaders(provider) {
|
|
7398
7442
|
return {
|
|
7399
|
-
"x-
|
|
7400
|
-
"x-
|
|
7443
|
+
"x-framework": provider?.name || "unknown",
|
|
7444
|
+
"x-source": "TYPESCRIPT_SDK",
|
|
7445
|
+
"x-runtime": RUNTIME_ENV,
|
|
7401
7446
|
"x-sdk-version": version
|
|
7402
7447
|
};
|
|
7403
7448
|
}
|
|
@@ -7429,7 +7474,7 @@ var ToolRouter = class {
|
|
|
7429
7474
|
constructor(client) {
|
|
7430
7475
|
this.client = client;
|
|
7431
7476
|
this.client = client;
|
|
7432
|
-
telemetry.instrument(this);
|
|
7477
|
+
telemetry.instrument(this, "ToolRouter");
|
|
7433
7478
|
}
|
|
7434
7479
|
/**
|
|
7435
7480
|
* Creates a new Session for the tool router
|
|
@@ -7603,8 +7648,11 @@ var Composio = class _Composio {
|
|
|
7603
7648
|
host: this.config.host
|
|
7604
7649
|
});
|
|
7605
7650
|
}
|
|
7606
|
-
telemetry.instrument(this);
|
|
7607
|
-
telemetry.instrument(
|
|
7651
|
+
telemetry.instrument(this, "Composio");
|
|
7652
|
+
telemetry.instrument(
|
|
7653
|
+
this.provider,
|
|
7654
|
+
this.provider.name ?? this.provider.constructor.name ?? "unknown"
|
|
7655
|
+
);
|
|
7608
7656
|
if (!this.config.disableVersionCheck) {
|
|
7609
7657
|
checkForLatestVersionFromNPM(version);
|
|
7610
7658
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -41127,7 +41127,13 @@ declare const ConnectedAccountRetrieveResponseSchema: z.ZodObject<{
|
|
|
41127
41127
|
isComposioManaged: boolean;
|
|
41128
41128
|
isDisabled: boolean;
|
|
41129
41129
|
}>;
|
|
41130
|
+
/**
|
|
41131
|
+
* @deprecated use connectedAccount.state instead
|
|
41132
|
+
*/
|
|
41130
41133
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
41134
|
+
/**
|
|
41135
|
+
* @deprecated use connectedAccount.state instead
|
|
41136
|
+
*/
|
|
41131
41137
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
41132
41138
|
status: z.ZodEnum<["INITIALIZING", "INITIATED", "ACTIVE", "FAILED", "EXPIRED", "INACTIVE"]>;
|
|
41133
41139
|
statusReason: z.ZodNullable<z.ZodString>;
|
|
@@ -51014,7 +51020,13 @@ declare const ConnectedAccountListResponseSchema: z.ZodObject<{
|
|
|
51014
51020
|
isComposioManaged: boolean;
|
|
51015
51021
|
isDisabled: boolean;
|
|
51016
51022
|
}>;
|
|
51023
|
+
/**
|
|
51024
|
+
* @deprecated use connectedAccount.state instead
|
|
51025
|
+
*/
|
|
51017
51026
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
51027
|
+
/**
|
|
51028
|
+
* @deprecated use connectedAccount.state instead
|
|
51029
|
+
*/
|
|
51018
51030
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
51019
51031
|
status: z.ZodEnum<["INITIALIZING", "INITIATED", "ACTIVE", "FAILED", "EXPIRED", "INACTIVE"]>;
|
|
51020
51032
|
statusReason: z.ZodNullable<z.ZodString>;
|
|
@@ -65041,10 +65053,10 @@ declare class Triggers<TProvider extends BaseComposioProvider<unknown, unknown,
|
|
|
65041
65053
|
*/
|
|
65042
65054
|
listTypes(query?: TriggersTypeListParams): Promise<TriggersTypeListResponse>;
|
|
65043
65055
|
/**
|
|
65044
|
-
* Retrieve a trigger type by its slug
|
|
65056
|
+
* Retrieve a trigger type by its slug for the provided version of the app
|
|
65057
|
+
* Use the global toolkit versions param when initializing composio to pass a toolkitversion
|
|
65045
65058
|
*
|
|
65046
65059
|
* @param {string} slug - The slug of the trigger type
|
|
65047
|
-
* @param {RequestOptions} options - request options
|
|
65048
65060
|
* @returns {Promise<TriggersTypeRetrieveResponse>} The trigger type object
|
|
65049
65061
|
*/
|
|
65050
65062
|
getType(slug: string): Promise<TriggersTypeRetrieveResponse>;
|
|
@@ -65052,7 +65064,6 @@ declare class Triggers<TProvider extends BaseComposioProvider<unknown, unknown,
|
|
|
65052
65064
|
* Fetches the list of all the available trigger enums
|
|
65053
65065
|
*
|
|
65054
65066
|
* This method is used by the CLI where filters are not required.
|
|
65055
|
-
* @param options
|
|
65056
65067
|
* @returns
|
|
65057
65068
|
*/
|
|
65058
65069
|
listEnum(): Promise<TriggersTypeRetrieveEnumResponse>;
|
package/dist/index.d.ts
CHANGED
|
@@ -41127,7 +41127,13 @@ declare const ConnectedAccountRetrieveResponseSchema: z.ZodObject<{
|
|
|
41127
41127
|
isComposioManaged: boolean;
|
|
41128
41128
|
isDisabled: boolean;
|
|
41129
41129
|
}>;
|
|
41130
|
+
/**
|
|
41131
|
+
* @deprecated use connectedAccount.state instead
|
|
41132
|
+
*/
|
|
41130
41133
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
41134
|
+
/**
|
|
41135
|
+
* @deprecated use connectedAccount.state instead
|
|
41136
|
+
*/
|
|
41131
41137
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
41132
41138
|
status: z.ZodEnum<["INITIALIZING", "INITIATED", "ACTIVE", "FAILED", "EXPIRED", "INACTIVE"]>;
|
|
41133
41139
|
statusReason: z.ZodNullable<z.ZodString>;
|
|
@@ -51014,7 +51020,13 @@ declare const ConnectedAccountListResponseSchema: z.ZodObject<{
|
|
|
51014
51020
|
isComposioManaged: boolean;
|
|
51015
51021
|
isDisabled: boolean;
|
|
51016
51022
|
}>;
|
|
51023
|
+
/**
|
|
51024
|
+
* @deprecated use connectedAccount.state instead
|
|
51025
|
+
*/
|
|
51017
51026
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
51027
|
+
/**
|
|
51028
|
+
* @deprecated use connectedAccount.state instead
|
|
51029
|
+
*/
|
|
51018
51030
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
51019
51031
|
status: z.ZodEnum<["INITIALIZING", "INITIATED", "ACTIVE", "FAILED", "EXPIRED", "INACTIVE"]>;
|
|
51020
51032
|
statusReason: z.ZodNullable<z.ZodString>;
|
|
@@ -65041,10 +65053,10 @@ declare class Triggers<TProvider extends BaseComposioProvider<unknown, unknown,
|
|
|
65041
65053
|
*/
|
|
65042
65054
|
listTypes(query?: TriggersTypeListParams): Promise<TriggersTypeListResponse>;
|
|
65043
65055
|
/**
|
|
65044
|
-
* Retrieve a trigger type by its slug
|
|
65056
|
+
* Retrieve a trigger type by its slug for the provided version of the app
|
|
65057
|
+
* Use the global toolkit versions param when initializing composio to pass a toolkitversion
|
|
65045
65058
|
*
|
|
65046
65059
|
* @param {string} slug - The slug of the trigger type
|
|
65047
|
-
* @param {RequestOptions} options - request options
|
|
65048
65060
|
* @returns {Promise<TriggersTypeRetrieveResponse>} The trigger type object
|
|
65049
65061
|
*/
|
|
65050
65062
|
getType(slug: string): Promise<TriggersTypeRetrieveResponse>;
|
|
@@ -65052,7 +65064,6 @@ declare class Triggers<TProvider extends BaseComposioProvider<unknown, unknown,
|
|
|
65052
65064
|
* Fetches the list of all the available trigger enums
|
|
65053
65065
|
*
|
|
65054
65066
|
* This method is used by the CLI where filters are not required.
|
|
65055
|
-
* @param options
|
|
65056
65067
|
* @returns
|
|
65057
65068
|
*/
|
|
65058
65069
|
listEnum(): Promise<TriggersTypeRetrieveEnumResponse>;
|
package/dist/index.js
CHANGED
|
@@ -1434,7 +1434,7 @@ var TelemetryTransport = class {
|
|
|
1434
1434
|
const descriptor = Object.getOwnPropertyDescriptor(proto, key);
|
|
1435
1435
|
return key !== "constructor" && descriptor && typeof descriptor.value === "function" && descriptor.value.constructor.name === "AsyncFunction";
|
|
1436
1436
|
});
|
|
1437
|
-
const instrumentedClassName =
|
|
1437
|
+
const instrumentedClassName = fileName ?? instance.constructor?.name ?? "unknown";
|
|
1438
1438
|
for (const name of methodNames) {
|
|
1439
1439
|
const originalMethod = instance[name];
|
|
1440
1440
|
instance[name] = async (...args) => {
|
|
@@ -1775,7 +1775,13 @@ var ConnectedAccountAuthConfigSchema = z4.object({
|
|
|
1775
1775
|
var ConnectedAccountRetrieveResponseSchema = z4.object({
|
|
1776
1776
|
id: z4.string(),
|
|
1777
1777
|
authConfig: ConnectedAccountAuthConfigSchema,
|
|
1778
|
+
/**
|
|
1779
|
+
* @deprecated use connectedAccount.state instead
|
|
1780
|
+
*/
|
|
1778
1781
|
data: z4.record(z4.string(), z4.unknown()).optional(),
|
|
1782
|
+
/**
|
|
1783
|
+
* @deprecated use connectedAccount.state instead
|
|
1784
|
+
*/
|
|
1779
1785
|
params: z4.record(z4.string(), z4.unknown()).optional(),
|
|
1780
1786
|
status: ConnectedAccountStatusSchema,
|
|
1781
1787
|
statusReason: z4.string().nullable(),
|
|
@@ -1886,7 +1892,7 @@ var CustomTools = class {
|
|
|
1886
1892
|
}
|
|
1887
1893
|
this.client = client;
|
|
1888
1894
|
this.customToolsRegistry = /* @__PURE__ */ new Map();
|
|
1889
|
-
telemetry.instrument(this);
|
|
1895
|
+
telemetry.instrument(this, "CustomTools");
|
|
1890
1896
|
}
|
|
1891
1897
|
/**
|
|
1892
1898
|
* Create a custom tool and registers it in the registry.
|
|
@@ -2594,7 +2600,7 @@ var Tools = class {
|
|
|
2594
2600
|
this.provider._setExecuteToolFn(this.execute);
|
|
2595
2601
|
this.getRawComposioToolBySlug = this.getRawComposioToolBySlug.bind(this);
|
|
2596
2602
|
this.getRawComposioTools = this.getRawComposioTools.bind(this);
|
|
2597
|
-
telemetry.instrument(this);
|
|
2603
|
+
telemetry.instrument(this, "Tools");
|
|
2598
2604
|
}
|
|
2599
2605
|
/**
|
|
2600
2606
|
* Transforms tool data from snake_case API format to camelCase for internal SDK use.
|
|
@@ -2613,7 +2619,7 @@ var Tools = class {
|
|
|
2613
2619
|
inputParameters: tool.input_parameters,
|
|
2614
2620
|
outputParameters: tool.output_parameters,
|
|
2615
2621
|
availableVersions: tool.available_versions,
|
|
2616
|
-
isDeprecated: tool.is_deprecated,
|
|
2622
|
+
isDeprecated: tool.deprecated?.is_deprecated ?? false,
|
|
2617
2623
|
isNoAuth: tool.no_auth
|
|
2618
2624
|
});
|
|
2619
2625
|
}
|
|
@@ -3387,7 +3393,7 @@ var AuthConfigs = class {
|
|
|
3387
3393
|
client;
|
|
3388
3394
|
constructor(client) {
|
|
3389
3395
|
this.client = client;
|
|
3390
|
-
telemetry.instrument(this);
|
|
3396
|
+
telemetry.instrument(this, "AuthConfigs");
|
|
3391
3397
|
}
|
|
3392
3398
|
/**
|
|
3393
3399
|
* Protected getter for the client instance.
|
|
@@ -3658,7 +3664,7 @@ function createConnectionRequest(client, connectedAccountId, status, redirectUrl
|
|
|
3658
3664
|
status: status || ConnectedAccountStatuses.INITIATED,
|
|
3659
3665
|
redirectUrl
|
|
3660
3666
|
};
|
|
3661
|
-
telemetry.instrument(state);
|
|
3667
|
+
telemetry.instrument(state, "ConnectionRequest");
|
|
3662
3668
|
async function waitForConnection(timeout = 6e4) {
|
|
3663
3669
|
try {
|
|
3664
3670
|
const response = await client.connectedAccounts.retrieve(state.id);
|
|
@@ -3725,7 +3731,7 @@ var ConnectedAccounts = class {
|
|
|
3725
3731
|
client;
|
|
3726
3732
|
constructor(client) {
|
|
3727
3733
|
this.client = client;
|
|
3728
|
-
telemetry.instrument(this);
|
|
3734
|
+
telemetry.instrument(this, "ConnectedAccounts");
|
|
3729
3735
|
}
|
|
3730
3736
|
/**
|
|
3731
3737
|
* Lists all connected accounts based on provided filter criteria.
|
|
@@ -4151,7 +4157,7 @@ var Toolkits = class {
|
|
|
4151
4157
|
constructor(client) {
|
|
4152
4158
|
this.client = client;
|
|
4153
4159
|
this.authorize = this.authorize.bind(this);
|
|
4154
|
-
telemetry.instrument(this);
|
|
4160
|
+
telemetry.instrument(this, "Toolkits");
|
|
4155
4161
|
}
|
|
4156
4162
|
/**
|
|
4157
4163
|
* Retrieves a list of toolkits based on the provided query parameters.
|
|
@@ -4604,7 +4610,7 @@ var PusherService = class {
|
|
|
4604
4610
|
this.composioClient = client;
|
|
4605
4611
|
this.pusherBaseURL = client.baseURL;
|
|
4606
4612
|
this.apiKey = client.apiKey ?? process.env.COMPOSIO_API_KEY ?? "";
|
|
4607
|
-
telemetry.instrument(this);
|
|
4613
|
+
telemetry.instrument(this, "PusherService");
|
|
4608
4614
|
}
|
|
4609
4615
|
/**
|
|
4610
4616
|
* Creates a Pusher client
|
|
@@ -4851,7 +4857,7 @@ var Triggers = class {
|
|
|
4851
4857
|
this.client = client;
|
|
4852
4858
|
this.pusherService = new PusherService(client);
|
|
4853
4859
|
this.toolkitVersions = config?.toolkitVersions ?? "latest";
|
|
4854
|
-
telemetry.instrument(this);
|
|
4860
|
+
telemetry.instrument(this, "Triggers");
|
|
4855
4861
|
}
|
|
4856
4862
|
/**
|
|
4857
4863
|
* Fetch list of all the active triggers
|
|
@@ -4917,6 +4923,7 @@ var Triggers = class {
|
|
|
4917
4923
|
cause: error,
|
|
4918
4924
|
possibleFixes: [
|
|
4919
4925
|
`Please check the trigger slug`,
|
|
4926
|
+
`Please check the provided version of toolkit has the trigger`,
|
|
4920
4927
|
`Visit the toolkit page to see the available triggers`
|
|
4921
4928
|
]
|
|
4922
4929
|
});
|
|
@@ -4974,7 +4981,8 @@ var Triggers = class {
|
|
|
4974
4981
|
}
|
|
4975
4982
|
const result = await this.client.triggerInstances.upsert(slug, {
|
|
4976
4983
|
connected_account_id: connectedAccountId,
|
|
4977
|
-
trigger_config: parsedBody.data.triggerConfig
|
|
4984
|
+
trigger_config: parsedBody.data.triggerConfig,
|
|
4985
|
+
toolkit_versions: this.toolkitVersions
|
|
4978
4986
|
});
|
|
4979
4987
|
return {
|
|
4980
4988
|
triggerId: result.trigger_id
|
|
@@ -5045,21 +5053,23 @@ var Triggers = class {
|
|
|
5045
5053
|
return transformTriggerTypeListResponse(result);
|
|
5046
5054
|
}
|
|
5047
5055
|
/**
|
|
5048
|
-
* Retrieve a trigger type by its slug
|
|
5056
|
+
* Retrieve a trigger type by its slug for the provided version of the app
|
|
5057
|
+
* Use the global toolkit versions param when initializing composio to pass a toolkitversion
|
|
5049
5058
|
*
|
|
5050
5059
|
* @param {string} slug - The slug of the trigger type
|
|
5051
|
-
* @param {RequestOptions} options - request options
|
|
5052
5060
|
* @returns {Promise<TriggersTypeRetrieveResponse>} The trigger type object
|
|
5053
5061
|
*/
|
|
5054
5062
|
async getType(slug) {
|
|
5055
|
-
const result = await this.client.triggersTypes.retrieve(slug
|
|
5063
|
+
const result = await this.client.triggersTypes.retrieve(slug, {
|
|
5064
|
+
// if the version is provided override the global version
|
|
5065
|
+
toolkit_versions: this.toolkitVersions
|
|
5066
|
+
});
|
|
5056
5067
|
return transformTriggerTypeRetrieveResponse(result);
|
|
5057
5068
|
}
|
|
5058
5069
|
/**
|
|
5059
5070
|
* Fetches the list of all the available trigger enums
|
|
5060
5071
|
*
|
|
5061
5072
|
* This method is used by the CLI where filters are not required.
|
|
5062
|
-
* @param options
|
|
5063
5073
|
* @returns
|
|
5064
5074
|
*/
|
|
5065
5075
|
async listEnum() {
|
|
@@ -5303,7 +5313,7 @@ var MCP = class {
|
|
|
5303
5313
|
client;
|
|
5304
5314
|
constructor(client) {
|
|
5305
5315
|
this.client = client;
|
|
5306
|
-
telemetry.instrument(this);
|
|
5316
|
+
telemetry.instrument(this, "MCP");
|
|
5307
5317
|
}
|
|
5308
5318
|
/**
|
|
5309
5319
|
* Create a new MCP configuration.
|
|
@@ -5942,7 +5952,7 @@ var MCP2 = class {
|
|
|
5942
5952
|
this.client = client;
|
|
5943
5953
|
this.provider = provider;
|
|
5944
5954
|
this.toolkits = new Toolkits(client);
|
|
5945
|
-
telemetry.instrument(this);
|
|
5955
|
+
telemetry.instrument(this, "MCP");
|
|
5946
5956
|
}
|
|
5947
5957
|
/**
|
|
5948
5958
|
* Validates toolkit configurations using Zod schema
|
|
@@ -6016,7 +6026,6 @@ var MCP2 = class {
|
|
|
6016
6026
|
}
|
|
6017
6027
|
const tools = mcpServer.tools?.sort();
|
|
6018
6028
|
const sortedCurrentTools = serverConfig.flatMap((config) => config.allowedTools).sort();
|
|
6019
|
-
console.log(tools, sortedCurrentTools, "tools");
|
|
6020
6029
|
if (tools?.length > 0 && !tools.every((tool, index) => tool === sortedCurrentTools[index])) {
|
|
6021
6030
|
throw new ValidationError("MCP server with this name already exists with different tools", {
|
|
6022
6031
|
meta: { serverName: name }
|
|
@@ -6572,7 +6581,7 @@ var MCP2 = class {
|
|
|
6572
6581
|
limit: 10
|
|
6573
6582
|
});
|
|
6574
6583
|
} catch (error) {
|
|
6575
|
-
|
|
6584
|
+
logger_default.error(error);
|
|
6576
6585
|
throw new ValidationError("Failed to search MCP servers by name", {
|
|
6577
6586
|
cause: error
|
|
6578
6587
|
});
|
|
@@ -7174,13 +7183,13 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
7174
7183
|
};
|
|
7175
7184
|
|
|
7176
7185
|
// package.json
|
|
7177
|
-
var version = "0.2.
|
|
7186
|
+
var version = "0.2.4";
|
|
7178
7187
|
|
|
7179
7188
|
// src/models/Files.ts
|
|
7180
7189
|
var Files = class {
|
|
7181
7190
|
constructor(client) {
|
|
7182
7191
|
this.client = client;
|
|
7183
|
-
telemetry.instrument(this);
|
|
7192
|
+
telemetry.instrument(this, "Files");
|
|
7184
7193
|
}
|
|
7185
7194
|
/**
|
|
7186
7195
|
* Upload a file to S3 and return the file data.
|
|
@@ -7217,10 +7226,46 @@ var Files = class {
|
|
|
7217
7226
|
};
|
|
7218
7227
|
|
|
7219
7228
|
// src/utils/session.ts
|
|
7229
|
+
function detectRuntime() {
|
|
7230
|
+
const global = globalThis;
|
|
7231
|
+
if ("Bun" in global && typeof global.Bun !== "undefined") {
|
|
7232
|
+
return "BUN";
|
|
7233
|
+
}
|
|
7234
|
+
if ("Deno" in global && typeof global.Deno !== "undefined") {
|
|
7235
|
+
return "DENO";
|
|
7236
|
+
}
|
|
7237
|
+
if (typeof process !== "undefined" && process.versions && process.versions.node) {
|
|
7238
|
+
return "NODEJS";
|
|
7239
|
+
}
|
|
7240
|
+
if ("caches" in global && typeof global.caches !== "undefined" && "WebSocketPair" in global && typeof global.WebSocketPair !== "undefined") {
|
|
7241
|
+
return "CLOUDFLARE_WORKERS";
|
|
7242
|
+
}
|
|
7243
|
+
if ("EdgeRuntime" in global && typeof global.EdgeRuntime !== "undefined") {
|
|
7244
|
+
return "VERCEL_EDGE";
|
|
7245
|
+
}
|
|
7246
|
+
if ("ServiceWorkerGlobalScope" in global && typeof global.ServiceWorkerGlobalScope !== "undefined") {
|
|
7247
|
+
const ServiceWorkerScope = global.ServiceWorkerGlobalScope;
|
|
7248
|
+
if (ServiceWorkerScope && global instanceof ServiceWorkerScope) {
|
|
7249
|
+
return "SERVICE_WORKER";
|
|
7250
|
+
}
|
|
7251
|
+
}
|
|
7252
|
+
if ("WorkerGlobalScope" in global && typeof global.WorkerGlobalScope !== "undefined" && "importScripts" in global && typeof global.importScripts === "function") {
|
|
7253
|
+
return "WEB_WORKER";
|
|
7254
|
+
}
|
|
7255
|
+
if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
7256
|
+
return "REACT_NATIVE";
|
|
7257
|
+
}
|
|
7258
|
+
if (typeof window !== "undefined" && typeof document !== "undefined") {
|
|
7259
|
+
return "BROWSER";
|
|
7260
|
+
}
|
|
7261
|
+
return "UNKNOWN";
|
|
7262
|
+
}
|
|
7263
|
+
var RUNTIME_ENV = detectRuntime();
|
|
7220
7264
|
function getSessionHeaders(provider) {
|
|
7221
7265
|
return {
|
|
7222
|
-
"x-
|
|
7223
|
-
"x-
|
|
7266
|
+
"x-framework": provider?.name || "unknown",
|
|
7267
|
+
"x-source": "TYPESCRIPT_SDK",
|
|
7268
|
+
"x-runtime": RUNTIME_ENV,
|
|
7224
7269
|
"x-sdk-version": version
|
|
7225
7270
|
};
|
|
7226
7271
|
}
|
|
@@ -7252,7 +7297,7 @@ var ToolRouter = class {
|
|
|
7252
7297
|
constructor(client) {
|
|
7253
7298
|
this.client = client;
|
|
7254
7299
|
this.client = client;
|
|
7255
|
-
telemetry.instrument(this);
|
|
7300
|
+
telemetry.instrument(this, "ToolRouter");
|
|
7256
7301
|
}
|
|
7257
7302
|
/**
|
|
7258
7303
|
* Creates a new Session for the tool router
|
|
@@ -7426,8 +7471,11 @@ var Composio = class _Composio {
|
|
|
7426
7471
|
host: this.config.host
|
|
7427
7472
|
});
|
|
7428
7473
|
}
|
|
7429
|
-
telemetry.instrument(this);
|
|
7430
|
-
telemetry.instrument(
|
|
7474
|
+
telemetry.instrument(this, "Composio");
|
|
7475
|
+
telemetry.instrument(
|
|
7476
|
+
this.provider,
|
|
7477
|
+
this.provider.name ?? this.provider.constructor.name ?? "unknown"
|
|
7478
|
+
);
|
|
7431
7479
|
if (!this.config.disableVersionCheck) {
|
|
7432
7480
|
checkForLatestVersionFromNPM(version);
|
|
7433
7481
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@composio/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"zod": ">=3.25.76 <5"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@composio/client": "0.1.0-alpha.
|
|
42
|
+
"@composio/client": "0.1.0-alpha.40",
|
|
43
43
|
"@types/json-schema": "^7.0.15",
|
|
44
44
|
"chalk": "^4.1.2",
|
|
45
45
|
"openai": "^5.16.0",
|