@composio/vercel 0.1.3-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/dist/index.cjs ADDED
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ VercelToolset: () => VercelToolset
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+ var import_core = require("@composio/core");
27
+ var import_ai = require("ai");
28
+ var VercelToolset = class extends import_core.BaseAgenticToolset {
29
+ name = "vercel";
30
+ /**
31
+ * Wrap a Composio tool in a Vercel tool.
32
+ * @param {ComposioTool} composioTool - The Composio tool to wrap.
33
+ * @returns {VercelTool} The wrapped Vercel tool.
34
+ */
35
+ wrapTool(composioTool, executeTool) {
36
+ return (0, import_ai.tool)({
37
+ description: composioTool.description,
38
+ parameters: (0, import_ai.jsonSchema)(composioTool.inputParameters ?? {}),
39
+ execute: async (params) => {
40
+ const input = typeof params === "string" ? JSON.parse(params) : params;
41
+ return await executeTool(composioTool.slug, input);
42
+ }
43
+ });
44
+ }
45
+ /**
46
+ * Wrap a list of Composio tools as a Vercel tool collection.
47
+ * @param {ComposioTool[]} tools - The list of Composio tools to wrap.
48
+ * @returns {VercelToolCollection} The wrapped Vercel tool collection.
49
+ */
50
+ wrapTools(tools, executeTool) {
51
+ return tools.reduce((acc, tool2) => {
52
+ acc[tool2.slug] = this.wrapTool(tool2, executeTool);
53
+ return acc;
54
+ }, {});
55
+ }
56
+ };
57
+ // Annotate the CommonJS export names for ESM import in node:
58
+ 0 && (module.exports = {
59
+ VercelToolset
60
+ });
@@ -0,0 +1,34 @@
1
+ import { BaseAgenticToolset, Tool as Tool$1, ExecuteToolFn } from '@composio/core';
2
+ import { Tool } from 'ai';
3
+
4
+ /**
5
+ * Vercel AI Toolset
6
+ * To be used with the Vercel AI SDK
7
+ *
8
+ * Author: Musthaq Ahamad <musthaq@composio.dev>
9
+ * Legacy Reference: https://github.com/ComposioHQ/composio/blob/master/js/src/frameworks/vercel.ts
10
+ *
11
+ * This toolset provides a set of tools for interacting with Vercel AI SDK.
12
+ *
13
+ * @packageDocumentation
14
+ * @module toolsets/vercel
15
+ */
16
+
17
+ type VercelToolCollection = Record<string, Tool>;
18
+ declare class VercelToolset extends BaseAgenticToolset<VercelToolCollection, Tool> {
19
+ readonly name = "vercel";
20
+ /**
21
+ * Wrap a Composio tool in a Vercel tool.
22
+ * @param {ComposioTool} composioTool - The Composio tool to wrap.
23
+ * @returns {VercelTool} The wrapped Vercel tool.
24
+ */
25
+ wrapTool(composioTool: Tool$1, executeTool: ExecuteToolFn): Tool;
26
+ /**
27
+ * Wrap a list of Composio tools as a Vercel tool collection.
28
+ * @param {ComposioTool[]} tools - The list of Composio tools to wrap.
29
+ * @returns {VercelToolCollection} The wrapped Vercel tool collection.
30
+ */
31
+ wrapTools(tools: Tool$1[], executeTool: ExecuteToolFn): VercelToolCollection;
32
+ }
33
+
34
+ export { VercelToolset };
@@ -0,0 +1,34 @@
1
+ import { BaseAgenticToolset, Tool as Tool$1, ExecuteToolFn } from '@composio/core';
2
+ import { Tool } from 'ai';
3
+
4
+ /**
5
+ * Vercel AI Toolset
6
+ * To be used with the Vercel AI SDK
7
+ *
8
+ * Author: Musthaq Ahamad <musthaq@composio.dev>
9
+ * Legacy Reference: https://github.com/ComposioHQ/composio/blob/master/js/src/frameworks/vercel.ts
10
+ *
11
+ * This toolset provides a set of tools for interacting with Vercel AI SDK.
12
+ *
13
+ * @packageDocumentation
14
+ * @module toolsets/vercel
15
+ */
16
+
17
+ type VercelToolCollection = Record<string, Tool>;
18
+ declare class VercelToolset extends BaseAgenticToolset<VercelToolCollection, Tool> {
19
+ readonly name = "vercel";
20
+ /**
21
+ * Wrap a Composio tool in a Vercel tool.
22
+ * @param {ComposioTool} composioTool - The Composio tool to wrap.
23
+ * @returns {VercelTool} The wrapped Vercel tool.
24
+ */
25
+ wrapTool(composioTool: Tool$1, executeTool: ExecuteToolFn): Tool;
26
+ /**
27
+ * Wrap a list of Composio tools as a Vercel tool collection.
28
+ * @param {ComposioTool[]} tools - The list of Composio tools to wrap.
29
+ * @returns {VercelToolCollection} The wrapped Vercel tool collection.
30
+ */
31
+ wrapTools(tools: Tool$1[], executeTool: ExecuteToolFn): VercelToolCollection;
32
+ }
33
+
34
+ export { VercelToolset };
package/dist/index.js ADDED
@@ -0,0 +1,35 @@
1
+ // src/index.ts
2
+ import { BaseAgenticToolset } from "@composio/core";
3
+ import { jsonSchema, tool } from "ai";
4
+ var VercelToolset = class extends BaseAgenticToolset {
5
+ name = "vercel";
6
+ /**
7
+ * Wrap a Composio tool in a Vercel tool.
8
+ * @param {ComposioTool} composioTool - The Composio tool to wrap.
9
+ * @returns {VercelTool} The wrapped Vercel tool.
10
+ */
11
+ wrapTool(composioTool, executeTool) {
12
+ return tool({
13
+ description: composioTool.description,
14
+ parameters: jsonSchema(composioTool.inputParameters ?? {}),
15
+ execute: async (params) => {
16
+ const input = typeof params === "string" ? JSON.parse(params) : params;
17
+ return await executeTool(composioTool.slug, input);
18
+ }
19
+ });
20
+ }
21
+ /**
22
+ * Wrap a list of Composio tools as a Vercel tool collection.
23
+ * @param {ComposioTool[]} tools - The list of Composio tools to wrap.
24
+ * @returns {VercelToolCollection} The wrapped Vercel tool collection.
25
+ */
26
+ wrapTools(tools, executeTool) {
27
+ return tools.reduce((acc, tool2) => {
28
+ acc[tool2.slug] = this.wrapTool(tool2, executeTool);
29
+ return acc;
30
+ }, {});
31
+ }
32
+ };
33
+ export {
34
+ VercelToolset
35
+ };
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@composio/vercel",
3
+ "version": "0.1.3-alpha.0",
4
+ "description": "",
5
+ "main": "src/index.ts",
6
+ "type": "module",
7
+ "publishConfig": {
8
+ "access": "public",
9
+ "main": "dist/index.js",
10
+ "types": "dist/index.d.ts"
11
+ },
12
+ "exports": {
13
+ ".": {
14
+ "import": "./dist/index.js",
15
+ "types": "./dist/index.d.ts",
16
+ "require": "./dist/index.cjs"
17
+ }
18
+ },
19
+ "files": [
20
+ "README.md",
21
+ "dist"
22
+ ],
23
+ "scripts": {
24
+ "build": "tsup",
25
+ "test": "echo \"Error: no test specified\" && exit 1"
26
+ },
27
+ "keywords": [],
28
+ "author": "",
29
+ "license": "ISC",
30
+ "packageManager": "pnpm@10.8.0",
31
+ "peerDependencies": {
32
+ "@composio/core": "^0.1.0-alpha.0",
33
+ "ai": "^4.3.8"
34
+ },
35
+ "devDependencies": {
36
+ "@composio/core": "0.1.3-alpha.0",
37
+ "tsup": "^8.4.0",
38
+ "typescript": "^5.8.3"
39
+ },
40
+ "gitHead": "84ce22190d205c3846bc29fd63b88462e0eaa3bb"
41
+ }
package/src/index.ts ADDED
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Vercel AI Toolset
3
+ * To be used with the Vercel AI SDK
4
+ *
5
+ * Author: Musthaq Ahamad <musthaq@composio.dev>
6
+ * Legacy Reference: https://github.com/ComposioHQ/composio/blob/master/js/src/frameworks/vercel.ts
7
+ *
8
+ * This toolset provides a set of tools for interacting with Vercel AI SDK.
9
+ *
10
+ * @packageDocumentation
11
+ * @module toolsets/vercel
12
+ */
13
+ import { BaseAgenticToolset, Tool as ComposioTool, ExecuteToolFn } from '@composio/core';
14
+ import type { Tool as VercelTool } from 'ai';
15
+ import { jsonSchema, tool } from 'ai';
16
+
17
+ type VercelToolCollection = Record<string, VercelTool>;
18
+ export class VercelToolset extends BaseAgenticToolset<VercelToolCollection, VercelTool> {
19
+ readonly name = 'vercel';
20
+
21
+ /**
22
+ * Wrap a Composio tool in a Vercel tool.
23
+ * @param {ComposioTool} composioTool - The Composio tool to wrap.
24
+ * @returns {VercelTool} The wrapped Vercel tool.
25
+ */
26
+ wrapTool(composioTool: ComposioTool, executeTool: ExecuteToolFn): VercelTool {
27
+ return tool({
28
+ description: composioTool.description,
29
+ parameters: jsonSchema(composioTool.inputParameters ?? {}),
30
+ execute: async params => {
31
+ const input = typeof params === 'string' ? JSON.parse(params) : params;
32
+ return await executeTool(composioTool.slug, input);
33
+ },
34
+ });
35
+ }
36
+
37
+ /**
38
+ * Wrap a list of Composio tools as a Vercel tool collection.
39
+ * @param {ComposioTool[]} tools - The list of Composio tools to wrap.
40
+ * @returns {VercelToolCollection} The wrapped Vercel tool collection.
41
+ */
42
+ wrapTools(tools: ComposioTool[], executeTool: ExecuteToolFn): VercelToolCollection {
43
+ return tools.reduce((acc, tool) => {
44
+ acc[tool.slug] = this.wrapTool(tool, executeTool);
45
+ return acc;
46
+ }, {} as VercelToolCollection);
47
+ }
48
+ }