@composio/core 0.10.0 → 0.11.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.
Files changed (39) hide show
  1. package/dist/{tool.types-CB_4JKhV.d.mts → BaseProvider-BvHvJLXc.d.mts} +24346 -24345
  2. package/dist/{tool.types-CwbAy9l_.d.cts → BaseProvider-CVbQxTNa.d.cts} +24346 -24345
  3. package/dist/{CustomTool-aber890o.d.cts → CustomTool-C-IUByoU.d.cts} +1 -1
  4. package/dist/{CustomTool-DJUGNOer.d.mts → CustomTool-CChQSp44.d.mts} +1 -1
  5. package/dist/{CustomTool-CQ_YjABZ.cjs → CustomTool-D3-NreIm.cjs} +79 -79
  6. package/dist/{CustomTool-D7-1S2at.mjs → CustomTool-D5s-aADw.mjs} +74 -74
  7. package/dist/{FileToolModifier.utils.neutral-B7P7wn-b.mjs → FileToolModifier.utils.neutral-BpSceNK8.mjs} +1 -7
  8. package/dist/{FileToolModifier.utils.neutral-Dfwqgimk.cjs → FileToolModifier.utils.neutral-DSBQs9-i.cjs} +2 -8
  9. package/dist/{Telemetry-Dm-0sewu.cjs → Telemetry-BQ_pl5AK.cjs} +34 -9
  10. package/dist/{Telemetry-kgWlkavX.mjs → Telemetry-DQax33Gh.mjs} +34 -9
  11. package/dist/{composio-DRl6WCI9.d.mts → composio-BlASKqjQ.d.mts} +161 -208
  12. package/dist/{composio-CSMCZZgj.d.cts → composio-pcA13w87.d.cts} +161 -208
  13. package/dist/{customTool.types-CMOMgxoM.d.mts → customTool.types-DLIORcYN.d.mts} +43 -81
  14. package/dist/{customTool.types-BzEWHa0w.d.cts → customTool.types-QtkAZQma.d.cts} +43 -81
  15. package/dist/experimental/index.cjs +1 -1
  16. package/dist/experimental/index.d.cts +2 -2
  17. package/dist/experimental/index.d.mts +3 -3
  18. package/dist/experimental/index.mjs +1 -1
  19. package/dist/index.cjs +476 -590
  20. package/dist/index.d.cts +406 -13
  21. package/dist/index.d.mts +406 -13
  22. package/dist/index.mjs +473 -588
  23. package/dist/models/Files.node.cjs +1 -1
  24. package/dist/models/Files.node.mjs +1 -1
  25. package/dist/{types-BTOPdg4d.d.mts → types-DRG5qLxI.d.cts} +2 -2
  26. package/dist/{types-DE7O6Z6S.d.cts → types-J2KCXP8R.d.mts} +2 -2
  27. package/dist/utils/config-defaults/ConfigDefaults.node.d.cts +2 -2
  28. package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +4 -4
  29. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.cts +2 -2
  30. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +4 -4
  31. package/dist/utils/modifiers/FileToolModifier.node.cjs +38 -21
  32. package/dist/utils/modifiers/FileToolModifier.node.d.cts +1 -1
  33. package/dist/utils/modifiers/FileToolModifier.node.d.mts +1 -1
  34. package/dist/utils/modifiers/FileToolModifier.node.mjs +38 -21
  35. package/dist/utils/modifiers/FileToolModifier.workerd.cjs +1 -1
  36. package/dist/utils/modifiers/FileToolModifier.workerd.d.cts +1 -1
  37. package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
  38. package/dist/utils/modifiers/FileToolModifier.workerd.mjs +1 -1
  39. package/package.json +11 -2
@@ -1,4 +1,4 @@
1
- import { a as CustomTool, h as CustomToolkit, i as CreateCustomToolkitParams, n as CreateCustomToolParams } from "./customTool.types-BzEWHa0w.cjs";
1
+ import { a as CustomTool, d as CustomToolkit, i as CreateCustomToolkitParams, n as CreateCustomToolParams } from "./customTool.types-QtkAZQma.cjs";
2
2
  import { z } from "zod/v3";
3
3
  import { SessionCreateResponse } from "@composio/client/resources/tool-router/session/session.mjs";
4
4
 
@@ -1,4 +1,4 @@
1
- import { a as CustomTool, h as CustomToolkit, i as CreateCustomToolkitParams, n as CreateCustomToolParams } from "./customTool.types-CMOMgxoM.mjs";
1
+ import { a as CustomTool, d as CustomToolkit, i as CreateCustomToolkitParams, n as CreateCustomToolParams } from "./customTool.types-DLIORcYN.mjs";
2
2
  import { z as z$1 } from "zod/v3";
3
3
  import { SessionCreateResponse } from "@composio/client/resources/tool-router/session/session.mjs";
4
4
 
@@ -128,8 +128,8 @@ const ToolErrorCodes = {
128
128
  TOOLSET_NOT_DEFINED: "TOOLSET_NOT_DEFINED",
129
129
  TOOL_NOT_FOUND: "TOOL_NOT_FOUND",
130
130
  INVALID_MODIFIER: "INVALID_MODIFIER",
131
- CUSTOM_TOOLS_NOT_INITIALIZED: "CUSTOM_TOOLS_NOT_INITIALIZED",
132
131
  TOOL_EXECUTION_ERROR: "TOOL_EXECUTION_ERROR",
132
+ INVALID_TOOL_ARGUMENTS: "INVALID_TOOL_ARGUMENTS",
133
133
  INVALID_EXECUTE_FUNCTION: "INVALID_EXECUTE_FUNCTION",
134
134
  GLOBAL_EXECUTE_TOOL_FN_NOT_SET: "GLOBAL_EXECUTE_TOOL_FN_NOT_SET",
135
135
  TOOL_VERSION_REQUIRED: "TOOL_VERSION_REQUIRED"
@@ -164,16 +164,6 @@ var ComposioInvalidModifierError = class extends require_FileModifierErrors.Comp
164
164
  this.name = "ComposioInvalidModifierError";
165
165
  }
166
166
  };
167
- var ComposioCustomToolsNotInitializedError = class extends require_FileModifierErrors.ComposioError {
168
- constructor(message = "Custom tools not initialized", options = {}) {
169
- super(message, {
170
- ...options,
171
- code: ToolErrorCodes.CUSTOM_TOOLS_NOT_INITIALIZED,
172
- possibleFixes: options.possibleFixes || ["Ensure the custom tools class is initialized in the Tools instance"]
173
- });
174
- this.name = "ComposioCustomToolsNotInitializedError";
175
- }
176
- };
177
167
  var ComposioToolExecutionError = class extends require_FileModifierErrors.ComposioError {
178
168
  constructor(message = "Tool execution error", options = {}) {
179
169
  super(message, {
@@ -185,6 +175,16 @@ var ComposioToolExecutionError = class extends require_FileModifierErrors.Compos
185
175
  this.name = "ComposioToolExecutionError";
186
176
  }
187
177
  };
178
+ var ComposioInvalidToolArgumentsError = class extends require_FileModifierErrors.ComposioError {
179
+ constructor(message = "Invalid tool arguments", options = {}) {
180
+ super(message, {
181
+ ...options,
182
+ code: ToolErrorCodes.INVALID_TOOL_ARGUMENTS,
183
+ possibleFixes: options.possibleFixes || ["Tool arguments must be a JSON object (or a string that parses to one)", "If a model emitted the arguments as a string, ensure it is valid JSON"]
184
+ });
185
+ this.name = "ComposioInvalidToolArgumentsError";
186
+ }
187
+ };
188
188
  var ComposioInvalidExecuteFunctionError = class extends require_FileModifierErrors.ComposioError {
189
189
  constructor(message = "Invalid execute function", options = {}) {
190
190
  super(message, {
@@ -296,6 +296,68 @@ const handleToolExecutionError = (tool, actualError) => {
296
296
  });
297
297
  };
298
298
 
299
+ //#endregion
300
+ //#region src/errors/ValidationErrors.ts
301
+ /**
302
+ * Represents an input validation error using Zod.
303
+ */
304
+ const ValidationErrorCodes = {
305
+ VALIDATION_ERROR: "VALIDATION_ERROR",
306
+ JSON_SCHEMA_TO_ZOD_ERROR: "JSON_SCHEMA_TO_ZOD_ERROR",
307
+ JSON_SCHEMA_REF_RESOLUTION_ERROR: "JSON_SCHEMA_REF_RESOLUTION_ERROR"
308
+ };
309
+ var ValidationError = class extends require_FileModifierErrors.ComposioError {
310
+ constructor(message = "Input validation failed", options = {}) {
311
+ const { cause: providedZodError, ...restOptions } = options;
312
+ let zodErrorInstance;
313
+ if (providedZodError instanceof zod_v3.ZodError) zodErrorInstance = providedZodError;
314
+ else zodErrorInstance = new zod_v3.ZodError([{
315
+ path: [],
316
+ message: "Invalid input",
317
+ code: "custom"
318
+ }]);
319
+ const issues = zodErrorInstance.issues.map((issue) => `[${issue.code}] ${issue.path.join(".")} - ${issue.message}`);
320
+ super(message, {
321
+ ...restOptions,
322
+ code: options.code || ValidationErrorCodes.VALIDATION_ERROR,
323
+ possibleFixes: issues,
324
+ cause: zodErrorInstance
325
+ });
326
+ this.name = "ValidationError";
327
+ this.message = `${message}: ${this.generateUserFriendlyMessage()}`;
328
+ }
329
+ generateUserFriendlyMessage() {
330
+ if (this.cause instanceof zod_v3.ZodError && this.cause.issues.length > 0) {
331
+ const issue = this.cause.issues[0];
332
+ const param = issue.path.join(".") || "parameter";
333
+ if (issue.code === "invalid_type") return `The ${param} should be a ${issue.expected}, but you provided a ${issue.received}`;
334
+ return issue.message;
335
+ }
336
+ return "Please check your input parameters";
337
+ }
338
+ };
339
+ var JsonSchemaToZodError = class extends require_FileModifierErrors.ComposioError {
340
+ constructor(message = "Failed to convert JSON schema to Zod schema", options = {}) {
341
+ super(message, {
342
+ ...options,
343
+ code: options.code || ValidationErrorCodes.JSON_SCHEMA_TO_ZOD_ERROR
344
+ });
345
+ }
346
+ };
347
+ /**
348
+ * Thrown when a JSON Schema `$ref` pointer cannot be resolved against the
349
+ * document. Used by `dereferenceJsonSchema` to surface malformed pointers,
350
+ * missing `$defs`/`definitions` targets, or chains exceeding the depth cap.
351
+ */
352
+ var JsonSchemaRefResolutionError = class extends require_FileModifierErrors.ComposioError {
353
+ constructor(message = "Failed to resolve JSON Schema $ref", options = {}) {
354
+ super(message, {
355
+ ...options,
356
+ code: options.code || ValidationErrorCodes.JSON_SCHEMA_REF_RESOLUTION_ERROR
357
+ });
358
+ }
359
+ };
360
+
299
361
  //#endregion
300
362
  //#region src/errors/AuthConfigErrors.ts
301
363
  const AuthConfigErrorCodes = { AUTH_CONFIG_NOT_FOUND: "AUTH_CONFIG_NOT_FOUND" };
@@ -367,68 +429,6 @@ var ComposioToolkitFetchError = class extends require_FileModifierErrors.Composi
367
429
  }
368
430
  };
369
431
 
370
- //#endregion
371
- //#region src/errors/ValidationErrors.ts
372
- /**
373
- * Represents an input validation error using Zod.
374
- */
375
- const ValidationErrorCodes = {
376
- VALIDATION_ERROR: "VALIDATION_ERROR",
377
- JSON_SCHEMA_TO_ZOD_ERROR: "JSON_SCHEMA_TO_ZOD_ERROR",
378
- JSON_SCHEMA_REF_RESOLUTION_ERROR: "JSON_SCHEMA_REF_RESOLUTION_ERROR"
379
- };
380
- var ValidationError = class extends require_FileModifierErrors.ComposioError {
381
- constructor(message = "Input validation failed", options = {}) {
382
- const { cause: providedZodError, ...restOptions } = options;
383
- let zodErrorInstance;
384
- if (providedZodError instanceof zod_v3.ZodError) zodErrorInstance = providedZodError;
385
- else zodErrorInstance = new zod_v3.ZodError([{
386
- path: [],
387
- message: "Invalid input",
388
- code: "custom"
389
- }]);
390
- const issues = zodErrorInstance.issues.map((issue) => `[${issue.code}] ${issue.path.join(".")} - ${issue.message}`);
391
- super(message, {
392
- ...restOptions,
393
- code: options.code || ValidationErrorCodes.VALIDATION_ERROR,
394
- possibleFixes: issues,
395
- cause: zodErrorInstance
396
- });
397
- this.name = "ValidationError";
398
- this.message = `${message}: ${this.generateUserFriendlyMessage()}`;
399
- }
400
- generateUserFriendlyMessage() {
401
- if (this.cause instanceof zod_v3.ZodError && this.cause.issues.length > 0) {
402
- const issue = this.cause.issues[0];
403
- const param = issue.path.join(".") || "parameter";
404
- if (issue.code === "invalid_type") return `The ${param} should be a ${issue.expected}, but you provided a ${issue.received}`;
405
- return issue.message;
406
- }
407
- return "Please check your input parameters";
408
- }
409
- };
410
- var JsonSchemaToZodError = class extends require_FileModifierErrors.ComposioError {
411
- constructor(message = "Failed to convert JSON schema to Zod schema", options = {}) {
412
- super(message, {
413
- ...options,
414
- code: options.code || ValidationErrorCodes.JSON_SCHEMA_TO_ZOD_ERROR
415
- });
416
- }
417
- };
418
- /**
419
- * Thrown when a JSON Schema `$ref` pointer cannot be resolved against the
420
- * document. Used by `dereferenceJsonSchema` to surface malformed pointers,
421
- * missing `$defs`/`definitions` targets, or chains exceeding the depth cap.
422
- */
423
- var JsonSchemaRefResolutionError = class extends require_FileModifierErrors.ComposioError {
424
- constructor(message = "Failed to resolve JSON Schema $ref", options = {}) {
425
- super(message, {
426
- ...options,
427
- code: options.code || ValidationErrorCodes.JSON_SCHEMA_REF_RESOLUTION_ERROR
428
- });
429
- }
430
- };
431
-
432
432
  //#endregion
433
433
  //#region src/errors/SDKErrors.ts
434
434
  const SDKErrorCodes = { NO_API_KEY_PROVIDED: "NO_API_KEY_PROVIDED" };
@@ -1027,12 +1027,6 @@ Object.defineProperty(exports, 'ComposioConnectedAccountNotFoundError', {
1027
1027
  return ComposioConnectedAccountNotFoundError;
1028
1028
  }
1029
1029
  });
1030
- Object.defineProperty(exports, 'ComposioCustomToolsNotInitializedError', {
1031
- enumerable: true,
1032
- get: function () {
1033
- return ComposioCustomToolsNotInitializedError;
1034
- }
1035
- });
1036
1030
  Object.defineProperty(exports, 'ComposioFailedToCreateConnectedAccountLink', {
1037
1031
  enumerable: true,
1038
1032
  get: function () {
@@ -1081,6 +1075,12 @@ Object.defineProperty(exports, 'ComposioInvalidModifierError', {
1081
1075
  return ComposioInvalidModifierError;
1082
1076
  }
1083
1077
  });
1078
+ Object.defineProperty(exports, 'ComposioInvalidToolArgumentsError', {
1079
+ enumerable: true,
1080
+ get: function () {
1081
+ return ComposioInvalidToolArgumentsError;
1082
+ }
1083
+ });
1084
1084
  Object.defineProperty(exports, 'ComposioLegacyConnectedAccountsEndpointRetiredError', {
1085
1085
  enumerable: true,
1086
1086
  get: function () {
@@ -126,8 +126,8 @@ const ToolErrorCodes = {
126
126
  TOOLSET_NOT_DEFINED: "TOOLSET_NOT_DEFINED",
127
127
  TOOL_NOT_FOUND: "TOOL_NOT_FOUND",
128
128
  INVALID_MODIFIER: "INVALID_MODIFIER",
129
- CUSTOM_TOOLS_NOT_INITIALIZED: "CUSTOM_TOOLS_NOT_INITIALIZED",
130
129
  TOOL_EXECUTION_ERROR: "TOOL_EXECUTION_ERROR",
130
+ INVALID_TOOL_ARGUMENTS: "INVALID_TOOL_ARGUMENTS",
131
131
  INVALID_EXECUTE_FUNCTION: "INVALID_EXECUTE_FUNCTION",
132
132
  GLOBAL_EXECUTE_TOOL_FN_NOT_SET: "GLOBAL_EXECUTE_TOOL_FN_NOT_SET",
133
133
  TOOL_VERSION_REQUIRED: "TOOL_VERSION_REQUIRED"
@@ -162,16 +162,6 @@ var ComposioInvalidModifierError = class extends ComposioError$1 {
162
162
  this.name = "ComposioInvalidModifierError";
163
163
  }
164
164
  };
165
- var ComposioCustomToolsNotInitializedError = class extends ComposioError$1 {
166
- constructor(message = "Custom tools not initialized", options = {}) {
167
- super(message, {
168
- ...options,
169
- code: ToolErrorCodes.CUSTOM_TOOLS_NOT_INITIALIZED,
170
- possibleFixes: options.possibleFixes || ["Ensure the custom tools class is initialized in the Tools instance"]
171
- });
172
- this.name = "ComposioCustomToolsNotInitializedError";
173
- }
174
- };
175
165
  var ComposioToolExecutionError = class extends ComposioError$1 {
176
166
  constructor(message = "Tool execution error", options = {}) {
177
167
  super(message, {
@@ -183,6 +173,16 @@ var ComposioToolExecutionError = class extends ComposioError$1 {
183
173
  this.name = "ComposioToolExecutionError";
184
174
  }
185
175
  };
176
+ var ComposioInvalidToolArgumentsError = class extends ComposioError$1 {
177
+ constructor(message = "Invalid tool arguments", options = {}) {
178
+ super(message, {
179
+ ...options,
180
+ code: ToolErrorCodes.INVALID_TOOL_ARGUMENTS,
181
+ possibleFixes: options.possibleFixes || ["Tool arguments must be a JSON object (or a string that parses to one)", "If a model emitted the arguments as a string, ensure it is valid JSON"]
182
+ });
183
+ this.name = "ComposioInvalidToolArgumentsError";
184
+ }
185
+ };
186
186
  var ComposioInvalidExecuteFunctionError = class extends ComposioError$1 {
187
187
  constructor(message = "Invalid execute function", options = {}) {
188
188
  super(message, {
@@ -294,6 +294,68 @@ const handleToolExecutionError = (tool, actualError) => {
294
294
  });
295
295
  };
296
296
 
297
+ //#endregion
298
+ //#region src/errors/ValidationErrors.ts
299
+ /**
300
+ * Represents an input validation error using Zod.
301
+ */
302
+ const ValidationErrorCodes = {
303
+ VALIDATION_ERROR: "VALIDATION_ERROR",
304
+ JSON_SCHEMA_TO_ZOD_ERROR: "JSON_SCHEMA_TO_ZOD_ERROR",
305
+ JSON_SCHEMA_REF_RESOLUTION_ERROR: "JSON_SCHEMA_REF_RESOLUTION_ERROR"
306
+ };
307
+ var ValidationError = class extends ComposioError$1 {
308
+ constructor(message = "Input validation failed", options = {}) {
309
+ const { cause: providedZodError, ...restOptions } = options;
310
+ let zodErrorInstance;
311
+ if (providedZodError instanceof ZodError) zodErrorInstance = providedZodError;
312
+ else zodErrorInstance = new ZodError([{
313
+ path: [],
314
+ message: "Invalid input",
315
+ code: "custom"
316
+ }]);
317
+ const issues = zodErrorInstance.issues.map((issue) => `[${issue.code}] ${issue.path.join(".")} - ${issue.message}`);
318
+ super(message, {
319
+ ...restOptions,
320
+ code: options.code || ValidationErrorCodes.VALIDATION_ERROR,
321
+ possibleFixes: issues,
322
+ cause: zodErrorInstance
323
+ });
324
+ this.name = "ValidationError";
325
+ this.message = `${message}: ${this.generateUserFriendlyMessage()}`;
326
+ }
327
+ generateUserFriendlyMessage() {
328
+ if (this.cause instanceof ZodError && this.cause.issues.length > 0) {
329
+ const issue = this.cause.issues[0];
330
+ const param = issue.path.join(".") || "parameter";
331
+ if (issue.code === "invalid_type") return `The ${param} should be a ${issue.expected}, but you provided a ${issue.received}`;
332
+ return issue.message;
333
+ }
334
+ return "Please check your input parameters";
335
+ }
336
+ };
337
+ var JsonSchemaToZodError = class extends ComposioError$1 {
338
+ constructor(message = "Failed to convert JSON schema to Zod schema", options = {}) {
339
+ super(message, {
340
+ ...options,
341
+ code: options.code || ValidationErrorCodes.JSON_SCHEMA_TO_ZOD_ERROR
342
+ });
343
+ }
344
+ };
345
+ /**
346
+ * Thrown when a JSON Schema `$ref` pointer cannot be resolved against the
347
+ * document. Used by `dereferenceJsonSchema` to surface malformed pointers,
348
+ * missing `$defs`/`definitions` targets, or chains exceeding the depth cap.
349
+ */
350
+ var JsonSchemaRefResolutionError = class extends ComposioError$1 {
351
+ constructor(message = "Failed to resolve JSON Schema $ref", options = {}) {
352
+ super(message, {
353
+ ...options,
354
+ code: options.code || ValidationErrorCodes.JSON_SCHEMA_REF_RESOLUTION_ERROR
355
+ });
356
+ }
357
+ };
358
+
297
359
  //#endregion
298
360
  //#region src/errors/AuthConfigErrors.ts
299
361
  const AuthConfigErrorCodes = { AUTH_CONFIG_NOT_FOUND: "AUTH_CONFIG_NOT_FOUND" };
@@ -365,68 +427,6 @@ var ComposioToolkitFetchError = class extends ComposioError$1 {
365
427
  }
366
428
  };
367
429
 
368
- //#endregion
369
- //#region src/errors/ValidationErrors.ts
370
- /**
371
- * Represents an input validation error using Zod.
372
- */
373
- const ValidationErrorCodes = {
374
- VALIDATION_ERROR: "VALIDATION_ERROR",
375
- JSON_SCHEMA_TO_ZOD_ERROR: "JSON_SCHEMA_TO_ZOD_ERROR",
376
- JSON_SCHEMA_REF_RESOLUTION_ERROR: "JSON_SCHEMA_REF_RESOLUTION_ERROR"
377
- };
378
- var ValidationError = class extends ComposioError$1 {
379
- constructor(message = "Input validation failed", options = {}) {
380
- const { cause: providedZodError, ...restOptions } = options;
381
- let zodErrorInstance;
382
- if (providedZodError instanceof ZodError) zodErrorInstance = providedZodError;
383
- else zodErrorInstance = new ZodError([{
384
- path: [],
385
- message: "Invalid input",
386
- code: "custom"
387
- }]);
388
- const issues = zodErrorInstance.issues.map((issue) => `[${issue.code}] ${issue.path.join(".")} - ${issue.message}`);
389
- super(message, {
390
- ...restOptions,
391
- code: options.code || ValidationErrorCodes.VALIDATION_ERROR,
392
- possibleFixes: issues,
393
- cause: zodErrorInstance
394
- });
395
- this.name = "ValidationError";
396
- this.message = `${message}: ${this.generateUserFriendlyMessage()}`;
397
- }
398
- generateUserFriendlyMessage() {
399
- if (this.cause instanceof ZodError && this.cause.issues.length > 0) {
400
- const issue = this.cause.issues[0];
401
- const param = issue.path.join(".") || "parameter";
402
- if (issue.code === "invalid_type") return `The ${param} should be a ${issue.expected}, but you provided a ${issue.received}`;
403
- return issue.message;
404
- }
405
- return "Please check your input parameters";
406
- }
407
- };
408
- var JsonSchemaToZodError = class extends ComposioError$1 {
409
- constructor(message = "Failed to convert JSON schema to Zod schema", options = {}) {
410
- super(message, {
411
- ...options,
412
- code: options.code || ValidationErrorCodes.JSON_SCHEMA_TO_ZOD_ERROR
413
- });
414
- }
415
- };
416
- /**
417
- * Thrown when a JSON Schema `$ref` pointer cannot be resolved against the
418
- * document. Used by `dereferenceJsonSchema` to surface malformed pointers,
419
- * missing `$defs`/`definitions` targets, or chains exceeding the depth cap.
420
- */
421
- var JsonSchemaRefResolutionError = class extends ComposioError$1 {
422
- constructor(message = "Failed to resolve JSON Schema $ref", options = {}) {
423
- super(message, {
424
- ...options,
425
- code: options.code || ValidationErrorCodes.JSON_SCHEMA_REF_RESOLUTION_ERROR
426
- });
427
- }
428
- };
429
-
430
430
  //#endregion
431
431
  //#region src/errors/SDKErrors.ts
432
432
  const SDKErrorCodes = { NO_API_KEY_PROVIDED: "NO_API_KEY_PROVIDED" };
@@ -1001,4 +1001,4 @@ function getPreloadedCustomToolSlugs(customToolsMap, defaultPreload = false) {
1001
1001
  }
1002
1002
 
1003
1003
  //#endregion
1004
- export { ComposioMultipleConnectedAccountsError as $, ValidationErrorCodes as A, ComposioGlobalExecuteToolFnNotSetError as B, ComposioWebhookSignatureVerificationError as C, JsonSchemaRefResolutionError as D, SDKErrorCodes as E, ConnectionRequestFailedError as F, ComposioToolNotFoundError as G, ComposioInvalidModifierError as H, ConnectionRequestTimeoutError as I, handleToolExecutionError as J, ComposioToolVersionRequiredError as K, AuthConfigErrorCodes as L, ComposioToolkitNotFoundError as M, ToolkitErrorCodes as N, JsonSchemaToZodError as O, ConnectionRequestErrorCodes as P, ComposioLegacyConnectedAccountsEndpointRetiredError as Q, ComposioAuthConfigNotFoundError as R, ComposioWebhookPayloadError as S, ComposioNoAPIKeyError as T, ComposioProviderNotDefinedError as U, ComposioInvalidExecuteFunctionError as V, ComposioToolExecutionError as W, ComposioConnectedAccountNotFoundError as X, ComposioAclOnlyForSharedError as Y, ComposioFailedToCreateConnectedAccountLink as Z, ComposioFailedToCreatePusherClientError as _, createCustomToolkit as a, ComposioFailedToUnsubscribeFromPusherChannelError as b, getPreloadedCustomToolSlugs as c, CreateCustomToolBaseSchema as d, ComposioSharedAccessDeniedError as et, CreateCustomToolkitBaseSchema as f, RemoteFileErrorCodes as g, RemoteFileDownloadError as h, createCustomTool as i, ComposioToolkitFetchError as j, ValidationError as k, serializeCustomToolkits as l, PRELOAD_TOOLS_ALL as m, buildCustomToolsMap as n, ConnectedAccountErrorCodes as nt, findCustomToolMapEntryByFinalSlug as o, CustomToolSlugSchema as p, ToolErrorCodes as q, buildCustomToolsMapFromResponse as r, findCustomToolMapEntryByToolkitAndOriginalSlug as s, assertNoCustomToolSlugsInPreload as t, ComposioSharedConnectionNotAccessibleError as tt, serializeCustomTools as u, ComposioFailedToGetSDKRealtimeCredentialsError as v, TriggerErrorCodes as w, ComposioTriggerTypeNotFoundError as x, ComposioFailedToSubscribeToPusherChannelError as y, ComposioCustomToolsNotInitializedError as z };
1004
+ export { ComposioMultipleConnectedAccountsError as $, ConnectionRequestErrorCodes as A, ComposioInvalidExecuteFunctionError as B, ComposioWebhookSignatureVerificationError as C, ComposioToolkitFetchError as D, SDKErrorCodes as E, JsonSchemaRefResolutionError as F, ComposioToolNotFoundError as G, ComposioInvalidToolArgumentsError as H, JsonSchemaToZodError as I, handleToolExecutionError as J, ComposioToolVersionRequiredError as K, ValidationError as L, ConnectionRequestTimeoutError as M, AuthConfigErrorCodes as N, ComposioToolkitNotFoundError as O, ComposioAuthConfigNotFoundError as P, ComposioLegacyConnectedAccountsEndpointRetiredError as Q, ValidationErrorCodes as R, ComposioWebhookPayloadError as S, ComposioNoAPIKeyError as T, ComposioProviderNotDefinedError as U, ComposioInvalidModifierError as V, ComposioToolExecutionError as W, ComposioConnectedAccountNotFoundError as X, ComposioAclOnlyForSharedError as Y, ComposioFailedToCreateConnectedAccountLink as Z, ComposioFailedToCreatePusherClientError as _, createCustomToolkit as a, ComposioFailedToUnsubscribeFromPusherChannelError as b, getPreloadedCustomToolSlugs as c, CreateCustomToolBaseSchema as d, ComposioSharedAccessDeniedError as et, CreateCustomToolkitBaseSchema as f, RemoteFileErrorCodes as g, RemoteFileDownloadError as h, createCustomTool as i, ConnectionRequestFailedError as j, ToolkitErrorCodes as k, serializeCustomToolkits as l, PRELOAD_TOOLS_ALL as m, buildCustomToolsMap as n, ConnectedAccountErrorCodes as nt, findCustomToolMapEntryByFinalSlug as o, CustomToolSlugSchema as p, ToolErrorCodes as q, buildCustomToolsMapFromResponse as r, findCustomToolMapEntryByToolkitAndOriginalSlug as s, assertNoCustomToolSlugsInPreload as t, ComposioSharedConnectionNotAccessibleError as tt, serializeCustomTools as u, ComposioFailedToGetSDKRealtimeCredentialsError as v, TriggerErrorCodes as w, ComposioTriggerTypeNotFoundError as x, ComposioFailedToSubscribeToPusherChannelError as y, ComposioGlobalExecuteToolFnNotSetError as z };
@@ -67,12 +67,6 @@ const schemaHasFileProperty = (schema, property) => {
67
67
  const schemaHasFileUploadable = (schema) => {
68
68
  return schemaHasFileProperty(schema, "file_uploadable");
69
69
  };
70
- /**
71
- * Recursively checks if a schema (or any of its variants) contains file_downloadable properties.
72
- */
73
- const schemaHasFileDownloadable = (schema) => {
74
- return schemaHasFileProperty(schema, "file_downloadable");
75
- };
76
70
 
77
71
  //#endregion
78
- export { transformProperties as i, schemaHasFileDownloadable as n, schemaHasFileUploadable as r, isPlainObject as t };
72
+ export { transformProperties as i, schemaHasFileProperty as n, schemaHasFileUploadable as r, isPlainObject as t };
@@ -68,12 +68,6 @@ const schemaHasFileProperty = (schema, property) => {
68
68
  const schemaHasFileUploadable = (schema) => {
69
69
  return schemaHasFileProperty(schema, "file_uploadable");
70
70
  };
71
- /**
72
- * Recursively checks if a schema (or any of its variants) contains file_downloadable properties.
73
- */
74
- const schemaHasFileDownloadable = (schema) => {
75
- return schemaHasFileProperty(schema, "file_downloadable");
76
- };
77
71
 
78
72
  //#endregion
79
73
  Object.defineProperty(exports, 'isPlainObject', {
@@ -82,10 +76,10 @@ Object.defineProperty(exports, 'isPlainObject', {
82
76
  return isPlainObject;
83
77
  }
84
78
  });
85
- Object.defineProperty(exports, 'schemaHasFileDownloadable', {
79
+ Object.defineProperty(exports, 'schemaHasFileProperty', {
86
80
  enumerable: true,
87
81
  get: function () {
88
- return schemaHasFileDownloadable;
82
+ return schemaHasFileProperty;
89
83
  }
90
84
  });
91
85
  Object.defineProperty(exports, 'schemaHasFileUploadable', {
@@ -35,10 +35,17 @@ var BatchProcessor = class {
35
35
  if (this.batch.length > 0) {
36
36
  const batchToProcess = this.batch;
37
37
  this.batch = [];
38
- const pending = this.processBatchCallback(batchToProcess).catch(() => {}).finally(() => {
39
- this.pendingBatches.delete(pending);
38
+ const pending = new Promise((resolve) => {
39
+ const run = () => {
40
+ Promise.resolve().then(() => this.processBatchCallback(batchToProcess)).catch(() => {}).finally(resolve);
41
+ };
42
+ if (typeof queueMicrotask === "function") queueMicrotask(run);
43
+ else setTimeout(run, 0);
40
44
  });
41
45
  this.pendingBatches.add(pending);
46
+ pending.finally(() => {
47
+ this.pendingBatches.delete(pending);
48
+ });
42
49
  }
43
50
  if (this.timer) {
44
51
  clearTimeout(this.timer);
@@ -120,6 +127,7 @@ var TelemetryTransport = class {
120
127
  telemetryServiceName = "sdk";
121
128
  telemetryLanguage = "typescript";
122
129
  exitHandlersRegistered = false;
130
+ pendingImmediateTelemetry = /* @__PURE__ */ new Set();
123
131
  batchProcessor = new BatchProcessor(200, 10, async (data) => {
124
132
  require_FileModifierErrors.logger_default.debug("Sending batch of telemetry metrics", data);
125
133
  await TelemetryService.sendMetric(data);
@@ -136,7 +144,7 @@ var TelemetryTransport = class {
136
144
  environment: require_FileModifierErrors.getEnvVariable("NODE_ENV", "production")
137
145
  };
138
146
  this.registerExitHandlers();
139
- this.sendMetric([{
147
+ this.deferTelemetry(() => this.sendMetric([{
140
148
  functionName: TELEMETRY_EVENTS.SDK_INITIALIZED,
141
149
  durationMs: 0,
142
150
  timestamp: Date.now() / 1e3,
@@ -144,7 +152,7 @@ var TelemetryTransport = class {
144
152
  source: this.telemetrySource,
145
153
  metadata: { provider: this.telemetryMetadata?.provider ?? "openai" },
146
154
  error: void 0
147
- }]);
155
+ }]));
148
156
  }
149
157
  /**
150
158
  * Instrument the telemetry for the given instance.
@@ -192,7 +200,7 @@ var TelemetryTransport = class {
192
200
  error.errorId = require_buffer.getRandomUUID();
193
201
  if (telemetryEnabled && startTime !== void 0) {
194
202
  const durationMs = Date.now() - startTime;
195
- await this.prepareAndSendErrorTelemetry(error, instrumentedClassName, name, startTime, durationMs);
203
+ this.prepareAndSendErrorTelemetry(error, instrumentedClassName, name, startTime, durationMs);
196
204
  }
197
205
  }
198
206
  }
@@ -216,15 +224,13 @@ var TelemetryTransport = class {
216
224
  /**
217
225
  * Prepare and send the error telemetry.
218
226
  *
219
- * @TODO This currently blocks the thread and sends the telemetry to the server.
220
- *
221
227
  * @param {unknown} error - The error to send.
222
228
  * @param {string} instrumentedClassName - The class name of the instrumented class.
223
229
  * @param {string} name - The name of the method that threw the error.
224
230
  * @param {number} startTime - The start time of the method invocation in milliseconds.
225
231
  * @param {number} durationMs - The duration of the method invocation in milliseconds.
226
232
  */
227
- async prepareAndSendErrorTelemetry(error, instrumentedClassName, name, startTime, durationMs) {
233
+ prepareAndSendErrorTelemetry(error, instrumentedClassName, name, startTime, durationMs) {
228
234
  const telemetryPayload = {
229
235
  functionName: `${instrumentedClassName}.${name}`,
230
236
  durationMs,
@@ -255,7 +261,25 @@ var TelemetryTransport = class {
255
261
  message: error.message,
256
262
  stack: error.stack
257
263
  };
258
- await this.sendErrorTelemetry(telemetryPayload);
264
+ this.deferTelemetry(() => this.sendErrorTelemetry(telemetryPayload));
265
+ }
266
+ deferTelemetry(callback) {
267
+ const pending = new Promise((resolve) => {
268
+ const run = () => {
269
+ Promise.resolve().then(callback).catch((error) => {
270
+ require_FileModifierErrors.logger_default.debug("Error sending deferred telemetry", error);
271
+ }).finally(resolve);
272
+ };
273
+ if (typeof queueMicrotask === "function") queueMicrotask(run);
274
+ else setTimeout(run, 0);
275
+ });
276
+ this.pendingImmediateTelemetry.add(pending);
277
+ pending.finally(() => {
278
+ this.pendingImmediateTelemetry.delete(pending);
279
+ });
280
+ }
281
+ async flushImmediateTelemetry() {
282
+ while (this.pendingImmediateTelemetry.size > 0) await Promise.all(Array.from(this.pendingImmediateTelemetry));
259
283
  }
260
284
  /**
261
285
  * Send the telemetry payload to the server.
@@ -292,6 +316,7 @@ var TelemetryTransport = class {
292
316
  */
293
317
  async flush() {
294
318
  await this.batchProcessor.flush();
319
+ await this.flushImmediateTelemetry();
295
320
  }
296
321
  /**
297
322
  * Register process exit handlers to automatically flush telemetry.
@@ -34,10 +34,17 @@ var BatchProcessor = class {
34
34
  if (this.batch.length > 0) {
35
35
  const batchToProcess = this.batch;
36
36
  this.batch = [];
37
- const pending = this.processBatchCallback(batchToProcess).catch(() => {}).finally(() => {
38
- this.pendingBatches.delete(pending);
37
+ const pending = new Promise((resolve) => {
38
+ const run = () => {
39
+ Promise.resolve().then(() => this.processBatchCallback(batchToProcess)).catch(() => {}).finally(resolve);
40
+ };
41
+ if (typeof queueMicrotask === "function") queueMicrotask(run);
42
+ else setTimeout(run, 0);
39
43
  });
40
44
  this.pendingBatches.add(pending);
45
+ pending.finally(() => {
46
+ this.pendingBatches.delete(pending);
47
+ });
41
48
  }
42
49
  if (this.timer) {
43
50
  clearTimeout(this.timer);
@@ -119,6 +126,7 @@ var TelemetryTransport = class {
119
126
  telemetryServiceName = "sdk";
120
127
  telemetryLanguage = "typescript";
121
128
  exitHandlersRegistered = false;
129
+ pendingImmediateTelemetry = /* @__PURE__ */ new Set();
122
130
  batchProcessor = new BatchProcessor(200, 10, async (data) => {
123
131
  logger_default.debug("Sending batch of telemetry metrics", data);
124
132
  await TelemetryService.sendMetric(data);
@@ -135,7 +143,7 @@ var TelemetryTransport = class {
135
143
  environment: getEnvVariable("NODE_ENV", "production")
136
144
  };
137
145
  this.registerExitHandlers();
138
- this.sendMetric([{
146
+ this.deferTelemetry(() => this.sendMetric([{
139
147
  functionName: TELEMETRY_EVENTS.SDK_INITIALIZED,
140
148
  durationMs: 0,
141
149
  timestamp: Date.now() / 1e3,
@@ -143,7 +151,7 @@ var TelemetryTransport = class {
143
151
  source: this.telemetrySource,
144
152
  metadata: { provider: this.telemetryMetadata?.provider ?? "openai" },
145
153
  error: void 0
146
- }]);
154
+ }]));
147
155
  }
148
156
  /**
149
157
  * Instrument the telemetry for the given instance.
@@ -191,7 +199,7 @@ var TelemetryTransport = class {
191
199
  error.errorId = getRandomUUID();
192
200
  if (telemetryEnabled && startTime !== void 0) {
193
201
  const durationMs = Date.now() - startTime;
194
- await this.prepareAndSendErrorTelemetry(error, instrumentedClassName, name, startTime, durationMs);
202
+ this.prepareAndSendErrorTelemetry(error, instrumentedClassName, name, startTime, durationMs);
195
203
  }
196
204
  }
197
205
  }
@@ -215,15 +223,13 @@ var TelemetryTransport = class {
215
223
  /**
216
224
  * Prepare and send the error telemetry.
217
225
  *
218
- * @TODO This currently blocks the thread and sends the telemetry to the server.
219
- *
220
226
  * @param {unknown} error - The error to send.
221
227
  * @param {string} instrumentedClassName - The class name of the instrumented class.
222
228
  * @param {string} name - The name of the method that threw the error.
223
229
  * @param {number} startTime - The start time of the method invocation in milliseconds.
224
230
  * @param {number} durationMs - The duration of the method invocation in milliseconds.
225
231
  */
226
- async prepareAndSendErrorTelemetry(error, instrumentedClassName, name, startTime, durationMs) {
232
+ prepareAndSendErrorTelemetry(error, instrumentedClassName, name, startTime, durationMs) {
227
233
  const telemetryPayload = {
228
234
  functionName: `${instrumentedClassName}.${name}`,
229
235
  durationMs,
@@ -254,7 +260,25 @@ var TelemetryTransport = class {
254
260
  message: error.message,
255
261
  stack: error.stack
256
262
  };
257
- await this.sendErrorTelemetry(telemetryPayload);
263
+ this.deferTelemetry(() => this.sendErrorTelemetry(telemetryPayload));
264
+ }
265
+ deferTelemetry(callback) {
266
+ const pending = new Promise((resolve) => {
267
+ const run = () => {
268
+ Promise.resolve().then(callback).catch((error) => {
269
+ logger_default.debug("Error sending deferred telemetry", error);
270
+ }).finally(resolve);
271
+ };
272
+ if (typeof queueMicrotask === "function") queueMicrotask(run);
273
+ else setTimeout(run, 0);
274
+ });
275
+ this.pendingImmediateTelemetry.add(pending);
276
+ pending.finally(() => {
277
+ this.pendingImmediateTelemetry.delete(pending);
278
+ });
279
+ }
280
+ async flushImmediateTelemetry() {
281
+ while (this.pendingImmediateTelemetry.size > 0) await Promise.all(Array.from(this.pendingImmediateTelemetry));
258
282
  }
259
283
  /**
260
284
  * Send the telemetry payload to the server.
@@ -291,6 +315,7 @@ var TelemetryTransport = class {
291
315
  */
292
316
  async flush() {
293
317
  await this.batchProcessor.flush();
318
+ await this.flushImmediateTelemetry();
294
319
  }
295
320
  /**
296
321
  * Register process exit handlers to automatically flush telemetry.