@composio/core 0.1.9-alpha.0 → 0.1.11-alpha.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.
- package/README.md +6 -6
- package/dist/index.cjs +200 -102
- package/dist/index.d.cts +151 -79
- package/dist/index.d.ts +151 -79
- package/dist/index.js +196 -98
- package/package.json +6 -5
- package/src/index.ts +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -251,11 +251,11 @@ interface ExecuteMetadata {
|
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
/**
|
|
254
|
-
* Base
|
|
255
|
-
* This class is used to create a base
|
|
256
|
-
* This class also extends InstrumentedInstance, so that the telemetry can be instrumented for the
|
|
254
|
+
* Base provider implementation, which needs to be implemented by the extended class.
|
|
255
|
+
* This class is used to create a base provider by implementing this class.
|
|
256
|
+
* This class also extends InstrumentedInstance, so that the telemetry can be instrumented for the provider.
|
|
257
257
|
*/
|
|
258
|
-
interface
|
|
258
|
+
interface Provider<TTool, TToolCollection> {
|
|
259
259
|
wrapTool: (tool: Tool) => TTool;
|
|
260
260
|
getTools: (params?: ToolListParams) => Promise<TToolCollection>;
|
|
261
261
|
}
|
|
@@ -264,8 +264,8 @@ type ExecuteToolFnOptions = {
|
|
|
264
264
|
customAuthParams?: CustomAuthParams;
|
|
265
265
|
};
|
|
266
266
|
/**
|
|
267
|
-
* This type is used to infer the wrapped tool type from the
|
|
268
|
-
* It checks if the
|
|
267
|
+
* This type is used to infer the wrapped tool type from the provider.
|
|
268
|
+
* It checks if the provider has a method `_wrapTool` and infers the return type.
|
|
269
269
|
*/
|
|
270
270
|
type ExecuteToolFn = (toolSlug: string, input: Record<string, unknown>) => Promise<ToolExecuteResponse>;
|
|
271
271
|
type GlobalExecuteToolFn = (slug: string, body: ToolExecuteParams, modifiers?: ExecuteToolModifiers) => Promise<ToolExecuteResponse>;
|
|
@@ -273,19 +273,19 @@ type GlobalExecuteToolFn = (slug: string, body: ToolExecuteParams, modifiers?: E
|
|
|
273
273
|
/**
|
|
274
274
|
* @internal
|
|
275
275
|
* Base class for all toolsets.
|
|
276
|
-
* This class is not meant to be used directly, but rather to be extended by different
|
|
276
|
+
* This class is not meant to be used directly, but rather to be extended by different provider implementations.
|
|
277
277
|
*/
|
|
278
|
-
declare abstract class
|
|
278
|
+
declare abstract class BaseProvider {
|
|
279
279
|
/**
|
|
280
280
|
* @public
|
|
281
|
-
* The name of the
|
|
282
|
-
* Used to identify the
|
|
281
|
+
* The name of the provider.
|
|
282
|
+
* Used to identify the provider in the telemetry.
|
|
283
283
|
*/
|
|
284
284
|
abstract readonly name: string;
|
|
285
285
|
/**
|
|
286
286
|
* @internal
|
|
287
|
-
* Whether the
|
|
288
|
-
* This is set automatically set by the core SDK implementation for different
|
|
287
|
+
* Whether the provider is agentic.
|
|
288
|
+
* This is set automatically set by the core SDK implementation for different provider types.
|
|
289
289
|
*/
|
|
290
290
|
abstract readonly _isAgentic: boolean;
|
|
291
291
|
/**
|
|
@@ -297,13 +297,13 @@ declare abstract class BaseToolset {
|
|
|
297
297
|
/**
|
|
298
298
|
* @internal
|
|
299
299
|
* Set the function to execute a tool.
|
|
300
|
-
* This is set automatically injected by the core SDK.
|
|
300
|
+
* This is set automatically and injected by the core SDK.
|
|
301
301
|
*/
|
|
302
302
|
_setExecuteToolFn(executeToolFn: GlobalExecuteToolFn): void;
|
|
303
303
|
/**
|
|
304
304
|
* @public
|
|
305
305
|
* Gloabl function to execute a tool.
|
|
306
|
-
* This function is used by
|
|
306
|
+
* This function is used by provider providers to implement helper functions to execute tools.
|
|
307
307
|
* This is a 1:1 mapping of the `execute` method in the `Tools` class.
|
|
308
308
|
* @param {string} toolSlug - The slug of the tool to execute.
|
|
309
309
|
* @param {Record<string, unknown>} input - The input to the tool.
|
|
@@ -314,9 +314,9 @@ declare abstract class BaseToolset {
|
|
|
314
314
|
/**
|
|
315
315
|
* @public
|
|
316
316
|
* Base class for all non-agentic toolsets.
|
|
317
|
-
* This class is not meant to be used directly, but rather to be extended by concrete
|
|
317
|
+
* This class is not meant to be used directly, but rather to be extended by concrete provider implementations.
|
|
318
318
|
*/
|
|
319
|
-
declare abstract class
|
|
319
|
+
declare abstract class BaseNonAgenticProvider<TToolCollection, TTool> extends BaseProvider {
|
|
320
320
|
readonly _isAgentic = false;
|
|
321
321
|
/**
|
|
322
322
|
* Wrap a tool in the provider specific format.
|
|
@@ -334,9 +334,9 @@ declare abstract class BaseNonAgenticToolset<TToolCollection, TTool> extends Bas
|
|
|
334
334
|
/**
|
|
335
335
|
* @public
|
|
336
336
|
* Base class for all agentic toolsets.
|
|
337
|
-
* This class is not meant to be used directly, but rather to be extended by concrete
|
|
337
|
+
* This class is not meant to be used directly, but rather to be extended by concrete provider implementations.
|
|
338
338
|
*/
|
|
339
|
-
declare abstract class
|
|
339
|
+
declare abstract class BaseAgenticProvider<TToolCollection, TTool> extends BaseProvider {
|
|
340
340
|
readonly _isAgentic = true;
|
|
341
341
|
/**
|
|
342
342
|
* Wrap a tool in the provider specific format.
|
|
@@ -354,9 +354,9 @@ declare abstract class BaseAgenticToolset<TToolCollection, TTool> extends BaseTo
|
|
|
354
354
|
/**
|
|
355
355
|
* @internal
|
|
356
356
|
* Base type for all toolsets.
|
|
357
|
-
* This type is used to infer the type of the
|
|
357
|
+
* This type is used to infer the type of the provider from the provider implementation.
|
|
358
358
|
*/
|
|
359
|
-
type
|
|
359
|
+
type BaseComposioProvider<TToolCollection, TTool> = BaseNonAgenticProvider<TToolCollection, TTool> | BaseAgenticProvider<TToolCollection, TTool>;
|
|
360
360
|
|
|
361
361
|
/**
|
|
362
362
|
* Modifier for altering the tool execute params
|
|
@@ -400,17 +400,17 @@ type ExecuteToolModifiers = {
|
|
|
400
400
|
* Agentic tool options. These are used by Agentic toolsets
|
|
401
401
|
*/
|
|
402
402
|
type AgenticToolOptions = ToolOptions & ExecuteToolModifiers;
|
|
403
|
-
type
|
|
403
|
+
type ProviderOptions<T extends BaseComposioProvider<unknown, unknown>> = T extends BaseAgenticProvider<unknown, unknown> ? AgenticToolOptions : ToolOptions;
|
|
404
404
|
|
|
405
405
|
/**
|
|
406
406
|
* This class is used to manage tools in the Composio SDK.
|
|
407
407
|
* It provides methods to list, get, and execute tools.
|
|
408
408
|
*/
|
|
409
|
-
declare class Tools<TToolCollection, TTool,
|
|
409
|
+
declare class Tools<TToolCollection, TTool, TProvider extends BaseComposioProvider<TToolCollection, TTool>> {
|
|
410
410
|
private client;
|
|
411
411
|
private readonly customTools;
|
|
412
|
-
private
|
|
413
|
-
constructor(client: ComposioClient,
|
|
412
|
+
private provider;
|
|
413
|
+
constructor(client: ComposioClient, provider: TProvider);
|
|
414
414
|
/**
|
|
415
415
|
* Transform the tool cases
|
|
416
416
|
* @param {ToolRetrieveResponse | ComposioToolListResponse['items'][0]} tool - The tool to transform
|
|
@@ -439,19 +439,51 @@ declare class Tools<TToolCollection, TTool, TToolset extends BaseComposioToolset
|
|
|
439
439
|
private getConnectedAccountIdForTool;
|
|
440
440
|
/**
|
|
441
441
|
* Lists all tools available in the Composio SDK as well as custom tools.
|
|
442
|
-
* This method fetches the tools from the Composio API and wraps them using the
|
|
442
|
+
* This method fetches the tools from the Composio API and wraps them using the provider.
|
|
443
443
|
* @returns {ToolList} List of tools
|
|
444
444
|
*/
|
|
445
|
-
|
|
445
|
+
getRawComposioTools(userId: string, query?: ToolListParams, modifier?: TransformToolSchemaModifier): Promise<ToolList>;
|
|
446
446
|
/**
|
|
447
447
|
* Retrieves a tool by its Slug.
|
|
448
448
|
* @param slug The ID of the tool to be retrieved
|
|
449
449
|
* @returns {Promise<Tool>} The tool
|
|
450
|
+
*
|
|
451
|
+
* @example
|
|
452
|
+
* ```ts
|
|
453
|
+
* const tool = await composio.tools.getRawComposioToolBySlug('default', 'github');
|
|
454
|
+
* ```
|
|
450
455
|
*/
|
|
451
|
-
|
|
452
|
-
get<T extends TToolset>(userId: string, slug: string, options?: ToolsetOptions<TToolset>): Promise<ReturnType<T['wrapTool']>>;
|
|
453
|
-
get<T extends TToolset>(userId: string, filters: ToolListParams, options?: ToolsetOptions<TToolset>): Promise<ReturnType<T['wrapTools']>>;
|
|
456
|
+
getRawComposioToolBySlug(userId: string, slug: string, modifier?: TransformToolSchemaModifier): Promise<Tool>;
|
|
454
457
|
/**
|
|
458
|
+
* Get a tool by its slug
|
|
459
|
+
* @param userId - The user id
|
|
460
|
+
* @param slug - The slug of the tool
|
|
461
|
+
* @param options - The options for the tool
|
|
462
|
+
* @returns The tool
|
|
463
|
+
*
|
|
464
|
+
* @example
|
|
465
|
+
* ```ts
|
|
466
|
+
* const tool = await composio.tools.get('default', 'github');
|
|
467
|
+
* ```
|
|
468
|
+
*/
|
|
469
|
+
get<T extends TProvider>(userId: string, slug: string, options?: ProviderOptions<TProvider>): Promise<ReturnType<T['wrapTool']>>;
|
|
470
|
+
/**
|
|
471
|
+
* Get a list of tools by their slugs
|
|
472
|
+
* @param userId - The user id
|
|
473
|
+
* @param filters - The filters for the tools
|
|
474
|
+
* @param options - The options for the tools
|
|
475
|
+
* @returns The tools
|
|
476
|
+
*
|
|
477
|
+
* @example
|
|
478
|
+
* ```ts
|
|
479
|
+
* const tools = await composio.tools.get('default', {
|
|
480
|
+
* tools: ['github'],
|
|
481
|
+
* });
|
|
482
|
+
* ```
|
|
483
|
+
*/
|
|
484
|
+
get<T extends TProvider>(userId: string, filters: ToolListParams, options?: ProviderOptions<TProvider>): Promise<ReturnType<T['wrapTools']>>;
|
|
485
|
+
/**
|
|
486
|
+
* @internal
|
|
455
487
|
* Creates a function that executes a tool.
|
|
456
488
|
* This function is used by agentic the toolsets to execute the tool
|
|
457
489
|
* @param {string} userId - The user id
|
|
@@ -459,7 +491,23 @@ declare class Tools<TToolCollection, TTool, TToolset extends BaseComposioToolset
|
|
|
459
491
|
* @returns {ExecuteToolFn} The execute tool function
|
|
460
492
|
*/
|
|
461
493
|
private createExecuteToolFn;
|
|
494
|
+
/**
|
|
495
|
+
* @internal
|
|
496
|
+
* Handles the execution of a custom tool
|
|
497
|
+
* @param tool - The tool to execute
|
|
498
|
+
* @param body - The body of the tool execution
|
|
499
|
+
* @param modifiers - The modifiers to be applied to the tool execution
|
|
500
|
+
* @returns The response from the tool execution
|
|
501
|
+
*/
|
|
462
502
|
private handleCustomToolExecution;
|
|
503
|
+
/**
|
|
504
|
+
* @internal
|
|
505
|
+
* Handles the execution of a composio tool
|
|
506
|
+
* @param tool - The tool to execute
|
|
507
|
+
* @param body - The body of the tool execution
|
|
508
|
+
* @param modifiers - The modifiers to be applied to the tool execution
|
|
509
|
+
* @returns The response from the tool execution
|
|
510
|
+
*/
|
|
463
511
|
private handleComposioToolExecution;
|
|
464
512
|
/**
|
|
465
513
|
* Exectes a given tool with the provided parameters.
|
|
@@ -506,17 +554,17 @@ declare class Tools<TToolCollection, TTool, TToolset extends BaseComposioToolset
|
|
|
506
554
|
declare const ToolkitsListParamsSchema: z.ZodObject<{
|
|
507
555
|
category: z.ZodOptional<z.ZodString>;
|
|
508
556
|
isLocal: z.ZodOptional<z.ZodBoolean>;
|
|
509
|
-
managedBy: z.ZodOptional<z.ZodEnum<["all", "
|
|
557
|
+
managedBy: z.ZodOptional<z.ZodEnum<["all", "composio", "project"]>>;
|
|
510
558
|
sortBy: z.ZodOptional<z.ZodEnum<["usage", "alphabetically"]>>;
|
|
511
559
|
}, "strip", z.ZodTypeAny, {
|
|
512
560
|
category?: string | undefined;
|
|
513
561
|
isLocal?: boolean | undefined;
|
|
514
|
-
managedBy?: "all" | "
|
|
562
|
+
managedBy?: "all" | "composio" | "project" | undefined;
|
|
515
563
|
sortBy?: "usage" | "alphabetically" | undefined;
|
|
516
564
|
}, {
|
|
517
565
|
category?: string | undefined;
|
|
518
566
|
isLocal?: boolean | undefined;
|
|
519
|
-
managedBy?: "all" | "
|
|
567
|
+
managedBy?: "all" | "composio" | "project" | undefined;
|
|
520
568
|
sortBy?: "usage" | "alphabetically" | undefined;
|
|
521
569
|
}>;
|
|
522
570
|
type ToolkitListParams = z.infer<typeof ToolkitsListParamsSchema>;
|
|
@@ -895,13 +943,13 @@ declare const ToolkitRetrieveResponseSchema: z.ZodObject<{
|
|
|
895
943
|
}[];
|
|
896
944
|
};
|
|
897
945
|
}>;
|
|
898
|
-
proxy: z.ZodObject<{
|
|
899
|
-
baseUrl: z.ZodString
|
|
946
|
+
proxy: z.ZodOptional<z.ZodObject<{
|
|
947
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
900
948
|
}, "strip", z.ZodTypeAny, {
|
|
901
|
-
baseUrl
|
|
949
|
+
baseUrl?: string | undefined;
|
|
902
950
|
}, {
|
|
903
|
-
baseUrl
|
|
904
|
-
}
|
|
951
|
+
baseUrl?: string | undefined;
|
|
952
|
+
}>>;
|
|
905
953
|
}, "strip", z.ZodTypeAny, {
|
|
906
954
|
name: string;
|
|
907
955
|
mode: string;
|
|
@@ -935,9 +983,9 @@ declare const ToolkitRetrieveResponseSchema: z.ZodObject<{
|
|
|
935
983
|
}[];
|
|
936
984
|
};
|
|
937
985
|
};
|
|
938
|
-
proxy
|
|
939
|
-
baseUrl
|
|
940
|
-
};
|
|
986
|
+
proxy?: {
|
|
987
|
+
baseUrl?: string | undefined;
|
|
988
|
+
} | undefined;
|
|
941
989
|
}, {
|
|
942
990
|
name: string;
|
|
943
991
|
mode: string;
|
|
@@ -971,9 +1019,9 @@ declare const ToolkitRetrieveResponseSchema: z.ZodObject<{
|
|
|
971
1019
|
}[];
|
|
972
1020
|
};
|
|
973
1021
|
};
|
|
974
|
-
proxy
|
|
975
|
-
baseUrl
|
|
976
|
-
};
|
|
1022
|
+
proxy?: {
|
|
1023
|
+
baseUrl?: string | undefined;
|
|
1024
|
+
} | undefined;
|
|
977
1025
|
}>, "many">>;
|
|
978
1026
|
}, "strip", z.ZodTypeAny, {
|
|
979
1027
|
slug: string;
|
|
@@ -1026,9 +1074,9 @@ declare const ToolkitRetrieveResponseSchema: z.ZodObject<{
|
|
|
1026
1074
|
}[];
|
|
1027
1075
|
};
|
|
1028
1076
|
};
|
|
1029
|
-
proxy
|
|
1030
|
-
baseUrl
|
|
1031
|
-
};
|
|
1077
|
+
proxy?: {
|
|
1078
|
+
baseUrl?: string | undefined;
|
|
1079
|
+
} | undefined;
|
|
1032
1080
|
}[] | undefined;
|
|
1033
1081
|
}, {
|
|
1034
1082
|
slug: string;
|
|
@@ -1081,9 +1129,9 @@ declare const ToolkitRetrieveResponseSchema: z.ZodObject<{
|
|
|
1081
1129
|
}[];
|
|
1082
1130
|
};
|
|
1083
1131
|
};
|
|
1084
|
-
proxy
|
|
1085
|
-
baseUrl
|
|
1086
|
-
};
|
|
1132
|
+
proxy?: {
|
|
1133
|
+
baseUrl?: string | undefined;
|
|
1134
|
+
} | undefined;
|
|
1087
1135
|
}[] | undefined;
|
|
1088
1136
|
}>;
|
|
1089
1137
|
type ToolkitRetrieveResponse = z.infer<typeof ToolkitRetrieveResponseSchema>;
|
|
@@ -1123,7 +1171,7 @@ type ToolkitRetrieveCategoriesResponse = z.infer<typeof ToolkitRetrieveCategorie
|
|
|
1123
1171
|
declare const ConnectedAccountStatuses: {
|
|
1124
1172
|
readonly ACTIVE: "ACTIVE";
|
|
1125
1173
|
readonly INACTIVE: "INACTIVE";
|
|
1126
|
-
readonly
|
|
1174
|
+
readonly DELETED: "DELETED";
|
|
1127
1175
|
readonly INITIATED: "INITIATED";
|
|
1128
1176
|
readonly EXPIRED: "EXPIRED";
|
|
1129
1177
|
readonly FAILED: "FAILED";
|
|
@@ -1298,7 +1346,7 @@ declare class Toolkits {
|
|
|
1298
1346
|
* @param {string} authConfigId - The id of the auth config to use
|
|
1299
1347
|
* @returns {Promise<ConnectionRequest>} The connection request object
|
|
1300
1348
|
*/
|
|
1301
|
-
authorize(userId: string, toolkitSlug: string
|
|
1349
|
+
authorize(userId: string, toolkitSlug: string): Promise<ConnectionRequest>;
|
|
1302
1350
|
}
|
|
1303
1351
|
|
|
1304
1352
|
type TriggerStatusEnum = "enable" | "disable";
|
|
@@ -1692,13 +1740,31 @@ declare const AuthConfigListResponseSchema: z.ZodObject<{
|
|
|
1692
1740
|
nextCursor?: string | undefined;
|
|
1693
1741
|
}>;
|
|
1694
1742
|
type AuthConfigListResponse = z.infer<typeof AuthConfigListResponseSchema>;
|
|
1695
|
-
declare const AuthConfigUpdateParamsSchema: z.ZodObject<{
|
|
1696
|
-
credentials: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.
|
|
1743
|
+
declare const AuthConfigUpdateParamsSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
1744
|
+
credentials: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodUnknown]>>;
|
|
1745
|
+
type: z.ZodLiteral<"custom">;
|
|
1746
|
+
restrictToFollowingTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1697
1747
|
}, "strip", z.ZodTypeAny, {
|
|
1698
|
-
|
|
1748
|
+
type: "custom";
|
|
1749
|
+
credentials: Record<string, unknown>;
|
|
1750
|
+
restrictToFollowingTools?: string[] | undefined;
|
|
1699
1751
|
}, {
|
|
1700
|
-
|
|
1701
|
-
|
|
1752
|
+
type: "custom";
|
|
1753
|
+
credentials: Record<string, unknown>;
|
|
1754
|
+
restrictToFollowingTools?: string[] | undefined;
|
|
1755
|
+
}>, z.ZodObject<{
|
|
1756
|
+
scopes: z.ZodString;
|
|
1757
|
+
type: z.ZodLiteral<"default">;
|
|
1758
|
+
restrictToFollowingTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1759
|
+
}, "strip", z.ZodTypeAny, {
|
|
1760
|
+
type: "default";
|
|
1761
|
+
scopes: string;
|
|
1762
|
+
restrictToFollowingTools?: string[] | undefined;
|
|
1763
|
+
}, {
|
|
1764
|
+
type: "default";
|
|
1765
|
+
scopes: string;
|
|
1766
|
+
restrictToFollowingTools?: string[] | undefined;
|
|
1767
|
+
}>]>;
|
|
1702
1768
|
type AuthConfigUpdateParams = z.infer<typeof AuthConfigUpdateParamsSchema>;
|
|
1703
1769
|
|
|
1704
1770
|
/**
|
|
@@ -1718,6 +1784,12 @@ type AuthConfigUpdateParams = z.infer<typeof AuthConfigUpdateParamsSchema>;
|
|
|
1718
1784
|
declare class AuthConfigs {
|
|
1719
1785
|
private client;
|
|
1720
1786
|
constructor(client: ComposioClient);
|
|
1787
|
+
/**
|
|
1788
|
+
* Protected getter for the client instance.
|
|
1789
|
+
* This is primarily used for testing purposes.
|
|
1790
|
+
* @protected
|
|
1791
|
+
*/
|
|
1792
|
+
protected getClient(): ComposioClient;
|
|
1721
1793
|
private parseAuthConfigRetrieveResponse;
|
|
1722
1794
|
/**
|
|
1723
1795
|
* List all auth configs
|
|
@@ -1901,17 +1973,17 @@ declare abstract class BaseTelemetryTransport {
|
|
|
1901
1973
|
* Author: Musthaq Ahamad <musthaq@composio.dev>
|
|
1902
1974
|
* Legacy Reference: https://github.com/ComposioHQ/composio/blob/master/js/src/toolsets/openai.ts
|
|
1903
1975
|
*
|
|
1904
|
-
* This is a default
|
|
1976
|
+
* This is a default provider for Composio SDK.
|
|
1905
1977
|
* This will be shipped with the SDK and users don't need to install it separately.
|
|
1906
1978
|
*/
|
|
1907
1979
|
|
|
1908
1980
|
type OpenAiTool = OpenAI.ChatCompletionTool;
|
|
1909
1981
|
type OpenAiToolCollection = Array<OpenAiTool>;
|
|
1910
|
-
declare class
|
|
1982
|
+
declare class OpenAIProvider extends BaseNonAgenticProvider<OpenAiToolCollection, OpenAiTool> {
|
|
1911
1983
|
readonly name = "openai";
|
|
1912
1984
|
/**
|
|
1913
|
-
* Absract method to wrap a tool in the
|
|
1914
|
-
* This method is implemented by the
|
|
1985
|
+
* Absract method to wrap a tool in the provider.
|
|
1986
|
+
* This method is implemented by the provider.
|
|
1915
1987
|
* @param tool - The tool to wrap.
|
|
1916
1988
|
* @returns The wrapped tool.
|
|
1917
1989
|
*/
|
|
@@ -1962,19 +2034,19 @@ declare class OpenAIToolset extends BaseNonAgenticToolset<OpenAiToolCollection,
|
|
|
1962
2034
|
waitAndHandleAssistantToolCalls(userId: string, client: OpenAI, run: OpenAI.Beta.Threads.Run, thread: OpenAI.Beta.Threads.Thread, options?: ExecuteToolFnOptions, modifiers?: ExecuteToolModifiers): Promise<OpenAI.Beta.Threads.Runs.Run>;
|
|
1963
2035
|
}
|
|
1964
2036
|
|
|
1965
|
-
type ComposioConfig<
|
|
2037
|
+
type ComposioConfig<TProvider extends BaseComposioProvider<unknown, unknown> = OpenAIProvider> = {
|
|
1966
2038
|
apiKey?: string;
|
|
1967
2039
|
baseURL?: string;
|
|
1968
2040
|
allowTracking?: boolean;
|
|
1969
2041
|
allowTracing?: boolean;
|
|
1970
|
-
|
|
2042
|
+
provider?: TProvider;
|
|
1971
2043
|
telemetryTransport?: BaseTelemetryTransport;
|
|
1972
2044
|
};
|
|
1973
2045
|
/**
|
|
1974
2046
|
* This is the core class for Composio.
|
|
1975
2047
|
* It is used to initialize the Composio SDK and provide a global configuration.
|
|
1976
2048
|
*/
|
|
1977
|
-
declare class Composio<
|
|
2049
|
+
declare class Composio<TProvider extends BaseComposioProvider<unknown, unknown> = OpenAIProvider> {
|
|
1978
2050
|
/**
|
|
1979
2051
|
* The Composio API client.
|
|
1980
2052
|
* @type {ComposioClient}
|
|
@@ -1982,17 +2054,17 @@ declare class Composio<TToolset extends BaseComposioToolset<unknown, unknown> =
|
|
|
1982
2054
|
private client;
|
|
1983
2055
|
/**
|
|
1984
2056
|
* The configuration for the Composio SDK.
|
|
1985
|
-
* @type {ComposioConfig<
|
|
2057
|
+
* @type {ComposioConfig<TProvider>}
|
|
1986
2058
|
*/
|
|
1987
2059
|
private config;
|
|
1988
2060
|
private telemetry;
|
|
1989
2061
|
/**
|
|
1990
2062
|
* Core models for Composio.
|
|
1991
2063
|
*/
|
|
1992
|
-
tools: Tools<unknown, unknown,
|
|
2064
|
+
tools: Tools<unknown, unknown, TProvider>;
|
|
1993
2065
|
toolkits: Toolkits;
|
|
1994
2066
|
triggers: Triggers;
|
|
1995
|
-
|
|
2067
|
+
provider: TProvider;
|
|
1996
2068
|
authConfigs: AuthConfigs;
|
|
1997
2069
|
createAuthConfig: AuthConfigs['create'];
|
|
1998
2070
|
connectedAccounts: ConnectedAccounts;
|
|
@@ -2004,9 +2076,9 @@ declare class Composio<TToolset extends BaseComposioToolset<unknown, unknown> =
|
|
|
2004
2076
|
* @param {string} config.runtime The runtime for the Composio SDK.
|
|
2005
2077
|
* @param {boolean} config.allowTracking Whether to allow analytics / tracking. Defaults to true.
|
|
2006
2078
|
* @param {boolean} config.allowTracing Whether to allow tracing. Defaults to true.
|
|
2007
|
-
* @param {
|
|
2079
|
+
* @param {TProvider} config.provider The provider to use for this Composio instance.
|
|
2008
2080
|
*/
|
|
2009
|
-
constructor(config: ComposioConfig<
|
|
2081
|
+
constructor(config: ComposioConfig<TProvider>);
|
|
2010
2082
|
/**
|
|
2011
2083
|
* Initialize the instrumentations and telemetry for the Composio SDK.
|
|
2012
2084
|
* @param {TelemetryMetadata} config - The configuration for the telemetry.
|
|
@@ -2021,34 +2093,34 @@ declare class Composio<TToolset extends BaseComposioToolset<unknown, unknown> =
|
|
|
2021
2093
|
/**
|
|
2022
2094
|
* Fetch all the tools from Composio.
|
|
2023
2095
|
* @param {ToolListParams} params Parameters to fetch the tools.
|
|
2024
|
-
* @param {
|
|
2025
|
-
* @returns {Promise<ReturnType<
|
|
2096
|
+
* @param {ProviderOptions<TProvider>} modifiers Modifiers to apply to the tools.
|
|
2097
|
+
* @returns {Promise<ReturnType<TProvider['getTools']>>} The tools from the provider.
|
|
2026
2098
|
*/
|
|
2027
|
-
getTools<T extends
|
|
2099
|
+
getTools<T extends TProvider>(userId: string, filters: ToolListParams, modifiers?: ProviderOptions<T>): Promise<ReturnType<T['wrapTools']>>;
|
|
2028
2100
|
/**
|
|
2029
2101
|
* Fetch a tool from Composio by its slug.
|
|
2030
2102
|
* @param {string} slug slug of the tool
|
|
2031
|
-
* @param {
|
|
2032
|
-
* @returns {Promise<ReturnType<
|
|
2103
|
+
* @param {ProviderOptions<TProvider>} modifiers to be applied to the tool
|
|
2104
|
+
* @returns {Promise<ReturnType<TProvider['getToolBySlug']>>} The tool from the provider.
|
|
2033
2105
|
*/
|
|
2034
|
-
getToolBySlug<T extends
|
|
2106
|
+
getToolBySlug<T extends TProvider>(userId: string, slug: string, modifiers?: ProviderOptions<T>): Promise<ReturnType<T['wrapTool']>>;
|
|
2035
2107
|
}
|
|
2036
2108
|
|
|
2037
2109
|
/**
|
|
2038
|
-
* This is a default
|
|
2039
|
-
* This class is used as a default
|
|
2110
|
+
* This is a default provider implementation for Composio.
|
|
2111
|
+
* This class is used as a default provider for Composio, if the user does not provide a provider.
|
|
2040
2112
|
*
|
|
2041
2113
|
* This class shouldn't be used directly or to be extended.
|
|
2042
2114
|
*/
|
|
2043
2115
|
interface CustomTool {
|
|
2044
2116
|
name: string;
|
|
2045
2117
|
}
|
|
2046
|
-
declare class
|
|
2047
|
-
readonly name = "
|
|
2118
|
+
declare class ComposioProvider extends BaseNonAgenticProvider<Array<CustomTool>, CustomTool> {
|
|
2119
|
+
readonly name = "ComposioProvider";
|
|
2048
2120
|
wrapTool: (tool: Tool) => CustomTool;
|
|
2049
2121
|
wrapTools(tools: Tool[]): CustomTool[];
|
|
2050
2122
|
}
|
|
2051
2123
|
|
|
2052
2124
|
declare function jsonSchemaToModel(jsonSchema: Record<string, unknown>): z.ZodObject<Record<string, z.ZodTypeAny>>;
|
|
2053
2125
|
|
|
2054
|
-
export { type AfterToolExecuteModifier, type AgenticToolOptions, type AuthConfigType, AuthConfigTypes, type AuthSchemeType, AuthSchemeTypes,
|
|
2126
|
+
export { type AfterToolExecuteModifier, type AgenticToolOptions, type AuthConfigType, AuthConfigTypes, type AuthSchemeType, AuthSchemeTypes, BaseAgenticProvider, type BaseComposioProvider, BaseNonAgenticProvider, BaseTelemetryTransport, type BeforeToolExecuteModifier, Composio, ComposioProvider, type ExecuteMetadata, type ExecuteToolFn, type ExecuteToolFnOptions, type ExecuteToolModifiers, OpenAIProvider, type Provider, type Tool, type ToolExecuteParams, type ToolListParams, ToolListParamsSchema, type ToolOptions, type TransformToolSchemaModifier, jsonSchemaToModel };
|