Something went wrong. Try again.
Synapse is a study workspace. Organize courses read and annotate the material, train with generated exercises and watch your progress forked from denishovart.com/synapse
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121// Domain models - pure types, with no framework dependency.
export type ExerciseType = 'mcq' | 'true_false' | 'open';type ExerciseDifficulty = 'easy' | 'medium' | 'hard';type ExerciseSource = 'ai' | 'manual';
export type AiProvider = 'claude' | 'openai' | 'local';
export type UserRole = 'admin' | 'user';
// A user account. `provider` is the auth method that owns the identity// ('local' for password accounts; a strategy name like 'oidc' otherwise).// password_hash is set only for local accounts; external identities carry an// external_id instead.export interface User { id: string; username: string; password_hash: string | null; role: UserRole; provider: string; external_id: string | null; created_at: string;}
// The user shape safe to hand to the client / attach to a request: never// includes the password hash.export interface PublicUser { id: string; username: string; role: UserRole; provider: string;}
export interface Session { id: string; user_id: string; created_at: string; expires_at: string;}
// AI configuration held server-side. The apiKey is never sent to the client;// the API exposes only `hasKey`.export interface AiSettings { enabled: boolean; provider: AiProvider; model: string; apiKey: string; baseUrl: string; // for the OpenAI-compatible local provider}
export interface DocumentRow { id: string; user_id: string | null; original_name: string; filename: string; filepath: string; extracted_text: string | null; page_count: number | null; uploaded_at: string; render_path: string | null; content_hash?: string | null; render_hash?: string | null; text_hash?: string | null;}
// The shape generation answers with; rows are inserted into the clients'// workspace docs, never into a server table.export interface Exercise { id: string; document_id: string | null; course_id: string; topic_id: string | null; type: ExerciseType; question: string; options: string | null; // JSON string of a string[] correct_answer: string; explanation: string | null; difficulty: ExerciseDifficulty; source: ExerciseSource; created_at: string;}
// Upload formats beyond PDF. Office files (incl. pptx) render through// headless LibreOffice when available (docx/odt/rtf fall back to pandoc// without it; the other office formats are rejected with an install hint);// markup formats go through pandoc (see the composite converter adapter).export const CONVERTIBLE_EXTENSIONS = [ '.doc', '.pptx', '.docx', '.odt', '.odp', '.ppt', '.rtf', '.xls', '.xlsx', '.ods', '.csv', '.md', '.markdown', '.txt', '.html', '.htm', '.epub', '.tex', '.rst', '.org', '.ipynb', '.typ',] as const;
// An exercise "generated" by the AI before it is handed back to the client.export interface GeneratedExercise { type: ExerciseType; question: string; options?: string[]; correct_answer: string; explanation: string; difficulty: ExerciseDifficulty;}