@composio/core 0.1.12-alpha.10 → 0.1.12-alpha.11
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 +798 -373
- package/dist/index.d.cts +208 -22
- package/dist/index.d.ts +208 -22
- package/dist/index.js +614 -212
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -30,22 +30,45 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
AuthConfigErrorCodes: () => AuthConfigErrorCodes,
|
|
33
34
|
AuthConfigTypes: () => AuthConfigTypes,
|
|
34
35
|
AuthSchemeTypes: () => AuthSchemeTypes,
|
|
35
36
|
BaseAgenticProvider: () => BaseAgenticProvider,
|
|
36
37
|
BaseNonAgenticProvider: () => BaseNonAgenticProvider,
|
|
37
38
|
BaseTelemetryTransport: () => BaseTelemetryTransport,
|
|
38
39
|
Composio: () => Composio,
|
|
40
|
+
ComposioAuthConfigNotFoundError: () => ComposioAuthConfigNotFoundError,
|
|
41
|
+
ComposioConnectedAccountNotFoundError: () => ComposioConnectedAccountNotFoundError,
|
|
42
|
+
ComposioCustomToolsNotInitializedError: () => ComposioCustomToolsNotInitializedError,
|
|
43
|
+
ComposioError: () => ComposioError,
|
|
44
|
+
ComposioGlobalExecuteToolFnNotSetError: () => ComposioGlobalExecuteToolFnNotSetError,
|
|
45
|
+
ComposioInvalidExecuteFunctionError: () => ComposioInvalidExecuteFunctionError,
|
|
46
|
+
ComposioInvalidModifierError: () => ComposioInvalidModifierError,
|
|
47
|
+
ComposioNoAPIKeyError: () => ComposioNoAPIKeyError,
|
|
39
48
|
ComposioProvider: () => ComposioProvider,
|
|
49
|
+
ComposioProviderNotDefinedError: () => ComposioProviderNotDefinedError,
|
|
50
|
+
ComposioToolExecutionError: () => ComposioToolExecutionError,
|
|
51
|
+
ComposioToolNotFoundError: () => ComposioToolNotFoundError,
|
|
52
|
+
ComposioToolkitFetchError: () => ComposioToolkitFetchError,
|
|
53
|
+
ComposioToolkitNotFoundError: () => ComposioToolkitNotFoundError,
|
|
54
|
+
ConnectedAccountErrorCodes: () => ConnectedAccountErrorCodes,
|
|
55
|
+
ConnectionRequestErrorCodes: () => ConnectionRequestErrorCodes,
|
|
56
|
+
ConnectionRequestFailedError: () => ConnectionRequestFailedError,
|
|
57
|
+
ConnectionRequestTimeoutError: () => ConnectionRequestTimeoutError,
|
|
40
58
|
ConsoleTelemetryTransport: () => ConsoleTelemetryTransport,
|
|
41
59
|
OpenAIProvider: () => OpenAIProvider,
|
|
60
|
+
SDKErrorCodes: () => SDKErrorCodes,
|
|
61
|
+
ToolErrorCodes: () => ToolErrorCodes,
|
|
42
62
|
ToolListParamsSchema: () => ToolListParamsSchema,
|
|
63
|
+
ToolkitErrorCodes: () => ToolkitErrorCodes,
|
|
64
|
+
ValidationError: () => ValidationError,
|
|
65
|
+
ValidationErrorCodes: () => ValidationErrorCodes,
|
|
43
66
|
jsonSchemaToModel: () => jsonSchemaToModel
|
|
44
67
|
});
|
|
45
68
|
module.exports = __toCommonJS(index_exports);
|
|
46
69
|
|
|
47
70
|
// src/composio.ts
|
|
48
|
-
var
|
|
71
|
+
var import_client5 = __toESM(require("@composio/client"), 1);
|
|
49
72
|
|
|
50
73
|
// src/types/tool.types.ts
|
|
51
74
|
var import_zod = require("zod");
|
|
@@ -147,7 +170,20 @@ var Logger = class {
|
|
|
147
170
|
this.console = console;
|
|
148
171
|
}
|
|
149
172
|
formatMessage(args) {
|
|
150
|
-
const formattedArgs = args.map((arg) =>
|
|
173
|
+
const formattedArgs = args.map((arg, index) => {
|
|
174
|
+
if (typeof arg === "object") {
|
|
175
|
+
return JSON.stringify(arg);
|
|
176
|
+
} else {
|
|
177
|
+
if (index === 0) {
|
|
178
|
+
if (args.length > 1) {
|
|
179
|
+
return import_chalk.default.yellow(`${arg}`);
|
|
180
|
+
} else {
|
|
181
|
+
return String(arg);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return String(arg);
|
|
185
|
+
}
|
|
186
|
+
}).join("\n");
|
|
151
187
|
if (!this.includeTimestamp) {
|
|
152
188
|
return formattedArgs;
|
|
153
189
|
}
|
|
@@ -182,34 +218,211 @@ var logger = new Logger();
|
|
|
182
218
|
var logger_default = logger;
|
|
183
219
|
|
|
184
220
|
// src/errors/ComposioError.ts
|
|
185
|
-
var
|
|
221
|
+
var import_chalk2 = __toESM(require("chalk"), 1);
|
|
222
|
+
var import_zod2 = require("zod");
|
|
223
|
+
var import_client = require("@composio/client");
|
|
224
|
+
var ComposioError = class _ComposioError extends Error {
|
|
225
|
+
/** @readonly Error name */
|
|
186
226
|
name = "ComposioError";
|
|
187
227
|
code;
|
|
188
|
-
statusCode;
|
|
189
|
-
cause;
|
|
190
|
-
meta;
|
|
191
228
|
possibleFixes;
|
|
229
|
+
errorId;
|
|
230
|
+
/**
|
|
231
|
+
* Creates a new ComposioError
|
|
232
|
+
* @param message Error message
|
|
233
|
+
* @param options Additional error options
|
|
234
|
+
*/
|
|
192
235
|
constructor(message, options = {}) {
|
|
193
236
|
super(message);
|
|
194
|
-
|
|
195
|
-
this.
|
|
196
|
-
this.cause = options.cause;
|
|
197
|
-
this.meta = options.meta;
|
|
237
|
+
const statusCode = options.statusCode || (options.cause instanceof import_client.BadRequestError ? options.cause.status : void 0);
|
|
238
|
+
this.code = `TS-SDK::${options.code}`;
|
|
198
239
|
this.possibleFixes = options.possibleFixes;
|
|
240
|
+
this.definePropertyIfExists("statusCode", statusCode);
|
|
241
|
+
this.definePropertyIfExists("cause", options.cause);
|
|
242
|
+
this.definePropertyIfExists("stack", options.stack);
|
|
243
|
+
if (options.meta && Object.keys(options.meta).length > 0) {
|
|
244
|
+
this.definePropertyIfExists("meta", options.meta);
|
|
245
|
+
}
|
|
199
246
|
if (Error.captureStackTrace) {
|
|
200
247
|
Error.captureStackTrace(this, this.constructor);
|
|
201
248
|
}
|
|
202
249
|
}
|
|
203
|
-
|
|
204
|
-
|
|
250
|
+
/**
|
|
251
|
+
* Helper method to define a property only if it has a value
|
|
252
|
+
* @param propertyName Name of the property to define
|
|
253
|
+
* @param value Value to assign to the property
|
|
254
|
+
* @private
|
|
255
|
+
*/
|
|
256
|
+
definePropertyIfExists(propertyName, value) {
|
|
257
|
+
if (value !== void 0) {
|
|
258
|
+
Object.defineProperty(this, propertyName, {
|
|
259
|
+
value,
|
|
260
|
+
enumerable: true,
|
|
261
|
+
writable: false,
|
|
262
|
+
configurable: true
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Extract and normalize error data for formatting
|
|
268
|
+
* @param includeStack Whether to include stack trace information
|
|
269
|
+
* @returns Structured error data for formatting
|
|
270
|
+
* @private
|
|
271
|
+
*/
|
|
272
|
+
getErrorData(includeStack = false) {
|
|
273
|
+
const data = {
|
|
205
274
|
name: this.name,
|
|
206
|
-
message: this.message
|
|
207
|
-
code: this.code,
|
|
208
|
-
statusCode: this.statusCode,
|
|
209
|
-
cause: this.cause instanceof Error ? this.cause.message : this.cause,
|
|
210
|
-
meta: this.meta,
|
|
211
|
-
possibleFixes: this.possibleFixes?.length ? this.possibleFixes.join("\n") : void 0
|
|
275
|
+
message: this.message
|
|
212
276
|
};
|
|
277
|
+
const { cause, code, stack, statusCode, meta, possibleFixes } = this;
|
|
278
|
+
if (cause !== void 0) {
|
|
279
|
+
const rawCause = cause;
|
|
280
|
+
data.cause = rawCause instanceof Error ? rawCause.message : String(rawCause);
|
|
281
|
+
}
|
|
282
|
+
if (code) {
|
|
283
|
+
data.code = code;
|
|
284
|
+
}
|
|
285
|
+
if (statusCode !== void 0) {
|
|
286
|
+
data.statusCode = statusCode;
|
|
287
|
+
}
|
|
288
|
+
if (meta) {
|
|
289
|
+
data.meta = meta;
|
|
290
|
+
}
|
|
291
|
+
if (possibleFixes) {
|
|
292
|
+
data.possibleFixes = possibleFixes;
|
|
293
|
+
}
|
|
294
|
+
if (includeStack && stack) {
|
|
295
|
+
data.stack = stack.split("\n").slice(1);
|
|
296
|
+
}
|
|
297
|
+
return data;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Prints a user-friendly, colorful representation of the error to the logger
|
|
301
|
+
* @param includeStack Whether to include the stack trace in the output (default: false)
|
|
302
|
+
*/
|
|
303
|
+
prettyPrint(includeStack = false) {
|
|
304
|
+
const data = this.getErrorData(includeStack);
|
|
305
|
+
let output = "\n" + import_chalk2.default.bgRed.white.bold(" ERROR ") + " " + import_chalk2.default.white.bold(data.message) + "\n";
|
|
306
|
+
if (data.code) {
|
|
307
|
+
output += import_chalk2.default.yellow(`Error Code: ${data.code}`) + "\n";
|
|
308
|
+
}
|
|
309
|
+
if (data.statusCode !== void 0) {
|
|
310
|
+
output += import_chalk2.default.yellow(`Status: ${data.statusCode}`) + "\n";
|
|
311
|
+
}
|
|
312
|
+
if (data.cause) {
|
|
313
|
+
output += import_chalk2.default.gray("Reason:") + "\n";
|
|
314
|
+
output += " " + import_chalk2.default.white(data.cause) + "\n";
|
|
315
|
+
}
|
|
316
|
+
if (data.meta) {
|
|
317
|
+
output += import_chalk2.default.gray("Additional Information:") + "\n";
|
|
318
|
+
output += " " + import_chalk2.default.white(JSON.stringify(data.meta, null, 2).replace(/\n/g, "\n ")) + "\n";
|
|
319
|
+
}
|
|
320
|
+
if (data.possibleFixes?.length) {
|
|
321
|
+
output += "\n" + import_chalk2.default.cyan.bold("Try the following:") + "\n";
|
|
322
|
+
const fixes = data.possibleFixes?.map((fix, index) => ` ${index + 1}. ` + import_chalk2.default.white(fix));
|
|
323
|
+
output += fixes?.join("\n") + "\n";
|
|
324
|
+
}
|
|
325
|
+
if (data.stack?.length) {
|
|
326
|
+
output += "\n" + import_chalk2.default.gray("Stack Trace:") + "\n";
|
|
327
|
+
output += import_chalk2.default.gray(data.stack.join("\n")) + "\n";
|
|
328
|
+
}
|
|
329
|
+
output += "\n";
|
|
330
|
+
logger_default.error(output);
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Static factory method to create and pretty print an error in one step
|
|
334
|
+
* @param message Error message
|
|
335
|
+
* @param options Error options
|
|
336
|
+
* @param includeStack Whether to include the stack trace in the output
|
|
337
|
+
* @returns The created error instance
|
|
338
|
+
*/
|
|
339
|
+
static createAndPrint(message, options = {}, includeStack = false) {
|
|
340
|
+
const error = new _ComposioError(message, options);
|
|
341
|
+
error.prettyPrint(includeStack);
|
|
342
|
+
return error;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Utility function to handle errors in a consistent way
|
|
346
|
+
* This properly displays the error and exits the process if needed
|
|
347
|
+
* @param error The error to handle
|
|
348
|
+
* @param options Options for error handling
|
|
349
|
+
*/
|
|
350
|
+
static handle(error, options = {}) {
|
|
351
|
+
const { includeStack = false, exitProcess = false, exitCode = 1 } = options;
|
|
352
|
+
if (error instanceof _ComposioError) {
|
|
353
|
+
error.prettyPrint(includeStack);
|
|
354
|
+
} else if (error instanceof import_zod2.ZodError) {
|
|
355
|
+
this.handleZodError(error, includeStack);
|
|
356
|
+
} else if (error instanceof Error) {
|
|
357
|
+
this.handleStandardError(error, includeStack);
|
|
358
|
+
} else {
|
|
359
|
+
this.handleUnknownError(error);
|
|
360
|
+
}
|
|
361
|
+
if (exitProcess && typeof process !== "undefined") {
|
|
362
|
+
process.exit(exitCode);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Helper method to handle Zod validation errors
|
|
367
|
+
* @param error The Zod error to handle
|
|
368
|
+
* @param includeStack Whether to include the stack trace
|
|
369
|
+
* @private
|
|
370
|
+
*/
|
|
371
|
+
static handleZodError(error, includeStack) {
|
|
372
|
+
logger_default.error("\n" + import_chalk2.default.bgRed.white.bold(" ERROR ") + " " + import_chalk2.default.white.bold(error.message));
|
|
373
|
+
logger_default.error(import_chalk2.default.gray("Invalid parameters:"));
|
|
374
|
+
error.errors.forEach((err) => {
|
|
375
|
+
logger_default.error(import_chalk2.default.yellow(err.path.join(".")) + " " + import_chalk2.default.white(err.message));
|
|
376
|
+
});
|
|
377
|
+
logger_default.error(import_chalk2.default.gray("Expected parameters:"));
|
|
378
|
+
error.errors.forEach((err) => {
|
|
379
|
+
logger_default.error(import_chalk2.default.yellow(err.path.join(".")) + " " + import_chalk2.default.white(err.message));
|
|
380
|
+
});
|
|
381
|
+
if (includeStack) {
|
|
382
|
+
logger_default.error("\n" + import_chalk2.default.gray("Validation Errors:"));
|
|
383
|
+
error.errors.forEach((err) => {
|
|
384
|
+
const path = err.path.join(".");
|
|
385
|
+
logger_default.error(
|
|
386
|
+
import_chalk2.default.gray(" \u2022 ") + import_chalk2.default.yellow(path ? `${path}: ` : "") + import_chalk2.default.white(err.message)
|
|
387
|
+
);
|
|
388
|
+
});
|
|
389
|
+
if (error.stack) {
|
|
390
|
+
logger_default.error("\n" + import_chalk2.default.gray("Stack Trace:"));
|
|
391
|
+
const stackLines = error.stack.split("\n").slice(1);
|
|
392
|
+
logger_default.error(import_chalk2.default.gray(stackLines.join("\n")));
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
logger_default.error("");
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Helper method to handle standard Error objects
|
|
399
|
+
* @param error The standard error to handle
|
|
400
|
+
* @param includeStack Whether to include the stack trace
|
|
401
|
+
* @private
|
|
402
|
+
*/
|
|
403
|
+
static handleStandardError(error, includeStack) {
|
|
404
|
+
logger_default.error("\n" + import_chalk2.default.bgRed.white.bold(" ERROR ") + " " + import_chalk2.default.white.bold(error.message));
|
|
405
|
+
if (includeStack && error.stack) {
|
|
406
|
+
logger_default.error("\n" + import_chalk2.default.gray("Stack Trace:"));
|
|
407
|
+
const stackLines = error.stack.split("\n").slice(1);
|
|
408
|
+
logger_default.error(import_chalk2.default.gray(stackLines.join("\n")));
|
|
409
|
+
}
|
|
410
|
+
logger_default.error("");
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Helper method to handle unknown error types
|
|
414
|
+
* @param error The unknown error value
|
|
415
|
+
* @private
|
|
416
|
+
*/
|
|
417
|
+
static handleUnknownError(error) {
|
|
418
|
+
logger_default.error(
|
|
419
|
+
"\n" + import_chalk2.default.bgRed.white.bold(" ERROR ") + " " + import_chalk2.default.white.bold("Unknown error occurred")
|
|
420
|
+
);
|
|
421
|
+
if (error !== null && error !== void 0) {
|
|
422
|
+
logger_default.error(import_chalk2.default.gray("Error details:"));
|
|
423
|
+
logger_default.error(" " + import_chalk2.default.white(String(error)));
|
|
424
|
+
}
|
|
425
|
+
logger_default.error("");
|
|
213
426
|
}
|
|
214
427
|
};
|
|
215
428
|
|
|
@@ -224,11 +437,11 @@ var ToolErrorCodes = {
|
|
|
224
437
|
GLOBAL_EXECUTE_TOOL_FN_NOT_SET: "GLOBAL_EXECUTE_TOOL_FN_NOT_SET"
|
|
225
438
|
};
|
|
226
439
|
var ComposioProviderNotDefinedError = class extends ComposioError {
|
|
227
|
-
constructor(message = "Provider not defined",
|
|
440
|
+
constructor(message = "Provider not defined", options = {}) {
|
|
228
441
|
super(message, {
|
|
442
|
+
...options,
|
|
229
443
|
code: ToolErrorCodes.TOOLSET_NOT_DEFINED,
|
|
230
|
-
|
|
231
|
-
possibleFixes: [
|
|
444
|
+
possibleFixes: options.possibleFixes || [
|
|
232
445
|
"Ensure that the provider is defined in the Composio project and passed into the tool instance"
|
|
233
446
|
]
|
|
234
447
|
});
|
|
@@ -236,86 +449,103 @@ var ComposioProviderNotDefinedError = class extends ComposioError {
|
|
|
236
449
|
}
|
|
237
450
|
};
|
|
238
451
|
var ComposioToolNotFoundError = class extends ComposioError {
|
|
239
|
-
constructor(message = "Tool not found",
|
|
452
|
+
constructor(message = "Tool not found", options = {}) {
|
|
240
453
|
super(message, {
|
|
454
|
+
...options,
|
|
241
455
|
code: ToolErrorCodes.TOOL_NOT_FOUND,
|
|
242
|
-
|
|
243
|
-
|
|
456
|
+
possibleFixes: options.possibleFixes || [
|
|
457
|
+
"Ensure the tool slug is correct and exists in the Composio project"
|
|
458
|
+
]
|
|
244
459
|
});
|
|
245
460
|
this.name = "ComposioToolNotFoundError";
|
|
246
461
|
}
|
|
247
462
|
};
|
|
248
463
|
var ComposioInvalidModifierError = class extends ComposioError {
|
|
249
|
-
constructor(message = "Invalid modifier",
|
|
464
|
+
constructor(message = "Invalid modifier", options = {}) {
|
|
250
465
|
super(message, {
|
|
466
|
+
...options,
|
|
251
467
|
code: ToolErrorCodes.INVALID_MODIFIER,
|
|
252
|
-
|
|
253
|
-
|
|
468
|
+
possibleFixes: options.possibleFixes || [
|
|
469
|
+
"Ensure the modifier is a function and returns a valid result"
|
|
470
|
+
]
|
|
254
471
|
});
|
|
255
472
|
this.name = "ComposioInvalidModifierError";
|
|
256
473
|
}
|
|
257
474
|
};
|
|
258
475
|
var ComposioCustomToolsNotInitializedError = class extends ComposioError {
|
|
259
|
-
constructor(message = "Custom tools not initialized",
|
|
476
|
+
constructor(message = "Custom tools not initialized", options = {}) {
|
|
260
477
|
super(message, {
|
|
478
|
+
...options,
|
|
261
479
|
code: ToolErrorCodes.CUSTOM_TOOLS_NOT_INITIALIZED,
|
|
262
|
-
|
|
263
|
-
|
|
480
|
+
possibleFixes: options.possibleFixes || [
|
|
481
|
+
"Ensure the custom tools class is initialized in the Tools instance"
|
|
482
|
+
]
|
|
264
483
|
});
|
|
265
484
|
this.name = "ComposioCustomToolsNotInitializedError";
|
|
266
485
|
}
|
|
267
486
|
};
|
|
268
487
|
var ComposioToolExecutionError = class extends ComposioError {
|
|
269
488
|
error;
|
|
270
|
-
constructor(
|
|
489
|
+
constructor(message = "Tool execution error", options = {}) {
|
|
490
|
+
const { originalError, ...restOptions } = options;
|
|
271
491
|
super(message, {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
possibleFixes:
|
|
492
|
+
...restOptions,
|
|
493
|
+
code: options.code || ToolErrorCodes.TOOL_EXECUTION_ERROR,
|
|
494
|
+
cause: options.cause || originalError,
|
|
495
|
+
possibleFixes: options.possibleFixes || [
|
|
496
|
+
"Ensure the tool is correctly configured and the input is valid"
|
|
497
|
+
]
|
|
276
498
|
});
|
|
277
|
-
this.error =
|
|
499
|
+
this.error = originalError || (options.cause instanceof Error ? options.cause : new Error(String(options.cause)));
|
|
278
500
|
this.name = "ComposioToolExecutionError";
|
|
279
501
|
}
|
|
280
502
|
};
|
|
281
503
|
var ComposioInvalidExecuteFunctionError = class extends ComposioError {
|
|
282
|
-
constructor(message = "Invalid execute function",
|
|
504
|
+
constructor(message = "Invalid execute function", options = {}) {
|
|
283
505
|
super(message, {
|
|
506
|
+
...options,
|
|
284
507
|
code: ToolErrorCodes.INVALID_EXECUTE_FUNCTION,
|
|
285
|
-
|
|
286
|
-
|
|
508
|
+
possibleFixes: options.possibleFixes || [
|
|
509
|
+
"Ensure the execute function is a valid function and returns a valid result"
|
|
510
|
+
]
|
|
287
511
|
});
|
|
288
512
|
this.name = "ComposioInvalidExecuteFunctionError";
|
|
289
513
|
}
|
|
290
514
|
};
|
|
291
515
|
var ComposioGlobalExecuteToolFnNotSetError = class extends ComposioError {
|
|
292
|
-
constructor(message = "Global execute tool function not set",
|
|
516
|
+
constructor(message = "Global execute tool function not set", options = {}) {
|
|
293
517
|
super(message, {
|
|
518
|
+
...options,
|
|
294
519
|
code: ToolErrorCodes.GLOBAL_EXECUTE_TOOL_FN_NOT_SET,
|
|
295
|
-
|
|
296
|
-
|
|
520
|
+
possibleFixes: options.possibleFixes || [
|
|
521
|
+
"Ensure the global execute tool function is set in the provider"
|
|
522
|
+
]
|
|
297
523
|
});
|
|
298
524
|
this.name = "ComposioGlobalExecuteToolFnNotSetError";
|
|
299
525
|
}
|
|
300
526
|
};
|
|
301
527
|
|
|
302
|
-
// src/errors/
|
|
528
|
+
// src/errors/ConnectedAccountsErrors.ts
|
|
303
529
|
var ConnectedAccountErrorCodes = {
|
|
304
530
|
CONNECTED_ACCOUNT_NOT_FOUND: "CONNECTED_ACCOUNT_NOT_FOUND"
|
|
305
531
|
};
|
|
306
532
|
var ComposioConnectedAccountNotFoundError = class extends ComposioError {
|
|
307
|
-
constructor(message = "Connected account not found",
|
|
533
|
+
constructor(message = "Connected account not found", options = {}) {
|
|
308
534
|
super(message, {
|
|
535
|
+
...options,
|
|
309
536
|
code: ConnectedAccountErrorCodes.CONNECTED_ACCOUNT_NOT_FOUND,
|
|
310
537
|
statusCode: 404,
|
|
311
|
-
|
|
312
|
-
possibleFixes: [
|
|
538
|
+
possibleFixes: options.possibleFixes || [
|
|
313
539
|
"Ensure the connected account exists and is active in your Composio dashboard"
|
|
314
540
|
]
|
|
315
541
|
});
|
|
542
|
+
this.name = "ComposioConnectedAccountNotFoundError";
|
|
316
543
|
}
|
|
317
544
|
};
|
|
318
545
|
|
|
546
|
+
// src/telemetry/Telemetry.ts
|
|
547
|
+
var import_client2 = require("@composio/client");
|
|
548
|
+
|
|
319
549
|
// src/types/telemetry.types.ts
|
|
320
550
|
var TELEMETRY_EVENTS = {
|
|
321
551
|
SDK_INITIALIZED: "SDK_INITIALIZED",
|
|
@@ -393,7 +623,7 @@ var BrowserTelemetryTransport = class {
|
|
|
393
623
|
};
|
|
394
624
|
|
|
395
625
|
// src/telemetry/transports/ProcessTransport.ts
|
|
396
|
-
var
|
|
626
|
+
var import_chalk3 = __toESM(require("chalk"), 1);
|
|
397
627
|
var ProcessTelemetryTransport = class {
|
|
398
628
|
send(payload) {
|
|
399
629
|
if (typeof window !== "undefined") {
|
|
@@ -436,14 +666,15 @@ var ProcessTelemetryTransport = class {
|
|
|
436
666
|
import("child_process").then(({ spawn }) => {
|
|
437
667
|
spawn("node", args, {
|
|
438
668
|
stdio: "ignore",
|
|
439
|
-
detached:
|
|
669
|
+
detached: false,
|
|
440
670
|
shell: false
|
|
441
671
|
}).unref();
|
|
442
672
|
resolve();
|
|
443
|
-
}).catch(() => {
|
|
673
|
+
}).catch((error) => {
|
|
674
|
+
logger_default.error("Error sending telemetry", error);
|
|
444
675
|
resolve();
|
|
445
676
|
});
|
|
446
|
-
logger_default.debug(
|
|
677
|
+
logger_default.debug(import_chalk3.default.yellow("Process Telemetry"), JSON.stringify(payload, null, 2));
|
|
447
678
|
} catch (error) {
|
|
448
679
|
logger_default.error("Error sending telemetry", error);
|
|
449
680
|
resolve();
|
|
@@ -452,6 +683,12 @@ var ProcessTelemetryTransport = class {
|
|
|
452
683
|
}
|
|
453
684
|
};
|
|
454
685
|
|
|
686
|
+
// src/utils/uuid.ts
|
|
687
|
+
var import_uuid = require("uuid");
|
|
688
|
+
function getRandomUUID() {
|
|
689
|
+
return (0, import_uuid.v4)();
|
|
690
|
+
}
|
|
691
|
+
|
|
455
692
|
// src/telemetry/Telemetry.ts
|
|
456
693
|
var TelemetryService = class {
|
|
457
694
|
telemetryMetadata;
|
|
@@ -476,8 +713,7 @@ var TelemetryService = class {
|
|
|
476
713
|
this.sendTelemetry([
|
|
477
714
|
{
|
|
478
715
|
eventName: TELEMETRY_EVENTS.SDK_INITIALIZED,
|
|
479
|
-
data: {}
|
|
480
|
-
sdk_meta: this.telemetryMetadata
|
|
716
|
+
data: {}
|
|
481
717
|
}
|
|
482
718
|
]);
|
|
483
719
|
}
|
|
@@ -506,24 +742,16 @@ var TelemetryService = class {
|
|
|
506
742
|
fileName: instrumentedClassName,
|
|
507
743
|
method: name,
|
|
508
744
|
params: args
|
|
509
|
-
}
|
|
510
|
-
sdk_meta: this.telemetryMetadata
|
|
745
|
+
}
|
|
511
746
|
};
|
|
512
747
|
this.batchProcessor.pushItem(telemetryPayload);
|
|
513
748
|
try {
|
|
514
749
|
return await originalMethod.apply(instance, args);
|
|
515
750
|
} catch (error) {
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
method: name,
|
|
521
|
-
params: args,
|
|
522
|
-
error
|
|
523
|
-
},
|
|
524
|
-
sdk_meta: this.telemetryMetadata
|
|
525
|
-
};
|
|
526
|
-
this.batchProcessor.pushItem(telemetryPayload2);
|
|
751
|
+
if (error instanceof Error && !error.errorId) {
|
|
752
|
+
error.errorId = getRandomUUID();
|
|
753
|
+
this.prepareAndSendErrorTelemetry(error, instrumentedClassName, name, args);
|
|
754
|
+
}
|
|
527
755
|
throw error;
|
|
528
756
|
}
|
|
529
757
|
};
|
|
@@ -541,6 +769,47 @@ var TelemetryService = class {
|
|
|
541
769
|
const isTelemetryDisabledByEnv = getEnvVariable("TELEMETRY_DISABLED", "false") === "true";
|
|
542
770
|
return this.transport && !this.isTelemetryDisabled && !isTelemetryDisabledByEnv && !isDevEnvironment;
|
|
543
771
|
}
|
|
772
|
+
/**
|
|
773
|
+
* Prepare and send the error telemetry.
|
|
774
|
+
*
|
|
775
|
+
* @TODO This currently blocks the thread and sends the telemetry to the server.
|
|
776
|
+
*
|
|
777
|
+
* @param {unknown} error - The error to send.
|
|
778
|
+
* @param {string} instrumentedClassName - The class name of the instrumented class.
|
|
779
|
+
* @param {string} name - The name of the method that threw the error.
|
|
780
|
+
*/
|
|
781
|
+
prepareAndSendErrorTelemetry(error, instrumentedClassName, name, args) {
|
|
782
|
+
if (error instanceof import_client2.ComposioError) {
|
|
783
|
+
const telemetryPayload = {
|
|
784
|
+
error_id: error.errorId || "",
|
|
785
|
+
error_message: error.message,
|
|
786
|
+
original_error: error.cause || error,
|
|
787
|
+
current_stack: error.stack?.split("\n") || [],
|
|
788
|
+
description: `Original Call : ${this.telemetryMetadata?.source}:${instrumentedClassName}.${name}(${JSON.stringify(args)})`
|
|
789
|
+
};
|
|
790
|
+
this.sendErrorTelemetry(telemetryPayload);
|
|
791
|
+
} else if (error instanceof ComposioError) {
|
|
792
|
+
const telemetryPayload = {
|
|
793
|
+
error_id: error.errorId || "",
|
|
794
|
+
error_message: error.message,
|
|
795
|
+
original_error: error.cause || error,
|
|
796
|
+
current_stack: error.stack?.split("\n") || [],
|
|
797
|
+
error_code: error.code,
|
|
798
|
+
possible_fix: error.possibleFixes?.join("\n"),
|
|
799
|
+
description: `Original Call : ${instrumentedClassName}.${name}(${JSON.stringify(args)})`
|
|
800
|
+
};
|
|
801
|
+
this.sendErrorTelemetry(telemetryPayload);
|
|
802
|
+
} else if (error instanceof Error) {
|
|
803
|
+
const telemetryPayload = {
|
|
804
|
+
error_id: error.errorId || "",
|
|
805
|
+
error_message: error instanceof Error ? error.name : "Unknown error",
|
|
806
|
+
original_error: error,
|
|
807
|
+
current_stack: error.stack?.split("\n") || [],
|
|
808
|
+
description: `Original Call : ${this.telemetryMetadata?.source}:${instrumentedClassName}.${name}(${JSON.stringify(args)})`
|
|
809
|
+
};
|
|
810
|
+
this.sendErrorTelemetry(telemetryPayload);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
544
813
|
/**
|
|
545
814
|
* Send the telemetry payload to the server.
|
|
546
815
|
* @param payload - the telemetry payload to send
|
|
@@ -552,20 +821,27 @@ var TelemetryService = class {
|
|
|
552
821
|
}
|
|
553
822
|
const url = `${TELEMETRY_URL}/api/sdk_metrics/telemetry`;
|
|
554
823
|
const reqPayload = {
|
|
555
|
-
data: payload
|
|
824
|
+
data: payload.map((p) => ({
|
|
825
|
+
...p,
|
|
826
|
+
sdk_meta: this.telemetryMetadata
|
|
827
|
+
})),
|
|
556
828
|
url,
|
|
557
829
|
method: "POST",
|
|
558
830
|
headers: { "Content-Type": "application/json" }
|
|
559
831
|
};
|
|
560
832
|
this.transport.send(reqPayload);
|
|
561
833
|
}
|
|
562
|
-
|
|
834
|
+
// @TODO: check if this will send the error telemetry to the server
|
|
835
|
+
async sendErrorTelemetry(payload) {
|
|
563
836
|
if (!this.shouldSendTelemetry()) {
|
|
564
837
|
return;
|
|
565
838
|
}
|
|
566
839
|
const url = `${TELEMETRY_URL}/api/sdk_metrics/error`;
|
|
567
840
|
const reqPayload = {
|
|
568
|
-
data: {
|
|
841
|
+
data: {
|
|
842
|
+
...payload,
|
|
843
|
+
sdk_meta: this.telemetryMetadata
|
|
844
|
+
},
|
|
569
845
|
url,
|
|
570
846
|
method: "POST",
|
|
571
847
|
headers: { "Content-Type": "application/json" }
|
|
@@ -741,36 +1017,50 @@ var CustomTools = class {
|
|
|
741
1017
|
}
|
|
742
1018
|
};
|
|
743
1019
|
|
|
744
|
-
// src/errors/
|
|
745
|
-
var
|
|
1020
|
+
// src/errors/ValidationErrors.ts
|
|
1021
|
+
var import_zod3 = require("zod");
|
|
746
1022
|
var ValidationErrorCodes = {
|
|
747
1023
|
VALIDATION_ERROR: "VALIDATION_ERROR"
|
|
748
1024
|
};
|
|
749
1025
|
var ValidationError = class extends ComposioError {
|
|
750
|
-
|
|
751
|
-
|
|
1026
|
+
constructor(message = "Input validation failed", options = {}) {
|
|
1027
|
+
const { cause: providedZodError, ...restOptions } = options;
|
|
752
1028
|
let zodErrorInstance;
|
|
753
|
-
if (
|
|
754
|
-
zodErrorInstance =
|
|
1029
|
+
if (providedZodError instanceof import_zod3.ZodError) {
|
|
1030
|
+
zodErrorInstance = providedZodError;
|
|
1031
|
+
} else {
|
|
1032
|
+
zodErrorInstance = new import_zod3.ZodError([
|
|
755
1033
|
{
|
|
756
1034
|
path: [],
|
|
757
1035
|
message: "Invalid input",
|
|
758
1036
|
code: "custom"
|
|
759
1037
|
}
|
|
760
1038
|
]);
|
|
761
|
-
} else {
|
|
762
|
-
zodErrorInstance = zodError;
|
|
763
1039
|
}
|
|
764
1040
|
const issues = zodErrorInstance.issues.map(
|
|
765
1041
|
(issue) => `[${issue.code}] ${issue.path.join(".")} - ${issue.message}`
|
|
766
1042
|
);
|
|
767
1043
|
super(message, {
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
1044
|
+
...restOptions,
|
|
1045
|
+
code: options.code || ValidationErrorCodes.VALIDATION_ERROR,
|
|
1046
|
+
possibleFixes: issues,
|
|
1047
|
+
cause: zodErrorInstance
|
|
771
1048
|
});
|
|
772
|
-
this.zodError = zodErrorInstance;
|
|
773
1049
|
this.name = "ValidationError";
|
|
1050
|
+
const userFriendlyMessage = this.generateUserFriendlyMessage();
|
|
1051
|
+
this.message = `${message}: ${userFriendlyMessage}`;
|
|
1052
|
+
}
|
|
1053
|
+
generateUserFriendlyMessage() {
|
|
1054
|
+
if (this.cause instanceof import_zod3.ZodError && this.cause.issues.length > 0) {
|
|
1055
|
+
const issue = this.cause.issues[0];
|
|
1056
|
+
const path = issue.path.join(".");
|
|
1057
|
+
const param = path || "parameter";
|
|
1058
|
+
if (issue.code === "invalid_type") {
|
|
1059
|
+
return `The ${param} should be a ${issue.expected}, but you provided a ${issue.received}`;
|
|
1060
|
+
}
|
|
1061
|
+
return issue.message;
|
|
1062
|
+
}
|
|
1063
|
+
return "Please check your input parameters";
|
|
774
1064
|
}
|
|
775
1065
|
};
|
|
776
1066
|
|
|
@@ -940,7 +1230,9 @@ var Tools = class {
|
|
|
940
1230
|
async getRawComposioTools(userId, query = {}, modifier) {
|
|
941
1231
|
const queryParams = ToolListParamsSchema.safeParse(query);
|
|
942
1232
|
if (queryParams.error) {
|
|
943
|
-
throw new ValidationError(
|
|
1233
|
+
throw new ValidationError("Invalid tool list parameters", {
|
|
1234
|
+
cause: queryParams.error
|
|
1235
|
+
});
|
|
944
1236
|
}
|
|
945
1237
|
const tools = await this.client.tools.list({
|
|
946
1238
|
tool_slugs: queryParams.data.tools,
|
|
@@ -985,11 +1277,13 @@ var Tools = class {
|
|
|
985
1277
|
if (customTool) {
|
|
986
1278
|
return customTool;
|
|
987
1279
|
}
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
1280
|
+
let tool;
|
|
1281
|
+
try {
|
|
1282
|
+
tool = await this.client.tools.retrieve(slug);
|
|
1283
|
+
} catch (error) {
|
|
1284
|
+
throw new ComposioToolNotFoundError(`Unable to retrieve tool with slug ${slug}`, {
|
|
1285
|
+
cause: error
|
|
1286
|
+
});
|
|
993
1287
|
}
|
|
994
1288
|
let modifiedToool = this.transformToolCases(tool);
|
|
995
1289
|
if (modifier) {
|
|
@@ -1166,9 +1460,12 @@ var Tools = class {
|
|
|
1166
1460
|
return this.handleComposioToolExecution(composioTool, body, modifiers);
|
|
1167
1461
|
}
|
|
1168
1462
|
} catch (error) {
|
|
1169
|
-
throw new ComposioToolExecutionError(
|
|
1170
|
-
|
|
1171
|
-
|
|
1463
|
+
throw new ComposioToolExecutionError(`Error executing tool ${slug}`, {
|
|
1464
|
+
originalError: error,
|
|
1465
|
+
meta: {
|
|
1466
|
+
toolSlug: slug,
|
|
1467
|
+
body
|
|
1468
|
+
}
|
|
1172
1469
|
});
|
|
1173
1470
|
}
|
|
1174
1471
|
}
|
|
@@ -1242,91 +1539,187 @@ var Tools = class {
|
|
|
1242
1539
|
}
|
|
1243
1540
|
};
|
|
1244
1541
|
|
|
1542
|
+
// src/models/Toolkits.ts
|
|
1543
|
+
var import_client4 = __toESM(require("@composio/client"), 1);
|
|
1544
|
+
|
|
1245
1545
|
// src/types/toolkit.types.ts
|
|
1246
|
-
var
|
|
1247
|
-
var ToolkitMangedByEnumSchema =
|
|
1248
|
-
var ToolkitSortByEnumSchema =
|
|
1249
|
-
var ToolkitsListParamsSchema =
|
|
1250
|
-
category:
|
|
1251
|
-
isLocal:
|
|
1546
|
+
var import_zod4 = require("zod");
|
|
1547
|
+
var ToolkitMangedByEnumSchema = import_zod4.z.enum(["all", "composio", "project"]);
|
|
1548
|
+
var ToolkitSortByEnumSchema = import_zod4.z.enum(["usage", "alphabetically"]);
|
|
1549
|
+
var ToolkitsListParamsSchema = import_zod4.z.object({
|
|
1550
|
+
category: import_zod4.z.string().optional(),
|
|
1551
|
+
isLocal: import_zod4.z.boolean().optional(),
|
|
1252
1552
|
managedBy: ToolkitMangedByEnumSchema.optional(),
|
|
1253
1553
|
sortBy: ToolkitSortByEnumSchema.optional()
|
|
1254
1554
|
});
|
|
1255
|
-
var ToolKitMetaSchema =
|
|
1256
|
-
categories:
|
|
1257
|
-
|
|
1258
|
-
slug:
|
|
1259
|
-
name:
|
|
1555
|
+
var ToolKitMetaSchema = import_zod4.z.object({
|
|
1556
|
+
categories: import_zod4.z.array(
|
|
1557
|
+
import_zod4.z.object({
|
|
1558
|
+
slug: import_zod4.z.string(),
|
|
1559
|
+
name: import_zod4.z.string()
|
|
1260
1560
|
})
|
|
1261
1561
|
).optional(),
|
|
1262
|
-
appUrl:
|
|
1263
|
-
createdAt:
|
|
1264
|
-
description:
|
|
1265
|
-
logo:
|
|
1266
|
-
toolsCount:
|
|
1267
|
-
triggersCount:
|
|
1268
|
-
updatedAt:
|
|
1562
|
+
appUrl: import_zod4.z.string().optional(),
|
|
1563
|
+
createdAt: import_zod4.z.string().optional(),
|
|
1564
|
+
description: import_zod4.z.string().optional(),
|
|
1565
|
+
logo: import_zod4.z.string().optional(),
|
|
1566
|
+
toolsCount: import_zod4.z.number().optional(),
|
|
1567
|
+
triggersCount: import_zod4.z.number().optional(),
|
|
1568
|
+
updatedAt: import_zod4.z.string().optional()
|
|
1269
1569
|
});
|
|
1270
|
-
var ToolKitItemSchema =
|
|
1271
|
-
name:
|
|
1272
|
-
slug:
|
|
1570
|
+
var ToolKitItemSchema = import_zod4.z.object({
|
|
1571
|
+
name: import_zod4.z.string(),
|
|
1572
|
+
slug: import_zod4.z.string(),
|
|
1273
1573
|
meta: ToolKitMetaSchema,
|
|
1274
|
-
isLocalToolkit:
|
|
1275
|
-
authSchemes:
|
|
1276
|
-
composioManagedAuthSchemes:
|
|
1277
|
-
noAuth:
|
|
1574
|
+
isLocalToolkit: import_zod4.z.boolean(),
|
|
1575
|
+
authSchemes: import_zod4.z.array(import_zod4.z.string()).optional(),
|
|
1576
|
+
composioManagedAuthSchemes: import_zod4.z.array(import_zod4.z.string()).optional(),
|
|
1577
|
+
noAuth: import_zod4.z.boolean().optional()
|
|
1278
1578
|
});
|
|
1279
|
-
var ToolKitListResponseSchema =
|
|
1280
|
-
items:
|
|
1281
|
-
nextCursor:
|
|
1282
|
-
totalPages:
|
|
1579
|
+
var ToolKitListResponseSchema = import_zod4.z.object({
|
|
1580
|
+
items: import_zod4.z.array(ToolKitItemSchema),
|
|
1581
|
+
nextCursor: import_zod4.z.string().nullable(),
|
|
1582
|
+
totalPages: import_zod4.z.number()
|
|
1283
1583
|
});
|
|
1284
|
-
var ToolkitAuthFieldSchema =
|
|
1285
|
-
name:
|
|
1286
|
-
displayName:
|
|
1287
|
-
type:
|
|
1288
|
-
default:
|
|
1584
|
+
var ToolkitAuthFieldSchema = import_zod4.z.object({
|
|
1585
|
+
name: import_zod4.z.string(),
|
|
1586
|
+
displayName: import_zod4.z.string(),
|
|
1587
|
+
type: import_zod4.z.string(),
|
|
1588
|
+
default: import_zod4.z.string().nullable().optional()
|
|
1289
1589
|
});
|
|
1290
|
-
var ToolkitAuthConfigDetailsSchema =
|
|
1291
|
-
name:
|
|
1292
|
-
mode:
|
|
1293
|
-
fields:
|
|
1294
|
-
authConfigCreation:
|
|
1295
|
-
optional:
|
|
1296
|
-
required:
|
|
1590
|
+
var ToolkitAuthConfigDetailsSchema = import_zod4.z.object({
|
|
1591
|
+
name: import_zod4.z.string(),
|
|
1592
|
+
mode: import_zod4.z.string(),
|
|
1593
|
+
fields: import_zod4.z.object({
|
|
1594
|
+
authConfigCreation: import_zod4.z.object({
|
|
1595
|
+
optional: import_zod4.z.array(ToolkitAuthFieldSchema),
|
|
1596
|
+
required: import_zod4.z.array(ToolkitAuthFieldSchema)
|
|
1297
1597
|
}),
|
|
1298
|
-
connectedAccountInitiation:
|
|
1299
|
-
optional:
|
|
1300
|
-
required:
|
|
1598
|
+
connectedAccountInitiation: import_zod4.z.object({
|
|
1599
|
+
optional: import_zod4.z.array(ToolkitAuthFieldSchema),
|
|
1600
|
+
required: import_zod4.z.array(ToolkitAuthFieldSchema)
|
|
1301
1601
|
})
|
|
1302
1602
|
}),
|
|
1303
|
-
proxy:
|
|
1304
|
-
baseUrl:
|
|
1603
|
+
proxy: import_zod4.z.object({
|
|
1604
|
+
baseUrl: import_zod4.z.string().optional()
|
|
1305
1605
|
}).optional()
|
|
1306
1606
|
});
|
|
1307
|
-
var ToolkitRetrieveResponseSchema =
|
|
1308
|
-
name:
|
|
1309
|
-
slug:
|
|
1607
|
+
var ToolkitRetrieveResponseSchema = import_zod4.z.object({
|
|
1608
|
+
name: import_zod4.z.string(),
|
|
1609
|
+
slug: import_zod4.z.string(),
|
|
1310
1610
|
meta: ToolKitMetaSchema,
|
|
1311
|
-
isLocalToolkit:
|
|
1312
|
-
composioManagedAuthSchemes:
|
|
1313
|
-
authConfigDetails:
|
|
1611
|
+
isLocalToolkit: import_zod4.z.boolean(),
|
|
1612
|
+
composioManagedAuthSchemes: import_zod4.z.array(import_zod4.z.string()).optional(),
|
|
1613
|
+
authConfigDetails: import_zod4.z.array(ToolkitAuthConfigDetailsSchema).optional()
|
|
1314
1614
|
});
|
|
1315
|
-
var ToolkitCategorySchema =
|
|
1316
|
-
id:
|
|
1317
|
-
name:
|
|
1615
|
+
var ToolkitCategorySchema = import_zod4.z.object({
|
|
1616
|
+
id: import_zod4.z.string(),
|
|
1617
|
+
name: import_zod4.z.string()
|
|
1318
1618
|
});
|
|
1319
|
-
var ToolkitRetrieveCategoriesResponseSchema =
|
|
1320
|
-
items:
|
|
1321
|
-
nextCursor:
|
|
1322
|
-
totalPages:
|
|
1619
|
+
var ToolkitRetrieveCategoriesResponseSchema = import_zod4.z.object({
|
|
1620
|
+
items: import_zod4.z.array(ToolkitCategorySchema),
|
|
1621
|
+
nextCursor: import_zod4.z.string().nullable(),
|
|
1622
|
+
totalPages: import_zod4.z.number()
|
|
1323
1623
|
});
|
|
1324
1624
|
|
|
1325
|
-
// src/
|
|
1326
|
-
var
|
|
1625
|
+
// src/errors/AuthConfigErrors.ts
|
|
1626
|
+
var AuthConfigErrorCodes = {
|
|
1627
|
+
AUTH_CONFIG_NOT_FOUND: "AUTH_CONFIG_NOT_FOUND"
|
|
1628
|
+
};
|
|
1629
|
+
var ComposioAuthConfigNotFoundError = class extends ComposioError {
|
|
1630
|
+
constructor(message = "Auth config not found", options = {}) {
|
|
1631
|
+
super(message, {
|
|
1632
|
+
...options,
|
|
1633
|
+
code: AuthConfigErrorCodes.AUTH_CONFIG_NOT_FOUND,
|
|
1634
|
+
possibleFixes: options.possibleFixes || [
|
|
1635
|
+
"Check if the auth config exists",
|
|
1636
|
+
"Check if the auth config id is correct",
|
|
1637
|
+
"Check if the auth config is enabled"
|
|
1638
|
+
]
|
|
1639
|
+
});
|
|
1640
|
+
this.name = "ComposioAuthConfigNotFoundError";
|
|
1641
|
+
}
|
|
1642
|
+
};
|
|
1643
|
+
|
|
1644
|
+
// src/errors/ConnectionRequestErrors.ts
|
|
1645
|
+
var ConnectionRequestErrorCodes = {
|
|
1646
|
+
CONNECTION_REQUEST_TIMEOUT: "CONNECTION_REQUEST_TIMEOUT",
|
|
1647
|
+
CONNECTION_REQUEST_FAILED: "CONNECTION_REQUEST_FAILED"
|
|
1648
|
+
};
|
|
1649
|
+
var ConnectionRequestTimeoutError = class extends ComposioError {
|
|
1650
|
+
constructor(message = "Connection request timed out", options = {}) {
|
|
1651
|
+
super(message, {
|
|
1652
|
+
...options,
|
|
1653
|
+
code: ConnectionRequestErrorCodes.CONNECTION_REQUEST_TIMEOUT
|
|
1654
|
+
});
|
|
1655
|
+
this.name = "ConnectionRequestTimeoutError";
|
|
1656
|
+
}
|
|
1657
|
+
};
|
|
1658
|
+
var ConnectionRequestFailedError = class extends ComposioError {
|
|
1659
|
+
constructor(message = "Connection request failed", options = {}) {
|
|
1660
|
+
super(message, {
|
|
1661
|
+
...options,
|
|
1662
|
+
code: ConnectionRequestErrorCodes.CONNECTION_REQUEST_FAILED
|
|
1663
|
+
});
|
|
1664
|
+
this.name = "ConnectionRequestFailedError";
|
|
1665
|
+
}
|
|
1666
|
+
};
|
|
1667
|
+
|
|
1668
|
+
// src/errors/ToolkitErrors.ts
|
|
1669
|
+
var ToolkitErrorCodes = {
|
|
1670
|
+
TOOLKIT_NOT_FOUND: "TOOLKIT_NOT_FOUND"
|
|
1671
|
+
};
|
|
1672
|
+
var ComposioToolkitNotFoundError = class extends ComposioError {
|
|
1673
|
+
constructor(message = "Toolkit not found", options = {}) {
|
|
1674
|
+
super(message, {
|
|
1675
|
+
...options,
|
|
1676
|
+
code: "TOOLKIT_NOT_FOUND",
|
|
1677
|
+
possibleFixes: options.possibleFixes || [
|
|
1678
|
+
"Ensure the toolkit is correctly configured and the slug is valid"
|
|
1679
|
+
]
|
|
1680
|
+
});
|
|
1681
|
+
this.name = "ComposioToolkitNotFoundError";
|
|
1682
|
+
}
|
|
1683
|
+
};
|
|
1684
|
+
var ComposioToolkitFetchError = class extends ComposioError {
|
|
1685
|
+
constructor(message = "Failed to fetch toolkit", options = {}) {
|
|
1686
|
+
super(message, {
|
|
1687
|
+
...options,
|
|
1688
|
+
code: "TOOLKIT_FETCH_ERROR",
|
|
1689
|
+
possibleFixes: options.possibleFixes || [
|
|
1690
|
+
"Ensure the toolkit slug is valid",
|
|
1691
|
+
"Ensure you are using the correct API key",
|
|
1692
|
+
"Ensure you are using the correct API endpoint / Base URL and it is working"
|
|
1693
|
+
]
|
|
1694
|
+
});
|
|
1695
|
+
this.name = "ComposioToolkitFetchError";
|
|
1696
|
+
}
|
|
1697
|
+
};
|
|
1698
|
+
|
|
1699
|
+
// src/errors/SDKErrors.ts
|
|
1700
|
+
var SDKErrorCodes = {
|
|
1701
|
+
NO_API_KEY_PROVIDED: "NO_API_KEY_PROVIDED"
|
|
1702
|
+
};
|
|
1703
|
+
var ComposioNoAPIKeyError = class extends ComposioError {
|
|
1704
|
+
constructor(message = "No Composio API key provided", options = {}) {
|
|
1705
|
+
const defaultCause = "Couldn't find an API key in the params, environment variables or in the user config file";
|
|
1706
|
+
super(message, {
|
|
1707
|
+
...options,
|
|
1708
|
+
code: "NO_API_KEY",
|
|
1709
|
+
cause: options.cause || defaultCause,
|
|
1710
|
+
possibleFixes: options.possibleFixes || [
|
|
1711
|
+
"Ensure you have an API key passed in the params, or in environment variable (COMPOSIO_API_KEY) or in the user config file",
|
|
1712
|
+
"To get an API key, please sign up at https://composio.dev/signup",
|
|
1713
|
+
"You can also use the Composio CLI to create a project and get an API key"
|
|
1714
|
+
],
|
|
1715
|
+
statusCode: 401
|
|
1716
|
+
});
|
|
1717
|
+
this.name = "ComposioNoAPIKeyError";
|
|
1718
|
+
}
|
|
1719
|
+
};
|
|
1327
1720
|
|
|
1328
1721
|
// src/types/authConfigs.types.ts
|
|
1329
|
-
var
|
|
1722
|
+
var import_zod5 = require("zod");
|
|
1330
1723
|
var AuthConfigTypes = {
|
|
1331
1724
|
CUSTOM: "use_custom_auth",
|
|
1332
1725
|
COMPOSIO_MANAGED: "use_composio_managed_auth"
|
|
@@ -1346,7 +1739,7 @@ var AuthSchemeTypes = {
|
|
|
1346
1739
|
CALCOM_AUTH: "CALCOM_AUTH",
|
|
1347
1740
|
SNOWFLAKE: "SNOWFLAKE"
|
|
1348
1741
|
};
|
|
1349
|
-
var AuthSchemeEnum =
|
|
1742
|
+
var AuthSchemeEnum = import_zod5.z.enum([
|
|
1350
1743
|
"OAUTH2",
|
|
1351
1744
|
"OAUTH1",
|
|
1352
1745
|
"OAUTH1A",
|
|
@@ -1361,67 +1754,67 @@ var AuthSchemeEnum = import_zod4.z.enum([
|
|
|
1361
1754
|
"CALCOM_AUTH",
|
|
1362
1755
|
"SNOWFLAKE"
|
|
1363
1756
|
]);
|
|
1364
|
-
var CreateCustomAuthConfigParamsSchema =
|
|
1365
|
-
type:
|
|
1366
|
-
name:
|
|
1367
|
-
credentials:
|
|
1757
|
+
var CreateCustomAuthConfigParamsSchema = import_zod5.z.object({
|
|
1758
|
+
type: import_zod5.z.literal("use_custom_auth"),
|
|
1759
|
+
name: import_zod5.z.string().optional(),
|
|
1760
|
+
credentials: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.union([import_zod5.z.string(), import_zod5.z.number(), import_zod5.z.boolean()])),
|
|
1368
1761
|
authScheme: AuthSchemeEnum
|
|
1369
1762
|
});
|
|
1370
|
-
var CreateComposioManagedAuthConfigParamsSchema =
|
|
1371
|
-
type:
|
|
1372
|
-
name:
|
|
1373
|
-
credentials:
|
|
1763
|
+
var CreateComposioManagedAuthConfigParamsSchema = import_zod5.z.object({
|
|
1764
|
+
type: import_zod5.z.literal("use_composio_managed_auth"),
|
|
1765
|
+
name: import_zod5.z.string().optional(),
|
|
1766
|
+
credentials: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.union([import_zod5.z.string(), import_zod5.z.number(), import_zod5.z.boolean()])).optional()
|
|
1374
1767
|
});
|
|
1375
|
-
var CreateAuthConfigParamsSchema =
|
|
1768
|
+
var CreateAuthConfigParamsSchema = import_zod5.z.discriminatedUnion("type", [
|
|
1376
1769
|
CreateCustomAuthConfigParamsSchema,
|
|
1377
1770
|
CreateComposioManagedAuthConfigParamsSchema
|
|
1378
1771
|
]);
|
|
1379
|
-
var CreateAuthConfigResponseSchema =
|
|
1380
|
-
id:
|
|
1381
|
-
authScheme:
|
|
1382
|
-
isComposioManaged:
|
|
1383
|
-
toolkit:
|
|
1772
|
+
var CreateAuthConfigResponseSchema = import_zod5.z.object({
|
|
1773
|
+
id: import_zod5.z.string(),
|
|
1774
|
+
authScheme: import_zod5.z.string(),
|
|
1775
|
+
isComposioManaged: import_zod5.z.boolean(),
|
|
1776
|
+
toolkit: import_zod5.z.string()
|
|
1384
1777
|
});
|
|
1385
|
-
var AuthConfigRetrieveResponseSchema =
|
|
1386
|
-
id:
|
|
1387
|
-
name:
|
|
1388
|
-
toolkit:
|
|
1389
|
-
logo:
|
|
1390
|
-
slug:
|
|
1778
|
+
var AuthConfigRetrieveResponseSchema = import_zod5.z.object({
|
|
1779
|
+
id: import_zod5.z.string(),
|
|
1780
|
+
name: import_zod5.z.string(),
|
|
1781
|
+
toolkit: import_zod5.z.object({
|
|
1782
|
+
logo: import_zod5.z.string(),
|
|
1783
|
+
slug: import_zod5.z.string()
|
|
1391
1784
|
}),
|
|
1392
|
-
noOfConnections:
|
|
1393
|
-
status:
|
|
1394
|
-
uuid:
|
|
1785
|
+
noOfConnections: import_zod5.z.number(),
|
|
1786
|
+
status: import_zod5.z.enum(["ENABLED", "DISABLED"]),
|
|
1787
|
+
uuid: import_zod5.z.string(),
|
|
1395
1788
|
authScheme: AuthSchemeEnum.optional(),
|
|
1396
|
-
credentials:
|
|
1397
|
-
expectedInputFields:
|
|
1398
|
-
isComposioManaged:
|
|
1399
|
-
createdBy:
|
|
1400
|
-
createdAt:
|
|
1401
|
-
lastUpdatedAt:
|
|
1789
|
+
credentials: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.unknown()).optional(),
|
|
1790
|
+
expectedInputFields: import_zod5.z.array(import_zod5.z.unknown()).optional(),
|
|
1791
|
+
isComposioManaged: import_zod5.z.boolean().optional(),
|
|
1792
|
+
createdBy: import_zod5.z.string().optional(),
|
|
1793
|
+
createdAt: import_zod5.z.string().optional(),
|
|
1794
|
+
lastUpdatedAt: import_zod5.z.string().optional()
|
|
1402
1795
|
});
|
|
1403
|
-
var AuthConfigListParamsSchema =
|
|
1404
|
-
cursor:
|
|
1405
|
-
isComposioManaged:
|
|
1406
|
-
limit:
|
|
1407
|
-
|
|
1796
|
+
var AuthConfigListParamsSchema = import_zod5.z.object({
|
|
1797
|
+
cursor: import_zod5.z.string().optional(),
|
|
1798
|
+
isComposioManaged: import_zod5.z.boolean().optional(),
|
|
1799
|
+
limit: import_zod5.z.number().optional(),
|
|
1800
|
+
toolkit: import_zod5.z.string().optional()
|
|
1408
1801
|
});
|
|
1409
|
-
var AuthConfigListResponseSchema =
|
|
1410
|
-
items:
|
|
1411
|
-
nextCursor:
|
|
1412
|
-
totalPages:
|
|
1802
|
+
var AuthConfigListResponseSchema = import_zod5.z.object({
|
|
1803
|
+
items: import_zod5.z.array(AuthConfigRetrieveResponseSchema),
|
|
1804
|
+
nextCursor: import_zod5.z.string().optional(),
|
|
1805
|
+
totalPages: import_zod5.z.number()
|
|
1413
1806
|
});
|
|
1414
|
-
var AuthCustomConfigUpdateParamsSchema =
|
|
1415
|
-
credentials:
|
|
1416
|
-
type:
|
|
1417
|
-
restrictToFollowingTools:
|
|
1807
|
+
var AuthCustomConfigUpdateParamsSchema = import_zod5.z.object({
|
|
1808
|
+
credentials: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.union([import_zod5.z.string(), import_zod5.z.unknown()])),
|
|
1809
|
+
type: import_zod5.z.literal("custom"),
|
|
1810
|
+
restrictToFollowingTools: import_zod5.z.array(import_zod5.z.string()).optional()
|
|
1418
1811
|
});
|
|
1419
|
-
var AuthDefaultConfigUpdateParamsSchema =
|
|
1420
|
-
scopes:
|
|
1421
|
-
type:
|
|
1422
|
-
restrictToFollowingTools:
|
|
1812
|
+
var AuthDefaultConfigUpdateParamsSchema = import_zod5.z.object({
|
|
1813
|
+
scopes: import_zod5.z.string(),
|
|
1814
|
+
type: import_zod5.z.literal("default"),
|
|
1815
|
+
restrictToFollowingTools: import_zod5.z.array(import_zod5.z.string()).optional()
|
|
1423
1816
|
});
|
|
1424
|
-
var AuthConfigUpdateParamsSchema =
|
|
1817
|
+
var AuthConfigUpdateParamsSchema = import_zod5.z.discriminatedUnion("type", [
|
|
1425
1818
|
AuthCustomConfigUpdateParamsSchema,
|
|
1426
1819
|
AuthDefaultConfigUpdateParamsSchema
|
|
1427
1820
|
]);
|
|
@@ -1473,7 +1866,9 @@ var AuthConfigs = class {
|
|
|
1473
1866
|
lastUpdatedAt: authConfig.last_updated_at
|
|
1474
1867
|
});
|
|
1475
1868
|
if (result.error) {
|
|
1476
|
-
throw new ValidationError(
|
|
1869
|
+
throw new ValidationError("Failed to parse auth config response", {
|
|
1870
|
+
cause: result.error
|
|
1871
|
+
});
|
|
1477
1872
|
}
|
|
1478
1873
|
return result.data;
|
|
1479
1874
|
}
|
|
@@ -1494,7 +1889,7 @@ var AuthConfigs = class {
|
|
|
1494
1889
|
*
|
|
1495
1890
|
* // List auth configs for a specific toolkit
|
|
1496
1891
|
* const githubConfigs = await composio.authConfigs.list({
|
|
1497
|
-
*
|
|
1892
|
+
* toolkit: 'github'
|
|
1498
1893
|
* });
|
|
1499
1894
|
*
|
|
1500
1895
|
* // List Composio-managed auth configs
|
|
@@ -1509,7 +1904,7 @@ var AuthConfigs = class {
|
|
|
1509
1904
|
cursor: parsedQuery?.cursor,
|
|
1510
1905
|
is_composio_managed: parsedQuery?.isComposioManaged,
|
|
1511
1906
|
limit: parsedQuery?.limit?.toString(),
|
|
1512
|
-
toolkit_slug: parsedQuery?.
|
|
1907
|
+
toolkit_slug: parsedQuery?.toolkit
|
|
1513
1908
|
});
|
|
1514
1909
|
const parsedResult = AuthConfigListResponseSchema.safeParse({
|
|
1515
1910
|
items: result.items.map((item) => this.parseAuthConfigRetrieveResponse(item)),
|
|
@@ -1517,7 +1912,9 @@ var AuthConfigs = class {
|
|
|
1517
1912
|
totalPages: result.total_pages
|
|
1518
1913
|
});
|
|
1519
1914
|
if (parsedResult.error) {
|
|
1520
|
-
throw new ValidationError(
|
|
1915
|
+
throw new ValidationError("Failed to parse auth config list response", {
|
|
1916
|
+
cause: parsedResult.error
|
|
1917
|
+
});
|
|
1521
1918
|
}
|
|
1522
1919
|
return parsedResult.data;
|
|
1523
1920
|
}
|
|
@@ -1542,7 +1939,9 @@ var AuthConfigs = class {
|
|
|
1542
1939
|
async create(toolkit, options = { type: "use_composio_managed_auth" }) {
|
|
1543
1940
|
const parsedOptions = CreateAuthConfigParamsSchema.safeParse(options);
|
|
1544
1941
|
if (parsedOptions.error) {
|
|
1545
|
-
throw new ValidationError(
|
|
1942
|
+
throw new ValidationError("Failed to parse auth config create options", {
|
|
1943
|
+
cause: parsedOptions.error
|
|
1944
|
+
});
|
|
1546
1945
|
}
|
|
1547
1946
|
const result = await this.client.authConfigs.create({
|
|
1548
1947
|
toolkit: {
|
|
@@ -1557,7 +1956,9 @@ var AuthConfigs = class {
|
|
|
1557
1956
|
toolkit: result.toolkit.slug
|
|
1558
1957
|
});
|
|
1559
1958
|
if (parsedResult.error) {
|
|
1560
|
-
throw new ValidationError(
|
|
1959
|
+
throw new ValidationError("Failed to parse auth config create response", {
|
|
1960
|
+
cause: parsedResult.error
|
|
1961
|
+
});
|
|
1561
1962
|
}
|
|
1562
1963
|
return parsedResult.data;
|
|
1563
1964
|
}
|
|
@@ -1617,7 +2018,9 @@ var AuthConfigs = class {
|
|
|
1617
2018
|
async update(nanoid, data) {
|
|
1618
2019
|
const parsedData = AuthConfigUpdateParamsSchema.safeParse(data);
|
|
1619
2020
|
if (parsedData.error) {
|
|
1620
|
-
throw new ValidationError(
|
|
2021
|
+
throw new ValidationError("Failed to parse auth config update data", {
|
|
2022
|
+
cause: parsedData.error
|
|
2023
|
+
});
|
|
1621
2024
|
}
|
|
1622
2025
|
return this.client.authConfigs.update(
|
|
1623
2026
|
nanoid,
|
|
@@ -1718,27 +2121,8 @@ var AuthConfigs = class {
|
|
|
1718
2121
|
}
|
|
1719
2122
|
};
|
|
1720
2123
|
|
|
1721
|
-
// src/errors/AuthConfigErrors.ts
|
|
1722
|
-
var AuthConfigErrorCodes = {
|
|
1723
|
-
AUTH_CONFIG_NOT_FOUND: "AUTH_CONFIG_NOT_FOUND"
|
|
1724
|
-
};
|
|
1725
|
-
var ComposioAuthConfigNotFoundError = class extends ComposioError {
|
|
1726
|
-
constructor(message, meta) {
|
|
1727
|
-
super(message, {
|
|
1728
|
-
code: AuthConfigErrorCodes.AUTH_CONFIG_NOT_FOUND,
|
|
1729
|
-
cause: meta,
|
|
1730
|
-
possibleFixes: [
|
|
1731
|
-
"Check if the auth config exists",
|
|
1732
|
-
"Check if the auth config id is correct",
|
|
1733
|
-
"Check if the auth config is enabled"
|
|
1734
|
-
]
|
|
1735
|
-
});
|
|
1736
|
-
this.name = "ComposioAuthConfigNotFoundError";
|
|
1737
|
-
}
|
|
1738
|
-
};
|
|
1739
|
-
|
|
1740
2124
|
// src/types/connectedAccounts.types.ts
|
|
1741
|
-
var
|
|
2125
|
+
var import_zod6 = require("zod");
|
|
1742
2126
|
var ConnectedAccountStatuses = {
|
|
1743
2127
|
ACTIVE: "ACTIVE",
|
|
1744
2128
|
INACTIVE: "INACTIVE",
|
|
@@ -1747,7 +2131,7 @@ var ConnectedAccountStatuses = {
|
|
|
1747
2131
|
EXPIRED: "EXPIRED",
|
|
1748
2132
|
FAILED: "FAILED"
|
|
1749
2133
|
};
|
|
1750
|
-
var ConnectedAccountStatusSchema =
|
|
2134
|
+
var ConnectedAccountStatusSchema = import_zod6.z.enum([
|
|
1751
2135
|
ConnectedAccountStatuses.ACTIVE,
|
|
1752
2136
|
ConnectedAccountStatuses.INACTIVE,
|
|
1753
2137
|
ConnectedAccountStatuses.DELETED,
|
|
@@ -1755,34 +2139,34 @@ var ConnectedAccountStatusSchema = import_zod5.z.enum([
|
|
|
1755
2139
|
ConnectedAccountStatuses.EXPIRED,
|
|
1756
2140
|
ConnectedAccountStatuses.FAILED
|
|
1757
2141
|
]);
|
|
1758
|
-
var CreateConnectedAccountParamsSchema =
|
|
1759
|
-
authConfig:
|
|
1760
|
-
id:
|
|
2142
|
+
var CreateConnectedAccountParamsSchema = import_zod6.z.object({
|
|
2143
|
+
authConfig: import_zod6.z.object({
|
|
2144
|
+
id: import_zod6.z.string()
|
|
1761
2145
|
}),
|
|
1762
|
-
connection:
|
|
1763
|
-
data:
|
|
1764
|
-
callbackUrl:
|
|
1765
|
-
userId:
|
|
2146
|
+
connection: import_zod6.z.object({
|
|
2147
|
+
data: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()).optional(),
|
|
2148
|
+
callbackUrl: import_zod6.z.string().optional(),
|
|
2149
|
+
userId: import_zod6.z.string().optional()
|
|
1766
2150
|
})
|
|
1767
2151
|
});
|
|
1768
|
-
var DefaultCreateConnectedAccountParamsSchema =
|
|
1769
|
-
auth_config:
|
|
1770
|
-
id:
|
|
2152
|
+
var DefaultCreateConnectedAccountParamsSchema = import_zod6.z.object({
|
|
2153
|
+
auth_config: import_zod6.z.object({
|
|
2154
|
+
id: import_zod6.z.string()
|
|
1771
2155
|
}),
|
|
1772
|
-
connection:
|
|
1773
|
-
data:
|
|
1774
|
-
callback_url:
|
|
1775
|
-
user_id:
|
|
2156
|
+
connection: import_zod6.z.object({
|
|
2157
|
+
data: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()).optional(),
|
|
2158
|
+
callback_url: import_zod6.z.string().optional(),
|
|
2159
|
+
user_id: import_zod6.z.string().optional()
|
|
1776
2160
|
})
|
|
1777
2161
|
});
|
|
1778
|
-
var CreateConnectedAccountOptionsSchema =
|
|
1779
|
-
callbackUrl:
|
|
1780
|
-
data:
|
|
2162
|
+
var CreateConnectedAccountOptionsSchema = import_zod6.z.object({
|
|
2163
|
+
callbackUrl: import_zod6.z.string().optional(),
|
|
2164
|
+
data: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()).optional()
|
|
1781
2165
|
});
|
|
1782
|
-
var CreateConnectedAccountResponseSchema =
|
|
1783
|
-
id:
|
|
2166
|
+
var CreateConnectedAccountResponseSchema = import_zod6.z.object({
|
|
2167
|
+
id: import_zod6.z.string(),
|
|
1784
2168
|
status: ConnectedAccountStatusSchema,
|
|
1785
|
-
redirectUrl:
|
|
2169
|
+
redirectUrl: import_zod6.z.string().nullable()
|
|
1786
2170
|
});
|
|
1787
2171
|
var ConnectedAccountAuthSchemes = {
|
|
1788
2172
|
OAUTH2: "OAUTH2",
|
|
@@ -1799,7 +2183,7 @@ var ConnectedAccountAuthSchemes = {
|
|
|
1799
2183
|
CALCOM_AUTH: "CALCOM_AUTH",
|
|
1800
2184
|
SNOWFLAKE: "SNOWFLAKE"
|
|
1801
2185
|
};
|
|
1802
|
-
var ConnectedAccountAuthSchemesSchema =
|
|
2186
|
+
var ConnectedAccountAuthSchemesSchema = import_zod6.z.enum([
|
|
1803
2187
|
ConnectedAccountAuthSchemes.OAUTH2,
|
|
1804
2188
|
ConnectedAccountAuthSchemes.OAUTH1,
|
|
1805
2189
|
ConnectedAccountAuthSchemes.OAUTH1A,
|
|
@@ -1814,73 +2198,47 @@ var ConnectedAccountAuthSchemesSchema = import_zod5.z.enum([
|
|
|
1814
2198
|
ConnectedAccountAuthSchemes.CALCOM_AUTH,
|
|
1815
2199
|
ConnectedAccountAuthSchemes.SNOWFLAKE
|
|
1816
2200
|
]);
|
|
1817
|
-
var ConnectedAccountAuthConfigSchema =
|
|
1818
|
-
id:
|
|
2201
|
+
var ConnectedAccountAuthConfigSchema = import_zod6.z.object({
|
|
2202
|
+
id: import_zod6.z.string(),
|
|
1819
2203
|
authScheme: ConnectedAccountAuthSchemesSchema,
|
|
1820
|
-
isComposioManaged:
|
|
1821
|
-
isDisabled:
|
|
2204
|
+
isComposioManaged: import_zod6.z.boolean(),
|
|
2205
|
+
isDisabled: import_zod6.z.boolean()
|
|
1822
2206
|
});
|
|
1823
|
-
var ConnectedAccountRetrieveResponseSchema =
|
|
1824
|
-
id:
|
|
2207
|
+
var ConnectedAccountRetrieveResponseSchema = import_zod6.z.object({
|
|
2208
|
+
id: import_zod6.z.string(),
|
|
1825
2209
|
authConfig: ConnectedAccountAuthConfigSchema,
|
|
1826
|
-
userId:
|
|
1827
|
-
data:
|
|
1828
|
-
params:
|
|
2210
|
+
userId: import_zod6.z.string(),
|
|
2211
|
+
data: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()),
|
|
2212
|
+
params: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()).optional(),
|
|
1829
2213
|
status: ConnectedAccountStatusSchema,
|
|
1830
|
-
statusReason:
|
|
1831
|
-
toolkit:
|
|
1832
|
-
slug:
|
|
2214
|
+
statusReason: import_zod6.z.string().nullable(),
|
|
2215
|
+
toolkit: import_zod6.z.object({
|
|
2216
|
+
slug: import_zod6.z.string()
|
|
1833
2217
|
}),
|
|
1834
|
-
testRequestEndpoint:
|
|
1835
|
-
isDisabled:
|
|
1836
|
-
createdAt:
|
|
1837
|
-
updatedAt:
|
|
2218
|
+
testRequestEndpoint: import_zod6.z.string().optional(),
|
|
2219
|
+
isDisabled: import_zod6.z.boolean(),
|
|
2220
|
+
createdAt: import_zod6.z.string(),
|
|
2221
|
+
updatedAt: import_zod6.z.string()
|
|
1838
2222
|
});
|
|
1839
|
-
var ConnectedAccountListParamsSchema =
|
|
1840
|
-
authConfigIds:
|
|
1841
|
-
cursor:
|
|
1842
|
-
labels:
|
|
1843
|
-
limit:
|
|
1844
|
-
orderBy:
|
|
1845
|
-
statuses:
|
|
1846
|
-
toolkitSlugs:
|
|
1847
|
-
userIds:
|
|
2223
|
+
var ConnectedAccountListParamsSchema = import_zod6.z.object({
|
|
2224
|
+
authConfigIds: import_zod6.z.array(import_zod6.z.string()).nullable().optional().describe("The auth config ids of the connected accounts"),
|
|
2225
|
+
cursor: import_zod6.z.number().nullable().optional().describe("The cursor to paginate through the connected accounts"),
|
|
2226
|
+
labels: import_zod6.z.array(import_zod6.z.string()).nullable().optional().describe("The labels of the connected accounts"),
|
|
2227
|
+
limit: import_zod6.z.number().nullable().optional().describe("The limit of the connected accounts to return"),
|
|
2228
|
+
orderBy: import_zod6.z.enum(["created_at", "updated_at"]).optional().describe("The order by of the connected accounts"),
|
|
2229
|
+
statuses: import_zod6.z.array(ConnectedAccountStatusSchema).nullable().optional().describe("The statuses of the connected accounts"),
|
|
2230
|
+
toolkitSlugs: import_zod6.z.array(import_zod6.z.string()).nullable().optional().describe("The toolkit slugs of the connected accounts"),
|
|
2231
|
+
userIds: import_zod6.z.array(import_zod6.z.string()).nullable().optional().describe("The user ids of the connected accounts")
|
|
1848
2232
|
});
|
|
1849
|
-
var ConnectedAccountListResponseSchema =
|
|
1850
|
-
items:
|
|
1851
|
-
nextCursor:
|
|
1852
|
-
totalPages:
|
|
2233
|
+
var ConnectedAccountListResponseSchema = import_zod6.z.object({
|
|
2234
|
+
items: import_zod6.z.array(ConnectedAccountRetrieveResponseSchema).describe("The list of connected accounts"),
|
|
2235
|
+
nextCursor: import_zod6.z.string().nullable().describe("The next cursor to paginate through the connected accounts"),
|
|
2236
|
+
totalPages: import_zod6.z.number().describe("The total number of pages of connected accounts")
|
|
1853
2237
|
});
|
|
1854
2238
|
|
|
1855
2239
|
// src/models/ConnectionRequest.ts
|
|
1856
|
-
var
|
|
1857
|
-
var
|
|
1858
|
-
|
|
1859
|
-
// src/errors/ConnectionRequestError.ts
|
|
1860
|
-
var ConnectionRequestErrorCodes = {
|
|
1861
|
-
CONNECTION_REQUEST_TIMEOUT: "CONNECTION_REQUEST_TIMEOUT",
|
|
1862
|
-
CONNECTION_REQUEST_FAILED: "CONNECTION_REQUEST_FAILED"
|
|
1863
|
-
};
|
|
1864
|
-
var ConnectionRequestTimeoutError = class extends ComposioError {
|
|
1865
|
-
constructor(message = "Connection request timed out", meta = {}) {
|
|
1866
|
-
super(message, {
|
|
1867
|
-
code: ConnectionRequestErrorCodes.CONNECTION_REQUEST_TIMEOUT,
|
|
1868
|
-
meta
|
|
1869
|
-
});
|
|
1870
|
-
this.name = "ConnectionRequestTimeoutError";
|
|
1871
|
-
}
|
|
1872
|
-
};
|
|
1873
|
-
var ConnectionRequestFailedError = class extends ComposioError {
|
|
1874
|
-
constructor(message = "Connection request failed", meta = {}) {
|
|
1875
|
-
super(message, {
|
|
1876
|
-
code: ConnectionRequestErrorCodes.CONNECTION_REQUEST_FAILED,
|
|
1877
|
-
meta
|
|
1878
|
-
});
|
|
1879
|
-
this.name = "ConnectionRequestFailedError";
|
|
1880
|
-
}
|
|
1881
|
-
};
|
|
1882
|
-
|
|
1883
|
-
// src/models/ConnectionRequest.ts
|
|
2240
|
+
var import_client3 = __toESM(require("@composio/client"), 1);
|
|
2241
|
+
var import_zod7 = require("zod");
|
|
1884
2242
|
var ConnectionRequest = class {
|
|
1885
2243
|
client;
|
|
1886
2244
|
id;
|
|
@@ -1926,7 +2284,7 @@ var ConnectionRequest = class {
|
|
|
1926
2284
|
return parsedResponse;
|
|
1927
2285
|
} catch (error) {
|
|
1928
2286
|
logger_default.error("Error transforming response", error);
|
|
1929
|
-
if (error instanceof
|
|
2287
|
+
if (error instanceof import_zod7.ZodError) {
|
|
1930
2288
|
logger_default.error(JSON.stringify(error.errors, null, 2));
|
|
1931
2289
|
}
|
|
1932
2290
|
throw error;
|
|
@@ -1966,11 +2324,13 @@ var ConnectionRequest = class {
|
|
|
1966
2324
|
return this.transformResponse(response);
|
|
1967
2325
|
}
|
|
1968
2326
|
} catch (error) {
|
|
1969
|
-
if (error instanceof
|
|
2327
|
+
if (error instanceof import_client3.default.NotFoundError) {
|
|
1970
2328
|
throw new ComposioConnectedAccountNotFoundError(
|
|
1971
2329
|
`Connected account with id ${this.id} not found`,
|
|
1972
2330
|
{
|
|
1973
|
-
|
|
2331
|
+
meta: {
|
|
2332
|
+
connectedAccountId: this.id
|
|
2333
|
+
}
|
|
1974
2334
|
}
|
|
1975
2335
|
);
|
|
1976
2336
|
} else {
|
|
@@ -1995,10 +2355,12 @@ var ConnectionRequest = class {
|
|
|
1995
2355
|
throw new ConnectionRequestFailedError(
|
|
1996
2356
|
`Connection request failed with status: ${response.status}${response.status_reason ? `, reason: ${response.status_reason}` : ""}`,
|
|
1997
2357
|
{
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2358
|
+
meta: {
|
|
2359
|
+
userId: response.user_id,
|
|
2360
|
+
connectedAccountId: this.id,
|
|
2361
|
+
status: response.status,
|
|
2362
|
+
statusReason: response.status_reason
|
|
2363
|
+
}
|
|
2002
2364
|
}
|
|
2003
2365
|
);
|
|
2004
2366
|
}
|
|
@@ -2036,7 +2398,9 @@ var ConnectedAccounts = class {
|
|
|
2036
2398
|
testRequestEndpoint: response.test_request_endpoint
|
|
2037
2399
|
});
|
|
2038
2400
|
if (!result.success) {
|
|
2039
|
-
throw new ValidationError(
|
|
2401
|
+
throw new ValidationError("Failed to parse connected account retrieve response", {
|
|
2402
|
+
cause: result.error
|
|
2403
|
+
});
|
|
2040
2404
|
}
|
|
2041
2405
|
return result.data;
|
|
2042
2406
|
}
|
|
@@ -2069,7 +2433,9 @@ var ConnectedAccounts = class {
|
|
|
2069
2433
|
if (query) {
|
|
2070
2434
|
const parsedQuery = ConnectedAccountListParamsSchema.safeParse(query);
|
|
2071
2435
|
if (!parsedQuery.success) {
|
|
2072
|
-
throw new ValidationError(
|
|
2436
|
+
throw new ValidationError("Failed to parse connected account list query", {
|
|
2437
|
+
cause: parsedQuery.error
|
|
2438
|
+
});
|
|
2073
2439
|
}
|
|
2074
2440
|
rawQuery = {
|
|
2075
2441
|
auth_config_ids: parsedQuery.data.authConfigIds,
|
|
@@ -2089,7 +2455,9 @@ var ConnectedAccounts = class {
|
|
|
2089
2455
|
totalPages: result.total_pages
|
|
2090
2456
|
});
|
|
2091
2457
|
if (!parsedResponse.success) {
|
|
2092
|
-
throw new ValidationError(
|
|
2458
|
+
throw new ValidationError("Failed to parse connected account list response", {
|
|
2459
|
+
cause: parsedResponse.error
|
|
2460
|
+
});
|
|
2093
2461
|
}
|
|
2094
2462
|
return parsedResponse.data;
|
|
2095
2463
|
}
|
|
@@ -2275,42 +2643,46 @@ var Toolkits = class {
|
|
|
2275
2643
|
* @private
|
|
2276
2644
|
*/
|
|
2277
2645
|
async getToolkits(query) {
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
sort_by: parsedQuery.sortBy
|
|
2284
|
-
});
|
|
2285
|
-
const parsedResult = ToolKitListResponseSchema.parse({
|
|
2286
|
-
items: result.items.map((item) => {
|
|
2287
|
-
const parsedItem = ToolKitItemSchema.parse({
|
|
2288
|
-
name: item.name,
|
|
2289
|
-
slug: item.slug,
|
|
2290
|
-
meta: item.meta,
|
|
2291
|
-
isLocalToolkit: item.is_local_toolkit,
|
|
2292
|
-
authSchemes: item.auth_schemes,
|
|
2293
|
-
composioManagedAuthSchemes: item.composio_managed_auth_schemes,
|
|
2294
|
-
noAuth: item.no_auth
|
|
2646
|
+
try {
|
|
2647
|
+
const parsedQuery = ToolkitsListParamsSchema.safeParse(query);
|
|
2648
|
+
if (!parsedQuery.success) {
|
|
2649
|
+
throw new ValidationError("Failed to parse toolkit list query", {
|
|
2650
|
+
cause: parsedQuery.error
|
|
2295
2651
|
});
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2652
|
+
}
|
|
2653
|
+
const result = await this.client.toolkits.list({
|
|
2654
|
+
category: parsedQuery.data.category,
|
|
2655
|
+
is_local: parsedQuery.data.isLocal,
|
|
2656
|
+
managed_by: parsedQuery.data.managedBy,
|
|
2657
|
+
sort_by: parsedQuery.data.sortBy
|
|
2658
|
+
});
|
|
2659
|
+
const parsedResult = ToolKitListResponseSchema.safeParse({
|
|
2660
|
+
items: result.items.map((item) => {
|
|
2661
|
+
const parsedItem = ToolKitItemSchema.parse({
|
|
2662
|
+
name: item.name,
|
|
2663
|
+
slug: item.slug,
|
|
2664
|
+
meta: item.meta,
|
|
2665
|
+
isLocalToolkit: item.is_local_toolkit,
|
|
2666
|
+
authSchemes: item.auth_schemes,
|
|
2667
|
+
composioManagedAuthSchemes: item.composio_managed_auth_schemes,
|
|
2668
|
+
noAuth: item.no_auth
|
|
2669
|
+
});
|
|
2670
|
+
return parsedItem;
|
|
2671
|
+
}),
|
|
2672
|
+
nextCursor: result.next_cursor,
|
|
2673
|
+
totalPages: result.total_pages
|
|
2674
|
+
});
|
|
2675
|
+
if (!parsedResult.success) {
|
|
2676
|
+
throw new ValidationError("Failed to parse toolkit list response", {
|
|
2677
|
+
cause: parsedResult.error
|
|
2678
|
+
});
|
|
2679
|
+
}
|
|
2680
|
+
return parsedResult.data;
|
|
2681
|
+
} catch (error) {
|
|
2682
|
+
throw new ComposioToolkitFetchError("Failed to fetch toolkits", {
|
|
2683
|
+
cause: error
|
|
2684
|
+
});
|
|
2312
2685
|
}
|
|
2313
|
-
return this.getToolkits(arg);
|
|
2314
2686
|
}
|
|
2315
2687
|
/**
|
|
2316
2688
|
* Retrieves a specific toolkit by its slug identifier.
|
|
@@ -2328,7 +2700,7 @@ var Toolkits = class {
|
|
|
2328
2700
|
async getToolkitBySlug(slug) {
|
|
2329
2701
|
try {
|
|
2330
2702
|
const result = await this.client.toolkits.retrieve(slug);
|
|
2331
|
-
const parsedResult = ToolkitRetrieveResponseSchema.
|
|
2703
|
+
const parsedResult = ToolkitRetrieveResponseSchema.safeParse({
|
|
2332
2704
|
name: result.name,
|
|
2333
2705
|
slug: result.slug,
|
|
2334
2706
|
meta: {
|
|
@@ -2353,16 +2725,41 @@ var Toolkits = class {
|
|
|
2353
2725
|
}
|
|
2354
2726
|
}))
|
|
2355
2727
|
});
|
|
2356
|
-
|
|
2728
|
+
if (!parsedResult.success) {
|
|
2729
|
+
throw new ValidationError("Failed to parse toolkit response", {
|
|
2730
|
+
cause: parsedResult.error
|
|
2731
|
+
});
|
|
2732
|
+
}
|
|
2733
|
+
return parsedResult.data;
|
|
2357
2734
|
} catch (error) {
|
|
2358
|
-
if (error instanceof
|
|
2359
|
-
throw new
|
|
2735
|
+
if (error instanceof import_client4.default.NotFoundError) {
|
|
2736
|
+
throw new ComposioToolkitNotFoundError(`Toolkit with slug ${slug} not found`, {
|
|
2737
|
+
meta: {
|
|
2738
|
+
slug
|
|
2739
|
+
},
|
|
2740
|
+
cause: error
|
|
2741
|
+
});
|
|
2360
2742
|
}
|
|
2361
|
-
throw new
|
|
2362
|
-
|
|
2743
|
+
throw new ComposioToolkitFetchError(`Couldn't fetch Toolkit with slug: ${slug}`, {
|
|
2744
|
+
meta: {
|
|
2745
|
+
slug
|
|
2746
|
+
},
|
|
2747
|
+
cause: error
|
|
2363
2748
|
});
|
|
2364
2749
|
}
|
|
2365
2750
|
}
|
|
2751
|
+
/**
|
|
2752
|
+
* Implementation method that handles both overloads for retrieving toolkits.
|
|
2753
|
+
*
|
|
2754
|
+
* @param {string | ToolkitListParams} arg - Either a toolkit slug or query parameters
|
|
2755
|
+
* @returns {Promise<ToolkitRetrieveResponse | ToolKitListResponse>} The toolkit or list of toolkits
|
|
2756
|
+
*/
|
|
2757
|
+
async get(arg) {
|
|
2758
|
+
if (typeof arg === "string") {
|
|
2759
|
+
return this.getToolkitBySlug(arg);
|
|
2760
|
+
}
|
|
2761
|
+
return this.getToolkits(arg);
|
|
2762
|
+
}
|
|
2366
2763
|
/**
|
|
2367
2764
|
* Retrieves all toolkit categories available in the Composio SDK.
|
|
2368
2765
|
*
|
|
@@ -2410,7 +2807,7 @@ var Toolkits = class {
|
|
|
2410
2807
|
const composioAuthConfig = new AuthConfigs(this.client);
|
|
2411
2808
|
let authConfigIdToUse;
|
|
2412
2809
|
const authConfig = await composioAuthConfig.list({
|
|
2413
|
-
toolkitSlug
|
|
2810
|
+
toolkit: toolkitSlug
|
|
2414
2811
|
});
|
|
2415
2812
|
authConfigIdToUse = authConfig.items[0]?.id;
|
|
2416
2813
|
if (!authConfigIdToUse) {
|
|
@@ -2422,7 +2819,9 @@ var Toolkits = class {
|
|
|
2422
2819
|
authConfigIdToUse = authConfig2.id;
|
|
2423
2820
|
} else {
|
|
2424
2821
|
throw new ComposioAuthConfigNotFoundError("No auth config found for toolkit", {
|
|
2425
|
-
|
|
2822
|
+
meta: {
|
|
2823
|
+
toolkitSlug
|
|
2824
|
+
}
|
|
2426
2825
|
});
|
|
2427
2826
|
}
|
|
2428
2827
|
}
|
|
@@ -2682,6 +3081,7 @@ var userDataPath = () => {
|
|
|
2682
3081
|
const os = require("os");
|
|
2683
3082
|
return path.join(os.homedir(), COMPOSIO_DIR, USER_DATA_FILE_NAME);
|
|
2684
3083
|
} catch (_error) {
|
|
3084
|
+
logger_default.debug("Environment", `Unable to get user data path`);
|
|
2685
3085
|
return null;
|
|
2686
3086
|
}
|
|
2687
3087
|
};
|
|
@@ -2691,6 +3091,7 @@ var getUserDataJson = () => {
|
|
|
2691
3091
|
const data = fs.readFileSync(userDataPath(), "utf8");
|
|
2692
3092
|
return JSON.parse(data);
|
|
2693
3093
|
} catch (_error) {
|
|
3094
|
+
logger_default.debug("Environment", "No user data file found");
|
|
2694
3095
|
return {};
|
|
2695
3096
|
}
|
|
2696
3097
|
};
|
|
@@ -2699,6 +3100,13 @@ function getSDKConfig(baseUrl, apiKey) {
|
|
|
2699
3100
|
const { api_key: apiKeyFromUserConfig, base_url: baseURLFromUserConfig } = userData;
|
|
2700
3101
|
const baseURLParsed = baseUrl || getEnvVariable("COMPOSIO_BASE_URL") || baseURLFromUserConfig || DEFAULT_BASE_URL;
|
|
2701
3102
|
const apiKeyParsed = apiKey || getEnvVariable("COMPOSIO_API_KEY") || apiKeyFromUserConfig || "";
|
|
3103
|
+
if (!apiKeyParsed) {
|
|
3104
|
+
ComposioError.handle(new ComposioNoAPIKeyError(), {
|
|
3105
|
+
exitProcess: true
|
|
3106
|
+
});
|
|
3107
|
+
}
|
|
3108
|
+
logger_default.debug("Environment", `API Key: ${apiKeyParsed}`);
|
|
3109
|
+
logger_default.debug("Environment", `Base URL: ${baseURLParsed}`);
|
|
2702
3110
|
return { baseURL: baseURLParsed, apiKey: apiKeyParsed };
|
|
2703
3111
|
}
|
|
2704
3112
|
|
|
@@ -2932,13 +3340,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
2932
3340
|
};
|
|
2933
3341
|
|
|
2934
3342
|
// package.json
|
|
2935
|
-
var version = "0.1.12-alpha.
|
|
2936
|
-
|
|
2937
|
-
// src/utils/uuid.ts
|
|
2938
|
-
var import_uuid = require("uuid");
|
|
2939
|
-
function getRandomUUID() {
|
|
2940
|
-
return (0, import_uuid.v4)();
|
|
2941
|
-
}
|
|
3343
|
+
var version = "0.1.12-alpha.11";
|
|
2942
3344
|
|
|
2943
3345
|
// src/composio.ts
|
|
2944
3346
|
var Composio = class {
|
|
@@ -2978,18 +3380,18 @@ var Composio = class {
|
|
|
2978
3380
|
config?.apiKey
|
|
2979
3381
|
);
|
|
2980
3382
|
if (IS_DEVELOPMENT_OR_CI) {
|
|
2981
|
-
logger_default.
|
|
3383
|
+
logger_default.debug(`Initializing Composio w API Key: [REDACTED] and baseURL: ${baseURLParsed}`);
|
|
2982
3384
|
}
|
|
2983
|
-
this.client = new
|
|
3385
|
+
this.client = new import_client5.default({
|
|
2984
3386
|
apiKey: apiKeyParsed,
|
|
2985
3387
|
baseURL: baseURLParsed
|
|
2986
3388
|
});
|
|
2987
3389
|
this.config = {
|
|
2988
3390
|
...config,
|
|
2989
|
-
allowTracking: config
|
|
2990
|
-
allowTracing: config
|
|
3391
|
+
allowTracking: config?.allowTracking ?? true,
|
|
3392
|
+
allowTracing: config?.allowTracing ?? true
|
|
2991
3393
|
};
|
|
2992
|
-
this.provider = config
|
|
3394
|
+
this.provider = config?.provider ?? new OpenAIProvider();
|
|
2993
3395
|
this.tools = new Tools(this.client, this.provider);
|
|
2994
3396
|
this.toolkits = new Toolkits(this.client);
|
|
2995
3397
|
this.triggers = new Triggers(this.client);
|
|
@@ -3000,7 +3402,7 @@ var Composio = class {
|
|
|
3000
3402
|
{
|
|
3001
3403
|
apiKey: apiKeyParsed ?? "",
|
|
3002
3404
|
baseUrl: baseURLParsed ?? "",
|
|
3003
|
-
|
|
3405
|
+
frameworkRuntime: this.provider?.name || "unknown",
|
|
3004
3406
|
isAgentic: this.provider?._isAgentic || false,
|
|
3005
3407
|
source: "javascript",
|
|
3006
3408
|
version,
|
|
@@ -3011,7 +3413,7 @@ var Composio = class {
|
|
|
3011
3413
|
sessionId: this.config.allowTracing ? getRandomUUID() : void 0
|
|
3012
3414
|
// @TODO: get the session id
|
|
3013
3415
|
},
|
|
3014
|
-
config
|
|
3416
|
+
config?.telemetryTransport
|
|
3015
3417
|
);
|
|
3016
3418
|
}
|
|
3017
3419
|
telemetry.instrument(this);
|
|
@@ -3042,12 +3444,12 @@ var ComposioProvider = class extends BaseNonAgenticProvider {
|
|
|
3042
3444
|
};
|
|
3043
3445
|
|
|
3044
3446
|
// src/telemetry/TelemetryTransport.ts
|
|
3045
|
-
var
|
|
3447
|
+
var import_chalk4 = __toESM(require("chalk"), 1);
|
|
3046
3448
|
var BaseTelemetryTransport = class {
|
|
3047
3449
|
};
|
|
3048
3450
|
var ConsoleTelemetryTransport = class {
|
|
3049
3451
|
send(payload) {
|
|
3050
|
-
logger_default.debug(
|
|
3452
|
+
logger_default.debug(import_chalk4.default.yellow("telemetry"), JSON.stringify(payload, null, 2));
|
|
3051
3453
|
return Promise.resolve();
|
|
3052
3454
|
}
|
|
3053
3455
|
};
|
|
@@ -3162,15 +3564,38 @@ Examples: ${value.examples.join(", ")}` : "")
|
|
|
3162
3564
|
}
|
|
3163
3565
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3164
3566
|
0 && (module.exports = {
|
|
3567
|
+
AuthConfigErrorCodes,
|
|
3165
3568
|
AuthConfigTypes,
|
|
3166
3569
|
AuthSchemeTypes,
|
|
3167
3570
|
BaseAgenticProvider,
|
|
3168
3571
|
BaseNonAgenticProvider,
|
|
3169
3572
|
BaseTelemetryTransport,
|
|
3170
3573
|
Composio,
|
|
3574
|
+
ComposioAuthConfigNotFoundError,
|
|
3575
|
+
ComposioConnectedAccountNotFoundError,
|
|
3576
|
+
ComposioCustomToolsNotInitializedError,
|
|
3577
|
+
ComposioError,
|
|
3578
|
+
ComposioGlobalExecuteToolFnNotSetError,
|
|
3579
|
+
ComposioInvalidExecuteFunctionError,
|
|
3580
|
+
ComposioInvalidModifierError,
|
|
3581
|
+
ComposioNoAPIKeyError,
|
|
3171
3582
|
ComposioProvider,
|
|
3583
|
+
ComposioProviderNotDefinedError,
|
|
3584
|
+
ComposioToolExecutionError,
|
|
3585
|
+
ComposioToolNotFoundError,
|
|
3586
|
+
ComposioToolkitFetchError,
|
|
3587
|
+
ComposioToolkitNotFoundError,
|
|
3588
|
+
ConnectedAccountErrorCodes,
|
|
3589
|
+
ConnectionRequestErrorCodes,
|
|
3590
|
+
ConnectionRequestFailedError,
|
|
3591
|
+
ConnectionRequestTimeoutError,
|
|
3172
3592
|
ConsoleTelemetryTransport,
|
|
3173
3593
|
OpenAIProvider,
|
|
3594
|
+
SDKErrorCodes,
|
|
3595
|
+
ToolErrorCodes,
|
|
3174
3596
|
ToolListParamsSchema,
|
|
3597
|
+
ToolkitErrorCodes,
|
|
3598
|
+
ValidationError,
|
|
3599
|
+
ValidationErrorCodes,
|
|
3175
3600
|
jsonSchemaToModel
|
|
3176
3601
|
});
|