diff --git a/apps/webapp/app/trigger/extension/search.ts b/apps/webapp/app/trigger/extension/search.ts index abe2b36..b6bbb7d 100644 --- a/apps/webapp/app/trigger/extension/search.ts +++ b/apps/webapp/app/trigger/extension/search.ts @@ -50,7 +50,7 @@ export const extensionSearch = task({ { query }, { headers: { - Authorization: `Bearer rc_pat_v41311t6trhr3c8sc7ap4hsbhp6pwsstzyunaazq`, + Authorization: `Bearer ${pat.token}`, }, }, ); diff --git a/integrations/README.md b/integrations/README.md index 9ca1547..3e8b2fb 100644 --- a/integrations/README.md +++ b/integrations/README.md @@ -5,9 +5,11 @@ Integrations connect external services to CORE's knowledge graph, automatically ## Available Integrations ### 🐙 [GitHub](./github/README.md) + Tracks your GitHub activities and notifications, including PRs, issues, comments, and repository events. **Features:** + - Pull request creation, comments, and reviews - Issue tracking and assignments - Notification processing (mentions, reviews, assignments) @@ -15,17 +17,21 @@ Tracks your GitHub activities and notifications, including PRs, issues, comments - Team mentions and state changes ### 📐 [Linear](./linear/README.md) + Project management and issue tracking integration. **Features:** + - Issue creation and updates - Project milestone tracking - Team assignments and workflows ### 💬 [Slack](./slack/README.md) + Workspace communication and activity tracking. **Features:** + - Channel message monitoring - Direct message tracking - Thread participation @@ -41,6 +47,7 @@ Workspace communication and activity tracking. ## Common Features ### 🔄 Data Collection Methods + - **Scheduled Sync**: Periodic API polling (every 5 minutes) for services like GitHub and Linear - **Real-time Webhooks**: Instant event delivery for services that support personal webhooks (like Slack) - **Incremental Updates**: Only fetch new activities since last sync @@ -49,12 +56,14 @@ Workspace communication and activity tracking. - **Error Handling**: Graceful degradation on service outages ### 📊 Activity Tracking + - **User Actions**: What you created, commented, or modified - **Mentions**: When others reference you in discussions - **Assignments**: Tasks or issues assigned to you - **State Changes**: Status updates on projects you follow ### 🧠 Knowledge Graph Integration + - **Entities**: People, projects, repositories, issues, organizations - **Relationships**: Created, commented, assigned, mentioned, collaborated - **Temporal Context**: When events occurred and their sequence @@ -74,6 +83,7 @@ All integrations generate events in a consistent format for knowledge graph inge ``` ### Example Events + ``` john_doe created PR #123 in facebook/react: Fix memory leak in hooks alice_smith mentioned manoj_k in linear/project issue #456: Can you review? @@ -94,12 +104,14 @@ Each integration requires: ### Adding New Integrations 1. **Create Integration Directory** + ```bash mkdir integrations/{service-name} cd integrations/{service-name} ``` 2. **Required Files** + ``` src/ ├── index.ts # Main entry point @@ -110,6 +122,7 @@ Each integration requires: ``` 3. **Core Implementation** + - Extend `IntegrationCLI` class - Implement OAuth2 authentication - Define sync schedule and event processing @@ -119,4 +132,4 @@ Each integration requires: - Convert service events to standard format - Extract entities and relationships - Ensure consistent naming and structure - - Add deduplication logic \ No newline at end of file + - Add deduplication logic diff --git a/packages/sdk/README.md b/packages/sdk/README.md index 5d8867c..41c4f2a 100644 --- a/packages/sdk/README.md +++ b/packages/sdk/README.md @@ -1,19 +1,21 @@ -# Echo SDK +# Core SDK -The Echo SDK provides tools and utilities for building integrations with the Echo platform. +The Core SDK provides tools and utilities for building integrations with the Core platform. ## Integration System -The Echo integration system uses a CLI-based approach where each integration is a command-line tool that responds to specific events. This makes integrations portable, testable, and easy to debug. +The Core integration system uses a CLI-based approach where each integration is a command-line tool that responds to specific events. This makes integrations portable, testable, and easy to debug. ### Integration Event Types Each integration CLI handles 5 core event types: #### 1. `spec` + Returns the integration's metadata and configuration. **Usage:** + ```bash my-integration spec ``` @@ -21,9 +23,11 @@ my-integration spec **Returns:** Integration specification including name, description, auth config, etc. #### 2. `setup` + Processes authentication data and returns tokens/credentials to be saved. **Usage:** + ```bash my-integration setup --event-body '{"code":"oauth_code","state":"state"}' --integration-definition '{}' ``` @@ -31,9 +35,11 @@ my-integration setup --event-body '{"code":"oauth_code","state":"state"}' --inte **Returns:** Configuration data (tokens, credentials) to be stored for the account. #### 3. `identify` + Extracts accountId from webhook data to route webhooks to the correct account. **Usage:** + ```bash my-integration identify --webhook-data '{"team_id":"T123","event":{}}' ``` @@ -41,9 +47,11 @@ my-integration identify --webhook-data '{"team_id":"T123","event":{}}' **Returns:** Account identifier for webhook routing. #### 4. `process` + Handles webhook events and returns activity data. **Usage:** + ```bash my-integration process --event-data '{"type":"reaction_added","reaction":"=M"}' --config '{"access_token":"token"}' ``` @@ -51,9 +59,11 @@ my-integration process --event-data '{"type":"reaction_added","reaction":"=M"}' **Returns:** Activity messages representing user actions. #### 5. `sync` + Performs scheduled data synchronization for integrations that don't support webhooks. **Usage:** + ```bash my-integration sync --config '{"access_token":"token","last_sync":"2023-01-01T00:00:00Z"}' ``` @@ -72,20 +82,24 @@ All integration responses are wrapped in a `Message` object with a `type` field: ### Building an Integration 1. **Install the SDK:** + ```bash -npm install @echo/core-sdk +npm install @Core/core-sdk ``` 2. **Create your integration class:** + ```typescript -import { IntegrationCLI } from '@echo/core-sdk'; +import { IntegrationCLI } from '@Core/core-sdk'; class MyIntegration extends IntegrationCLI { constructor() { super('my-integration', '1.0.0'); } - protected async handleEvent(eventPayload: IntegrationEventPayload): Promise { + protected async handleEvent( + eventPayload: IntegrationEventPayload, + ): Promise { switch (eventPayload.event) { case 'SETUP': return this.handleSetup(eventPayload); @@ -110,24 +124,28 @@ class MyIntegration extends IntegrationCLI { OAuth2: { token_url: 'https://api.example.com/oauth/token', authorization_url: 'https://api.example.com/oauth/authorize', - scopes: ['read', 'write'] - } - } + scopes: ['read', 'write'], + }, + }, }; } - private async handleSetup(eventPayload: IntegrationEventPayload): Promise { + private async handleSetup( + eventPayload: IntegrationEventPayload, + ): Promise { // Process OAuth response and return tokens to save const { code } = eventPayload.eventBody; // Exchange code for tokens... return { access_token: 'token', refresh_token: 'refresh_token', - expires_at: Date.now() + 3600000 + expires_at: Date.now() + 3600000, }; } - private async handleProcess(eventPayload: IntegrationEventPayload): Promise { + private async handleProcess( + eventPayload: IntegrationEventPayload, + ): Promise { // Handle webhook events const { eventData } = eventPayload.eventBody; // Process event and return activity... @@ -135,23 +153,29 @@ class MyIntegration extends IntegrationCLI { type: 'message', user: 'user123', content: 'Hello world', - timestamp: new Date() + timestamp: new Date(), }; } - private async handleIdentify(eventPayload: IntegrationEventPayload): Promise { + private async handleIdentify( + eventPayload: IntegrationEventPayload, + ): Promise { // Extract account ID from webhook const { team_id } = eventPayload.eventBody; return { id: team_id }; } - private async handleSync(eventPayload: IntegrationEventPayload): Promise { + private async handleSync( + eventPayload: IntegrationEventPayload, + ): Promise { // Perform scheduled sync const { config } = eventPayload; // Fetch data since last sync... return { - activities: [/* activity data */], - state: { last_sync: new Date().toISOString() } + activities: [ + /* activity data */ + ], + state: { last_sync: new Date().toISOString() }, }; } } @@ -162,6 +186,7 @@ integration.parse(); ``` 3. **Build and package your integration:** + ```bash npm run build npm pack @@ -200,4 +225,4 @@ node dist/index.js process --event-data '{"type":"test"}' --config '{"token":"te 5. **Store minimal state** for sync operations 6. **Test all event types** thoroughly -For more examples, see the integrations in the `integrations/` directory. \ No newline at end of file +For more examples, see the integrations in the `integrations/` directory.