summaryrefslogtreecommitdiff
path: root/src/main/otTypes.ts
diff options
context:
space:
mode:
authorhaoyuren <13851610112@163.com>2026-03-12 17:52:53 -0500
committerhaoyuren <13851610112@163.com>2026-03-12 17:52:53 -0500
commitb116335f9dbde4f483c0b2b8e7bfca5d321c5dfc (patch)
tree8bd84b0f4a54eb879c8cc5a158002e999b23d57e /src/main/otTypes.ts
parentebec1a1073f9cc5b69e125d5b284669545ea3d9f (diff)
Add bidirectional file sync, OT system, comments, and real-time collaboration
Implement full Overleaf integration with Socket.IO v0.9 real-time sync: - FileSyncBridge for bidirectional temp dir ↔ Overleaf sync via chokidar + diff-match-patch - OT state machine, transform functions, and CM6 adapter for collaborative editing - Comment system with highlights, tooltips, and review panel - Project list, file tree management, and socket-based compilation - 3-layer loop prevention (write guards, content equality, debounce) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/main/otTypes.ts')
-rw-r--r--src/main/otTypes.ts31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/main/otTypes.ts b/src/main/otTypes.ts
new file mode 100644
index 0000000..8e9df9f
--- /dev/null
+++ b/src/main/otTypes.ts
@@ -0,0 +1,31 @@
+// OT type definitions for main process (mirror of renderer types)
+
+export interface InsertOp {
+ i: string
+ p: number
+}
+
+export interface DeleteOp {
+ d: string
+ p: number
+}
+
+export interface CommentOp {
+ c: string
+ p: number
+ t: string
+}
+
+export type OtOp = InsertOp | DeleteOp | CommentOp
+
+export function isInsert(op: OtOp): op is InsertOp {
+ return 'i' in op
+}
+
+export function isDelete(op: OtOp): op is DeleteOp {
+ return 'd' in op
+}
+
+export function isComment(op: OtOp): op is CommentOp {
+ return 'c' in op
+}