/** * Base Synapse Augmentation * * Synapses are special augmentations that provide bidirectional data sync * with external platforms (Notion, Salesforce, Slack, etc.) * * Like biological synapses that transmit signals between neurons, these * connect Brainy to external data sources, enabling seamless information flow. * * They are managed through the Brain Cloud augmentation registry alongside * other augmentations, enabling unified discovery, installation, and updates. * * Example synapses: * - NotionSynapse: Sync pages, databases, and blocks * - SalesforceSynapse: Sync contacts, leads, opportunities * - SlackSynapse: Sync messages, channels, users * - GoogleDriveSynapse: Sync documents, sheets, presentations */ import { AugmentationResponse } from '../types/augmentations.js'; import { BaseAugmentation } from './brainyAugmentation.js'; import { NeuralImportAugmentation } from './neuralImport.js'; /** * Base class for all synapse augmentations * Provides common functionality for external data synchronization */ export declare abstract class SynapseAugmentation extends BaseAugmentation { readonly timing: "after"; readonly operations: ("all")[]; readonly priority = 10; readonly metadata: { reads: "*"; writes: string[]; }; abstract readonly synapseId: string; abstract readonly supportedTypes: string[]; protected syncInProgress: boolean; protected lastSyncId?: string; protected syncStats: { totalSyncs: number; totalItems: number; lastSync: string | undefined; }; protected neuralImport?: NeuralImportAugmentation; protected useNeuralImport: boolean; protected onInit(): Promise; /** * Synapse-specific initialization * Override this in implementations */ protected abstract onInitialize(): Promise; /** * BrainyAugmentation execute method * Intercepts operations to sync external data when relevant */ execute(operation: string, params: any, next: () => Promise): Promise; /** * Determine if sync should be triggered after an operation */ protected shouldSync(operation: string, params: any): boolean; /** * Background sync process */ protected backgroundSync(): Promise; protected onShutdown(): Promise; protected onSynapseShutdown(): Promise; /** * ISynapseAugmentation methods */ abstract testConnection(): Promise>; abstract startSync(options?: Record): Promise; }>>; stopSync(): Promise; abstract incrementalSync(lastSyncId?: string): Promise>; abstract previewSync(limit?: number): Promise; totalCount: number; estimatedDuration: number; }>>; getSynapseStatus(): Promise>; /** * Helper method to store synced data in Brainy * Optionally uses Neural Import for intelligent processing */ protected storeInBrainy(content: string | Record, metadata: Record, options?: { useNeuralImport?: boolean; dataType?: string; rawData?: Buffer | string; }): Promise; /** * Helper method to query existing synced data */ protected queryBrainy(filter: { connector?: string; [key: string]: any; }): Promise; } /** * Example implementation for reference * Real synapses would be in Brain Cloud registry */ export declare class ExampleFileSystemSynapse extends SynapseAugmentation { readonly name = "example-filesystem-synapse"; readonly description = "Example synapse for local file system with Neural Import intelligence"; readonly synapseId = "filesystem"; readonly supportedTypes: string[]; protected onInitialize(): Promise; testConnection(): Promise>; startSync(options?: Record): Promise; }>>; incrementalSync(lastSyncId?: string): Promise>; previewSync(limit?: number): Promise; totalCount: number; estimatedDuration: number; }>>; }