mirror of
https://github.com/eliasstepanik/core.git
synced 2026-01-11 18:08:27 +00:00
fix: remove the hard coded token in search
This commit is contained in:
parent
92182f1428
commit
169a2713d2
@ -50,7 +50,7 @@ export const extensionSearch = task({
|
|||||||
{ query },
|
{ query },
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer rc_pat_v41311t6trhr3c8sc7ap4hsbhp6pwsstzyunaazq`,
|
Authorization: `Bearer ${pat.token}`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@ -5,9 +5,11 @@ Integrations connect external services to CORE's knowledge graph, automatically
|
|||||||
## Available Integrations
|
## Available Integrations
|
||||||
|
|
||||||
### 🐙 [GitHub](./github/README.md)
|
### 🐙 [GitHub](./github/README.md)
|
||||||
|
|
||||||
Tracks your GitHub activities and notifications, including PRs, issues, comments, and repository events.
|
Tracks your GitHub activities and notifications, including PRs, issues, comments, and repository events.
|
||||||
|
|
||||||
**Features:**
|
**Features:**
|
||||||
|
|
||||||
- Pull request creation, comments, and reviews
|
- Pull request creation, comments, and reviews
|
||||||
- Issue tracking and assignments
|
- Issue tracking and assignments
|
||||||
- Notification processing (mentions, reviews, 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
|
- Team mentions and state changes
|
||||||
|
|
||||||
### 📐 [Linear](./linear/README.md)
|
### 📐 [Linear](./linear/README.md)
|
||||||
|
|
||||||
Project management and issue tracking integration.
|
Project management and issue tracking integration.
|
||||||
|
|
||||||
**Features:**
|
**Features:**
|
||||||
|
|
||||||
- Issue creation and updates
|
- Issue creation and updates
|
||||||
- Project milestone tracking
|
- Project milestone tracking
|
||||||
- Team assignments and workflows
|
- Team assignments and workflows
|
||||||
|
|
||||||
### 💬 [Slack](./slack/README.md)
|
### 💬 [Slack](./slack/README.md)
|
||||||
|
|
||||||
Workspace communication and activity tracking.
|
Workspace communication and activity tracking.
|
||||||
|
|
||||||
**Features:**
|
**Features:**
|
||||||
|
|
||||||
- Channel message monitoring
|
- Channel message monitoring
|
||||||
- Direct message tracking
|
- Direct message tracking
|
||||||
- Thread participation
|
- Thread participation
|
||||||
@ -41,6 +47,7 @@ Workspace communication and activity tracking.
|
|||||||
## Common Features
|
## Common Features
|
||||||
|
|
||||||
### 🔄 Data Collection Methods
|
### 🔄 Data Collection Methods
|
||||||
|
|
||||||
- **Scheduled Sync**: Periodic API polling (every 5 minutes) for services like GitHub and Linear
|
- **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)
|
- **Real-time Webhooks**: Instant event delivery for services that support personal webhooks (like Slack)
|
||||||
- **Incremental Updates**: Only fetch new activities since last sync
|
- **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
|
- **Error Handling**: Graceful degradation on service outages
|
||||||
|
|
||||||
### 📊 Activity Tracking
|
### 📊 Activity Tracking
|
||||||
|
|
||||||
- **User Actions**: What you created, commented, or modified
|
- **User Actions**: What you created, commented, or modified
|
||||||
- **Mentions**: When others reference you in discussions
|
- **Mentions**: When others reference you in discussions
|
||||||
- **Assignments**: Tasks or issues assigned to you
|
- **Assignments**: Tasks or issues assigned to you
|
||||||
- **State Changes**: Status updates on projects you follow
|
- **State Changes**: Status updates on projects you follow
|
||||||
|
|
||||||
### 🧠 Knowledge Graph Integration
|
### 🧠 Knowledge Graph Integration
|
||||||
|
|
||||||
- **Entities**: People, projects, repositories, issues, organizations
|
- **Entities**: People, projects, repositories, issues, organizations
|
||||||
- **Relationships**: Created, commented, assigned, mentioned, collaborated
|
- **Relationships**: Created, commented, assigned, mentioned, collaborated
|
||||||
- **Temporal Context**: When events occurred and their sequence
|
- **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
|
### Example Events
|
||||||
|
|
||||||
```
|
```
|
||||||
john_doe created PR #123 in facebook/react: Fix memory leak in hooks
|
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?
|
alice_smith mentioned manoj_k in linear/project issue #456: Can you review?
|
||||||
@ -94,12 +104,14 @@ Each integration requires:
|
|||||||
### Adding New Integrations
|
### Adding New Integrations
|
||||||
|
|
||||||
1. **Create Integration Directory**
|
1. **Create Integration Directory**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mkdir integrations/{service-name}
|
mkdir integrations/{service-name}
|
||||||
cd integrations/{service-name}
|
cd integrations/{service-name}
|
||||||
```
|
```
|
||||||
|
|
||||||
2. **Required Files**
|
2. **Required Files**
|
||||||
|
|
||||||
```
|
```
|
||||||
src/
|
src/
|
||||||
├── index.ts # Main entry point
|
├── index.ts # Main entry point
|
||||||
@ -110,6 +122,7 @@ Each integration requires:
|
|||||||
```
|
```
|
||||||
|
|
||||||
3. **Core Implementation**
|
3. **Core Implementation**
|
||||||
|
|
||||||
- Extend `IntegrationCLI` class
|
- Extend `IntegrationCLI` class
|
||||||
- Implement OAuth2 authentication
|
- Implement OAuth2 authentication
|
||||||
- Define sync schedule and event processing
|
- Define sync schedule and event processing
|
||||||
@ -119,4 +132,4 @@ Each integration requires:
|
|||||||
- Convert service events to standard format
|
- Convert service events to standard format
|
||||||
- Extract entities and relationships
|
- Extract entities and relationships
|
||||||
- Ensure consistent naming and structure
|
- Ensure consistent naming and structure
|
||||||
- Add deduplication logic
|
- Add deduplication logic
|
||||||
|
|||||||
@ -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
|
## 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
|
### Integration Event Types
|
||||||
|
|
||||||
Each integration CLI handles 5 core event types:
|
Each integration CLI handles 5 core event types:
|
||||||
|
|
||||||
#### 1. `spec`
|
#### 1. `spec`
|
||||||
|
|
||||||
Returns the integration's metadata and configuration.
|
Returns the integration's metadata and configuration.
|
||||||
|
|
||||||
**Usage:**
|
**Usage:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
my-integration spec
|
my-integration spec
|
||||||
```
|
```
|
||||||
@ -21,9 +23,11 @@ my-integration spec
|
|||||||
**Returns:** Integration specification including name, description, auth config, etc.
|
**Returns:** Integration specification including name, description, auth config, etc.
|
||||||
|
|
||||||
#### 2. `setup`
|
#### 2. `setup`
|
||||||
|
|
||||||
Processes authentication data and returns tokens/credentials to be saved.
|
Processes authentication data and returns tokens/credentials to be saved.
|
||||||
|
|
||||||
**Usage:**
|
**Usage:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
my-integration setup --event-body '{"code":"oauth_code","state":"state"}' --integration-definition '{}'
|
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.
|
**Returns:** Configuration data (tokens, credentials) to be stored for the account.
|
||||||
|
|
||||||
#### 3. `identify`
|
#### 3. `identify`
|
||||||
|
|
||||||
Extracts accountId from webhook data to route webhooks to the correct account.
|
Extracts accountId from webhook data to route webhooks to the correct account.
|
||||||
|
|
||||||
**Usage:**
|
**Usage:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
my-integration identify --webhook-data '{"team_id":"T123","event":{}}'
|
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.
|
**Returns:** Account identifier for webhook routing.
|
||||||
|
|
||||||
#### 4. `process`
|
#### 4. `process`
|
||||||
|
|
||||||
Handles webhook events and returns activity data.
|
Handles webhook events and returns activity data.
|
||||||
|
|
||||||
**Usage:**
|
**Usage:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
my-integration process --event-data '{"type":"reaction_added","reaction":"=M"}' --config '{"access_token":"token"}'
|
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.
|
**Returns:** Activity messages representing user actions.
|
||||||
|
|
||||||
#### 5. `sync`
|
#### 5. `sync`
|
||||||
|
|
||||||
Performs scheduled data synchronization for integrations that don't support webhooks.
|
Performs scheduled data synchronization for integrations that don't support webhooks.
|
||||||
|
|
||||||
**Usage:**
|
**Usage:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
my-integration sync --config '{"access_token":"token","last_sync":"2023-01-01T00:00:00Z"}'
|
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
|
### Building an Integration
|
||||||
|
|
||||||
1. **Install the SDK:**
|
1. **Install the SDK:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install @echo/core-sdk
|
npm install @Core/core-sdk
|
||||||
```
|
```
|
||||||
|
|
||||||
2. **Create your integration class:**
|
2. **Create your integration class:**
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { IntegrationCLI } from '@echo/core-sdk';
|
import { IntegrationCLI } from '@Core/core-sdk';
|
||||||
|
|
||||||
class MyIntegration extends IntegrationCLI {
|
class MyIntegration extends IntegrationCLI {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('my-integration', '1.0.0');
|
super('my-integration', '1.0.0');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async handleEvent(eventPayload: IntegrationEventPayload): Promise<any> {
|
protected async handleEvent(
|
||||||
|
eventPayload: IntegrationEventPayload,
|
||||||
|
): Promise<any> {
|
||||||
switch (eventPayload.event) {
|
switch (eventPayload.event) {
|
||||||
case 'SETUP':
|
case 'SETUP':
|
||||||
return this.handleSetup(eventPayload);
|
return this.handleSetup(eventPayload);
|
||||||
@ -110,24 +124,28 @@ class MyIntegration extends IntegrationCLI {
|
|||||||
OAuth2: {
|
OAuth2: {
|
||||||
token_url: 'https://api.example.com/oauth/token',
|
token_url: 'https://api.example.com/oauth/token',
|
||||||
authorization_url: 'https://api.example.com/oauth/authorize',
|
authorization_url: 'https://api.example.com/oauth/authorize',
|
||||||
scopes: ['read', 'write']
|
scopes: ['read', 'write'],
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private async handleSetup(eventPayload: IntegrationEventPayload): Promise<any> {
|
private async handleSetup(
|
||||||
|
eventPayload: IntegrationEventPayload,
|
||||||
|
): Promise<any> {
|
||||||
// Process OAuth response and return tokens to save
|
// Process OAuth response and return tokens to save
|
||||||
const { code } = eventPayload.eventBody;
|
const { code } = eventPayload.eventBody;
|
||||||
// Exchange code for tokens...
|
// Exchange code for tokens...
|
||||||
return {
|
return {
|
||||||
access_token: 'token',
|
access_token: 'token',
|
||||||
refresh_token: 'refresh_token',
|
refresh_token: 'refresh_token',
|
||||||
expires_at: Date.now() + 3600000
|
expires_at: Date.now() + 3600000,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private async handleProcess(eventPayload: IntegrationEventPayload): Promise<any> {
|
private async handleProcess(
|
||||||
|
eventPayload: IntegrationEventPayload,
|
||||||
|
): Promise<any> {
|
||||||
// Handle webhook events
|
// Handle webhook events
|
||||||
const { eventData } = eventPayload.eventBody;
|
const { eventData } = eventPayload.eventBody;
|
||||||
// Process event and return activity...
|
// Process event and return activity...
|
||||||
@ -135,23 +153,29 @@ class MyIntegration extends IntegrationCLI {
|
|||||||
type: 'message',
|
type: 'message',
|
||||||
user: 'user123',
|
user: 'user123',
|
||||||
content: 'Hello world',
|
content: 'Hello world',
|
||||||
timestamp: new Date()
|
timestamp: new Date(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private async handleIdentify(eventPayload: IntegrationEventPayload): Promise<any> {
|
private async handleIdentify(
|
||||||
|
eventPayload: IntegrationEventPayload,
|
||||||
|
): Promise<any> {
|
||||||
// Extract account ID from webhook
|
// Extract account ID from webhook
|
||||||
const { team_id } = eventPayload.eventBody;
|
const { team_id } = eventPayload.eventBody;
|
||||||
return { id: team_id };
|
return { id: team_id };
|
||||||
}
|
}
|
||||||
|
|
||||||
private async handleSync(eventPayload: IntegrationEventPayload): Promise<any> {
|
private async handleSync(
|
||||||
|
eventPayload: IntegrationEventPayload,
|
||||||
|
): Promise<any> {
|
||||||
// Perform scheduled sync
|
// Perform scheduled sync
|
||||||
const { config } = eventPayload;
|
const { config } = eventPayload;
|
||||||
// Fetch data since last sync...
|
// Fetch data since last sync...
|
||||||
return {
|
return {
|
||||||
activities: [/* activity data */],
|
activities: [
|
||||||
state: { last_sync: new Date().toISOString() }
|
/* activity data */
|
||||||
|
],
|
||||||
|
state: { last_sync: new Date().toISOString() },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -162,6 +186,7 @@ integration.parse();
|
|||||||
```
|
```
|
||||||
|
|
||||||
3. **Build and package your integration:**
|
3. **Build and package your integration:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run build
|
npm run build
|
||||||
npm pack
|
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
|
5. **Store minimal state** for sync operations
|
||||||
6. **Test all event types** thoroughly
|
6. **Test all event types** thoroughly
|
||||||
|
|
||||||
For more examples, see the integrations in the `integrations/` directory.
|
For more examples, see the integrations in the `integrations/` directory.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user