Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
Implement core models for the library
haxzie5a926cde6d72
diff --git a/README.md b/README.mdnew file mode 100644index 000000000..74f2cc83a--- /dev/null+++ b/README.md@@ -0,0 +1,22 @@+# @composio/core++The core Composio SDK which allows users to interact with the Composio Platform.++## Core Features++- **Tools**: Manage and execute tools within the Composio ecosystem. Includes functionality to list, retrieve, and execute tools.+- **Toolkits**: Organize and manage collections of tools for specific use cases.+- **Triggers**: Create and manage event triggers that can execute tools based on specific conditions. Includes support for different trigger types and status management.+- **AuthConfigs**: Configure authentication providers and settings. Manage auth configs with features to create, update, enable/disable, and delete configurations.+- **ConnectedAccounts**: Manage third-party service connections. Includes functionality to create, list, refresh, and manage the status of connected accounts.+- **ActionExecution**: Track and manage the execution of actions within the platform.++## Internal+What's not included from @composio/client+- Action Execution+- Org/Project Mangement with API Keys+- CLI+- MCP+- Team Members++These models can be still be accessed via the SDK explicitly by using the `@composio/client`.\ No newline at end of filediff --git a/packages/core/src/composio.ts b/packages/core/src/composio.tsindex b50ec4469..ae37ccb88 100644--- a/packages/core/src/composio.ts+++ b/packages/core/src/composio.ts@@ -2,10 +2,12 @@ import ComposioClient from "@composio/client";import { Tools } from "./models/Tools";import { Toolkits } from "./models/Toolkits";import { Triggers } from "./models/Triggers";-import { Org } from "./models/Org";import { ComposioToolset } from "./toolset/ComposioToolset";-import { Toolset } from "./types/Toolset.types.";-import { Tool } from "./types/Tool.types";+import { Toolset, WrappedTool } from "./types/toolset.types.";+import { Tool } from "./types/tool.types";+import { AuthConfigs } from "./models/AuthConfigs";+import { ConnectedAccounts } from "./models/ConnectedAccounts";+import { ActionExecutions } from "./models/ActionExecution";export type ComposioConfig<TTool extends Tool,@@ -38,8 +40,10 @@ export class Composio<TTool extends Tool, TToolset extends Toolset<TTool>> {tools: Tools<TTool, TToolset>;toolkits: Toolkits;triggers: Triggers;- org: Org;toolset: TToolset;+ authConfigs: AuthConfigs;+ connectedAccounts: ConnectedAccounts;+ ActionExecution: ActionExecutions;/*** @param {Object} config Configuration for the Composio SDK.@@ -58,21 +62,36 @@ export class Composio<TTool extends Tool, TToolset extends Toolset<TTool>> {allowTracing?: boolean;toolset?: TToolset;}) {+ /**+ * Initialize the Composio SDK client.+ * The client is used to make API calls to the Composio API.+ */this.client = new ComposioClient({apiKey: config.apiKey,baseURL: config.baseURL,});+ /**+ * Keep a reference to the config object.+ * This is useful for creating a builder pattern, debugging and logging.+ */this.config = config;+ /**+ * Set the default toolset, if not provided by the user.+ */const defaultToolset = new ComposioToolset();this.toolset = config.toolset ?? (defaultToolset as unknown as TToolset);- // Initialize models+ /**+ * Initialize all the models with composio client.+ */this.tools = new Tools(this.client, this.toolset);this.toolkits = new Toolkits(this.client);this.triggers = new Triggers(this.client);- this.org = new Org(this.client);+ this.authConfigs = new AuthConfigs(this.client);+ this.connectedAccounts = new ConnectedAccounts(this.client);+ this.ActionExecution = new ActionExecutions(this.client);}/**@@ -92,10 +111,12 @@ export class Composio<TTool extends Tool, TToolset extends Toolset<TTool>> {* Generic function to get all the tools* @returns {Promise<T[]>} Promise with list of tools*/- getTools(): Promise<TTool[]> {- console.log("Tools");- return Promise.resolve([]);- // return this.tools.get();+ getTool(id: string): Promise<WrappedTool<TToolset>> {+ return this.tools.get(id);+ }++ getTools(): Promise<WrappedTool<TToolset>[]> {+ return this.tools.list();}getEntity(): Promise<void> {diff --git a/packages/core/src/index.ts b/packages/core/src/index.tsindex 62b6cdfd0..e44a9f7f5 100644--- a/packages/core/src/index.ts+++ b/packages/core/src/index.ts@@ -1,7 +1,7 @@import { Composio } from "./composio";import type { ComposioToolset } from "./toolset/ComposioToolset";import type { BaseComposioToolset } from "./toolset/BaseToolset";-import type { Tool } from "./types/Tool.types";-import type { Toolset } from "./types/Toolset.types.";+import type { Tool } from "./types/tool.types";+import type { Toolset } from "./types/toolset.types.";export { Composio, ComposioToolset, BaseComposioToolset, Tool, Toolset };diff --git a/packages/core/src/models/AuthConfigs.ts b/packages/core/src/models/AuthConfigs.tsnew file mode 100644index 000000000..eebfc990d--- /dev/null+++ b/packages/core/src/models/AuthConfigs.ts@@ -0,0 +1,136 @@+import ComposioSDK from "@composio/client";+import { RequestOptions } from "@composio/client/internal/request-options";+import {+ AuthConfigListParams,+ AuthConfigListResponse,+ AuthConfigCreateParams,+ AuthConfigCreateResponse,+ AuthConfigDeleteResponse,+ AuthConfigRetrieveResponse,+ AuthConfigUpdateParams,+ AuthConfigUpdateResponse,+ AuthConfigUpdateStatusParams,+ AuthConfigUpdateStatusResponse,+} from "@composio/client/resources/auth-configs";++/**+ * AuthConfigs class+ *+ * This class is used to manage authentication configurations in the Composio SDK.+ * Auth configs are used to configure authentication providers and settings.+ */+export class AuthConfigs {+ private client: ComposioSDK;++ constructor(client: ComposioSDK) {+ this.client = client;+ }++ /**+ * List all auth configs+ * @param {AuthConfigListParams} query - Query parameters for filtering auth configs+ * @param {RequestOptions} options - Request options+ * @returns {Promise<AuthConfigListResponse>} List of auth configs+ */+ async list(+ query?: AuthConfigListParams,+ options?: RequestOptions+ ): Promise<AuthConfigListResponse> {+ return this.client.authConfigs.list(query, options);+ }++ /**+ * Create a new auth config+ * @param {AuthConfigCreateParams} data - Data for creating a new auth config+ * @param {RequestOptions} options - Request options+ * @returns {Promise<AuthConfigCreateResponse>} Created auth config+ */+ async create(+ data: AuthConfigCreateParams,+ options?: RequestOptions+ ): Promise<AuthConfigCreateResponse> {+ return this.client.authConfigs.create(data, options);+ }++ /**+ * Get an auth config by nanoid+ * @param {string} nanoid - Unique identifier of the auth config+ * @param {RequestOptions} options - Request options+ * @returns {Promise<AuthConfigRetrieveResponse>} Auth config details+ */+ async get(+ nanoid: string,+ options?: RequestOptions+ ): Promise<AuthConfigRetrieveResponse> {+ return this.client.authConfigs.retrieve(nanoid, options);+ }++ /**+ * Update an auth config+ * @param {string} nanoid - Unique identifier of the auth config to update+ * @param {AuthConfigUpdateParams} data - Data to update+ * @param {RequestOptions} options - Request options+ * @returns {Promise<AuthConfigUpdateResponse>} Updated auth config+ */+ async update(+ nanoid: string,+ data: AuthConfigUpdateParams,+ options?: RequestOptions+ ): Promise<AuthConfigUpdateResponse> {+ return this.client.authConfigs.update(nanoid, data, options);+ }++ /**+ * Delete an auth config+ * @param {string} nanoid - Unique identifier of the auth config to delete+ * @param {RequestOptions} options - Request options+ * @returns {Promise<AuthConfigDeleteResponse>} Response from deletion+ */+ async delete(+ nanoid: string,+ options?: RequestOptions+ ): Promise<AuthConfigDeleteResponse> {+ return this.client.authConfigs.delete(nanoid, options);+ }++ /**+ * Update the status of an auth config+ * @param {string} nanoid - Unique identifier of the auth config+ * @param {AuthConfigUpdateStatusParams} params - Parameters for updating the status+ * @param {RequestOptions} options - Request options+ * @returns {Promise<AuthConfigUpdateStatusResponse>} Updated auth config details+ */+ async updateStatus(+ status: "ENABLED" | "DISABLED",+ nanoid: string,+ options?: RequestOptions+ ): Promise<AuthConfigUpdateStatusResponse> {+ return this.client.authConfigs.updateStatus(status, { nanoid }, options);+ }++ /**+ * Enable an auth config+ * @param {string} nanoid - Unique identifier of the auth config+ * @param {RequestOptions} options - Request options+ * @returns {Promise<AuthConfigUpdateStatusResponse>} Updated auth config details+ */+ async enable(+ nanoid: string,+ options?: RequestOptions+ ): Promise<AuthConfigUpdateStatusResponse> {+ return this.client.authConfigs.updateStatus("ENABLED", { nanoid }, options);+ }++ /**+ * Disable an auth config+ * @param {string} nanoid - Unique identifier of the auth config+ * @param {RequestOptions} options - Request options+ * @returns {Promise<AuthConfigUpdateStatusResponse>} Updated auth config details+ */+ async disable(+ nanoid: string,+ options?: RequestOptions+ ): Promise<AuthConfigUpdateStatusResponse> {+ return this.client.authConfigs.updateStatus("DISABLED", { nanoid }, options);+ }+}\ No newline at end of filediff --git a/packages/core/src/models/ConnectedAccounts.ts b/packages/core/src/models/ConnectedAccounts.tsnew file mode 100644index 000000000..6ada30d4a--- /dev/null+++ b/packages/core/src/models/ConnectedAccounts.ts@@ -0,0 +1,133 @@+import ComposioSDK from "@composio/client";+import { RequestOptions } from "@composio/client/internal/request-options";+import {+ ConnectedAccountListParams,+ ConnectedAccountListResponse,+ ConnectedAccountCreateParams,+ ConnectedAccountCreateResponse,+ ConnectedAccountDeleteResponse,+ ConnectedAccountRetrieveResponse,+ ConnectedAccountRefreshResponse,+ ConnectedAccountUpdateStatusParams,+ ConnectedAccountUpdateStatusResponse,+} from "@composio/client/resources/connected-accounts";++/**+ * ConnectedAccounts class+ *+ * This class is used to manage connected accounts in the Composio SDK.+ * Connected accounts are used to authenticate with third-party services.+ */+export class ConnectedAccounts {+ private client: ComposioSDK;++ constructor(client: ComposioSDK) {+ this.client = client;+ }++ /**+ * List all connected accounts+ * @param {ConnectedAccountListParams} query - Query parameters for filtering connected accounts+ * @param {RequestOptions} options - Request options+ * @returns {Promise<ConnectedAccountListResponse>} List of connected accounts+ */+ async list(+ query?: ConnectedAccountListParams,+ options?: RequestOptions+ ): Promise<ConnectedAccountListResponse> {+ return this.client.connectedAccounts.list(query, options);+ }++ /**+ * Create a new connected account+ * @param {ConnectedAccountCreateParams} data - Data for creating a new connected account+ * @param {RequestOptions} options - Request options+ * @returns {Promise<ConnectedAccountCreateResponse>} Created connected account+ */+ async create(+ data: ConnectedAccountCreateParams,+ options?: RequestOptions+ ): Promise<ConnectedAccountCreateResponse> {+ return this.client.connectedAccounts.create(data, options);+ }++ /**+ * Get a connected account by nanoid+ * @param {string} nanoid - Unique identifier of the connected account+ * @param {RequestOptions} options - Request options+ * @returns {Promise<ConnectedAccountRetrieveResponse>} Connected account details+ */+ async get(+ nanoid: string,+ options?: RequestOptions+ ): Promise<ConnectedAccountRetrieveResponse> {+ return this.client.connectedAccounts.retrieve(nanoid, options);+ }++ /**+ * Delete a connected account+ * @param {string} nanoid - Unique identifier of the connected account to delete+ * @param {RequestOptions} options - Request options+ * @returns {Promise<ConnectedAccountDeleteResponse>} Response from deletion+ */+ async delete(+ nanoid: string,+ options?: RequestOptions+ ): Promise<ConnectedAccountDeleteResponse> {+ return this.client.connectedAccounts.delete(nanoid, options);+ }++ /**+ * Refresh a connected account's credentials+ * @param {string} nanoid - Unique identifier of the connected account to refresh+ * @param {RequestOptions} options - Request options+ * @returns {Promise<ConnectedAccountRefreshResponse>} Refreshed connected account details+ */+ async refresh(+ nanoid: string,+ options?: RequestOptions+ ): Promise<ConnectedAccountRefreshResponse> {+ return this.client.connectedAccounts.refresh(nanoid, options);+ }++ /**+ * Update the status of a connected account+ * @param {string} nanoid - Unique identifier of the connected account+ * @param {ConnectedAccountUpdateStatusParams} params - Parameters for updating the status+ * @param {RequestOptions} options - Request options+ * @returns {Promise<ConnectedAccountUpdateStatusResponse>} Updated connected account details+ */+ async updateStatus(+ nanoid: string,+ params: ConnectedAccountUpdateStatusParams,+ options?: RequestOptions+ ): Promise<ConnectedAccountUpdateStatusResponse> {+ return this.client.connectedAccounts.updateStatus(nanoid, params, options);+ }++ /**+ * Enable a connected account+ * @param {string} nanoid - Unique identifier of the connected account+ * @param {RequestOptions} options - Request options+ * @returns {Promise<ConnectedAccountUpdateStatusResponse>} Updated connected account details+ */+ async enable(+ nanoid: string,+ options?: RequestOptions+ ): Promise<ConnectedAccountUpdateStatusResponse> {+ return this.client.connectedAccounts.updateStatus(nanoid, { enabled: true }, options);+ }++ /**+ * Disable a connected account+ * @param {string} nanoid - Unique identifier of the connected account+ * @param {RequestOptions} options - Request options+ * @returns {Promise<ConnectedAccountUpdateStatusResponse>} Updated connected account details+ */+ async disable(+ nanoid: string,+ options?: RequestOptions+ ): Promise<ConnectedAccountUpdateStatusResponse> {+ return this.client.connectedAccounts.updateStatus(nanoid, { enabled: false }, options);+ }+}\ No newline at end of filediff --git a/packages/core/src/models/Org.ts b/packages/core/src/models/Org.tsdeleted file mode 100644index 6606efd70..000000000--- a/packages/core/src/models/Org.ts+++ /dev/null@@ -1,18 +0,0 @@-import ComposioSDK from "@composio/client";--export class Org {- private client: ComposioSDK;-- constructor(client: any) {- this.client = client;- }-- async getAPIKey() {- return this.client.org.apiKey.retrieve();- }-- async reGenerateAPIKey() {- return this.client.org.apiKey.regenerate();- }--}\ No newline at end of filediff --git a/packages/core/src/models/Toolkits.ts b/packages/core/src/models/Toolkits.tsindex 28de33514..b4bbbdb4b 100644--- a/packages/core/src/models/Toolkits.ts+++ b/packages/core/src/models/Toolkits.ts@@ -1,21 +1,58 @@import ComposioSDK from "@composio/client";+import { RequestOptions } from "@composio/client/internal/request-options";+import {+ ToolkitListParams,+ ToolkitListResponse,+ ToolkitRetrieveCategoriesResponse,+ ToolkitRetrieveResponse,+} from "@composio/client/resources/toolkits";+/**+ * Toolkits class+ *+ * Toolkits are a collection of tools that can be used to perform various tasks.+ * This is similar/replacement of `apps` in the Composio API.+ */export class Toolkits {- private client: ComposioSDK;+ private client: ComposioSDK;- constructor(client: ComposioSDK) {- this.client = client;- }+ constructor(client: ComposioSDK) {+ this.client = client;+ }+ /**+ * List all toolkits available in the Composio SDK.+ * This method fetches the toolkits from the Composio API.+ * @returns {Promise<Toolkit[]>} List of toolkits+ */+ async list(+ query: ToolkitListParams,+ options?: RequestOptions+ ): Promise<ToolkitListResponse> {+ return this.client.toolkits.list(query, options);+ }- async list() {- return this.client.toolkits.list();- }+ /**+ * Fetches a toolkit by its Slug.+ * This method retrieves the toolkit from the Composio API.+ * @param slug - The ID of the toolkit to be retrieved+ * @param options - Request options+ * @returns {Promise<ToolkitRetrieveResponse>} The toolkit object+ */+ async get(+ slug: string,+ options?: RequestOptions+ ): Promise<ToolkitRetrieveResponse> {+ return this.client.toolkits.retrieve(slug, options);+ }- async get(toolkitId: string) {- return this.client.toolkits.retrieve(toolkitId);- }-- async listCategories() {- return this.client.toolkits.retrieveCategories();- }-}\ No newline at end of file+ /**+ * Fetches all categories available in the Composio SDK+ *+ * @returns {Promise<ToolkitRetrieveCategoriesResponse>} List of categories+ */+ async listCategories(+ options?: RequestOptions+ ): Promise<ToolkitRetrieveCategoriesResponse> {+ return this.client.toolkits.retrieveCategories(options);+ }+}diff --git a/packages/core/src/models/Tools.ts b/packages/core/src/models/Tools.tsindex a9017efc7..d4a690f22 100644--- a/packages/core/src/models/Tools.ts+++ b/packages/core/src/models/Tools.ts@@ -1,11 +1,21 @@import ComposioSDK from "@composio/client";-import { Tool } from "../types/Tool.types";-import { Toolset } from "../types/Toolset.types.";+import { Tool } from "../types/tool.types";+import { Toolset, WrappedTool } from "../types/toolset.types.";+import {+ ToolExecuteParams,+ ToolExecuteResponse,+ ToolGetInputParams,+ ToolGetInputResponse,+ ToolListParams,+ ToolRetrieveEnumResponse,+} from "@composio/client/resources/tools";-export class Tools<- TTool extends Tool,- TToolset extends Toolset<TTool>-> {+/**+ * This class is used to manage tools in the Composio SDK.+ * It provides methods to list, get, and execute tools.+ * It also provides a method to wrap tools using the toolset.+ */+export class Tools<TTool extends Tool, TToolset extends Toolset<TTool>> {private client: ComposioSDK;private toolset: TToolset;@@ -14,24 +24,84 @@ export class Tools<this.toolset = toolset;}- async list() {- return this.client.tools.list();+ /**+ * This method helps us to safely wrap the tool in the toolset.+ *+ * @param {Tool} tool Tool to be wrapped by the toolset+ * @returns {ReturnType<WrappedTool<TToolset>>} Wrapped tool+ */+ private wrap(tool: Tool): WrappedTool<TToolset> {+ return this.toolset._wrapTool(tool) as WrappedTool<TToolset>;}- async get(toolId: string): Promise<ReturnType<TToolset["_wrapTool"]>> {- const tool: Tool = await this.client.tools.retrieve(toolId);- return this.toolset._wrapTool(tool) as ReturnType<TToolset["_wrapTool"]>;+ /**+ * Lists all tools available in the Composio SDK.+ * This method fetches the tools from the Composio API and wraps them using the toolset.+ * @returns {Promise<WrappedTool<TToolset>[]>} List of tools+ */+ async list(query: ToolListParams = {}): Promise<WrappedTool<TToolset>[]> {+ try {+ const tools = await this.client.tools.list(query);+ if (!tools) {+ return [];+ }+ return tools.items.map((tool) => this.wrap(tool));+ } catch (error) {+ console.error("Error fetching tools:", error);+ return [];+ }}- async execute(tool: string, body: { [key: string]: any }) {- return this.client.tools.execute(tool, body);+ /**+ * Retrieves a tool by its Slug.+ * @param slug The ID of the tool to be retrieved+ * @returns {Promise<WrappedTool<TToolset>>} The tool object wrapped by the toolset+ */+ async get(slug: string): Promise<WrappedTool<TToolset>> {+ const tool = await this.client.tools.retrieve(slug);+ return this.wrap(tool);}- async getToolsByEnum(toolEnum: string) {- return this.client.tools.retrieveEnum({- body: {- toolEnum,- },- });+ /**+ * Exectes a given tool with the provided parameters.+ *+ * This method calls the Composio API to execute the tool and returns the response.+ *+ * @param {string} slug - The ID of the tool to be executed+ * @param {ToolExecuteParams} body - The parameters to be passed to the tool+ * @returns {Promise<ToolExecuteResponse>} - The response from the tool execution+ */+ async execute(+ slug: string,+ body: ToolExecuteParams+ ): Promise<ToolExecuteResponse> {+ return this.client.tools.execute(slug, body);+ }++ /**+ * Fetches the list of all available tools in the Composio SDK.+ *+ * This method is mostly used by the CLI to get the list of tools.+ * No filtering is done on the tools, the list is cached in the backend, no further optimization is required.+ * @returns {string} - The list of all available tools as a string+ */+ async getToolsEnum(): Promise<ToolRetrieveEnumResponse> {+ return this.client.tools.retrieveEnum();+ }++ /**+ * Fetches the input parameters for a given tool.+ *+ * This method is used to get the input parameters for a tool before executing it.+ *+ * @param {string} slug - The ID of the tool to find input for+ * @param {ToolGetInputParams} body - The parameters to be passed to the tool+ * @returns+ */+ async getInput(+ slug: string,+ body: ToolGetInputParams+ ): Promise<ToolGetInputResponse> {+ return this.client.tools.getInput(slug, body);}}diff --git a/packages/core/src/models/Triggers.ts b/packages/core/src/models/Triggers.tsindex 0b62577e4..c4aafdb58 100644--- a/packages/core/src/models/Triggers.ts+++ b/packages/core/src/models/Triggers.ts@@ -1,5 +1,23 @@import ComposioSDK from "@composio/client";+import { RequestOptions } from "@composio/client/internal/request-options";+import {+ TriggerInstanceListActiveParams,+ TriggerInstanceRemoveUpsertResponse,+ TriggerInstanceUpdateStatusParams,+ TriggerInstanceUpsertParams,+ TriggerInstanceUpsertResponse,+ TriggersTypeListParams,+ TriggersTypeListResponse,+ TriggersTypeRetrieveEnumResponse,+ TriggersTypeRetrieveResponse,+} from "@composio/client/resources/index";+import { TriggerStatusEnum } from "../types/triggers.types";+/**+ * Trigger (Instance) class+ * /api/v3/trigger_instances+ *+ */export class Triggers {private client: ComposioSDK;@@ -7,28 +25,136 @@ export class Triggers {this.client = client;}- async list() {- return this.client.triggerInstances.listActive();+ /**+ * Fetch list of all the active triggers+ * @returns {Promise<TriggerInstance[]>} List of trigger instances+ */+ async list(+ query?: TriggerInstanceListActiveParams,+ options?: RequestOptions+ ) {+ return this.client.triggerInstances.listActive(query, options);}+ /**+ * Create a new trigger instance+ *+ * @param {string} slug - The slug of the trigger instance+ * @param {TriggerInstanceUpsertParams} body - The parameters to create the trigger instance+ * @returns {Promise<TriggerInstanceUpsertResponse>} The created trigger instance+ */async create(slug: string,- {- connectedAuthId,- triggerConfig,- }: {- connectedAuthId: string;- triggerConfig: { [key: string]: any };- }- ) {- return this.client.triggerInstances.upsert(slug, {- connectedAuthId,- triggerConfig,- });+ body: TriggerInstanceUpsertParams,+ options?: RequestOptions+ ): Promise<TriggerInstanceUpsertResponse> {+ return this.client.triggerInstances.upsert(slug, body, options);+ }++ /**+ * Update an existing trigger instance+ *+ * @param {string} slug - The slug of the trigger instance+ * @param {TriggerInstanceUpsertParams} body - The parameters to create the trigger instance+ * @returns {Promise<TriggerInstanceUpsertResponse>} The updated trigger instance+ */+ async update(+ slug: string,+ body: TriggerInstanceUpsertParams,+ options?: RequestOptions+ ): Promise<TriggerInstanceUpsertResponse> {+ return this.client.triggerInstances.upsert(slug, body, options);}- async delete(slug: string) {+ /**+ * Delete a trigger instance+ *+ * @param {string} slug - The slug of the trigger instance+ * @returns+ */+ async delete(slug: string): Promise<TriggerInstanceRemoveUpsertResponse> {return this.client.triggerInstances.removeUpsert(slug);}-++ /**+ * Update the status of a trigger+ *+ * @param {TriggerStatusEnum} status - The new status of the trigger+ * @param {TriggerInstanceUpdateStatusParams} params - The parameters to update the trigger instance+ * @param {RequestOptions} options - Request options+ * @returns {Promise<TriggerInstanceUpsertResponse>} The updated trigger instance+ */+ async updateStatus(+ status: TriggerStatusEnum,+ params: TriggerInstanceUpdateStatusParams,+ options?: RequestOptions+ ) {+ return this.client.triggerInstances.updateStatus(status, params, options);+ }++ /**+ * Disable a trigger instance+ *+ * @param {string} slug - The slug of the trigger instance+ * @param {RequestOptions options - Request options+ * @returns {Promise<TriggerInstanceUpsertResponse>} The updated trigger instance+ */+ async disable(slug: string, options?: RequestOptions) {+ return this.client.triggerInstances.updateStatus(+ "disable",+ { slug },+ options+ );+ }++ /**+ * Enable a trigger instance+ *+ * @param {string} slug - The slug of the trigger instance+ * @param {RequestOptions options - Request options+ * @returns {Promise<TriggerInstanceUpsertResponse>} The updated trigger instance+ */+ async enable(slug: string, options?: RequestOptions) {+ return this.client.triggerInstances.updateStatus(+ "enable",+ { slug },+ options+ );+ }++ /**+ * @TODO Learn about trigger types+ */+ /**+ * List all the trigger types+ *+ * @param {TriggersTypeListParams} query - The query parameters to filter the trigger types+ * @param {RequestOptions} options - Request options+ * @returns {Promise<TriggersTypeListResponse>} The list of trigger types+ */+ async listTypes(query?: TriggersTypeListParams, options?: RequestOptions): Promise<TriggersTypeListResponse> {+ return this.client.triggersTypes.list(query, options);+ }++ /**+ * Retrieve a trigger type by its slug+ *+ * @param {string} slug - The slug of the trigger type+ * @param {RequestOptions} options - request options+ * @returns {Promise<TriggersTypeRetrieveResponse>} The trigger type object+ */+ async getType(slug: string, options?: RequestOptions): Promise<TriggersTypeRetrieveResponse> {+ return this.client.triggersTypes.retrieve(slug, options);+ }++ /**+ * Fetches the list of all the available trigger enums+ *+ * This method is used by the CLI where filters are not required.+ * @param options+ * @returns+ */+ async listEnum(options?: RequestOptions): Promise<TriggersTypeRetrieveEnumResponse> {+ return this.client.triggersTypes.retrieveEnum(options);+ }}diff --git a/packages/core/src/toolset/BaseToolset.ts b/packages/core/src/toolset/BaseToolset.tsindex d63cdd294..f2dd4ff91 100644--- a/packages/core/src/toolset/BaseToolset.ts+++ b/packages/core/src/toolset/BaseToolset.ts@@ -1,5 +1,5 @@-import { Toolset } from "../types/Toolset.types.";-import { Tool } from "../types/Tool.types";+import { Toolset } from "../types/toolset.types.";+import { Tool } from "../types/tool.types";/*** Base toolset implementation with proper generic defaultsdiff --git a/packages/core/src/toolset/ComposioToolset.ts b/packages/core/src/toolset/ComposioToolset.tsindex 530f95cf2..d6b274efb 100644--- a/packages/core/src/toolset/ComposioToolset.ts+++ b/packages/core/src/toolset/ComposioToolset.ts@@ -1,4 +1,4 @@-import { Tool } from "../types/Tool.types";+import { Tool } from "../types/tool.types";import { BaseComposioToolset } from "./BaseToolset";/**diff --git a/packages/core/src/types/Tool.types.ts b/packages/core/src/types/Tool.types.tsindex 5c6844221..12a023b0e 100644--- a/packages/core/src/types/Tool.types.ts+++ b/packages/core/src/types/Tool.types.ts@@ -1,3 +1,3 @@-import { ToolRetrieveResponse } from "@composio/client/resources/tools";+import { ToolListResponse, ToolRetrieveResponse } from "@composio/client/resources/tools";-export type Tool = ToolRetrieveResponse;+export type Tool = ToolRetrieveResponse | ToolListResponse.Item;\ No newline at end of filediff --git a/packages/core/src/types/Toolset.types..ts b/packages/core/src/types/Toolset.types..tsindex 1177af786..1125f098d 100644--- a/packages/core/src/types/Toolset.types..ts+++ b/packages/core/src/types/Toolset.types..ts@@ -1,4 +1,4 @@-import { Tool } from "./Tool.types";+import { Tool } from "./tool.types";/*** Base toolset implementation, which needs to be implemented by the extended class.@@ -7,3 +7,12 @@ import { Tool } from "./Tool.types";export interface Toolset<TTool extends Tool> {_wrapTool: (tool: Tool) => TTool;}+++/**+ * This type is used to infer the wrapped tool type from the toolset.+ * It checks if the toolset has a method `_wrapTool` and infers the return type.+ */+export type WrappedTool<TToolset> = TToolset extends {+ _wrapTool: (tool: Tool) => infer TTool;+} ? TTool : never;\ No newline at end of filediff --git a/packages/core/src/types/org.types.ts b/packages/core/src/types/org.types.tsnew file mode 100644index 000000000..e69de29bbdiff --git a/packages/core/src/types/triggers.types.ts b/packages/core/src/types/triggers.types.tsnew file mode 100644index 000000000..45eb6121b--- /dev/null+++ b/packages/core/src/types/triggers.types.ts@@ -0,0 +1 @@+export type TriggerStatusEnum = "enable" | "disable";\ No newline at end of filediff --git a/packages/examples/sample/src/index.ts b/packages/examples/sample/src/index.tsindex dce81cfe0..efa732458 100644--- a/packages/examples/sample/src/index.ts+++ b/packages/examples/sample/src/index.ts@@ -12,6 +12,9 @@ async function constructorExample() {const tool = await composio.tools.get("HACKERNEWS_SEARCH_POSTS");+ const sampleTool = await composio.getTool("HACKERNEWS_SEARCH_POSTS");+ sampleTool.execute({});+composio.toolset.handleToolCall(tool);tool.execute({});