@composio/core 0.5.0 → 0.5.2

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.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./chunk-0j-ceAHr.mjs";
2
- import { a as logger_default, c as DEFAULT_BASE_URL, d as constants_exports, f as getEnvVariable, i as ComposioError, l as IS_DEVELOPMENT_OR_CI, n as getFileDataAfterUploadingToS3, o as COMPOSIO_DIR, p as getEnvsWithPrefix, r as telemetry, s as COMPOSIO_LOG_LEVEL, t as downloadFileFromS3, u as USER_DATA_FILE_NAME } from "./fileUtils-XEoNI39Q.mjs";
2
+ import { a as logger_default, c as DEFAULT_BASE_URL, d as constants_exports, f as getEnvVariable, i as ComposioError, l as IS_DEVELOPMENT_OR_CI, n as getFileDataAfterUploadingToS3, o as COMPOSIO_DIR, p as getEnvsWithPrefix, r as telemetry, s as COMPOSIO_LOG_LEVEL, t as downloadFileFromS3, u as USER_DATA_FILE_NAME } from "./fileUtils-BxTR8M_c.mjs";
3
3
  import ComposioClient, { APIError } from "@composio/client";
4
4
  import z, { ZodError, z as z$1 } from "zod/v3";
5
5
  import * as zodToJsonSchema from "zod-to-json-schema";
@@ -63,17 +63,18 @@ const CreateCustomAuthConfigParamsSchema = z$1.object({
63
63
  proxyUrl: z$1.string(),
64
64
  proxyAuthKey: z$1.string().optional()
65
65
  }).optional(),
66
- toolAccessConfig: AuthConfigCreationToolAccessConfigSchema.optional()
66
+ toolAccessConfig: AuthConfigCreationToolAccessConfigSchema.optional(),
67
+ isEnabledForToolRouter: z$1.boolean().optional()
67
68
  });
68
69
  const CreateComposioManagedAuthConfigParamsSchema = z$1.object({
69
70
  type: z$1.literal("use_composio_managed_auth"),
70
71
  name: z$1.string().optional(),
71
- credentials: z$1.record(z$1.string(), z$1.union([
72
- z$1.string(),
73
- z$1.number(),
74
- z$1.boolean()
75
- ])).optional(),
76
- toolAccessConfig: AuthConfigCreationToolAccessConfigSchema.optional()
72
+ credentials: z$1.object({
73
+ scopes: z$1.union([z$1.string(), z$1.array(z$1.string())]).optional(),
74
+ user_scopes: z$1.union([z$1.string(), z$1.array(z$1.string())]).optional()
75
+ }).passthrough().optional(),
76
+ toolAccessConfig: AuthConfigCreationToolAccessConfigSchema.optional(),
77
+ isEnabledForToolRouter: z$1.boolean().optional()
77
78
  });
78
79
  /**
79
80
  * Discriminated union of all possible auth config types.
@@ -98,6 +99,7 @@ const AuthConfigRetrieveResponseSchema = z$1.object({
98
99
  authScheme: AuthSchemeEnum.optional(),
99
100
  credentials: z$1.record(z$1.string(), z$1.unknown()).optional(),
100
101
  expectedInputFields: z$1.array(z$1.unknown()).optional(),
102
+ isEnabledForToolRouter: z$1.boolean().optional(),
101
103
  restrictToFollowingTools: z$1.array(z$1.string()).optional(),
102
104
  isComposioManaged: z$1.boolean().optional(),
103
105
  createdBy: z$1.string().optional(),
@@ -117,14 +119,19 @@ const AuthConfigListResponseSchema = z$1.object({
117
119
  totalPages: z$1.number()
118
120
  });
119
121
  const AuthCustomConfigUpdateParamsSchema = z$1.object({
120
- credentials: z$1.record(z$1.string(), z$1.union([z$1.string(), z$1.unknown()])),
121
122
  type: z$1.literal("custom"),
123
+ credentials: z$1.object({
124
+ scopes: z$1.union([z$1.string(), z$1.array(z$1.string())]).optional(),
125
+ user_scopes: z$1.union([z$1.string(), z$1.array(z$1.string())]).optional()
126
+ }).passthrough().optional(),
127
+ isEnabledForToolRouter: z$1.boolean().optional(),
122
128
  restrictToFollowingTools: z$1.array(z$1.string()).optional(),
123
129
  toolAccessConfig: AuthConfigToolAccessConfigSchema.optional()
124
130
  });
125
131
  const AuthDefaultConfigUpdateParamsSchema = z$1.object({
126
- scopes: z$1.string().optional(),
127
132
  type: z$1.literal("default"),
133
+ scopes: z$1.string().optional(),
134
+ isEnabledForToolRouter: z$1.boolean().optional(),
128
135
  restrictToFollowingTools: z$1.array(z$1.string()).optional(),
129
136
  toolAccessConfig: AuthConfigToolAccessConfigSchema.optional()
130
137
  });
@@ -2760,6 +2767,7 @@ function transformAuthConfigRetrieveResponse(authConfig) {
2760
2767
  logo: authConfig$1.toolkit.logo,
2761
2768
  slug: authConfig$1.toolkit.slug
2762
2769
  },
2770
+ isEnabledForToolRouter: authConfig$1.is_enabled_for_tool_router,
2763
2771
  uuid: authConfig$1.uuid,
2764
2772
  authScheme: authConfig$1.auth_scheme,
2765
2773
  credentials: authConfig$1.credentials,
@@ -2898,6 +2906,7 @@ var AuthConfigs = class {
2898
2906
  name: parsedOptions.data.name,
2899
2907
  authScheme: parsedOptions.data.authScheme,
2900
2908
  credentials: parsedOptions.data.credentials,
2909
+ is_enabled_for_tool_router: parsedOptions.data.isEnabledForToolRouter,
2901
2910
  proxy_config: parsedOptions.data.proxyConfig ? {
2902
2911
  proxy_url: parsedOptions.data.proxyConfig.proxyUrl,
2903
2912
  proxy_auth_key: parsedOptions.data.proxyConfig.proxyAuthKey
@@ -2907,6 +2916,7 @@ var AuthConfigs = class {
2907
2916
  type: parsedOptions.data.type,
2908
2917
  credentials: parsedOptions.data.credentials,
2909
2918
  name: parsedOptions.data.name,
2919
+ is_enabled_for_tool_router: parsedOptions.data.isEnabledForToolRouter,
2910
2920
  tool_access_config: parsedOptions.data.toolAccessConfig ? { tools_for_connected_account_creation: parsedOptions.data.toolAccessConfig.toolsForConnectedAccountCreation } : void 0
2911
2921
  }
2912
2922
  }));
@@ -2969,6 +2979,7 @@ var AuthConfigs = class {
2969
2979
  return this.client.authConfigs.update(nanoid, parsedData.data.type === "custom" ? {
2970
2980
  type: "custom",
2971
2981
  credentials: parsedData.data.credentials,
2982
+ is_enabled_for_tool_router: parsedData.data.isEnabledForToolRouter,
2972
2983
  tool_access_config: {
2973
2984
  tools_for_connected_account_creation: parsedData.data.toolAccessConfig?.toolsForConnectedAccountCreation,
2974
2985
  tools_available_for_execution: parsedData.data.toolAccessConfig?.toolsAvailableForExecution ?? parsedData.data.restrictToFollowingTools
@@ -2976,6 +2987,7 @@ var AuthConfigs = class {
2976
2987
  } : {
2977
2988
  type: "default",
2978
2989
  scopes: parsedData.data.scopes,
2990
+ is_enabled_for_tool_router: parsedData.data.isEnabledForToolRouter,
2979
2991
  tool_access_config: {
2980
2992
  tools_for_connected_account_creation: parsedData.data.toolAccessConfig?.toolsForConnectedAccountCreation,
2981
2993
  tools_available_for_execution: parsedData.data.toolAccessConfig?.toolsAvailableForExecution ?? parsedData.data.restrictToFollowingTools
@@ -5621,7 +5633,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
5621
5633
 
5622
5634
  //#endregion
5623
5635
  //#region package.json
5624
- var version = "0.5.0";
5636
+ var version = "0.5.2";
5625
5637
 
5626
5638
  //#endregion
5627
5639
  //#region src/utils/session.ts
@@ -6242,6 +6254,36 @@ var Composio = class Composio {
6242
6254
  defaultHeaders: sessionHeaders
6243
6255
  });
6244
6256
  }
6257
+ /**
6258
+ * Flush any pending telemetry and wait for it to complete.
6259
+ *
6260
+ * In Node.js-compatible environments, telemetry is automatically flushed on process exit.
6261
+ * However, in environments like Cloudflare Workers that don't support process exit events,
6262
+ * you should call this method manually to ensure all telemetry is sent.
6263
+ *
6264
+ * @returns {Promise<void>} A promise that resolves when all pending telemetry has been sent.
6265
+ *
6266
+ * @example
6267
+ * ```typescript
6268
+ * // In a Cloudflare Worker, use ctx.waitUntil to ensure telemetry is flushed
6269
+ * export default {
6270
+ * async fetch(request: Request, env: Env, ctx: ExecutionContext) {
6271
+ * const composio = new Composio({ apiKey: env.COMPOSIO_API_KEY });
6272
+ *
6273
+ * // Do your work...
6274
+ * const result = await composio.tools.execute(...);
6275
+ *
6276
+ * // Ensure telemetry flushes before worker terminates
6277
+ * ctx.waitUntil(composio.flush());
6278
+ *
6279
+ * return new Response(JSON.stringify(result));
6280
+ * }
6281
+ * };
6282
+ * ```
6283
+ */
6284
+ async flush() {
6285
+ await telemetry.flush();
6286
+ }
6245
6287
  };
6246
6288
 
6247
6289
  //#endregion
@@ -1,4 +1,4 @@
1
- const require_fileUtils = require('../fileUtils-CJjp8sBn.cjs');
1
+ const require_fileUtils = require('../fileUtils-BbE-aKW0.cjs');
2
2
 
3
3
  //#region src/models/Files.node.ts
4
4
  var Files = class {
@@ -1,5 +1,5 @@
1
1
  import "../chunk-0j-ceAHr.mjs";
2
- import { n as getFileDataAfterUploadingToS3, r as telemetry, t as downloadFileFromS3 } from "../fileUtils-XEoNI39Q.mjs";
2
+ import { n as getFileDataAfterUploadingToS3, r as telemetry, t as downloadFileFromS3 } from "../fileUtils-BxTR8M_c.mjs";
3
3
 
4
4
  //#region src/models/Files.node.ts
5
5
  var Files = class {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@composio/core",
3
3
  "type": "module",
4
- "version": "0.5.0",
4
+ "version": "0.5.2",
5
5
  "description": "",
6
6
  "main": "dist/index.mjs",
7
7
  "publishConfig": {
@@ -106,10 +106,10 @@
106
106
  "zod": "^3.25 || ^4"
107
107
  },
108
108
  "dependencies": {
109
- "@composio/client": "0.1.0-alpha.54",
109
+ "@composio/client": "0.1.0-alpha.55",
110
110
  "@types/json-schema": "^7.0.15",
111
111
  "chalk": "^4.1.2",
112
- "openai": "^5.16.0",
112
+ "openai": "^6.16.0",
113
113
  "pusher-js": "^8.4.0",
114
114
  "semver": "^7.7.2",
115
115
  "zod-to-json-schema": "^3.25.1",