From e0e7945bd9e09e9e8fb3d52e2faa0ae0f1d422e7 Mon Sep 17 00:00:00 2001 From: tusharmagar Date: Thu, 2 Apr 2026 15:58:37 +0530 Subject: [PATCH] Refactor Composio toolkit management for improved structure and maintainability - Consolidated toolkit definitions and display names into a single source of truth in shared/composio.ts. - Updated core composio/curated-toolkits.ts to re-export types and constants for backward compatibility. - Enhanced the organization of toolkit data, ensuring clarity and ease of access for future development. --- .../core/src/composio/curated-toolkits.ts | 81 ++-------------- apps/x/packages/shared/src/composio.ts | 92 +++++++++++++------ 2 files changed, 71 insertions(+), 102 deletions(-) diff --git a/apps/x/packages/core/src/composio/curated-toolkits.ts b/apps/x/packages/core/src/composio/curated-toolkits.ts index 5c4077f6..b3d4deed 100644 --- a/apps/x/packages/core/src/composio/curated-toolkits.ts +++ b/apps/x/packages/core/src/composio/curated-toolkits.ts @@ -1,74 +1,11 @@ /** - * Curated list of Composio toolkits available to Rowboat users. - * Only these toolkits are shown in the UI and discoverable via chat. - * Exact slugs match Composio API naming convention. - * - * Display names come from @x/shared/composio (single source of truth). + * Re-exports from @x/shared/composio — kept for backward compatibility + * so existing core imports don't need to change paths. */ - -import { COMPOSIO_DISPLAY_NAMES } from "@x/shared/dist/composio.js"; - -export { COMPOSIO_DISPLAY_NAMES } from "@x/shared/dist/composio.js"; - -export type ToolkitCategory = 'communication' | 'productivity' | 'development' | 'crm' | 'social' | 'storage' | 'support'; - -export interface CuratedToolkit { - slug: string; - displayName: string; - category: ToolkitCategory; -} - -const toolkit = (slug: string, category: ToolkitCategory): CuratedToolkit => ({ - slug, - displayName: COMPOSIO_DISPLAY_NAMES[slug] ?? slug, - category, -}); - -export const CURATED_TOOLKITS: CuratedToolkit[] = [ - // Communication - toolkit('gmail', 'communication'), - toolkit('slack', 'communication'), - toolkit('microsoft_outlook', 'communication'), - toolkit('microsoft_teams', 'communication'), - - // Productivity - toolkit('googlecalendar', 'productivity'), - toolkit('googledocs', 'productivity'), - toolkit('googlesheets', 'productivity'), - toolkit('notion', 'productivity'), - toolkit('airtable', 'productivity'), - toolkit('calendly', 'productivity'), - toolkit('cal', 'productivity'), - - // Storage - toolkit('googledrive', 'storage'), - toolkit('dropbox', 'storage'), - toolkit('onedrive', 'storage'), - - // Development - toolkit('github', 'development'), - toolkit('linear', 'development'), - toolkit('jira', 'development'), - - // Project Management - toolkit('asana', 'productivity'), - toolkit('trello', 'productivity'), - - // CRM & Sales - toolkit('hubspot', 'crm'), - toolkit('salesforce', 'crm'), - - // Social - toolkit('linkedin', 'social'), - toolkit('twitter', 'social'), - toolkit('reddit', 'social'), - - // Support - toolkit('intercom', 'support'), - toolkit('zendesk', 'support'), -]; - -/** - * Set of curated toolkit slugs for fast lookup. - */ -export const CURATED_TOOLKIT_SLUGS = new Set(CURATED_TOOLKITS.map(t => t.slug)); +export { + type ToolkitCategory, + type CuratedToolkit, + CURATED_TOOLKITS, + CURATED_TOOLKIT_SLUGS, + COMPOSIO_DISPLAY_NAMES, +} from "@x/shared/dist/composio.js"; diff --git a/apps/x/packages/shared/src/composio.ts b/apps/x/packages/shared/src/composio.ts index f2b3f3cd..e752678a 100644 --- a/apps/x/packages/shared/src/composio.ts +++ b/apps/x/packages/shared/src/composio.ts @@ -1,32 +1,64 @@ /** - * Composio display-name map: toolkit slug → human-readable name. - * Single source of truth — used by both core and renderer. + * Curated Composio toolkits available to Rowboat users. + * Single source of truth for slugs, display names, and categories. */ -export const COMPOSIO_DISPLAY_NAMES: Record = { - gmail: 'Gmail', - slack: 'Slack', - microsoft_outlook: 'Microsoft Outlook', - microsoft_teams: 'Microsoft Teams', - googlecalendar: 'Google Calendar', - googledocs: 'Google Docs', - googlesheets: 'Google Sheets', - notion: 'Notion', - airtable: 'Airtable', - calendly: 'Calendly', - cal: 'Cal.com', - googledrive: 'Google Drive', - dropbox: 'Dropbox', - onedrive: 'OneDrive', - github: 'GitHub', - linear: 'Linear', - jira: 'Jira', - asana: 'Asana', - trello: 'Trello', - hubspot: 'HubSpot', - salesforce: 'Salesforce', - linkedin: 'LinkedIn', - twitter: 'X', - reddit: 'Reddit', - intercom: 'Intercom', - zendesk: 'Zendesk', -}; + +export type ToolkitCategory = 'communication' | 'productivity' | 'development' | 'crm' | 'social' | 'storage' | 'support'; + +export interface CuratedToolkit { + slug: string; + displayName: string; + category: ToolkitCategory; +} + +export const CURATED_TOOLKITS: CuratedToolkit[] = [ + // Communication + { slug: 'gmail', displayName: 'Gmail', category: 'communication' }, + { slug: 'slack', displayName: 'Slack', category: 'communication' }, + { slug: 'microsoft_outlook', displayName: 'Microsoft Outlook', category: 'communication' }, + { slug: 'microsoft_teams', displayName: 'Microsoft Teams', category: 'communication' }, + + // Productivity + { slug: 'googlecalendar', displayName: 'Google Calendar', category: 'productivity' }, + { slug: 'googledocs', displayName: 'Google Docs', category: 'productivity' }, + { slug: 'googlesheets', displayName: 'Google Sheets', category: 'productivity' }, + { slug: 'notion', displayName: 'Notion', category: 'productivity' }, + { slug: 'airtable', displayName: 'Airtable', category: 'productivity' }, + { slug: 'calendly', displayName: 'Calendly', category: 'productivity' }, + { slug: 'cal', displayName: 'Cal.com', category: 'productivity' }, + + // Storage + { slug: 'googledrive', displayName: 'Google Drive', category: 'storage' }, + { slug: 'dropbox', displayName: 'Dropbox', category: 'storage' }, + { slug: 'onedrive', displayName: 'OneDrive', category: 'storage' }, + + // Development + { slug: 'github', displayName: 'GitHub', category: 'development' }, + { slug: 'linear', displayName: 'Linear', category: 'development' }, + { slug: 'jira', displayName: 'Jira', category: 'development' }, + + // Project Management + { slug: 'asana', displayName: 'Asana', category: 'productivity' }, + { slug: 'trello', displayName: 'Trello', category: 'productivity' }, + + // CRM & Sales + { slug: 'hubspot', displayName: 'HubSpot', category: 'crm' }, + { slug: 'salesforce', displayName: 'Salesforce', category: 'crm' }, + + // Social + { slug: 'linkedin', displayName: 'LinkedIn', category: 'social' }, + { slug: 'twitter', displayName: 'X', category: 'social' }, + { slug: 'reddit', displayName: 'Reddit', category: 'social' }, + + // Support + { slug: 'intercom', displayName: 'Intercom', category: 'support' }, + { slug: 'zendesk', displayName: 'Zendesk', category: 'support' }, +]; + +/** Slug → display-name lookup. */ +export const COMPOSIO_DISPLAY_NAMES: Record = Object.fromEntries( + CURATED_TOOLKITS.map(t => [t.slug, t.displayName]) +); + +/** Set of curated slugs for fast membership checks. */ +export const CURATED_TOOLKIT_SLUGS = new Set(CURATED_TOOLKITS.map(t => t.slug));