@composio/core 0.1.18 → 0.1.20

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 CHANGED
@@ -43,7 +43,6 @@ __export(index_exports, {
43
43
  AuthSchemeTypes: () => AuthSchemeTypes,
44
44
  BaseAgenticProvider: () => BaseAgenticProvider,
45
45
  BaseNonAgenticProvider: () => BaseNonAgenticProvider,
46
- BaseTelemetryTransport: () => BaseTelemetryTransport,
47
46
  BasicWithJwtConnectionDataSchema: () => BasicWithJwtConnectionDataSchema,
48
47
  BillcomAuthConnectionDataSchema: () => BillcomAuthConnectionDataSchema,
49
48
  Composio: () => Composio,
@@ -68,7 +67,6 @@ __export(index_exports, {
68
67
  ConnectionRequestFailedError: () => ConnectionRequestFailedError,
69
68
  ConnectionRequestTimeoutError: () => ConnectionRequestTimeoutError,
70
69
  ConnectionStatuses: () => ConnectionStatuses,
71
- ConsoleTelemetryTransport: () => ConsoleTelemetryTransport,
72
70
  CreateAuthConfigParamsSchema: () => CreateAuthConfigParamsSchema,
73
71
  CreateAuthConfigResponseSchema: () => CreateAuthConfigResponseSchema,
74
72
  CreateComposioManagedAuthConfigParamsSchema: () => CreateComposioManagedAuthConfigParamsSchema,
@@ -106,6 +104,7 @@ __export(index_exports, {
106
104
  ToolSchema: () => ToolSchema,
107
105
  ToolkitAuthConfigDetailsSchema: () => ToolkitAuthConfigDetailsSchema,
108
106
  ToolkitAuthFieldSchema: () => ToolkitAuthFieldSchema,
107
+ ToolkitAuthFieldsResponseSchema: () => ToolkitAuthFieldsResponseSchema,
109
108
  ToolkitCategorySchema: () => ToolkitCategorySchema,
110
109
  ToolkitErrorCodes: () => ToolkitErrorCodes,
111
110
  ToolkitMangedByEnumSchema: () => ToolkitMangedByEnumSchema,
@@ -152,21 +151,63 @@ var JSONSchemaType = import_zod.z.enum([
152
151
  "null"
153
152
  ]);
154
153
  var JSONSchemaProperty = import_zod.z.object({
155
- type: JSONSchemaType.optional(),
154
+ type: import_zod.z.union([JSONSchemaType, import_zod.z.array(JSONSchemaType)]).optional(),
156
155
  description: import_zod.z.string().optional(),
157
156
  anyOf: import_zod.z.lazy(() => import_zod.z.array(JSONSchemaProperty)).optional(),
157
+ oneOf: import_zod.z.lazy(() => import_zod.z.array(JSONSchemaProperty)).optional(),
158
+ allOf: import_zod.z.lazy(() => import_zod.z.array(JSONSchemaProperty)).optional(),
159
+ not: import_zod.z.lazy(() => JSONSchemaProperty).optional(),
158
160
  title: import_zod.z.string().optional(),
159
161
  default: import_zod.z.any().optional(),
162
+ nullable: import_zod.z.boolean().optional(),
160
163
  properties: import_zod.z.lazy(() => import_zod.z.record(import_zod.z.string(), JSONSchemaProperty)).optional(),
161
164
  required: import_zod.z.array(import_zod.z.string()).optional(),
162
- items: import_zod.z.lazy(() => JSONSchemaProperty).optional()
165
+ items: import_zod.z.lazy(() => import_zod.z.union([JSONSchemaProperty, import_zod.z.array(JSONSchemaProperty)])).optional(),
166
+ enum: import_zod.z.array(import_zod.z.any()).optional(),
167
+ const: import_zod.z.any().optional(),
168
+ minimum: import_zod.z.number().optional(),
169
+ maximum: import_zod.z.number().optional(),
170
+ exclusiveMinimum: import_zod.z.number().optional(),
171
+ exclusiveMaximum: import_zod.z.number().optional(),
172
+ multipleOf: import_zod.z.number().optional(),
173
+ minLength: import_zod.z.number().optional(),
174
+ maxLength: import_zod.z.number().optional(),
175
+ pattern: import_zod.z.string().optional(),
176
+ format: import_zod.z.string().optional(),
177
+ minItems: import_zod.z.number().optional(),
178
+ maxItems: import_zod.z.number().optional(),
179
+ uniqueItems: import_zod.z.boolean().optional(),
180
+ minProperties: import_zod.z.number().optional(),
181
+ maxProperties: import_zod.z.number().optional(),
182
+ patternProperties: import_zod.z.lazy(() => import_zod.z.record(import_zod.z.string(), JSONSchemaProperty)).optional(),
183
+ additionalProperties: import_zod.z.union([import_zod.z.boolean(), import_zod.z.lazy(() => JSONSchemaProperty)]).optional(),
184
+ examples: import_zod.z.array(import_zod.z.any()).optional(),
185
+ readOnly: import_zod.z.boolean().optional(),
186
+ writeOnly: import_zod.z.boolean().optional(),
187
+ if: import_zod.z.lazy(() => JSONSchemaProperty).optional(),
188
+ then: import_zod.z.lazy(() => JSONSchemaProperty).optional(),
189
+ else: import_zod.z.lazy(() => JSONSchemaProperty).optional(),
190
+ $ref: import_zod.z.string().optional(),
191
+ definitions: import_zod.z.record(
192
+ import_zod.z.string(),
193
+ import_zod.z.lazy(() => JSONSchemaProperty)
194
+ ).optional(),
195
+ $defs: import_zod.z.record(
196
+ import_zod.z.string(),
197
+ import_zod.z.lazy(() => JSONSchemaProperty)
198
+ ).optional()
163
199
  });
164
200
  var ParametersSchema = import_zod.z.object({
165
201
  type: import_zod.z.literal("object"),
166
202
  anyOf: import_zod.z.array(JSONSchemaProperty).optional(),
203
+ oneOf: import_zod.z.array(JSONSchemaProperty).optional(),
204
+ allOf: import_zod.z.array(JSONSchemaProperty).optional(),
205
+ not: JSONSchemaProperty.optional(),
167
206
  properties: import_zod.z.record(import_zod.z.string(), JSONSchemaProperty),
168
207
  required: import_zod.z.array(import_zod.z.string()).optional(),
169
208
  title: import_zod.z.string().optional(),
209
+ default: import_zod.z.any().optional(),
210
+ nullable: import_zod.z.boolean().optional(),
170
211
  description: import_zod.z.string().optional(),
171
212
  additionalProperties: import_zod.z.boolean().default(false).optional()
172
213
  });
@@ -708,13 +749,6 @@ var TELEMETRY_EVENTS = {
708
749
  CLI_INVOKED: "CLI_INVOKED"
709
750
  };
710
751
 
711
- // src/utils/constants.ts
712
- var COMPOSIO_DIR = ".composio";
713
- var USER_DATA_FILE_NAME = "user_data.json";
714
- var DEFAULT_BASE_URL = "https://backend.composio.dev";
715
- var TELEMETRY_URL = "https://app.composio.dev";
716
- var IS_DEVELOPMENT_OR_CI = process.env.DEVELOPMENT || process.env.CI || false;
717
-
718
752
  // src/telemetry/BatchProcessor.ts
719
753
  var BatchProcessor = class {
720
754
  batch = [];
@@ -748,126 +782,78 @@ var BatchProcessor = class {
748
782
  }
749
783
  };
750
784
 
751
- // src/telemetry/transports/BrowserTransport.ts
752
- var BrowserTelemetryTransport = class {
753
- send(payload) {
754
- if (typeof window === "undefined") {
755
- return Promise.reject(
756
- new Error("BrowserTelemetryTransport can only be used in browser environments")
757
- );
758
- }
759
- return new Promise((resolve) => {
760
- try {
761
- const xhr = new XMLHttpRequest();
762
- xhr.open(payload.method, payload.url, true);
763
- xhr.setRequestHeader("Content-Type", "application/json");
764
- Object.entries(payload.headers || {}).forEach(([key, value]) => {
765
- xhr.setRequestHeader(key, value);
766
- });
767
- xhr.onload = function() {
768
- resolve();
769
- };
770
- xhr.send(JSON.stringify(payload.data));
771
- } catch (error) {
772
- logger_default.error("Error sending error to telemetry", error);
773
- resolve();
774
- }
775
- });
776
- }
777
- };
778
-
779
- // src/telemetry/transports/ProcessTransport.ts
780
- var import_chalk3 = __toESM(require("chalk"), 1);
781
- var ProcessTelemetryTransport = class {
782
- send(payload) {
783
- if (typeof window !== "undefined") {
784
- return Promise.reject(
785
- new Error("ProcessTelemetryTransport can only be used in Node.js environments")
786
- );
787
- }
788
- return new Promise((resolve) => {
789
- try {
790
- const url = new URL(payload.url);
791
- const protocol = url.protocol === "https:" ? "https" : "http";
792
- const port = url.port || (url.protocol === "https:" ? 443 : 80);
793
- const args = [
794
- "-e",
795
- `
796
- const http = require('${protocol}');
797
- const options = {
798
- hostname: '${url.hostname}',
799
- path: '${url.pathname}${url.search}',
800
- port: ${port},
801
- method: '${payload.method}',
802
- headers: ${JSON.stringify(payload.headers)}
803
- };
804
-
805
- const req = http.request(options, (res) => {
806
- res.on('data', () => {});
807
- res.on('end', () => {
808
- process.exit(0);
809
- });
810
- });
811
-
812
- req.on('error', () => {
813
- process.exit(0);
814
- });
815
-
816
- req.write(JSON.stringify(${JSON.stringify(payload.data)}));
817
- req.end();
818
- `
819
- ];
820
- import("child_process").then(({ spawn }) => {
821
- spawn("node", args, {
822
- stdio: "ignore",
823
- detached: false,
824
- shell: false
825
- }).unref();
826
- resolve();
827
- }).catch((error) => {
828
- logger_default.error("Error sending telemetry", error);
829
- resolve();
830
- });
831
- logger_default.debug(import_chalk3.default.yellow("Process Telemetry"), JSON.stringify(payload, null, 2));
832
- } catch (error) {
833
- logger_default.error("Error sending telemetry", error);
834
- resolve();
835
- }
836
- });
837
- }
838
- };
839
-
840
785
  // src/utils/uuid.ts
841
786
  var import_uuid = require("uuid");
842
787
  function getRandomUUID() {
843
788
  return (0, import_uuid.v4)();
844
789
  }
845
790
 
846
- // src/telemetry/Telemetry.ts
791
+ // src/services/telemetry/TelemetryService.ts
792
+ var TELEMETRY_URL = "https://telemetry.composio.dev/v1";
847
793
  var TelemetryService = class {
794
+ /**
795
+ * Sends a metric to the Telemetry API.
796
+ * @param payload - The payload to send to the Telemetry API.
797
+ * @returns The response from the Telemetry API.
798
+ */
799
+ static async sendMetric(payload) {
800
+ return fetch(`${TELEMETRY_URL}/metrics/invocations`, {
801
+ method: "POST",
802
+ headers: {
803
+ "Content-Type": "application/json"
804
+ },
805
+ body: JSON.stringify(payload)
806
+ });
807
+ }
808
+ /**
809
+ * Sends an error log to the Telemetry API.
810
+ * @param payload - The payload to send to the Telemetry API.
811
+ * @returns The response from the Telemetry API.
812
+ */
813
+ static async sendErrorLog(payload) {
814
+ return fetch(`${TELEMETRY_URL}/errors`, {
815
+ method: "POST",
816
+ headers: {
817
+ "Content-Type": "application/json"
818
+ },
819
+ body: JSON.stringify(payload)
820
+ });
821
+ }
822
+ };
823
+
824
+ // src/telemetry/Telemetry.ts
825
+ var TelemetryTransport = class {
848
826
  telemetryMetadata;
849
- transport;
850
827
  isTelemetryDisabled = true;
851
- batchProcessor = new BatchProcessor(100, 10, async (data) => {
852
- await this.sendTelemetry(data);
828
+ telemetrySource;
829
+ telemetrySourceName = "typescript-sdk";
830
+ telemetryServiceName = "sdk";
831
+ telemetryLanguage = "typescript";
832
+ batchProcessor = new BatchProcessor(200, 10, async (data) => {
833
+ logger_default.debug("Sending batch of telemetry metrics", data);
834
+ await TelemetryService.sendMetric(data);
853
835
  });
854
- setup(metadata, transport) {
836
+ setup(metadata) {
855
837
  this.telemetryMetadata = metadata;
856
838
  this.isTelemetryDisabled = false;
857
- const isBrowser = typeof window !== "undefined";
858
- if (transport) {
859
- this.transport = transport;
860
- } else if (isBrowser) {
861
- this.transport = new BrowserTelemetryTransport();
862
- this.telemetryMetadata.transport = "browser";
863
- } else {
864
- this.transport = new ProcessTelemetryTransport();
865
- this.telemetryMetadata.transport = "process";
866
- }
867
- this.sendTelemetry([
839
+ this.telemetrySource = {
840
+ name: this.telemetrySourceName,
841
+ service: this.telemetryServiceName,
842
+ language: this.telemetryLanguage,
843
+ version: this.telemetryMetadata?.version,
844
+ platform: this.telemetryMetadata?.isBrowser ? "browser" : "node"
845
+ };
846
+ this.sendMetric([
868
847
  {
869
- eventName: TELEMETRY_EVENTS.SDK_INITIALIZED,
870
- data: {}
848
+ functionName: TELEMETRY_EVENTS.SDK_INITIALIZED,
849
+ durationMs: 0,
850
+ timestamp: Date.now() / 1e3,
851
+ props: {},
852
+ source: this.telemetrySource,
853
+ metadata: {
854
+ provider: this.telemetryMetadata?.provider ?? "openai"
855
+ },
856
+ error: void 0
871
857
  }
872
858
  ]);
873
859
  }
@@ -891,12 +877,19 @@ var TelemetryService = class {
891
877
  const originalMethod = instance[name];
892
878
  instance[name] = async (...args) => {
893
879
  const telemetryPayload = {
894
- eventName: TELEMETRY_EVENTS.SDK_METHOD_INVOKED,
895
- data: {
880
+ functionName: `${instrumentedClassName}.${name}`,
881
+ durationMs: 0,
882
+ timestamp: Date.now() / 1e3,
883
+ props: {
896
884
  fileName: instrumentedClassName,
897
885
  method: name,
898
886
  params: args
899
- }
887
+ },
888
+ metadata: {
889
+ provider: this.telemetryMetadata?.provider ?? "openai"
890
+ },
891
+ error: void 0,
892
+ source: this.telemetrySource
900
893
  };
901
894
  this.batchProcessor.pushItem(telemetryPayload);
902
895
  try {
@@ -905,7 +898,7 @@ var TelemetryService = class {
905
898
  if (error instanceof Error) {
906
899
  if (!error.errorId) {
907
900
  error.errorId = getRandomUUID();
908
- this.prepareAndSendErrorTelemetry(error, instrumentedClassName, name, args);
901
+ await this.prepareAndSendErrorTelemetry(error, instrumentedClassName, name, args);
909
902
  }
910
903
  }
911
904
  throw error;
@@ -919,11 +912,11 @@ var TelemetryService = class {
919
912
  * @returns true if the telemetry should be sent, false otherwise
920
913
  */
921
914
  shouldSendTelemetry() {
922
- const devEnvironments = ["test", "development", "CI"];
915
+ const telemetryDisabledEnvironments = ["test", "ci"];
923
916
  const nodeEnv = (getEnvVariable("NODE_ENV", "development") || "").toLowerCase();
924
- const isDevEnvironment = devEnvironments.includes(nodeEnv);
917
+ const isDisabledEnvironment = telemetryDisabledEnvironments.includes(nodeEnv);
925
918
  const isTelemetryDisabledByEnv = getEnvVariable("TELEMETRY_DISABLED", "false") === "true";
926
- return this.transport && !this.isTelemetryDisabled && !isTelemetryDisabledByEnv && !isDevEnvironment;
919
+ return !this.isTelemetryDisabled && !isTelemetryDisabledByEnv && !isDisabledEnvironment;
927
920
  }
928
921
  /**
929
922
  * Prepare and send the error telemetry.
@@ -934,78 +927,78 @@ var TelemetryService = class {
934
927
  * @param {string} instrumentedClassName - The class name of the instrumented class.
935
928
  * @param {string} name - The name of the method that threw the error.
936
929
  */
937
- prepareAndSendErrorTelemetry(error, instrumentedClassName, name, args) {
930
+ async prepareAndSendErrorTelemetry(error, instrumentedClassName, name, args) {
931
+ const telemetryPayload = {
932
+ functionName: `${instrumentedClassName}.${name}`,
933
+ durationMs: 0,
934
+ timestamp: Date.now() / 1e3,
935
+ props: {
936
+ fileName: instrumentedClassName,
937
+ method: name,
938
+ params: args
939
+ },
940
+ metadata: {
941
+ provider: this.telemetryMetadata?.provider ?? "openai"
942
+ },
943
+ source: this.telemetrySource
944
+ };
938
945
  if (error instanceof import_client2.ComposioError) {
939
- const telemetryPayload = {
940
- error_id: error.errorId || "",
941
- error_message: error.message,
942
- original_error: error.cause || error,
943
- current_stack: error.stack ? error.stack.split("\n") : [],
944
- description: `Original Call : ${this.telemetryMetadata?.source}:${instrumentedClassName}.${name}(${JSON.stringify(args)})`
946
+ telemetryPayload.error = {
947
+ errorId: error.errorId,
948
+ name: error.name,
949
+ message: error.message,
950
+ stack: error.stack
945
951
  };
946
- this.sendErrorTelemetry(telemetryPayload);
947
952
  } else if (error instanceof ComposioError) {
948
- const telemetryPayload = {
949
- error_id: error.errorId || "",
950
- error_message: error.message,
951
- original_error: error.cause || error,
952
- current_stack: error.stack ? error.stack.split("\n") : [],
953
- error_code: error.code,
954
- possible_fix: error.possibleFixes?.join("\n"),
955
- description: `Original Call : ${instrumentedClassName}.${name}(${JSON.stringify(args)})`
953
+ telemetryPayload.error = {
954
+ errorId: error.errorId,
955
+ name: error.name,
956
+ code: error.code,
957
+ message: error.message,
958
+ stack: error.stack
956
959
  };
957
- this.sendErrorTelemetry(telemetryPayload);
958
960
  } else if (error instanceof Error) {
959
- const telemetryPayload = {
960
- error_id: error.errorId || "",
961
- error_message: error instanceof Error ? error.name : "Unknown error",
962
- original_error: error,
963
- current_stack: error.stack ? error.stack.split("\n") : [],
964
- description: `Original Call : ${this.telemetryMetadata?.source}:${instrumentedClassName}.${name}(${JSON.stringify(args)})`
961
+ telemetryPayload.error = {
962
+ errorId: error.errorId,
963
+ name: error.name ?? "Unknown error",
964
+ message: error.message,
965
+ stack: error.stack
965
966
  };
966
- this.sendErrorTelemetry(telemetryPayload);
967
967
  }
968
+ await this.sendErrorTelemetry(telemetryPayload);
968
969
  }
969
970
  /**
970
971
  * Send the telemetry payload to the server.
971
972
  * @param payload - the telemetry payload to send
972
973
  * @returns
973
974
  */
974
- async sendTelemetry(payload) {
975
+ async sendMetric(payload) {
975
976
  if (!this.shouldSendTelemetry()) {
977
+ logger_default.debug("Telemetry is disabled, skipping metric telemetry", payload);
976
978
  return;
977
979
  }
978
- const url = `${TELEMETRY_URL}/api/sdk_metrics/telemetry`;
979
- const reqPayload = {
980
- data: payload.map((p) => ({
981
- ...p,
982
- sdk_meta: this.telemetryMetadata
983
- })),
984
- url,
985
- method: "POST",
986
- headers: { "Content-Type": "application/json" }
987
- };
988
- this.transport.send(reqPayload);
980
+ try {
981
+ logger_default.debug("SDK Metric", payload);
982
+ await TelemetryService.sendMetric(payload);
983
+ } catch (error) {
984
+ logger_default.error("Error sending metric telemetry", error);
985
+ }
989
986
  }
990
987
  // @TODO: check if this will send the error telemetry to the server
991
988
  async sendErrorTelemetry(payload) {
992
989
  if (!this.shouldSendTelemetry()) {
990
+ logger_default.debug("Telemetry is disabled, skipping metric telemetry", payload);
993
991
  return;
994
992
  }
995
- const url = `${TELEMETRY_URL}/api/sdk_metrics/error`;
996
- const reqPayload = {
997
- data: {
998
- ...payload,
999
- sdk_meta: this.telemetryMetadata
1000
- },
1001
- url,
1002
- method: "POST",
1003
- headers: { "Content-Type": "application/json" }
1004
- };
1005
- this.transport.send(reqPayload);
993
+ try {
994
+ logger_default.debug("SDK Error Telemetry", payload);
995
+ await TelemetryService.sendErrorLog(payload);
996
+ } catch (error) {
997
+ logger_default.error("Error sending error telemetry", error);
998
+ }
1006
999
  }
1007
1000
  };
1008
- var telemetry = new TelemetryService();
1001
+ var telemetry = new TelemetryTransport();
1009
1002
 
1010
1003
  // src/errors/AuthConfigErrors.ts
1011
1004
  var AuthConfigErrorCodes = {
@@ -2076,7 +2069,8 @@ function jsonSchemaToZodSchema(jsonSchema, { strict } = {
2076
2069
  schema
2077
2070
  );
2078
2071
  }
2079
- return (0, import_json_schema_to_zod.jsonSchemaToZod)(schema);
2072
+ const zodSchema = (0, import_json_schema_to_zod.jsonSchemaToZod)(schema);
2073
+ return zodSchema;
2080
2074
  } catch (error) {
2081
2075
  throw new JsonSchemaToZodError("Failed to convert JSON Schema to Zod Schema", {
2082
2076
  cause: error
@@ -2725,6 +2719,14 @@ var ToolkitRetrieveCategoriesResponseSchema = import_zod7.z.object({
2725
2719
  nextCursor: import_zod7.z.string().nullable(),
2726
2720
  totalPages: import_zod7.z.number()
2727
2721
  });
2722
+ var ToolkitAuthFieldsResponseSchema = import_zod7.z.object({
2723
+ authScheme: AuthSchemeEnum,
2724
+ fields: import_zod7.z.array(
2725
+ ToolkitAuthFieldSchema.extend({
2726
+ required: import_zod7.z.boolean().optional()
2727
+ })
2728
+ )
2729
+ });
2728
2730
 
2729
2731
  // src/models/AuthConfigs.ts
2730
2732
  var AuthConfigs = class {
@@ -3581,6 +3583,89 @@ var Toolkits = class {
3581
3583
  }
3582
3584
  return this.getToolkits(arg);
3583
3585
  }
3586
+ async getAuthConfigFields(toolkitSlug, authScheme, authConfigType, requiredOnly) {
3587
+ const toolkit = await this.getToolkitBySlug(toolkitSlug);
3588
+ if (!toolkit.authConfigDetails) {
3589
+ throw new ComposioAuthConfigNotFoundError("No auth config found for toolkit", {
3590
+ meta: {
3591
+ toolkitSlug
3592
+ }
3593
+ });
3594
+ }
3595
+ if (toolkit.authConfigDetails.length > 1 && !authScheme) {
3596
+ logger_default.warn(
3597
+ `Multiple auth configs found for ${toolkitSlug}, please specify the auth scheme to get details of specific auth scheme. Selecting the first scheme by default.`,
3598
+ {
3599
+ meta: {
3600
+ toolkitSlug
3601
+ }
3602
+ }
3603
+ );
3604
+ }
3605
+ const authConfig = authScheme ? toolkit.authConfigDetails.find((authConfig2) => authConfig2.mode === authScheme) : toolkit.authConfigDetails[0];
3606
+ if (!authConfig) {
3607
+ throw new ComposioAuthConfigNotFoundError("No auth config found for toolkit", {
3608
+ meta: {
3609
+ toolkitSlug,
3610
+ authScheme
3611
+ }
3612
+ });
3613
+ }
3614
+ const requiredFields = authConfig.fields[authConfigType].required.map((field) => ({
3615
+ ...field,
3616
+ required: true
3617
+ }));
3618
+ if (requiredOnly) {
3619
+ return {
3620
+ authScheme: AuthSchemeEnum.parse(authConfig.mode),
3621
+ fields: requiredFields
3622
+ };
3623
+ }
3624
+ const optionalFields = authConfig.fields[authConfigType].optional.map((field) => ({
3625
+ ...field,
3626
+ required: false
3627
+ }));
3628
+ return {
3629
+ authScheme: AuthSchemeEnum.parse(authConfig.mode),
3630
+ fields: [...requiredFields, ...optionalFields]
3631
+ };
3632
+ }
3633
+ /**
3634
+ * Retrieves the fields required for creating an auth config for a toolkit.
3635
+ * @param toolkitSlug - The slug of the toolkit to retrieve the fields for
3636
+ * @param authScheme - The auth scheme to retrieve the fields for
3637
+ * @param requiredOnly - Whether to only return the required fields
3638
+ * @returns {Promise<ToolkitAuthFieldsResponse>} The fields required for creating an auth config
3639
+ */
3640
+ async getAuthConfigCreationFields(toolkitSlug, {
3641
+ authScheme,
3642
+ requiredOnly = false
3643
+ } = {}) {
3644
+ return this.getAuthConfigFields(
3645
+ toolkitSlug,
3646
+ authScheme ?? null,
3647
+ "authConfigCreation",
3648
+ requiredOnly
3649
+ );
3650
+ }
3651
+ /**
3652
+ * Retrieves the fields required for initiating a connected account for a toolkit.
3653
+ * @param toolkitSlug - The slug of the toolkit to retrieve the fields for
3654
+ * @param authScheme - The auth scheme to retrieve the fields for
3655
+ * @param requiredOnly - Whether to only return the required fields
3656
+ * @returns {Promise<ToolkitAuthFieldsResponse>} The fields required for initiating a connected account
3657
+ */
3658
+ async getConnectedAccountInitiationFields(toolkitSlug, {
3659
+ authScheme,
3660
+ requiredOnly = false
3661
+ } = {}) {
3662
+ return this.getAuthConfigFields(
3663
+ toolkitSlug,
3664
+ authScheme ?? null,
3665
+ "connectedAccountInitiation",
3666
+ requiredOnly
3667
+ );
3668
+ }
3584
3669
  /**
3585
3670
  * Retrieves all toolkit categories available in the Composio SDK.
3586
3671
  *
@@ -4319,6 +4404,12 @@ var Triggers = class {
4319
4404
  }
4320
4405
  };
4321
4406
 
4407
+ // src/utils/constants.ts
4408
+ var COMPOSIO_DIR = ".composio";
4409
+ var USER_DATA_FILE_NAME = "user_data.json";
4410
+ var DEFAULT_BASE_URL = "https://backend.composio.dev";
4411
+ var IS_DEVELOPMENT_OR_CI = process.env.DEVELOPMENT || process.env.CI || false;
4412
+
4322
4413
  // src/utils/sdk.ts
4323
4414
  var userDataPath = () => {
4324
4415
  try {
@@ -4835,7 +4926,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
4835
4926
  };
4836
4927
 
4837
4928
  // package.json
4838
- var version = "0.1.18";
4929
+ var version = "0.1.20";
4839
4930
 
4840
4931
  // src/composio.ts
4841
4932
  var Composio = class _Composio {
@@ -4872,7 +4963,6 @@ var Composio = class _Composio {
4872
4963
  * @param {boolean} [config.allowTracking=true] - Whether to allow anonymous usage analytics
4873
4964
  * @param {boolean} [config.allowTracing=true] - Whether to allow request tracing for debugging
4874
4965
  * @param {TProvider} [config.provider] - The provider to use for this Composio instance (defaults to OpenAIProvider)
4875
- * @param {BaseTelemetryTransport} [config.telemetryTransport] - Custom telemetry transport implementation
4876
4966
  *
4877
4967
  * @example
4878
4968
  * ```typescript
@@ -4918,23 +5008,21 @@ var Composio = class _Composio {
4918
5008
  this.authConfigs = new AuthConfigs(this.client);
4919
5009
  this.connectedAccounts = new ConnectedAccounts(this.client);
4920
5010
  if (this.config.allowTracking) {
4921
- telemetry.setup(
4922
- {
4923
- apiKey: apiKeyParsed ?? "",
4924
- baseUrl: baseURLParsed ?? "",
4925
- frameworkRuntime: this.provider?.name ?? "unknown",
4926
- isAgentic: this.provider?._isAgentic || false,
4927
- source: "javascript",
4928
- version,
4929
- sdkType: "Typescript-V3",
4930
- isBrowser: typeof window !== "undefined",
4931
- // @TODO: Users might want to pass their own session id
4932
- // @TODO: We shouldn't be doing this as people might always have one session id throughout the process in server
4933
- sessionId: this.config.allowTracing ? getRandomUUID() : void 0
4934
- // @TODO: get the session id
4935
- },
4936
- config?.telemetryTransport
4937
- );
5011
+ telemetry.setup({
5012
+ apiKey: apiKeyParsed ?? "",
5013
+ baseUrl: baseURLParsed ?? "",
5014
+ frameworkRuntime: this.provider?.name ?? "unknown",
5015
+ isAgentic: this.provider?._isAgentic || false,
5016
+ source: "composio-sdk-typescript",
5017
+ version,
5018
+ sdkType: "Typescript-V3",
5019
+ isBrowser: typeof window !== "undefined",
5020
+ provider: this.provider?.name ?? "openai",
5021
+ // @TODO: Users might want to pass their own session id
5022
+ // @TODO: We shouldn't be doing this as people might always have one session id throughout the process in server
5023
+ sessionId: this.config.allowTracing ? getRandomUUID() : void 0
5024
+ // @TODO: get the session id
5025
+ });
4938
5026
  }
4939
5027
  telemetry.instrument(this);
4940
5028
  telemetry.instrument(this.provider);
@@ -5003,17 +5091,6 @@ var ComposioProvider = class extends BaseNonAgenticProvider {
5003
5091
  }
5004
5092
  };
5005
5093
 
5006
- // src/telemetry/TelemetryTransport.ts
5007
- var import_chalk4 = __toESM(require("chalk"), 1);
5008
- var BaseTelemetryTransport = class {
5009
- };
5010
- var ConsoleTelemetryTransport = class {
5011
- send(payload) {
5012
- logger_default.debug(import_chalk4.default.yellow("telemetry"), JSON.stringify(payload, null, 2));
5013
- return Promise.resolve();
5014
- }
5015
- };
5016
-
5017
5094
  // src/models/AuthScheme.ts
5018
5095
  var AuthScheme = class {
5019
5096
  /**
@@ -5195,7 +5272,6 @@ var AuthScheme = class {
5195
5272
  AuthSchemeTypes,
5196
5273
  BaseAgenticProvider,
5197
5274
  BaseNonAgenticProvider,
5198
- BaseTelemetryTransport,
5199
5275
  BasicWithJwtConnectionDataSchema,
5200
5276
  BillcomAuthConnectionDataSchema,
5201
5277
  Composio,
@@ -5220,7 +5296,6 @@ var AuthScheme = class {
5220
5296
  ConnectionRequestFailedError,
5221
5297
  ConnectionRequestTimeoutError,
5222
5298
  ConnectionStatuses,
5223
- ConsoleTelemetryTransport,
5224
5299
  CreateAuthConfigParamsSchema,
5225
5300
  CreateAuthConfigResponseSchema,
5226
5301
  CreateComposioManagedAuthConfigParamsSchema,
@@ -5258,6 +5333,7 @@ var AuthScheme = class {
5258
5333
  ToolSchema,
5259
5334
  ToolkitAuthConfigDetailsSchema,
5260
5335
  ToolkitAuthFieldSchema,
5336
+ ToolkitAuthFieldsResponseSchema,
5261
5337
  ToolkitCategorySchema,
5262
5338
  ToolkitErrorCodes,
5263
5339
  ToolkitMangedByEnumSchema,