@composio/core 0.1.12-alpha.0 → 0.1.12-alpha.10
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 +27 -7
- package/dist/index.cjs +894 -452
- package/dist/index.d.cts +957 -169
- package/dist/index.d.ts +957 -169
- package/dist/index.js +893 -452
- package/package.json +13 -12
- package/src/index.ts +0 -23
package/README.md
CHANGED
|
@@ -35,8 +35,8 @@ const composio = new Composio({
|
|
|
35
35
|
provider: new OpenAIProvider(),
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
// Fetch a single tool
|
|
39
|
-
const
|
|
38
|
+
// Fetch a single tool by slig
|
|
39
|
+
const tools = await composio.tools.get('user123', 'HACKERNEWS_SEARCH_POSTS');
|
|
40
40
|
|
|
41
41
|
// Fetch multiple tools
|
|
42
42
|
const tools = await composio.tools.get('user123', {
|
|
@@ -69,8 +69,8 @@ Composio SDK supports powerful modifiers to transform tool schemas and execution
|
|
|
69
69
|
Schema modifiers allow you to transform tool schemas before they are used:
|
|
70
70
|
|
|
71
71
|
```typescript
|
|
72
|
-
const
|
|
73
|
-
|
|
72
|
+
const tools = await composio.tools.get('user123', 'HACKERNEWS_SEARCH_POSTS', {
|
|
73
|
+
modifySchema: (toolSlug: string, toolkitSlug: string, tool: Tool) => ({
|
|
74
74
|
...tool,
|
|
75
75
|
description: 'Enhanced HackerNews search with additional features',
|
|
76
76
|
inputParameters: {
|
|
@@ -90,9 +90,9 @@ const tool = await composio.tools.get('user123', 'HACKERNEWS_SEARCH_POSTS', {
|
|
|
90
90
|
For agentic providers (like Vercel AI and Langchain), you can also modify tool execution behavior:
|
|
91
91
|
|
|
92
92
|
```typescript
|
|
93
|
-
const
|
|
93
|
+
const tools = await composio.tools.get('user123', 'HACKERNEWS_SEARCH_POSTS', {
|
|
94
94
|
// Transform input before execution
|
|
95
|
-
|
|
95
|
+
beforeExecute: (toolSlug: string, toolkitSlug: string, params: ToolExecuteParams) => ({
|
|
96
96
|
...params,
|
|
97
97
|
arguments: {
|
|
98
98
|
...params.arguments,
|
|
@@ -101,7 +101,7 @@ const tool = await composio.tools.get('user123', 'HACKERNEWS_SEARCH_POSTS', {
|
|
|
101
101
|
}),
|
|
102
102
|
|
|
103
103
|
// Transform output after execution
|
|
104
|
-
|
|
104
|
+
afterExecute: (toolSlug: string, toolkitSlug: string, response: ToolExecuteResponse) => ({
|
|
105
105
|
...response,
|
|
106
106
|
data: {
|
|
107
107
|
...response.data,
|
|
@@ -145,6 +145,26 @@ const connectionRequest = await composio.createConnectedAccount(
|
|
|
145
145
|
const connectedAccount = await connectionRequest.waitForConnection();
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
+
### Waiting for Connection Establishment
|
|
149
|
+
|
|
150
|
+
The `waitForConnection` method is available on both the `ConnectionRequest` and `ConnectedAccounts` classes. It allows you to poll for a connection to become active:
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
// From a ConnectionRequest instance (returned by createConnectedAccount)
|
|
154
|
+
const connectedAccount = await connectionRequest.waitForConnection(120000); // 2 minute timeout
|
|
155
|
+
|
|
156
|
+
// From the ConnectedAccounts class (using a connected account ID)
|
|
157
|
+
const connectedAccount = await composio.connectedAccounts.waitForConnection('conn_abc123', 60000); // 1 minute timeout
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
The method continuously polls the Composio API until the connection:
|
|
161
|
+
|
|
162
|
+
- Becomes `ACTIVE` (returns the connected account)
|
|
163
|
+
- Enters a terminal state like `FAILED`, `EXPIRED`, or `DELETED` (throws an error)
|
|
164
|
+
- Exceeds the specified timeout (throws a timeout error)
|
|
165
|
+
|
|
166
|
+
If the connection does not complete within the provided timeout (default: 60 seconds), a `ConnectionRequestTimeoutError` is thrown.
|
|
167
|
+
|
|
148
168
|
### Managing Connected Accounts
|
|
149
169
|
|
|
150
170
|
```typescript
|