@flexabrain/mcp-server
Version:
Advanced electrical schematic analysis MCP server with rail engineering expertise
407 lines • 13.1 kB
TypeScript
/**
* FlexaBrain MCP Server - Real-time Collaboration Specification
*
* Comprehensive specification for multi-user real-time collaboration features
* for railway traction schematic analysis and annotation.
*/
export interface CollaborationArchitecture {
communication: {
protocol: 'WebSocket' | 'SSE' | 'WebRTC';
fallbacks: string[];
messageFormat: 'JSON' | 'MessagePack' | 'Protocol Buffers';
compression: boolean;
encryption: boolean;
};
synchronization: {
strategy: 'OT' | 'CRDT' | 'Event Sourcing';
conflictResolution: 'last-write-wins' | 'merge' | 'manual';
stateManagement: 'centralized' | 'distributed';
persistenceLayer: 'database' | 'event-store' | 'hybrid';
};
scalability: {
maxConcurrentUsers: number;
sessionSharding: boolean;
loadBalancing: boolean;
geographicDistribution: boolean;
};
}
export interface CollaborationSession {
id: string;
document_id: string;
session_name: string;
session_type: 'analysis' | 'review' | 'maintenance_planning' | 'training' | 'emergency_response';
status: 'active' | 'paused' | 'closed' | 'archived';
created_by: string;
created_at: Date;
started_at?: Date;
ended_at?: Date;
expiration?: Date;
participants: CollaborationParticipant[];
max_participants: number;
permissions: SessionPermissions;
access_control: AccessControlSettings;
settings: SessionSettings;
metadata: {
total_annotations: number;
total_edits: number;
components_analyzed: number;
ai_analyses_triggered: number;
session_duration?: number;
};
}
export interface CollaborationParticipant {
user_id: string;
display_name: string;
role: UserRole;
avatar_url?: string;
joined_at: Date;
last_activity: Date;
status: 'online' | 'away' | 'offline';
cursor_position?: {
x: number;
y: number;
page: number;
};
selected_components?: string[];
current_tool?: string;
active_annotation?: string;
permissions: UserPermissions;
session_stats: {
annotations_added: number;
components_verified: number;
edits_made: number;
chat_messages: number;
ai_analyses_triggered: number;
};
}
export declare enum UserRole {
VIEWER = "viewer",
ANALYST = "analyst",
ENGINEER = "engineer",
SUPERVISOR = "supervisor",
ADMIN = "admin"
}
export interface UserPermissions {
view_schematic: boolean;
add_annotations: boolean;
edit_annotations: boolean;
delete_annotations: boolean;
update_components: boolean;
verify_components: boolean;
trigger_ai_analysis: boolean;
manage_session: boolean;
moderate_chat: boolean;
export_data: boolean;
}
export interface SessionPermissions {
public_join: boolean;
invite_required: boolean;
approval_required: boolean;
allow_anonymous: boolean;
max_concurrent_editors: number;
allow_simultaneous_edits: boolean;
require_verification: boolean;
}
export interface AccessControlSettings {
ip_restrictions?: string[];
domain_restrictions?: string[];
vpn_required?: boolean;
mfa_required?: boolean;
session_timeout: number;
idle_timeout: number;
}
export interface SessionSettings {
auto_save_interval: number;
snapshot_frequency: number;
chat_enabled: boolean;
voice_enabled: boolean;
screen_sharing_enabled: boolean;
ai_assistant_enabled: boolean;
show_cursors: boolean;
show_selections: boolean;
show_user_names: boolean;
highlight_changes: boolean;
notify_on_join: boolean;
notify_on_edit: boolean;
notify_on_comment: boolean;
notify_on_ai_complete: boolean;
}
export interface RealTimeFeatures {
liveAnnotations: LiveAnnotationSystem;
sharedCursors: SharedCursorSystem;
liveChat: LiveChatSystem;
activityFeed: ActivityFeedSystem;
voiceChat: VoiceChatSystem;
screenSharing: ScreenSharingSystem;
collaborativeAI: CollaborativeAISystem;
conflictResolution: ConflictResolutionSystem;
changeTracking: ChangeTrackingSystem;
versionControl: VersionControlSystem;
}
export interface LiveAnnotationSystem {
supportedTypes: ('comment' | 'highlight' | 'arrow' | 'shape' | 'text' | 'stamp')[];
syncMode: 'immediate' | 'batched' | 'on-save';
batchInterval?: number;
threading: boolean;
mentions: boolean;
attachments: boolean;
drawing: boolean;
editOwnOnly: boolean;
moderationRequired: boolean;
approvalWorkflow: boolean;
layerManagement: boolean;
filterByUser: boolean;
filterByType: boolean;
temporalView: boolean;
}
export interface SharedCursorSystem {
enabled: boolean;
showCursorNames: boolean;
cursorColors: string[];
fadeTimeout: number;
shareSelections: boolean;
selectionColors: string[];
showSelectionNames: boolean;
throttleRate: number;
interpolation: boolean;
predictiveMovement: boolean;
}
export interface LiveChatSystem {
enabled: boolean;
globalChat: boolean;
contextualChat: boolean;
privateMessages: boolean;
messageHistory: number;
fileSharing: boolean;
emojiReactions: boolean;
messageThreads: boolean;
profanityFilter: boolean;
moderationQueue: boolean;
reportingSystem: boolean;
mentionNotifications: boolean;
componentLinking: boolean;
aiAssistantIntegration: boolean;
}
export interface ActivityFeedSystem {
enabled: boolean;
trackedActivities: ('user_joined' | 'user_left' | 'annotation_added' | 'annotation_edited' | 'component_updated' | 'component_verified' | 'ai_analysis_complete' | 'chat_message' | 'file_uploaded' | 'export_created')[];
realTimeUpdates: boolean;
groupSimilarActivities: boolean;
showTimestamps: boolean;
showUserAvatars: boolean;
filterByUser: boolean;
filterByType: boolean;
filterByComponent: boolean;
filterByTimeRange: boolean;
historyDuration: number;
maxEntriesPerSession: number;
}
export interface VoiceChatSystem {
enabled: boolean;
pushToTalk: boolean;
voiceActivation: boolean;
noiseSupression: boolean;
echoCancellation: boolean;
globalRoom: boolean;
breakoutRooms: boolean;
privateChannels: boolean;
spatialAudio: boolean;
bitrate: number;
sampleRate: number;
adaptiveBitrate: boolean;
muteAll: boolean;
moderatorControls: boolean;
recordingEnabled: boolean;
}
export interface ScreenSharingSystem {
enabled: boolean;
fullScreen: boolean;
applicationWindow: boolean;
browserTab: boolean;
annotationOverlay: boolean;
cursorHighlight: boolean;
clickIndicator: boolean;
moderatorOnly: boolean;
requestApproval: boolean;
maxConcurrentShares: number;
maxResolution: string;
frameRate: number;
adaptiveQuality: boolean;
}
export interface CollaborativeAISystem {
enabled: boolean;
sharedAIRequests: boolean;
collaborativePrompting: boolean;
aiMediatedDiscussion: boolean;
contextAwareHelp: boolean;
componentSuggestions: boolean;
anomalyHighlighting: boolean;
maintenanceRecommendations: boolean;
sessionInsights: boolean;
knowledgeSharing: boolean;
expertiseMatching: boolean;
}
export interface ConflictResolutionSystem {
strategy: 'automatic' | 'manual' | 'hybrid';
lastWriteWins: boolean;
timestampBased: boolean;
priorityBased: boolean;
conflictDetection: boolean;
conflictNotification: boolean;
resolutionInterface: boolean;
rollbackCapability: boolean;
semanticMerging: boolean;
conflictPrevention: boolean;
versionBranching: boolean;
}
export interface ChangeTrackingSystem {
enabled: boolean;
trackAllChanges: boolean;
trackAnnotations: boolean;
trackComponentUpdates: boolean;
trackVerifications: boolean;
highlightRecentChanges: boolean;
showChangeAuthor: boolean;
showChangeTimestamp: boolean;
changeHistory: boolean;
changeStatistics: boolean;
changePatterns: boolean;
collaborationMetrics: boolean;
changeBuffering: boolean;
batchSize: number;
compressionEnabled: boolean;
}
export interface VersionControlSystem {
enabled: boolean;
automaticSnapshots: boolean;
snapshotInterval: number;
manualSnapshots: boolean;
namedVersions: boolean;
versionComparison: boolean;
versionRollback: boolean;
versionBranching: boolean;
versionMerging: boolean;
versionNotes: boolean;
versionTags: boolean;
versionApproval: boolean;
maxVersions: number;
compressionLevel: number;
distributedStorage: boolean;
}
export interface CollaborationEvent {
id: string;
session_id: string;
event_type: CollaborationEventType;
user_id: string;
timestamp: Date;
data: Record<string, any>;
component_id?: string;
page_number?: number;
annotation_id?: string;
client_info: {
user_agent: string;
ip_address: string;
platform: string;
};
processed: boolean;
acknowledged: string[];
retry_count: number;
}
export declare enum CollaborationEventType {
SESSION_CREATED = "session_created",
SESSION_STARTED = "session_started",
SESSION_ENDED = "session_ended",
USER_JOINED = "user_joined",
USER_LEFT = "user_left",
USER_STATUS_CHANGED = "user_status_changed",
CURSOR_MOVED = "cursor_moved",
SELECTION_CHANGED = "selection_changed",
ANNOTATION_ADDED = "annotation_added",
ANNOTATION_UPDATED = "annotation_updated",
ANNOTATION_DELETED = "annotation_deleted",
COMPONENT_UPDATED = "component_updated",
COMPONENT_VERIFIED = "component_verified",
CHAT_MESSAGE = "chat_message",
VOICE_STATUS_CHANGED = "voice_status_changed",
SCREEN_SHARE_STARTED = "screen_share_started",
SCREEN_SHARE_ENDED = "screen_share_ended",
AI_ANALYSIS_REQUESTED = "ai_analysis_requested",
AI_ANALYSIS_COMPLETED = "ai_analysis_completed",
AI_SUGGESTION_SHARED = "ai_suggestion_shared",
CONFLICT_DETECTED = "conflict_detected",
CONFLICT_RESOLVED = "conflict_resolved",
VERSION_CREATED = "version_created",
EXPORT_COMPLETED = "export_completed"
}
export interface CollaborationMetrics {
session_metrics: {
total_sessions: number;
active_sessions: number;
average_duration: number;
average_participants: number;
peak_concurrent_users: number;
};
user_metrics: {
total_participants: number;
active_users: number;
user_engagement: number;
collaboration_efficiency: number;
};
content_metrics: {
annotations_per_session: number;
components_verified_per_session: number;
ai_analyses_per_session: number;
conflicts_per_session: number;
};
performance_metrics: {
average_latency: number;
message_throughput: number;
connection_stability: number;
sync_accuracy: number;
};
}
export interface CollaborationAPI {
createSession(params: CreateSessionParams): Promise<CollaborationSession>;
joinSession(sessionId: string, userId: string): Promise<JoinSessionResult>;
leaveSession(sessionId: string, userId: string): Promise<void>;
updateSessionSettings(sessionId: string, settings: Partial<SessionSettings>): Promise<void>;
sendEvent(sessionId: string, event: CollaborationEvent): Promise<void>;
subscribeToEvents(sessionId: string, callback: (event: CollaborationEvent) => void): Promise<void>;
unsubscribeFromEvents(sessionId: string): Promise<void>;
syncAnnotation(sessionId: string, annotation: any): Promise<void>;
syncComponentUpdate(sessionId: string, componentId: string, update: any): Promise<void>;
resolveConflict(sessionId: string, conflictId: string, resolution: any): Promise<void>;
getSessionState(sessionId: string): Promise<SessionState>;
updateCursorPosition(sessionId: string, userId: string, position: any): Promise<void>;
updateSelection(sessionId: string, userId: string, selection: any): Promise<void>;
getSessionMetrics(sessionId: string): Promise<CollaborationMetrics>;
getCollaborationInsights(timeRange: any): Promise<any>;
}
export interface CreateSessionParams {
document_id: string;
session_name: string;
session_type: string;
created_by: string;
permissions?: SessionPermissions;
settings?: SessionSettings;
expiration?: Date;
}
export interface JoinSessionResult {
session: CollaborationSession;
participant: CollaborationParticipant;
initial_state: SessionState;
websocket_url: string;
auth_token: string;
}
export interface SessionState {
participants: CollaborationParticipant[];
annotations: any[];
cursors: Record<string, any>;
selections: Record<string, any>;
chat_history: any[];
version_info: any;
sync_timestamp: Date;
}
declare const _default: {};
export default _default;
//# sourceMappingURL=realtime-collaboration-spec.d.ts.map