@customclaw/composio 0.0.1

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.
@@ -0,0 +1,50 @@
1
+ import type { ComposioClient } from "../client.js";
2
+ import type { ComposioConfig } from "../types.js";
3
+ /**
4
+ * Tool parameters for composio_search_tools
5
+ */
6
+ export declare const ComposioSearchToolSchema: import("@sinclair/typebox").TObject<{
7
+ query: import("@sinclair/typebox").TString;
8
+ toolkits: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
9
+ limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
10
+ user_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
11
+ }>;
12
+ /**
13
+ * Create the composio_search_tools tool
14
+ */
15
+ export declare function createComposioSearchTool(client: ComposioClient, _config: ComposioConfig): {
16
+ name: string;
17
+ label: string;
18
+ description: string;
19
+ parameters: import("@sinclair/typebox").TObject<{
20
+ query: import("@sinclair/typebox").TString;
21
+ toolkits: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
22
+ limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
23
+ user_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
24
+ }>;
25
+ execute(_toolCallId: string, params: Record<string, unknown>): Promise<{
26
+ content: {
27
+ type: string;
28
+ text: string;
29
+ }[];
30
+ details: {
31
+ error: string;
32
+ };
33
+ } | {
34
+ content: {
35
+ type: string;
36
+ text: string;
37
+ }[];
38
+ details: {
39
+ query: string;
40
+ count: number;
41
+ tools: {
42
+ slug: string;
43
+ name: string;
44
+ description: string;
45
+ toolkit: string;
46
+ parameters: Record<string, unknown>;
47
+ }[];
48
+ };
49
+ }>;
50
+ };
@@ -0,0 +1,71 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ /**
3
+ * Tool parameters for composio_search_tools
4
+ */
5
+ export const ComposioSearchToolSchema = Type.Object({
6
+ query: Type.String({
7
+ description: "Task description to find matching tools (e.g., 'send an email', 'create github issue')",
8
+ }),
9
+ toolkits: Type.Optional(Type.Array(Type.String(), {
10
+ description: "Limit search to specific toolkits (e.g., ['github', 'gmail'])",
11
+ })),
12
+ limit: Type.Optional(Type.Number({
13
+ description: "Maximum number of results to return (default: 10, max: 50)",
14
+ })),
15
+ user_id: Type.Optional(Type.String({
16
+ description: "User ID for session scoping (uses default if not provided)",
17
+ })),
18
+ });
19
+ /**
20
+ * Create the composio_search_tools tool
21
+ */
22
+ export function createComposioSearchTool(client, _config) {
23
+ return {
24
+ name: "composio_search_tools",
25
+ label: "Composio Search Tools",
26
+ description: "Search for tools across 1000+ integrations (Gmail, Slack, GitHub, Notion, etc.) " +
27
+ "by describing what you want to accomplish. Returns matching tools with their schemas.",
28
+ parameters: ComposioSearchToolSchema,
29
+ async execute(_toolCallId, params) {
30
+ const query = String(params.query || "").trim();
31
+ if (!query) {
32
+ return {
33
+ content: [{ type: "text", text: JSON.stringify({ error: "query is required" }, null, 2) }],
34
+ details: { error: "query is required" },
35
+ };
36
+ }
37
+ const toolkits = Array.isArray(params.toolkits)
38
+ ? params.toolkits.filter((t) => typeof t === "string")
39
+ : undefined;
40
+ const limit = Math.min(typeof params.limit === "number" && params.limit > 0 ? params.limit : 10, 50);
41
+ const userId = typeof params.user_id === "string" ? params.user_id : undefined;
42
+ try {
43
+ const results = await client.searchTools(query, { toolkits, limit, userId });
44
+ const response = {
45
+ query,
46
+ count: results.length,
47
+ tools: results.map((tool) => ({
48
+ slug: tool.slug,
49
+ name: tool.name,
50
+ description: tool.description,
51
+ toolkit: tool.toolkit,
52
+ parameters: tool.parameters,
53
+ })),
54
+ };
55
+ return {
56
+ content: [{ type: "text", text: JSON.stringify(response, null, 2) }],
57
+ details: response,
58
+ };
59
+ }
60
+ catch (err) {
61
+ const errorResponse = {
62
+ error: err instanceof Error ? err.message : String(err),
63
+ };
64
+ return {
65
+ content: [{ type: "text", text: JSON.stringify(errorResponse, null, 2) }],
66
+ details: errorResponse,
67
+ };
68
+ }
69
+ },
70
+ };
71
+ }
@@ -0,0 +1,48 @@
1
+ import type { ComposioClient } from "../client.js";
2
+ import type { ComposioConfig } from "../types.js";
3
+ /**
4
+ * Tool parameters for composio_workbench
5
+ */
6
+ export declare const ComposioWorkbenchSchema: import("@sinclair/typebox").TObject<{
7
+ code: import("@sinclair/typebox").TString;
8
+ thought: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
9
+ current_step: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
10
+ current_step_metric: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
11
+ user_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
12
+ }>;
13
+ /**
14
+ * Create the composio_workbench tool
15
+ */
16
+ export declare function createComposioWorkbenchTool(client: ComposioClient, _config: ComposioConfig): {
17
+ name: string;
18
+ label: string;
19
+ description: string;
20
+ parameters: import("@sinclair/typebox").TObject<{
21
+ code: import("@sinclair/typebox").TString;
22
+ thought: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
23
+ current_step: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
24
+ current_step_metric: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
25
+ user_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
26
+ }>;
27
+ execute(_toolCallId: string, params: Record<string, unknown>): Promise<{
28
+ content: {
29
+ type: string;
30
+ text: string;
31
+ }[];
32
+ details: {
33
+ error: string;
34
+ };
35
+ } | {
36
+ content: {
37
+ type: string;
38
+ text: string;
39
+ }[];
40
+ details: {
41
+ output: unknown;
42
+ success: boolean;
43
+ } | {
44
+ error: string | undefined;
45
+ success: boolean;
46
+ };
47
+ }>;
48
+ };
@@ -0,0 +1,76 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ /**
3
+ * Tool parameters for composio_workbench
4
+ */
5
+ export const ComposioWorkbenchSchema = Type.Object({
6
+ code: Type.String({
7
+ description: "Python code to execute in the remote Jupyter sandbox. " +
8
+ "Helper functions available: run_composio_tool(slug, args), invoke_llm(query), " +
9
+ "upload_local_file(*paths), proxy_execute(method, endpoint, toolkit, ...), " +
10
+ "web_search(query), smart_file_extract(path). State persists across executions.",
11
+ }),
12
+ thought: Type.Optional(Type.String({
13
+ description: "Concise objective describing what the code should achieve",
14
+ })),
15
+ current_step: Type.Optional(Type.String({
16
+ description: "Short enum for current workflow step (e.g., FETCHING_EMAILS, GENERATING_REPLIES)",
17
+ })),
18
+ current_step_metric: Type.Optional(Type.String({
19
+ description: "Progress metrics for current step (e.g., '10/100 emails', '3/10 pages')",
20
+ })),
21
+ user_id: Type.Optional(Type.String({
22
+ description: "User ID for session scoping (uses default if not provided)",
23
+ })),
24
+ });
25
+ /**
26
+ * Create the composio_workbench tool
27
+ */
28
+ export function createComposioWorkbenchTool(client, _config) {
29
+ return {
30
+ name: "composio_workbench",
31
+ label: "Composio Remote Workbench",
32
+ description: "Execute Python code in a remote Jupyter sandbox for processing large tool responses, " +
33
+ "scripting bulk operations, or running data analysis. Use when data is stored in remote files " +
34
+ "or when orchestrating multiple Composio tool calls. Has access to pandas, numpy, PIL, PyTorch, etc.",
35
+ parameters: ComposioWorkbenchSchema,
36
+ async execute(_toolCallId, params) {
37
+ const code = String(params.code || "").trim();
38
+ if (!code) {
39
+ return {
40
+ content: [{ type: "text", text: JSON.stringify({ error: "code is required" }, null, 2) }],
41
+ details: { error: "code is required" },
42
+ };
43
+ }
44
+ const thought = typeof params.thought === "string" ? params.thought : undefined;
45
+ const currentStep = typeof params.current_step === "string" ? params.current_step : undefined;
46
+ const currentStepMetric = typeof params.current_step_metric === "string" ? params.current_step_metric : undefined;
47
+ const userId = typeof params.user_id === "string" ? params.user_id : undefined;
48
+ try {
49
+ const result = await client.executeWorkbench(code, {
50
+ thought,
51
+ currentStep,
52
+ currentStepMetric,
53
+ userId,
54
+ });
55
+ const response = {
56
+ success: result.success,
57
+ ...(result.success ? { output: result.output } : { error: result.error }),
58
+ };
59
+ return {
60
+ content: [{ type: "text", text: JSON.stringify(response, null, 2) }],
61
+ details: response,
62
+ };
63
+ }
64
+ catch (err) {
65
+ const errorResponse = {
66
+ success: false,
67
+ error: err instanceof Error ? err.message : String(err),
68
+ };
69
+ return {
70
+ content: [{ type: "text", text: JSON.stringify(errorResponse, null, 2) }],
71
+ details: errorResponse,
72
+ };
73
+ }
74
+ },
75
+ };
76
+ }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Composio Tool Router types for OpenClaw integration
3
+ */
4
+ export interface ComposioConfig {
5
+ enabled: boolean;
6
+ apiKey?: string;
7
+ defaultUserId?: string;
8
+ allowedToolkits?: string[];
9
+ blockedToolkits?: string[];
10
+ }
11
+ export interface ToolSearchResult {
12
+ name: string;
13
+ slug: string;
14
+ description: string;
15
+ toolkit: string;
16
+ parameters: Record<string, unknown>;
17
+ }
18
+ export interface ToolExecutionResult {
19
+ success: boolean;
20
+ data?: unknown;
21
+ error?: string;
22
+ }
23
+ export interface MultiExecutionItem {
24
+ tool_slug: string;
25
+ arguments: Record<string, unknown>;
26
+ }
27
+ export interface MultiExecutionResult {
28
+ results: Array<{
29
+ tool_slug: string;
30
+ success: boolean;
31
+ data?: unknown;
32
+ error?: string;
33
+ }>;
34
+ }
35
+ export interface ConnectionStatus {
36
+ toolkit: string;
37
+ connected: boolean;
38
+ userId?: string;
39
+ authUrl?: string;
40
+ }
41
+ export interface ComposioClientOptions {
42
+ apiKey: string;
43
+ defaultUserId?: string;
44
+ allowedToolkits?: string[];
45
+ blockedToolkits?: string[];
46
+ }
package/dist/types.js ADDED
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Composio Tool Router types for OpenClaw integration
3
+ */
4
+ export {};
@@ -0,0 +1,58 @@
1
+ {
2
+ "id": "composio",
3
+ "name": "Composio Tool Router",
4
+ "description": "Access 1000+ third-party tools via Composio (Gmail, Slack, GitHub, Notion, etc.)",
5
+ "configSchema": {
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "enabled": {
10
+ "type": "boolean",
11
+ "description": "Enable or disable the Composio plugin"
12
+ },
13
+ "apiKey": {
14
+ "type": "string",
15
+ "description": "Composio API key (or set COMPOSIO_API_KEY env var)"
16
+ },
17
+ "defaultUserId": {
18
+ "type": "string",
19
+ "description": "Default user ID for session scoping"
20
+ },
21
+ "allowedToolkits": {
22
+ "type": "array",
23
+ "items": { "type": "string" },
24
+ "description": "Restrict to specific toolkits (e.g., github, gmail)"
25
+ },
26
+ "blockedToolkits": {
27
+ "type": "array",
28
+ "items": { "type": "string" },
29
+ "description": "Block specific toolkits"
30
+ }
31
+ }
32
+ },
33
+ "uiHints": {
34
+ "enabled": {
35
+ "label": "Enable Composio",
36
+ "help": "Enable or disable the Composio Tool Router integration"
37
+ },
38
+ "apiKey": {
39
+ "label": "API Key",
40
+ "help": "Composio API key from platform.composio.dev/settings",
41
+ "sensitive": true
42
+ },
43
+ "defaultUserId": {
44
+ "label": "Default User ID",
45
+ "help": "Default user ID for session scoping (optional)"
46
+ },
47
+ "allowedToolkits": {
48
+ "label": "Allowed Toolkits",
49
+ "help": "Restrict to specific toolkits (e.g., github, gmail)",
50
+ "advanced": true
51
+ },
52
+ "blockedToolkits": {
53
+ "label": "Blocked Toolkits",
54
+ "help": "Block specific toolkits from being used",
55
+ "advanced": true
56
+ }
57
+ }
58
+ }
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@customclaw/composio",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "description": "Composio Tool Router plugin for OpenClaw — access 1000+ third-party integrations",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "openclaw": {
9
+ "extensions": ["./dist/index.js"]
10
+ },
11
+ "scripts": {
12
+ "build": "tsc",
13
+ "prepublishOnly": "npm run build"
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "openclaw.plugin.json",
18
+ "THIRD-PARTY-NOTICES"
19
+ ],
20
+ "keywords": [
21
+ "openclaw",
22
+ "composio",
23
+ "plugin",
24
+ "integrations"
25
+ ],
26
+ "license": "MIT",
27
+ "dependencies": {
28
+ "@composio/core": "^0.5.5",
29
+ "@sinclair/typebox": "0.34.47",
30
+ "zod": "^4.3.6"
31
+ },
32
+ "devDependencies": {
33
+ "@types/node": "^25.2.3",
34
+ "typescript": "^5.4.0"
35
+ }
36
+ }