@composio/core 0.1.45 → 0.1.47
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 +89 -20
- package/dist/index.cjs +93 -7
- package/dist/index.d.cts +12 -4
- package/dist/index.d.ts +12 -4
- package/dist/index.js +93 -7
- package/package.json +1 -1
- package/generated/ably.ts +0 -20
- package/generated/accelo.ts +0 -8
- package/generated/acculynx.ts +0 -17
- package/generated/active_campaign.ts +0 -30
- package/generated/adobe.ts +0 -8
- package/generated/adyntel.ts +0 -12
- package/generated/aero_workflow.ts +0 -8
- package/generated/affinity.ts +0 -29
- package/generated/agencyzoom.ts +0 -108
- package/generated/ahrefs.ts +0 -49
- package/generated/airtable.ts +0 -26
- package/generated/alchemy.ts +0 -16
- package/generated/algolia.ts +0 -39
- package/generated/altoviz.ts +0 -18
- package/generated/amazon.ts +0 -8
- package/generated/amcards.ts +0 -11
- package/generated/amplitude.ts +0 -25
- package/generated/anthropic_administrator.ts +0 -13
- package/generated/apaleo.ts +0 -38
- package/generated/apollo.ts +0 -40
- package/generated/appdrag.ts +0 -8
- package/generated/appsflyer.ts +0 -8
- package/generated/asana.ts +0 -95
- package/generated/ashby.ts +0 -8
- package/generated/atlassian.ts +0 -8
- package/generated/attio.ts +0 -20
- package/generated/auth0.ts +0 -8
- package/generated/axonaut.ts +0 -8
- package/generated/bamboohr.ts +0 -168
- package/generated/bannerbear.ts +0 -17
- package/generated/baserow.ts +0 -11
- package/generated/battlenet.ts +0 -8
- package/generated/beeminder.ts +0 -14
- package/generated/bigmailer.ts +0 -12
- package/generated/bigml.ts +0 -15
- package/generated/bill.ts +0 -218
- package/generated/bitbucket.ts +0 -25
- package/generated/bitwarden.ts +0 -8
- package/generated/blackbaud.ts +0 -8
- package/generated/blackboard.ts +0 -323
- package/generated/boldsign.ts +0 -8
- package/generated/bolna.ts +0 -24
- package/generated/borneo.ts +0 -162
- package/generated/botbaba.ts +0 -8
- package/generated/box.ts +0 -282
- package/generated/braintree.ts +0 -8
- package/generated/brandfetch.ts +0 -15
- package/generated/breezy_hr.ts +0 -8
- package/generated/brevo.ts +0 -28
- package/generated/brex.ts +0 -8
- package/generated/brex_staging.ts +0 -8
- package/generated/brightpearl.ts +0 -8
- package/generated/brilliant_directories.ts +0 -15
- package/generated/browseai.ts +0 -18
- package/generated/browserbase_tool.ts +0 -10
- package/generated/browserhub.ts +0 -8
- package/generated/browserless.ts +0 -16
- package/generated/bubble.ts +0 -8
- package/generated/bugbug.ts +0 -13
- package/generated/builtwith.ts +0 -21
- package/generated/cal.ts +0 -150
- package/generated/calendly.ts +0 -51
- package/generated/canva.ts +0 -41
- package/generated/canvas.ts +0 -100
- package/generated/chatwork.ts +0 -17
- package/generated/chmeetings.ts +0 -8
- package/generated/clickup.ts +0 -153
- package/generated/clockify.ts +0 -23
- package/generated/close.ts +0 -15
- package/generated/cloudflare.ts +0 -10
- package/generated/coda.ts +0 -115
- package/generated/codeinterpreter.ts +0 -14
- package/generated/coinbase.ts +0 -15
- package/generated/coinmarketcal.ts +0 -8
- package/generated/composio.ts +0 -34
- package/generated/composio_search.ts +0 -22
- package/generated/confluence.ts +0 -199
- package/generated/contentful.ts +0 -12
- package/generated/crustdata.ts +0 -23
- package/generated/customer_io.ts +0 -8
- package/generated/cutt_ly.ts +0 -10
- package/generated/d2lbrightspace.ts +0 -54
- package/generated/dailybot.ts +0 -15
- package/generated/datadog.ts +0 -47
- package/generated/datagma.ts +0 -8
- package/generated/datarobot.ts +0 -8
- package/generated/deel.ts +0 -8
- package/generated/demio.ts +0 -8
- package/generated/dialpad.ts +0 -201
- package/generated/digicert.ts +0 -15
- package/generated/discord.ts +0 -17
- package/generated/discordbot.ts +0 -173
- package/generated/docmosis.ts +0 -8
- package/generated/docusign.ts +0 -351
- package/generated/dropbox.ts +0 -20
- package/generated/dropbox_sign.ts +0 -8
- package/generated/dynamics365.ts +0 -25
- package/generated/echtpost.ts +0 -10
- package/generated/elevenlabs.ts +0 -70
- package/generated/emailoctopus.ts +0 -16
- package/generated/enigma.ts +0 -11
- package/generated/entelligence.ts +0 -11
- package/generated/epic_games.ts +0 -8
- package/generated/eventbrite.ts +0 -12
- package/generated/exa.ts +0 -13
- package/generated/excel.ts +0 -34
- package/generated/exist.ts +0 -8
- package/generated/facebook.ts +0 -8
- package/generated/factorial.ts +0 -8
- package/generated/figma.ts +0 -59
- package/generated/finage.ts +0 -19
- package/generated/firecrawl.ts +0 -16
- package/generated/fireflies.ts +0 -21
- package/generated/fitbit.ts +0 -8
- package/generated/flutterwave.ts +0 -33
- package/generated/fomo.ts +0 -10
- package/generated/formcarry.ts +0 -10
- package/generated/formsite.ts +0 -14
- package/generated/foursquare.ts +0 -14
- package/generated/freshbooks.ts +0 -11
- package/generated/freshdesk.ts +0 -16
- package/generated/front.ts +0 -8
- package/generated/github.ts +0 -967
- package/generated/gitlab.ts +0 -82
- package/generated/gmail.d.ts +0 -205
- package/generated/gmail.js +0 -150
- package/generated/gmail.ts +0 -223
- package/generated/go_to_webinar.ts +0 -8
- package/generated/gong.ts +0 -63
- package/generated/google_analytics.ts +0 -13
- package/generated/google_maps.ts +0 -16
- package/generated/googleads.ts +0 -14
- package/generated/googlebigquery.ts +0 -10
- package/generated/googlecalendar.ts +0 -39
- package/generated/googledocs.ts +0 -41
- package/generated/googledrive.ts +0 -62
- package/generated/googlemeet.ts +0 -18
- package/generated/googlephotos.ts +0 -22
- package/generated/googlesheets.ts +0 -40
- package/generated/googleslides.ts +0 -8
- package/generated/googlesuper.ts +0 -230
- package/generated/googletasks.ts +0 -23
- package/generated/gorgias.ts +0 -41
- package/generated/gumroad.ts +0 -14
- package/generated/guru.ts +0 -8
- package/generated/hackernews.ts +0 -15
- package/generated/hackerrank_work.ts +0 -8
- package/generated/harvest.ts +0 -56
- package/generated/helcim.ts +0 -8
- package/generated/heygen.ts +0 -44
- package/generated/highlevel.ts +0 -8
- package/generated/hubspot.ts +0 -252
- package/generated/humanloop.ts +0 -13
- package/generated/icims_talent_cloud.ts +0 -8
- package/generated/idea_scale.ts +0 -8
- package/generated/index.d.ts +0 -377
- package/generated/index.js +0 -168
- package/generated/index.ts +0 -273
- package/generated/insighto_ai.ts +0 -19
- package/generated/intercom.ts +0 -52
- package/generated/interzoid.ts +0 -8
- package/generated/jira.ts +0 -59
- package/generated/jotform.ts +0 -15
- package/generated/junglescout.ts +0 -15
- package/generated/keap.ts +0 -8
- package/generated/kibana.ts +0 -58
- package/generated/kit.ts +0 -38
- package/generated/klaviyo.ts +0 -240
- package/generated/klipfolio.ts +0 -20
- package/generated/kommo.ts +0 -24
- package/generated/lastpass.ts +0 -8
- package/generated/launch_darkly.ts +0 -16
- package/generated/leadfeeder.ts +0 -13
- package/generated/leadoku.ts +0 -10
- package/generated/lever.ts +0 -8
- package/generated/lever_sandbox.ts +0 -8
- package/generated/lexoffice.ts +0 -8
- package/generated/linear.ts +0 -31
- package/generated/linkedin.ts +0 -13
- package/generated/linkhut.ts +0 -14
- package/generated/linkup.ts +0 -11
- package/generated/listennotes.ts +0 -35
- package/generated/lmnt.ts +0 -16
- package/generated/lodgify.ts +0 -10
- package/generated/mailchimp.ts +0 -285
- package/generated/mailerlite.ts +0 -8
- package/generated/maintainx.ts +0 -20
- package/generated/make.ts +0 -12
- package/generated/mboum.ts +0 -8
- package/generated/mem0.ts +0 -52
- package/generated/metaads.ts +0 -25
- package/generated/metatextai.ts +0 -8
- package/generated/microsoft_clarity.ts +0 -10
- package/generated/microsoft_teams.ts +0 -22
- package/generated/microsoft_tenant.ts +0 -8
- package/generated/miro.ts +0 -23
- package/generated/mixpanel.ts +0 -30
- package/generated/mocean.ts +0 -8
- package/generated/monday.ts +0 -30
- package/generated/mopinion.ts +0 -8
- package/generated/more_trees.ts +0 -10
- package/generated/moxie.ts +0 -8
- package/generated/moz.ts +0 -8
- package/generated/mural.ts +0 -14
- package/generated/nasdaq.ts +0 -15
- package/generated/ncscale.ts +0 -8
- package/generated/neon.ts +0 -78
- package/generated/netsuite.ts +0 -8
- package/generated/nextdns.ts +0 -11
- package/generated/ngrok.ts +0 -18
- package/generated/notion.ts +0 -40
- package/generated/oncehub.ts +0 -8
- package/generated/one_drive.ts +0 -49
- package/generated/onepage.ts +0 -11
- package/generated/open_sea.ts +0 -33
- package/generated/outlook.ts +0 -37
- package/generated/pagerduty.ts +0 -362
- package/generated/pandadoc.ts +0 -23
- package/generated/peopledatalabs.ts +0 -24
- package/generated/perplexityai.ts +0 -10
- package/generated/piggy.ts +0 -8
- package/generated/pipedrive.ts +0 -288
- package/generated/placekey.ts +0 -12
- package/generated/posthog.ts +0 -367
- package/generated/precoro.ts +0 -8
- package/generated/printnode.ts +0 -8
- package/generated/process_street.ts +0 -14
- package/generated/productboard.ts +0 -8
- package/generated/qualaroo.ts +0 -8
- package/generated/quickbooks.ts +0 -22
- package/generated/rafflys.ts +0 -8
- package/generated/ragic.ts +0 -10
- package/generated/ramp.ts +0 -17
- package/generated/ravenseotools.ts +0 -8
- package/generated/recallai.ts +0 -17
- package/generated/reddit.ts +0 -19
- package/generated/resend.ts +0 -27
- package/generated/retellai.ts +0 -19
- package/generated/retently.ts +0 -24
- package/generated/ring_central.ts +0 -8
- package/generated/rippling.ts +0 -8
- package/generated/rocket_reach.ts +0 -8
- package/generated/rocketlane.ts +0 -42
- package/generated/rootly.ts +0 -12
- package/generated/rosette_text_analytics.ts +0 -12
- package/generated/sage.ts +0 -8
- package/generated/salesforce.ts +0 -46
- package/generated/scrape_do.ts +0 -28
- package/generated/scrapingant.ts +0 -14
- package/generated/screenshotone.ts +0 -10
- package/generated/seismic.ts +0 -8
- package/generated/semanticscholar.ts +0 -23
- package/generated/semrush.ts +0 -45
- package/generated/sendgrid.ts +0 -384
- package/generated/sentry.ts +0 -185
- package/generated/serpapi.ts +0 -32
- package/generated/servicem8.ts +0 -37
- package/generated/servicenow.ts +0 -14
- package/generated/share_point.ts +0 -15
- package/generated/shopify.ts +0 -37
- package/generated/shortcut.ts +0 -131
- package/generated/simplesat.ts +0 -11
- package/generated/slack.d.ts +0 -16
- package/generated/slack.js +0 -8
- package/generated/slack.ts +0 -18
- package/generated/slackbot.ts +0 -205
- package/generated/smartrecruiters.ts +0 -8
- package/generated/smugmug.ts +0 -14
- package/generated/snowflake.ts +0 -15
- package/generated/sourcegraph.ts +0 -16
- package/generated/square.ts +0 -8
- package/generated/stack_exchange.ts +0 -17
- package/generated/starton.ts +0 -11
- package/generated/storeganise.ts +0 -12
- package/generated/stripe.ts +0 -50
- package/generated/supabase.ts +0 -86
- package/generated/survey_monkey.ts +0 -8
- package/generated/tally.ts +0 -25
- package/generated/tapfiliate.ts +0 -11
- package/generated/tapform.ts +0 -8
- package/generated/tavily.ts +0 -10
- package/generated/terminus.ts +0 -8
- package/generated/text_to_pdf.ts +0 -10
- package/generated/textrazor.ts +0 -22
- package/generated/timecamp.ts +0 -10
- package/generated/timekit.ts +0 -8
- package/generated/timely.ts +0 -11
- package/generated/tinypng.ts +0 -15
- package/generated/tinyurl.ts +0 -10
- package/generated/tisane.ts +0 -15
- package/generated/todoist.ts +0 -19
- package/generated/toneden.ts +0 -8
- package/generated/tpscheck.ts +0 -10
- package/generated/trello.ts +0 -360
- package/generated/twitch.ts +0 -8
- package/generated/twitter.ts +0 -82
- package/generated/twitter_media.ts +0 -10
- package/generated/typefully.ts +0 -14
- package/generated/venly.ts +0 -8
- package/generated/vero.ts +0 -8
- package/generated/visme.ts +0 -8
- package/generated/waboxapp.ts +0 -8
- package/generated/wakatime.ts +0 -8
- package/generated/wave_accounting.ts +0 -8
- package/generated/weathermap.ts +0 -10
- package/generated/webex.ts +0 -37
- package/generated/webflow.ts +0 -30
- package/generated/whatsapp.ts +0 -14
- package/generated/wiz.ts +0 -8
- package/generated/workiom.ts +0 -12
- package/generated/wrike.ts +0 -47
- package/generated/xero.ts +0 -13
- package/generated/yandex.ts +0 -13
- package/generated/ynab.ts +0 -8
- package/generated/yousearch.ts +0 -10
- package/generated/youtube.ts +0 -26
- package/generated/zendesk.ts +0 -23
- package/generated/zenrows.ts +0 -25
- package/generated/zenserp.ts +0 -20
- package/generated/zoho.ts +0 -33
- package/generated/zoho_bigin.ts +0 -21
- package/generated/zoho_books.ts +0 -8
- package/generated/zoho_desk.ts +0 -8
- package/generated/zoho_inventory.ts +0 -8
- package/generated/zoho_invoice.ts +0 -15
- package/generated/zoho_mail.ts +0 -8
- package/generated/zoom.ts +0 -181
- package/generated/zoominfo.ts +0 -26
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
The core Composio SDK which allows users to interact with the Composio Platform. It provides a powerful and flexible way to manage and execute tools, handle authentication, and integrate with various platforms and frameworks.
|
|
4
4
|
|
|
5
|
+
[Learn more about the SDK from our docs](https://docs.composio.dev)
|
|
6
|
+
|
|
5
7
|
## Core Features
|
|
6
8
|
|
|
7
9
|
- **Tools**: Manage and execute tools within the Composio ecosystem. Includes functionality to list, retrieve, and execute tools.
|
|
@@ -27,22 +29,86 @@ pnpm add @composio/core
|
|
|
27
29
|
|
|
28
30
|
```typescript
|
|
29
31
|
import { Composio } from '@composio/core';
|
|
30
|
-
import {
|
|
32
|
+
import { OpenAI } from 'openai';
|
|
33
|
+
|
|
34
|
+
// Initialize OpenAI client
|
|
35
|
+
const openai = new OpenAI({
|
|
36
|
+
apiKey: process.env.OPENAI_API_KEY,
|
|
37
|
+
});
|
|
31
38
|
|
|
39
|
+
// Initialize Composio with your API key
|
|
32
40
|
const composio = new Composio({
|
|
33
41
|
apiKey: process.env.COMPOSIO_API_KEY,
|
|
34
|
-
// OpenAIProvider is the default, so this is optional
|
|
35
|
-
provider: new OpenAIProvider(),
|
|
36
42
|
});
|
|
37
43
|
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
async function main() {
|
|
45
|
+
try {
|
|
46
|
+
// Fetch tools - single tool or multiple tools
|
|
47
|
+
const tools = await composio.tools.get('default', 'HACKERNEWS_GET_USER');
|
|
48
|
+
// Or fetch multiple tools: await composio.tools.get('default', { toolkits: ['hackernews'] });
|
|
49
|
+
|
|
50
|
+
const query = "Find information about the HackerNews user 'pg'";
|
|
51
|
+
|
|
52
|
+
// Create chat completion with tools
|
|
53
|
+
const response = await openai.chat.completions.create({
|
|
54
|
+
model: 'gpt-4o',
|
|
55
|
+
messages: [
|
|
56
|
+
{
|
|
57
|
+
role: 'system',
|
|
58
|
+
content: 'You are a helpful assistant that can use tools to answer questions.',
|
|
59
|
+
},
|
|
60
|
+
{ role: 'user', content: query },
|
|
61
|
+
],
|
|
62
|
+
tools: tools,
|
|
63
|
+
tool_choice: 'auto',
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Handle tool calls if the assistant decides to use them
|
|
67
|
+
if (response.choices[0].message.tool_calls) {
|
|
68
|
+
console.log(
|
|
69
|
+
'🔧 Assistant is using tool:',
|
|
70
|
+
response.choices[0].message.tool_calls[0].function.name
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
// Execute the tool call
|
|
74
|
+
const toolResult = await composio.provider.executeToolCall(
|
|
75
|
+
'default',
|
|
76
|
+
response.choices[0].message.tool_calls[0],
|
|
77
|
+
{
|
|
78
|
+
connectedAccountId: '', // Optional: specify connected account
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
console.log('✅ Tool execution result:', JSON.parse(toolResult));
|
|
83
|
+
|
|
84
|
+
// Get final response from assistant with tool result
|
|
85
|
+
const finalResponse = await openai.chat.completions.create({
|
|
86
|
+
model: 'gpt-4o',
|
|
87
|
+
messages: [
|
|
88
|
+
{
|
|
89
|
+
role: 'system',
|
|
90
|
+
content: 'You are a helpful assistant that can use tools to answer questions.',
|
|
91
|
+
},
|
|
92
|
+
{ role: 'user', content: query },
|
|
93
|
+
response.choices[0].message,
|
|
94
|
+
{
|
|
95
|
+
role: 'tool',
|
|
96
|
+
tool_call_id: response.choices[0].message.tool_calls[0].id,
|
|
97
|
+
content: toolResult,
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
console.log('🤖 Final response:', finalResponse.choices[0].message.content);
|
|
103
|
+
} else {
|
|
104
|
+
console.log('🤖 Response:', response.choices[0].message.content);
|
|
105
|
+
}
|
|
106
|
+
} catch (error) {
|
|
107
|
+
console.error('❌ Error:', error);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
40
110
|
|
|
41
|
-
|
|
42
|
-
const tools = await composio.tools.get('user123', {
|
|
43
|
-
category: 'search',
|
|
44
|
-
limit: 10,
|
|
45
|
-
});
|
|
111
|
+
main();
|
|
46
112
|
```
|
|
47
113
|
|
|
48
114
|
## Configuration
|
|
@@ -51,12 +117,14 @@ The Composio constructor accepts the following configuration options:
|
|
|
51
117
|
|
|
52
118
|
```typescript
|
|
53
119
|
interface ComposioConfig {
|
|
54
|
-
apiKey?: string; // Your Composio API key
|
|
55
|
-
baseURL?: string; // Custom API base URL (optional)
|
|
120
|
+
apiKey?: string | null; // Your Composio API key
|
|
121
|
+
baseURL?: string | null; // Custom API base URL (optional)
|
|
56
122
|
allowTracking?: boolean; // Enable/disable telemetry (default: true)
|
|
57
|
-
|
|
123
|
+
autoUploadDownloadFiles?: boolean; // Whether to automatically upload and download files during tool execution (default: true)
|
|
58
124
|
provider?: TProvider; // Custom provider (default: OpenAIProvider)
|
|
59
|
-
host?: string; // Name of the host service which is using the SDK, this is for telemetry
|
|
125
|
+
host?: string; // Name of the host service which is using the SDK, this is for telemetry
|
|
126
|
+
defaultHeaders?: ComposioRequestHeaders; // Request headers to be passed to the Composio API client
|
|
127
|
+
disableVersionCheck?: boolean; // Whether to disable version check for the Composio SDK (default: false)
|
|
60
128
|
}
|
|
61
129
|
```
|
|
62
130
|
|
|
@@ -70,7 +138,7 @@ Schema modifiers allow you to transform tool schemas before they are used:
|
|
|
70
138
|
|
|
71
139
|
```typescript
|
|
72
140
|
const tools = await composio.tools.get('user123', 'HACKERNEWS_SEARCH_POSTS', {
|
|
73
|
-
modifySchema: (toolSlug
|
|
141
|
+
modifySchema: ({ toolSlug, toolkitSlug, schema }) => ({
|
|
74
142
|
...tool,
|
|
75
143
|
description: 'Enhanced HackerNews search with additional features',
|
|
76
144
|
inputParameters: {
|
|
@@ -92,7 +160,7 @@ For agentic providers (like Vercel AI and Langchain), you can also modify tool e
|
|
|
92
160
|
```typescript
|
|
93
161
|
const tools = await composio.tools.get('user123', 'HACKERNEWS_SEARCH_POSTS', {
|
|
94
162
|
// Transform input before execution
|
|
95
|
-
beforeExecute: (toolSlug
|
|
163
|
+
beforeExecute: ({ toolSlug, toolkitSlug, params }) => ({
|
|
96
164
|
...params,
|
|
97
165
|
arguments: {
|
|
98
166
|
...params.arguments,
|
|
@@ -101,7 +169,7 @@ const tools = await composio.tools.get('user123', 'HACKERNEWS_SEARCH_POSTS', {
|
|
|
101
169
|
}),
|
|
102
170
|
|
|
103
171
|
// Transform output after execution
|
|
104
|
-
afterExecute: (toolSlug
|
|
172
|
+
afterExecute: ({ toolSlug, toolkitSlug, result }) => ({
|
|
105
173
|
...response,
|
|
106
174
|
data: {
|
|
107
175
|
...response.data,
|
|
@@ -128,11 +196,11 @@ const composio = new Composio({
|
|
|
128
196
|
});
|
|
129
197
|
|
|
130
198
|
// Create a connected account
|
|
131
|
-
const connectionRequest = await composio.
|
|
199
|
+
const connectionRequest = await composio.connectedAccounts.initiate(
|
|
132
200
|
'user123', // userId
|
|
133
|
-
'
|
|
201
|
+
'ac_12343544', // authConfigId: You can create it from the dashboard
|
|
134
202
|
{
|
|
135
|
-
|
|
203
|
+
callbackUrl: 'https://your-app.com/callback',
|
|
136
204
|
data: {
|
|
137
205
|
// Additional data for the connection
|
|
138
206
|
scope: ['read', 'write'],
|
|
@@ -143,6 +211,7 @@ const connectionRequest = await composio.createConnectedAccount(
|
|
|
143
211
|
// Wait for the connection to be established
|
|
144
212
|
// Default timeout is 60 seconds
|
|
145
213
|
const connectedAccount = await connectionRequest.waitForConnection();
|
|
214
|
+
console.log({ connectedAccount });
|
|
146
215
|
```
|
|
147
216
|
|
|
148
217
|
### Waiting for Connection Establishment
|
package/dist/index.cjs
CHANGED
|
@@ -958,6 +958,7 @@ __export(constants_exports, {
|
|
|
958
958
|
COMPOSIO_DIR: () => COMPOSIO_DIR,
|
|
959
959
|
COMPOSIO_LOG_LEVEL: () => COMPOSIO_LOG_LEVEL,
|
|
960
960
|
DEFAULT_BASE_URL: () => DEFAULT_BASE_URL,
|
|
961
|
+
DEFAULT_WEB_URL: () => DEFAULT_WEB_URL,
|
|
961
962
|
IS_DEVELOPMENT_OR_CI: () => IS_DEVELOPMENT_OR_CI,
|
|
962
963
|
TELEMETRY_URL: () => TELEMETRY_URL,
|
|
963
964
|
TEMP_FILES_DIRECTORY_NAME: () => TEMP_FILES_DIRECTORY_NAME,
|
|
@@ -978,6 +979,7 @@ var COMPOSIO_DIR = ".composio";
|
|
|
978
979
|
var USER_DATA_FILE_NAME = "user_data.json";
|
|
979
980
|
var TEMP_FILES_DIRECTORY_NAME = "files";
|
|
980
981
|
var DEFAULT_BASE_URL = "https://backend.composio.dev";
|
|
982
|
+
var DEFAULT_WEB_URL = "https://platform.composio.dev";
|
|
981
983
|
var TELEMETRY_URL = "https://app.composio.dev";
|
|
982
984
|
var CLIENT_PUSHER_KEY = getEnvVariable("CLIENT_PUSHER_KEY") || "ff9f18c208855d77a152";
|
|
983
985
|
var COMPOSIO_LOG_LEVEL = getEnvVariable("COMPOSIO_LOG_LEVEL");
|
|
@@ -1473,6 +1475,9 @@ var import_uuid = require("uuid");
|
|
|
1473
1475
|
function getRandomUUID() {
|
|
1474
1476
|
return (0, import_uuid.v4)();
|
|
1475
1477
|
}
|
|
1478
|
+
function getRandomShortId() {
|
|
1479
|
+
return getRandomUUID().slice(0, 8).replace(/-/g, "");
|
|
1480
|
+
}
|
|
1476
1481
|
|
|
1477
1482
|
// src/services/telemetry/TelemetryService.ts
|
|
1478
1483
|
var TELEMETRY_URL2 = "https://telemetry.composio.dev/v1";
|
|
@@ -2269,11 +2274,77 @@ var ComposioFileUploadError = class extends ComposioError {
|
|
|
2269
2274
|
// src/utils/fileUtils.ts
|
|
2270
2275
|
var import_crypto = __toESM(require("crypto"), 1);
|
|
2271
2276
|
var import_path = __toESM(require("path"), 1);
|
|
2277
|
+
var getExtensionFromMimeType = (mimeType) => {
|
|
2278
|
+
const mimeToExt = {
|
|
2279
|
+
"text/plain": "txt",
|
|
2280
|
+
"text/html": "html",
|
|
2281
|
+
"text/css": "css",
|
|
2282
|
+
"text/javascript": "js",
|
|
2283
|
+
"application/json": "json",
|
|
2284
|
+
"application/xml": "xml",
|
|
2285
|
+
"application/pdf": "pdf",
|
|
2286
|
+
"application/zip": "zip",
|
|
2287
|
+
"application/x-zip-compressed": "zip",
|
|
2288
|
+
"application/gzip": "gz",
|
|
2289
|
+
"application/x-tar": "tar",
|
|
2290
|
+
"application/msword": "doc",
|
|
2291
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
|
|
2292
|
+
"application/vnd.ms-excel": "xls",
|
|
2293
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx",
|
|
2294
|
+
"application/vnd.ms-powerpoint": "ppt",
|
|
2295
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation": "pptx",
|
|
2296
|
+
"image/jpeg": "jpg",
|
|
2297
|
+
"image/jpg": "jpg",
|
|
2298
|
+
"image/png": "png",
|
|
2299
|
+
"image/gif": "gif",
|
|
2300
|
+
"image/svg+xml": "svg",
|
|
2301
|
+
"image/webp": "webp",
|
|
2302
|
+
"image/bmp": "bmp",
|
|
2303
|
+
"image/tiff": "tiff",
|
|
2304
|
+
"audio/mpeg": "mp3",
|
|
2305
|
+
"audio/wav": "wav",
|
|
2306
|
+
"audio/ogg": "ogg",
|
|
2307
|
+
"video/mp4": "mp4",
|
|
2308
|
+
"video/mpeg": "mpeg",
|
|
2309
|
+
"video/quicktime": "mov",
|
|
2310
|
+
"video/x-msvideo": "avi",
|
|
2311
|
+
"video/webm": "webm"
|
|
2312
|
+
};
|
|
2313
|
+
const cleanMimeType = mimeType.split(";")[0].toLowerCase().trim();
|
|
2314
|
+
if (mimeToExt[cleanMimeType]) {
|
|
2315
|
+
return mimeToExt[cleanMimeType];
|
|
2316
|
+
}
|
|
2317
|
+
const parts = cleanMimeType.split("/");
|
|
2318
|
+
if (parts.length === 2) {
|
|
2319
|
+
const subtype = parts[1].toLowerCase();
|
|
2320
|
+
const cleanSubtype = subtype;
|
|
2321
|
+
if (cleanSubtype.includes("+")) {
|
|
2322
|
+
const plusParts = cleanSubtype.split("+");
|
|
2323
|
+
const prefix = plusParts[0];
|
|
2324
|
+
const suffix = plusParts[plusParts.length - 1];
|
|
2325
|
+
const knownPrefixes = ["svg", "atom", "rss"];
|
|
2326
|
+
if (knownPrefixes.includes(prefix)) {
|
|
2327
|
+
return prefix;
|
|
2328
|
+
}
|
|
2329
|
+
const structuredSuffixes = ["json", "xml", "yaml", "zip", "gzip"];
|
|
2330
|
+
if (structuredSuffixes.includes(suffix)) {
|
|
2331
|
+
return suffix;
|
|
2332
|
+
}
|
|
2333
|
+
return suffix;
|
|
2334
|
+
}
|
|
2335
|
+
return cleanSubtype || "txt";
|
|
2336
|
+
}
|
|
2337
|
+
return "txt";
|
|
2338
|
+
};
|
|
2339
|
+
var generateTimestampedFilename = (extension, prefix) => {
|
|
2340
|
+
const basePrefix = prefix || "file_ts";
|
|
2341
|
+
return `${basePrefix}${Date.now()}${getRandomShortId()}.${extension}`;
|
|
2342
|
+
};
|
|
2272
2343
|
var readFileContent = async (path) => {
|
|
2273
2344
|
try {
|
|
2274
2345
|
const content = require("fs").readFileSync(path);
|
|
2275
2346
|
return {
|
|
2276
|
-
fileName:
|
|
2347
|
+
fileName: generateTimestampedFilename(path.split(".").pop() || "txt"),
|
|
2277
2348
|
content: content.toString("base64"),
|
|
2278
2349
|
mimeType: "application/octet-stream"
|
|
2279
2350
|
};
|
|
@@ -2289,10 +2360,23 @@ var readFileContentFromURL = async (path) => {
|
|
|
2289
2360
|
const arrayBuffer = await response.arrayBuffer();
|
|
2290
2361
|
const content = Buffer.from(arrayBuffer);
|
|
2291
2362
|
const mimeType = response.headers.get("content-type") || "application/octet-stream";
|
|
2363
|
+
const url = new URL(path);
|
|
2364
|
+
const pathname = url.pathname;
|
|
2365
|
+
let fileName = import_path.default.basename(pathname);
|
|
2366
|
+
if (!fileName || fileName === "/") {
|
|
2367
|
+
const extension = getExtensionFromMimeType(mimeType);
|
|
2368
|
+
fileName = generateTimestampedFilename(extension);
|
|
2369
|
+
} else {
|
|
2370
|
+
const hasExtension = fileName.includes(".");
|
|
2371
|
+
if (!hasExtension) {
|
|
2372
|
+
const extension = getExtensionFromMimeType(mimeType);
|
|
2373
|
+
fileName = generateTimestampedFilename(extension);
|
|
2374
|
+
}
|
|
2375
|
+
}
|
|
2292
2376
|
return {
|
|
2293
2377
|
content: content.toString("base64"),
|
|
2294
2378
|
mimeType,
|
|
2295
|
-
fileName
|
|
2379
|
+
fileName
|
|
2296
2380
|
};
|
|
2297
2381
|
};
|
|
2298
2382
|
var uploadFileToS3 = async (fileName, content, toolSlug, toolkitSlug, mimeType, client) => {
|
|
@@ -2376,8 +2460,8 @@ var downloadFileFromS3 = async ({
|
|
|
2376
2460
|
throw new Error(`Failed to download file: ${response.statusText}`);
|
|
2377
2461
|
}
|
|
2378
2462
|
const data = await response.arrayBuffer();
|
|
2379
|
-
const extension = mimeType
|
|
2380
|
-
const fileName = `${toolSlug}_
|
|
2463
|
+
const extension = getExtensionFromMimeType(mimeType);
|
|
2464
|
+
const fileName = generateTimestampedFilename(extension, `${toolSlug}_`);
|
|
2381
2465
|
const filePath = saveFile(fileName, Buffer.from(data), true);
|
|
2382
2466
|
return {
|
|
2383
2467
|
name: fileName,
|
|
@@ -3847,7 +3931,7 @@ var ConnectedAccounts = class {
|
|
|
3847
3931
|
});
|
|
3848
3932
|
if (connectedAccount.items.length > 0 && !options?.allowMultiple) {
|
|
3849
3933
|
throw new ComposioMultipleConnectedAccountsError(
|
|
3850
|
-
`Multiple connected accounts found for user ${userId} in auth config ${authConfigId}
|
|
3934
|
+
`Multiple connected accounts found for user ${userId} in auth config ${authConfigId}. Please use the allowMultiple option to allow multiple connected accounts.`
|
|
3851
3935
|
);
|
|
3852
3936
|
} else if (connectedAccount.items.length > 0) {
|
|
3853
3937
|
logger_default.warn(
|
|
@@ -6590,7 +6674,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
6590
6674
|
};
|
|
6591
6675
|
|
|
6592
6676
|
// package.json
|
|
6593
|
-
var version = "0.1.
|
|
6677
|
+
var version = "0.1.47";
|
|
6594
6678
|
|
|
6595
6679
|
// src/models/Files.ts
|
|
6596
6680
|
var Files = class {
|
|
@@ -6745,7 +6829,9 @@ var Composio = class _Composio {
|
|
|
6745
6829
|
}
|
|
6746
6830
|
telemetry.instrument(this);
|
|
6747
6831
|
telemetry.instrument(this.provider);
|
|
6748
|
-
|
|
6832
|
+
if (!this.config.disableVersionCheck) {
|
|
6833
|
+
checkForLatestVersionFromNPM(version);
|
|
6834
|
+
}
|
|
6749
6835
|
}
|
|
6750
6836
|
/**
|
|
6751
6837
|
* Get the Composio SDK client.
|
package/dist/index.d.cts
CHANGED
|
@@ -72791,6 +72791,12 @@ type ComposioConfig<TProvider extends BaseComposioProvider<unknown, unknown, unk
|
|
|
72791
72791
|
* ```
|
|
72792
72792
|
*/
|
|
72793
72793
|
defaultHeaders?: ComposioRequestHeaders;
|
|
72794
|
+
/**
|
|
72795
|
+
* Whether to disable version check for the Composio SDK.
|
|
72796
|
+
* @example true, false
|
|
72797
|
+
* @default false
|
|
72798
|
+
*/
|
|
72799
|
+
disableVersionCheck?: boolean;
|
|
72794
72800
|
};
|
|
72795
72801
|
/**
|
|
72796
72802
|
* Extract the MCP response type from a provider
|
|
@@ -72976,8 +72982,8 @@ declare class AuthScheme {
|
|
|
72976
72982
|
* @returns ConnectionData object
|
|
72977
72983
|
*/
|
|
72978
72984
|
static OAuth2(params: BaseConnectionFields & {
|
|
72979
|
-
access_token
|
|
72980
|
-
token_type
|
|
72985
|
+
access_token?: string;
|
|
72986
|
+
token_type?: string;
|
|
72981
72987
|
id_token?: string;
|
|
72982
72988
|
refresh_token?: string;
|
|
72983
72989
|
expires_in?: number;
|
|
@@ -73001,7 +73007,7 @@ declare class AuthScheme {
|
|
|
73001
73007
|
* @returns ConnectionData object
|
|
73002
73008
|
*/
|
|
73003
73009
|
static OAuth1(params: BaseConnectionFields & {
|
|
73004
|
-
oauth_token
|
|
73010
|
+
oauth_token?: string;
|
|
73005
73011
|
consumer_key?: string;
|
|
73006
73012
|
redirectUrl?: string;
|
|
73007
73013
|
callback_url?: string;
|
|
@@ -73102,6 +73108,7 @@ declare const COMPOSIO_DIR = ".composio";
|
|
|
73102
73108
|
declare const USER_DATA_FILE_NAME = "user_data.json";
|
|
73103
73109
|
declare const TEMP_FILES_DIRECTORY_NAME = "files";
|
|
73104
73110
|
declare const DEFAULT_BASE_URL = "https://backend.composio.dev";
|
|
73111
|
+
declare const DEFAULT_WEB_URL = "https://platform.composio.dev";
|
|
73105
73112
|
declare const TELEMETRY_URL = "https://app.composio.dev";
|
|
73106
73113
|
declare const CLIENT_PUSHER_KEY: string;
|
|
73107
73114
|
declare const COMPOSIO_LOG_LEVEL: "debug" | "info" | "warn" | "error" | undefined;
|
|
@@ -73111,12 +73118,13 @@ declare const constants_CLIENT_PUSHER_KEY: typeof CLIENT_PUSHER_KEY;
|
|
|
73111
73118
|
declare const constants_COMPOSIO_DIR: typeof COMPOSIO_DIR;
|
|
73112
73119
|
declare const constants_COMPOSIO_LOG_LEVEL: typeof COMPOSIO_LOG_LEVEL;
|
|
73113
73120
|
declare const constants_DEFAULT_BASE_URL: typeof DEFAULT_BASE_URL;
|
|
73121
|
+
declare const constants_DEFAULT_WEB_URL: typeof DEFAULT_WEB_URL;
|
|
73114
73122
|
declare const constants_IS_DEVELOPMENT_OR_CI: typeof IS_DEVELOPMENT_OR_CI;
|
|
73115
73123
|
declare const constants_TELEMETRY_URL: typeof TELEMETRY_URL;
|
|
73116
73124
|
declare const constants_TEMP_FILES_DIRECTORY_NAME: typeof TEMP_FILES_DIRECTORY_NAME;
|
|
73117
73125
|
declare const constants_USER_DATA_FILE_NAME: typeof USER_DATA_FILE_NAME;
|
|
73118
73126
|
declare namespace constants {
|
|
73119
|
-
export { constants_CLIENT_PUSHER_KEY as CLIENT_PUSHER_KEY, constants_COMPOSIO_DIR as COMPOSIO_DIR, constants_COMPOSIO_LOG_LEVEL as COMPOSIO_LOG_LEVEL, constants_DEFAULT_BASE_URL as DEFAULT_BASE_URL, constants_IS_DEVELOPMENT_OR_CI as IS_DEVELOPMENT_OR_CI, constants_TELEMETRY_URL as TELEMETRY_URL, constants_TEMP_FILES_DIRECTORY_NAME as TEMP_FILES_DIRECTORY_NAME, constants_USER_DATA_FILE_NAME as USER_DATA_FILE_NAME };
|
|
73127
|
+
export { constants_CLIENT_PUSHER_KEY as CLIENT_PUSHER_KEY, constants_COMPOSIO_DIR as COMPOSIO_DIR, constants_COMPOSIO_LOG_LEVEL as COMPOSIO_LOG_LEVEL, constants_DEFAULT_BASE_URL as DEFAULT_BASE_URL, constants_DEFAULT_WEB_URL as DEFAULT_WEB_URL, constants_IS_DEVELOPMENT_OR_CI as IS_DEVELOPMENT_OR_CI, constants_TELEMETRY_URL as TELEMETRY_URL, constants_TEMP_FILES_DIRECTORY_NAME as TEMP_FILES_DIRECTORY_NAME, constants_USER_DATA_FILE_NAME as USER_DATA_FILE_NAME };
|
|
73120
73128
|
}
|
|
73121
73129
|
|
|
73122
73130
|
declare const LOG_LEVELS: {
|
package/dist/index.d.ts
CHANGED
|
@@ -72791,6 +72791,12 @@ type ComposioConfig<TProvider extends BaseComposioProvider<unknown, unknown, unk
|
|
|
72791
72791
|
* ```
|
|
72792
72792
|
*/
|
|
72793
72793
|
defaultHeaders?: ComposioRequestHeaders;
|
|
72794
|
+
/**
|
|
72795
|
+
* Whether to disable version check for the Composio SDK.
|
|
72796
|
+
* @example true, false
|
|
72797
|
+
* @default false
|
|
72798
|
+
*/
|
|
72799
|
+
disableVersionCheck?: boolean;
|
|
72794
72800
|
};
|
|
72795
72801
|
/**
|
|
72796
72802
|
* Extract the MCP response type from a provider
|
|
@@ -72976,8 +72982,8 @@ declare class AuthScheme {
|
|
|
72976
72982
|
* @returns ConnectionData object
|
|
72977
72983
|
*/
|
|
72978
72984
|
static OAuth2(params: BaseConnectionFields & {
|
|
72979
|
-
access_token
|
|
72980
|
-
token_type
|
|
72985
|
+
access_token?: string;
|
|
72986
|
+
token_type?: string;
|
|
72981
72987
|
id_token?: string;
|
|
72982
72988
|
refresh_token?: string;
|
|
72983
72989
|
expires_in?: number;
|
|
@@ -73001,7 +73007,7 @@ declare class AuthScheme {
|
|
|
73001
73007
|
* @returns ConnectionData object
|
|
73002
73008
|
*/
|
|
73003
73009
|
static OAuth1(params: BaseConnectionFields & {
|
|
73004
|
-
oauth_token
|
|
73010
|
+
oauth_token?: string;
|
|
73005
73011
|
consumer_key?: string;
|
|
73006
73012
|
redirectUrl?: string;
|
|
73007
73013
|
callback_url?: string;
|
|
@@ -73102,6 +73108,7 @@ declare const COMPOSIO_DIR = ".composio";
|
|
|
73102
73108
|
declare const USER_DATA_FILE_NAME = "user_data.json";
|
|
73103
73109
|
declare const TEMP_FILES_DIRECTORY_NAME = "files";
|
|
73104
73110
|
declare const DEFAULT_BASE_URL = "https://backend.composio.dev";
|
|
73111
|
+
declare const DEFAULT_WEB_URL = "https://platform.composio.dev";
|
|
73105
73112
|
declare const TELEMETRY_URL = "https://app.composio.dev";
|
|
73106
73113
|
declare const CLIENT_PUSHER_KEY: string;
|
|
73107
73114
|
declare const COMPOSIO_LOG_LEVEL: "debug" | "info" | "warn" | "error" | undefined;
|
|
@@ -73111,12 +73118,13 @@ declare const constants_CLIENT_PUSHER_KEY: typeof CLIENT_PUSHER_KEY;
|
|
|
73111
73118
|
declare const constants_COMPOSIO_DIR: typeof COMPOSIO_DIR;
|
|
73112
73119
|
declare const constants_COMPOSIO_LOG_LEVEL: typeof COMPOSIO_LOG_LEVEL;
|
|
73113
73120
|
declare const constants_DEFAULT_BASE_URL: typeof DEFAULT_BASE_URL;
|
|
73121
|
+
declare const constants_DEFAULT_WEB_URL: typeof DEFAULT_WEB_URL;
|
|
73114
73122
|
declare const constants_IS_DEVELOPMENT_OR_CI: typeof IS_DEVELOPMENT_OR_CI;
|
|
73115
73123
|
declare const constants_TELEMETRY_URL: typeof TELEMETRY_URL;
|
|
73116
73124
|
declare const constants_TEMP_FILES_DIRECTORY_NAME: typeof TEMP_FILES_DIRECTORY_NAME;
|
|
73117
73125
|
declare const constants_USER_DATA_FILE_NAME: typeof USER_DATA_FILE_NAME;
|
|
73118
73126
|
declare namespace constants {
|
|
73119
|
-
export { constants_CLIENT_PUSHER_KEY as CLIENT_PUSHER_KEY, constants_COMPOSIO_DIR as COMPOSIO_DIR, constants_COMPOSIO_LOG_LEVEL as COMPOSIO_LOG_LEVEL, constants_DEFAULT_BASE_URL as DEFAULT_BASE_URL, constants_IS_DEVELOPMENT_OR_CI as IS_DEVELOPMENT_OR_CI, constants_TELEMETRY_URL as TELEMETRY_URL, constants_TEMP_FILES_DIRECTORY_NAME as TEMP_FILES_DIRECTORY_NAME, constants_USER_DATA_FILE_NAME as USER_DATA_FILE_NAME };
|
|
73127
|
+
export { constants_CLIENT_PUSHER_KEY as CLIENT_PUSHER_KEY, constants_COMPOSIO_DIR as COMPOSIO_DIR, constants_COMPOSIO_LOG_LEVEL as COMPOSIO_LOG_LEVEL, constants_DEFAULT_BASE_URL as DEFAULT_BASE_URL, constants_DEFAULT_WEB_URL as DEFAULT_WEB_URL, constants_IS_DEVELOPMENT_OR_CI as IS_DEVELOPMENT_OR_CI, constants_TELEMETRY_URL as TELEMETRY_URL, constants_TEMP_FILES_DIRECTORY_NAME as TEMP_FILES_DIRECTORY_NAME, constants_USER_DATA_FILE_NAME as USER_DATA_FILE_NAME };
|
|
73120
73128
|
}
|
|
73121
73129
|
|
|
73122
73130
|
declare const LOG_LEVELS: {
|
package/dist/index.js
CHANGED
|
@@ -789,6 +789,7 @@ __export(constants_exports, {
|
|
|
789
789
|
COMPOSIO_DIR: () => COMPOSIO_DIR,
|
|
790
790
|
COMPOSIO_LOG_LEVEL: () => COMPOSIO_LOG_LEVEL,
|
|
791
791
|
DEFAULT_BASE_URL: () => DEFAULT_BASE_URL,
|
|
792
|
+
DEFAULT_WEB_URL: () => DEFAULT_WEB_URL,
|
|
792
793
|
IS_DEVELOPMENT_OR_CI: () => IS_DEVELOPMENT_OR_CI,
|
|
793
794
|
TELEMETRY_URL: () => TELEMETRY_URL,
|
|
794
795
|
TEMP_FILES_DIRECTORY_NAME: () => TEMP_FILES_DIRECTORY_NAME,
|
|
@@ -809,6 +810,7 @@ var COMPOSIO_DIR = ".composio";
|
|
|
809
810
|
var USER_DATA_FILE_NAME = "user_data.json";
|
|
810
811
|
var TEMP_FILES_DIRECTORY_NAME = "files";
|
|
811
812
|
var DEFAULT_BASE_URL = "https://backend.composio.dev";
|
|
813
|
+
var DEFAULT_WEB_URL = "https://platform.composio.dev";
|
|
812
814
|
var TELEMETRY_URL = "https://app.composio.dev";
|
|
813
815
|
var CLIENT_PUSHER_KEY = getEnvVariable("CLIENT_PUSHER_KEY") || "ff9f18c208855d77a152";
|
|
814
816
|
var COMPOSIO_LOG_LEVEL = getEnvVariable("COMPOSIO_LOG_LEVEL");
|
|
@@ -1304,6 +1306,9 @@ import { v4 as uuidv4 } from "uuid";
|
|
|
1304
1306
|
function getRandomUUID() {
|
|
1305
1307
|
return uuidv4();
|
|
1306
1308
|
}
|
|
1309
|
+
function getRandomShortId() {
|
|
1310
|
+
return getRandomUUID().slice(0, 8).replace(/-/g, "");
|
|
1311
|
+
}
|
|
1307
1312
|
|
|
1308
1313
|
// src/services/telemetry/TelemetryService.ts
|
|
1309
1314
|
var TELEMETRY_URL2 = "https://telemetry.composio.dev/v1";
|
|
@@ -2100,11 +2105,77 @@ var ComposioFileUploadError = class extends ComposioError {
|
|
|
2100
2105
|
// src/utils/fileUtils.ts
|
|
2101
2106
|
import crypto from "crypto";
|
|
2102
2107
|
import pathModule from "path";
|
|
2108
|
+
var getExtensionFromMimeType = (mimeType) => {
|
|
2109
|
+
const mimeToExt = {
|
|
2110
|
+
"text/plain": "txt",
|
|
2111
|
+
"text/html": "html",
|
|
2112
|
+
"text/css": "css",
|
|
2113
|
+
"text/javascript": "js",
|
|
2114
|
+
"application/json": "json",
|
|
2115
|
+
"application/xml": "xml",
|
|
2116
|
+
"application/pdf": "pdf",
|
|
2117
|
+
"application/zip": "zip",
|
|
2118
|
+
"application/x-zip-compressed": "zip",
|
|
2119
|
+
"application/gzip": "gz",
|
|
2120
|
+
"application/x-tar": "tar",
|
|
2121
|
+
"application/msword": "doc",
|
|
2122
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
|
|
2123
|
+
"application/vnd.ms-excel": "xls",
|
|
2124
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx",
|
|
2125
|
+
"application/vnd.ms-powerpoint": "ppt",
|
|
2126
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation": "pptx",
|
|
2127
|
+
"image/jpeg": "jpg",
|
|
2128
|
+
"image/jpg": "jpg",
|
|
2129
|
+
"image/png": "png",
|
|
2130
|
+
"image/gif": "gif",
|
|
2131
|
+
"image/svg+xml": "svg",
|
|
2132
|
+
"image/webp": "webp",
|
|
2133
|
+
"image/bmp": "bmp",
|
|
2134
|
+
"image/tiff": "tiff",
|
|
2135
|
+
"audio/mpeg": "mp3",
|
|
2136
|
+
"audio/wav": "wav",
|
|
2137
|
+
"audio/ogg": "ogg",
|
|
2138
|
+
"video/mp4": "mp4",
|
|
2139
|
+
"video/mpeg": "mpeg",
|
|
2140
|
+
"video/quicktime": "mov",
|
|
2141
|
+
"video/x-msvideo": "avi",
|
|
2142
|
+
"video/webm": "webm"
|
|
2143
|
+
};
|
|
2144
|
+
const cleanMimeType = mimeType.split(";")[0].toLowerCase().trim();
|
|
2145
|
+
if (mimeToExt[cleanMimeType]) {
|
|
2146
|
+
return mimeToExt[cleanMimeType];
|
|
2147
|
+
}
|
|
2148
|
+
const parts = cleanMimeType.split("/");
|
|
2149
|
+
if (parts.length === 2) {
|
|
2150
|
+
const subtype = parts[1].toLowerCase();
|
|
2151
|
+
const cleanSubtype = subtype;
|
|
2152
|
+
if (cleanSubtype.includes("+")) {
|
|
2153
|
+
const plusParts = cleanSubtype.split("+");
|
|
2154
|
+
const prefix = plusParts[0];
|
|
2155
|
+
const suffix = plusParts[plusParts.length - 1];
|
|
2156
|
+
const knownPrefixes = ["svg", "atom", "rss"];
|
|
2157
|
+
if (knownPrefixes.includes(prefix)) {
|
|
2158
|
+
return prefix;
|
|
2159
|
+
}
|
|
2160
|
+
const structuredSuffixes = ["json", "xml", "yaml", "zip", "gzip"];
|
|
2161
|
+
if (structuredSuffixes.includes(suffix)) {
|
|
2162
|
+
return suffix;
|
|
2163
|
+
}
|
|
2164
|
+
return suffix;
|
|
2165
|
+
}
|
|
2166
|
+
return cleanSubtype || "txt";
|
|
2167
|
+
}
|
|
2168
|
+
return "txt";
|
|
2169
|
+
};
|
|
2170
|
+
var generateTimestampedFilename = (extension, prefix) => {
|
|
2171
|
+
const basePrefix = prefix || "file_ts";
|
|
2172
|
+
return `${basePrefix}${Date.now()}${getRandomShortId()}.${extension}`;
|
|
2173
|
+
};
|
|
2103
2174
|
var readFileContent = async (path) => {
|
|
2104
2175
|
try {
|
|
2105
2176
|
const content = __require("fs").readFileSync(path);
|
|
2106
2177
|
return {
|
|
2107
|
-
fileName:
|
|
2178
|
+
fileName: generateTimestampedFilename(path.split(".").pop() || "txt"),
|
|
2108
2179
|
content: content.toString("base64"),
|
|
2109
2180
|
mimeType: "application/octet-stream"
|
|
2110
2181
|
};
|
|
@@ -2120,10 +2191,23 @@ var readFileContentFromURL = async (path) => {
|
|
|
2120
2191
|
const arrayBuffer = await response.arrayBuffer();
|
|
2121
2192
|
const content = Buffer.from(arrayBuffer);
|
|
2122
2193
|
const mimeType = response.headers.get("content-type") || "application/octet-stream";
|
|
2194
|
+
const url = new URL(path);
|
|
2195
|
+
const pathname = url.pathname;
|
|
2196
|
+
let fileName = pathModule.basename(pathname);
|
|
2197
|
+
if (!fileName || fileName === "/") {
|
|
2198
|
+
const extension = getExtensionFromMimeType(mimeType);
|
|
2199
|
+
fileName = generateTimestampedFilename(extension);
|
|
2200
|
+
} else {
|
|
2201
|
+
const hasExtension = fileName.includes(".");
|
|
2202
|
+
if (!hasExtension) {
|
|
2203
|
+
const extension = getExtensionFromMimeType(mimeType);
|
|
2204
|
+
fileName = generateTimestampedFilename(extension);
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2123
2207
|
return {
|
|
2124
2208
|
content: content.toString("base64"),
|
|
2125
2209
|
mimeType,
|
|
2126
|
-
fileName
|
|
2210
|
+
fileName
|
|
2127
2211
|
};
|
|
2128
2212
|
};
|
|
2129
2213
|
var uploadFileToS3 = async (fileName, content, toolSlug, toolkitSlug, mimeType, client) => {
|
|
@@ -2207,8 +2291,8 @@ var downloadFileFromS3 = async ({
|
|
|
2207
2291
|
throw new Error(`Failed to download file: ${response.statusText}`);
|
|
2208
2292
|
}
|
|
2209
2293
|
const data = await response.arrayBuffer();
|
|
2210
|
-
const extension = mimeType
|
|
2211
|
-
const fileName = `${toolSlug}_
|
|
2294
|
+
const extension = getExtensionFromMimeType(mimeType);
|
|
2295
|
+
const fileName = generateTimestampedFilename(extension, `${toolSlug}_`);
|
|
2212
2296
|
const filePath = saveFile(fileName, Buffer.from(data), true);
|
|
2213
2297
|
return {
|
|
2214
2298
|
name: fileName,
|
|
@@ -3678,7 +3762,7 @@ var ConnectedAccounts = class {
|
|
|
3678
3762
|
});
|
|
3679
3763
|
if (connectedAccount.items.length > 0 && !options?.allowMultiple) {
|
|
3680
3764
|
throw new ComposioMultipleConnectedAccountsError(
|
|
3681
|
-
`Multiple connected accounts found for user ${userId} in auth config ${authConfigId}
|
|
3765
|
+
`Multiple connected accounts found for user ${userId} in auth config ${authConfigId}. Please use the allowMultiple option to allow multiple connected accounts.`
|
|
3682
3766
|
);
|
|
3683
3767
|
} else if (connectedAccount.items.length > 0) {
|
|
3684
3768
|
logger_default.warn(
|
|
@@ -6421,7 +6505,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
6421
6505
|
};
|
|
6422
6506
|
|
|
6423
6507
|
// package.json
|
|
6424
|
-
var version = "0.1.
|
|
6508
|
+
var version = "0.1.47";
|
|
6425
6509
|
|
|
6426
6510
|
// src/models/Files.ts
|
|
6427
6511
|
var Files = class {
|
|
@@ -6576,7 +6660,9 @@ var Composio = class _Composio {
|
|
|
6576
6660
|
}
|
|
6577
6661
|
telemetry.instrument(this);
|
|
6578
6662
|
telemetry.instrument(this.provider);
|
|
6579
|
-
|
|
6663
|
+
if (!this.config.disableVersionCheck) {
|
|
6664
|
+
checkForLatestVersionFromNPM(version);
|
|
6665
|
+
}
|
|
6580
6666
|
}
|
|
6581
6667
|
/**
|
|
6582
6668
|
* Get the Composio SDK client.
|
package/package.json
CHANGED
package/generated/ably.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Map of Composio's ABLY toolkit.
|
|
3
|
-
*/
|
|
4
|
-
export const ABLY = {
|
|
5
|
-
slug: "ably",
|
|
6
|
-
tools: {
|
|
7
|
-
BATCH_PRESENCE: "ABLY_BATCH_PRESENCE",
|
|
8
|
-
BATCH_PRESENCE_HISTORY: "ABLY_BATCH_PRESENCE_HISTORY",
|
|
9
|
-
CREATE_CHANNEL: "ABLY_CREATE_CHANNEL",
|
|
10
|
-
DELETE_CHANNEL_SUBSCRIPTION: "ABLY_DELETE_CHANNEL_SUBSCRIPTION",
|
|
11
|
-
GET_CHANNEL_DETAILS: "ABLY_GET_CHANNEL_DETAILS",
|
|
12
|
-
GET_CHANNEL_HISTORY: "ABLY_GET_CHANNEL_HISTORY",
|
|
13
|
-
GET_PRESENCE_HISTORY: "ABLY_GET_PRESENCE_HISTORY",
|
|
14
|
-
GET_SERVICE_TIME: "ABLY_GET_SERVICE_TIME",
|
|
15
|
-
GET_STATS: "ABLY_GET_STATS",
|
|
16
|
-
LIST_PUSH_CHANNEL_SUBSCRIPTIONS: "ABLY_LIST_PUSH_CHANNEL_SUBSCRIPTIONS",
|
|
17
|
-
PUBLISH_MESSAGE_TO_CHANNEL: "ABLY_PUBLISH_MESSAGE_TO_CHANNEL",
|
|
18
|
-
},
|
|
19
|
-
triggerTypes: {},
|
|
20
|
-
}
|