diff options
| author | haoyuren <13851610112@163.com> | 2026-03-15 01:57:17 -0500 |
|---|---|---|
| committer | haoyuren <13851610112@163.com> | 2026-03-15 01:57:17 -0500 |
| commit | 7748999a8b0c3ab5e7b107bf7c42f24580cb23aa (patch) | |
| tree | 44d897792cab654ed577e8324794b764a1536c70 /src/preload | |
| parent | 99c663cdc9dc1ae23cec244bf7b0d79a16a62808 (diff) | |
Real-time comment sync, MCP server expansion, multi-tab terminal, UI fixes
- Fix Socket.IO v0.9 ack parser to handle acks without data (6:::N format),
fixing comment creation stuck at "sending"
- Rewrite comment sync to use local state updates from socket events
(new-comment, resolve-thread, reopen-thread, delete-thread, edit-message,
delete-message) instead of REST re-fetches — instant UI updates
- Optimistic updates for all comment actions (resolve, reopen, delete, reply, edit)
- Fetch threads + contexts on project connect so editor highlights are correct
from startup, not only when review panel is opened
- Add comment context to store immediately after creation for instant highlight
- Rename MCP server from overleaf-comments to lattex, add 6 new tools:
reopen_comment, delete_comment, get_chat_messages, send_chat_message,
list_project_files, compile_latex — all auto-granted permissions
- Refactor terminal from fixed Terminal/Claude tabs to dynamic multi-tab with
bottom tab bar and unlimited new terminal creation
- Fix chat panel layout overflow pushing other components
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/preload')
| -rw-r--r-- | src/preload/index.ts | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/preload/index.ts b/src/preload/index.ts index 7b23d27..2be6e0b 100644 --- a/src/preload/index.ts +++ b/src/preload/index.ts @@ -43,10 +43,10 @@ const api = { ipcRenderer.invoke('overleaf:getThreads', projectId) as Promise<{ success: boolean; threads?: Record<string, unknown>; message?: string }>, overleafReplyThread: (projectId: string, threadId: string, content: string) => ipcRenderer.invoke('overleaf:replyThread', projectId, threadId, content) as Promise<{ success: boolean }>, - overleafResolveThread: (projectId: string, threadId: string) => - ipcRenderer.invoke('overleaf:resolveThread', projectId, threadId) as Promise<{ success: boolean }>, - overleafReopenThread: (projectId: string, threadId: string) => - ipcRenderer.invoke('overleaf:reopenThread', projectId, threadId) as Promise<{ success: boolean }>, + overleafResolveThread: (projectId: string, threadId: string, docId?: string) => + ipcRenderer.invoke('overleaf:resolveThread', projectId, threadId, docId) as Promise<{ success: boolean }>, + overleafReopenThread: (projectId: string, threadId: string, docId?: string) => + ipcRenderer.invoke('overleaf:reopenThread', projectId, threadId, docId) as Promise<{ success: boolean }>, overleafDeleteMessage: (projectId: string, threadId: string, messageId: string) => ipcRenderer.invoke('overleaf:deleteMessage', projectId, threadId, messageId) as Promise<{ success: boolean }>, overleafEditMessage: (projectId: string, threadId: string, messageId: string, content: string) => @@ -182,6 +182,23 @@ const api = { return () => ipcRenderer.removeListener('chat:newMessage', handler) }, + // Comments real-time events + onCommentsEvent: (cb: (event: { type: string; args: unknown[] }) => void) => { + const handler = (_e: Electron.IpcRendererEvent, event: { type: string; args: unknown[] }) => cb(event) + ipcRenderer.on('comments:event', handler) + return () => ipcRenderer.removeListener('comments:event', handler) + }, + onCommentsInitThreads: (cb: (data: { threads: Record<string, unknown>; resolvedIds: string[] }) => void) => { + const handler = (_e: Electron.IpcRendererEvent, data: { threads: Record<string, unknown>; resolvedIds: string[] }) => cb(data) + ipcRenderer.on('comments:initThreads', handler) + return () => ipcRenderer.removeListener('comments:initThreads', handler) + }, + onCommentsInitContexts: (cb: (data: { contexts: Record<string, { file: string; text: string; pos: number }> }) => void) => { + const handler = (_e: Electron.IpcRendererEvent, data: { contexts: Record<string, { file: string; text: string; pos: number }> }) => cb(data) + ipcRenderer.on('comments:initContexts', handler) + return () => ipcRenderer.removeListener('comments:initContexts', handler) + }, + // Shell openExternal: (url: string) => ipcRenderer.invoke('shell:openExternal', url), showInFinder: (path: string) => ipcRenderer.invoke('shell:showInFinder', path) |
