summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
3 daysFix packaged MCP server pathv0.3.8haoyuren
3 daysFix Overleaf file tree sync updateshaoyuren
2026-03-18Fix OT sync corruption: match Overleaf ShareJS ack/echo handlinghaoyuren
The server broadcasts otUpdateApplied (with ops) to ALL clients including the sender. Our bridge was treating its own echoed ops as remote ops and re-applying them, causing text duplication (e.g. "simulatorimulator"). Rewrite OT handling to match Overleaf's ShareJS _onMessage pattern: - ACK = no ops OR meta.source matches our publicId (own echo) - REMOTE = ops from a different source - ACK path calls onAck() without re-applying ops - OtClient silently drops duplicate acks in synchronized state - OtClient drops stale remote ops (version < current) - Remove pendingEchos counter in favor of meta.source detection Also: refresh MCP comment contexts on new-comment/delete-thread events, add Overleaf reference repo to .gitignore. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15Document S2 API key rate limit in CLAUDE.md templatehaoyuren
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15Add API key management UI and wire S2 key to MCPhaoyuren
- Settings modal on project list page for OpenAI, Anthropic, OpenRouter, Gemini, Semantic Scholar keys - Keys stored in userData/api-keys.json, masked by default with show/hide toggle - S2 API key passed to MCP server via .lattex-mcp.json to avoid rate limits Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15Add read_compiled_pdf and search_citation MCP toolshaoyuren
- read_compiled_pdf: returns PDF path for Claude Code to visually inspect compiled output - search_citation: search Semantic Scholar for papers, returns ready-to-use BibTeX entries - Updated CLAUDE.md template with new tool docs, workflows, and permissions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15Fix resolved comment highlights not disappearing immediatelyhaoyuren
The resolve-thread socket event was only handled in ReviewPanel's useEffect, but ReviewPanel is conditionally mounted (only when visible). When Claude Code resolves a comment via MCP with the panel hidden, the resolvedThreadIds store was never updated, so the editor highlight persisted until the user opened the Review panel. Fix: add a comments:event listener in App.tsx (always mounted) that updates resolvedThreadIds for resolve/reopen/delete-thread events. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15Fix OT ack/error swallowed when doc transitions to editor modehaoyuren
When addEditorDoc is called while the bridge has in-flight OT ops (awaitingConfirm), the ack/error response was ignored because handleOtUpdate/handleOtError skipped editor docs entirely. This left the bridge's OtClient stuck and the edit appeared lost until removeEditorDoc re-discovered the discrepancy. Fix: always process acks regardless of editor doc status, and only skip OT errors for editor docs when the bridge has no OtClient. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15Strengthen CLAUDE.md: explicit step-by-step file reading instructionshaoyuren
Split "read main.tex and all inputs" into two discrete steps: 1. Read main file to discover \input/\include references 2. Read EVERY referenced file one by one (no skipping, no skimming) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15Add online users popover, MCP get_online_users, claude-workspace, stronger ↵v0.3.4haoyuren
CLAUDE.md - Online users: click "N online" badge to see user names with cursor colors - MCP get_online_users tool: main process tracks users in .lattex-online-users.json - CLAUDE.md: show current user's Overleaf name (fetched from /user/settings) - CLAUDE.md: mandatory first steps with MUST/NEVER language at top of file - claude-workspace/ directory: untracked scratch space for Claude Code experiments - chokidar + bridge skip claude-workspace/ to prevent syncing to Overleaf Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15Fix file sync for non-active tabs, MCP compile integration, OT resiliencehaoyuren
- Fix .bib (and other non-active tab) edits disappearing: call otLeaveDoc on tab switch so bridge takes back OT ownership; release .bib pre-loads immediately after reading content for citation autocomplete - Always update lastKnownContent in processDocChange for editor docs to prevent stale state accumulation - Flush pending OT ops in OverleafDocSync.destroy() before tab switch - Add three-way merge in replaceContent to preserve concurrent remote edits - Wire MCP compile to UI: file-based signal between MCP server and Electron main process, with compile animation and PDF refresh in renderer - Add CLSI flush before compile to prevent stale cached results - Add OT error recovery: re-join doc and re-apply disk changes on otUpdateError - Add bridge reconnect handling: reset OtClient on docRejoined for non-editor docs - Add compile concurrency lock to prevent duplicate compiles - removeEditorDoc compares disk vs server content to catch in-flight ops Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15Fix PDF not refreshing after recompilehaoyuren
setPdfPath with the same path didn't trigger re-render. Added pdfVersion counter that increments on every setPdfPath call, used as dependency in PdfViewer's renderPdf to force reload regardless of path equality. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15Fix sync race condition: external edits overwritten by remote opshaoyuren
When Claude Code writes to disk, a debounce timer is set. If a remote Overleaf op arrives during the debounce, onEditorContentChanged would write the remote content back to disk, overwriting Claude Code's edit. Fix: skip disk write and lastKnownContent update in onEditorContentChanged when a debounce is pending (external disk change waiting to be processed). Also increase writesInProgress guard to 800ms to exceed chokidar's 500ms polling interval. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15Enhance CLAUDE.md with project structure, guidelines, and conventionshaoyuren
Includes main file path, TeX file list, and rules for Claude Code: read full document before editing, match existing style, compile after changes, respond to comments properly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15Fix MCP server in packaged app: bundle with esbuild, asarUnpackhaoyuren
MCP server was not included in DMG builds. Now esbuild bundles it into a single file (out/mcp/lattex.mjs) with all dependencies inlined, and electron-builder unpacks it from asar so external node can execute it. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15v0.3.2: Add search features and SyncTeX forward searchv0.3.2haoyuren
- In-file search: Cmd+F opens CodeMirror search panel with themed styling - Multi-file search: Cmd+Shift+F or toolbar button opens project-wide search - PDF text search: Cmd+F on PDF or search button to find text in PDF - SyncTeX forward search: Cmd+Enter jumps from editor cursor to PDF position Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15Fix crash on quit: use ptyInstances map instead of undefined ptyInstancehaoyuren
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15v0.3.1: Smooth PDF zoom with cursor anchoring and no bounce-backv0.3.1haoyuren
- Zoom centers on mouse cursor position (scroll adjustment) - Two-phase render: instant CSS transform + debounced canvas re-render - No blank flash: old canvases kept until new render completes atomically - No bounce-back: track renderedScale separately from renderScale - Inner wrapper div for CSS transform (container stays as scroll viewport) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15Fix SyncTeX: download synctex.gz via web proxy, normalize paths, smooth zoomhaoyuren
- synctex.gz CDN returns 503; use Overleaf web proxy URL with session cookie - Normalize synctex paths (collapse /./ segments) - Pass session cookie to all compile artifact downloads - Smooth editor zoom: continuous delta, debounced remeasure Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15Fix PDF double-click text selection, add user-select: none to PDF containerhaoyuren
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15v0.3.0: Fix sync exclusions, add editor zoom, cached PDF loadingv0.3.0haoyuren
- Exclude CLAUDE.md from sync (move to .claude/ dotfile dir, clean up root copy) - Add Ctrl+wheel font zoom for editor (capture phase, disable Electron built-in zoom) - Load cached PDF on project connect (avoid recompile to see last PDF) - Add synctex debug logging for PDF↔source navigation troubleshooting - Fix .claude/ dir creation order (mkdir before write) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15Add MCP compile debugging tools: get_compile_errors, get_compile_warnings, ↵haoyuren
get_compile_log New MCP tools for agents to debug LaTeX compilation: - get_compile_errors: parsed errors with file paths and line numbers - get_compile_warnings: parsed warnings with locations - get_compile_log: full raw log with optional tail parameter - compile_latex: improved to fetch log via CDN URL, return error summary Log parsing uses the same Overleaf-style parser as the PdfViewer component. Updated CLAUDE.md template with compile-debug workflow documentation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15Fix server compile: download PDF to .build dir, prevent artifact sync to ↵haoyuren
Overleaf The root cause of server compile failures was that output.pdf was being saved into the synced project directory, causing FileSyncBridge to upload it back to Overleaf as a project file. CLSI then failed because it found an existing output.pdf blocking its compilation output. Changes: - Save compile artifacts (PDF, synctex.gz) to .build/ subdirectory instead of the synced project root — .build is a dotfile dir ignored by chokidar - Add pdf/pdfxref/stderr/stdout/chktex to FileSyncBridge ignore patterns - Add rootResourcePath to compile request body (matches Overleaf web client) - Implement PDF download with fallback via direct build ID URL construction - Add server compile handler, compile dropdown menu, PDF save button - Fix resolved comment highlight flash on startup (null initial state) - Fix EPIPE crash on startup when stdout/stderr is closed - Fix synctex inverse search to use relative paths via OT doc join Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15Real-time comment sync, MCP server expansion, multi-tab terminal, UI fixeshaoyuren
- 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>
2026-03-14Add new file sync to Overleaf, Copy Comments button with file filteringhaoyuren
- Sync new local files (created by Claude Code etc.) to Overleaf via REST API - Create intermediate folders as needed, handle both text docs and binaries - Scan for orphaned files on startup that weren't synced previously - Add "Copy Comments" quick action: copies unresolved comments for current file to clipboard with line numbers, context, author names, and timestamps - Filter comments to active file only, exclude resolved threads Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13Fix embedded terminal for Claude Code: PTY env, DEC 2026, xterm.js window ↵v0.2.4haoyuren
queries - Add missing PTY environment variables (TERM, COLORTERM, LANG, TERM_PROGRAM) - Strip DEC 2026 synchronized output sequences that cause xterm.js to buffer indefinitely when begin/end markers are split across PTY chunks - Enable xterm.js windowOptions for terminal pixel/char size queries that Claude Code sends to determine rendering capabilities - Launch Claude tab via login shell for full PATH inheritance Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13Fix Claude Code → Overleaf sync: remove hash from applyOtUpdate, fix OT bugshaoyuren
Root cause: SHA-1 hash sent with applyOtUpdate didn't match Overleaf's server-side computation, causing "Invalid hash" error, disconnect, and rollback of all synced changes. - Remove hash field from applyOtUpdate to skip server-side hash check - Switch applyOtUpdate from fire-and-forget to emitWithAck for reliable ack - Fix getOldDoc bug: save base doc when changes start accumulating instead of incorrectly using current doc (caused wrong delete ops) - Fix ack handler: only ack when no 'op' field (was acking remote ops too) - Await fileSyncBridge.start() instead of fire-and-forget - Add joinDoc retry logic for transient joinLeaveEpoch mismatch errors - Clear pending ack callbacks on WebSocket close to prevent timeout errors - Add otUpdateError logging for server-side rejections - Add file-based bridge logging for debugging sync issues Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13Improve editing experience: KaTeX math preview, syntax highlighting, symbol ↵haoyuren
autocomplete - Replace broken MathML math preview with KaTeX for rendered formula tooltips - Fix syntax highlighting by using proper HighlightStyle + syntaxHighlighting() instead of non-functional CSS class overrides - Add math region background highlighting (subtle gold tint for $...$ and $$...$$ regions) - Add Unicode symbol previews in autocomplete for Greek letters and math operators Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13Use polling for file watcher to reliably detect external editshaoyuren
chokidar FSEvents is unreliable in macOS temp dirs and misses atomic writes (write temp + rename) used by Claude Code and other editors. Switch to usePolling with 500ms interval and atomic: true. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13Separate Terminal and Claude into independent pty instanceshaoyuren
- Support multiple named pty instances via ID-based IPC channels - Terminal tab spawns a shell, Claude tab spawns `claude` CLI separately - Fix pty race condition: old instance's onExit callback could delete the replacement instance from the Map during React StrictMode re-mount - Guard against StrictMode double-initialization in TerminalInstance Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13Add bidirectional sync for binary files (PDF, images, etc.)haoyuren
FileSyncBridge now handles binary fileRefs in addition to text docs: - Downloads all binary files to temp dir on project connect - Watches for binary file changes on disk and uploads via REST API - Listens for Overleaf socket events (reciveNewFile, reciveNewDoc, removeEntity, reciveEntityRename) to sync remote changes to disk - Tracks binary files by SHA1 hash to avoid redundant uploads Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13Add drag-and-drop file upload, fix project creation modal and API endpointshaoyuren
- Add file upload to Overleaf projects via multipart POST with correct "name" text field (server reads filename from req.body.name, not from Content-Disposition filename) - Add drag-and-drop support in file tree panel with visual feedback - Replace window.prompt() with custom modal for new project creation (prompt() returns null in Electron) - Fix API endpoints: /api/project/new → /project/new Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13Add code folding, outline view, smart closing, math preview, syntax improvementsv0.2.0haoyuren
- LaTeX code folding: \begin/\end, sections, \if/\fi, comment blocks, braces - Outline view: section hierarchy in sidebar with click-to-navigate - Smart closing: auto-close \begin{env} with \end{env} on Enter, $...$ auto-pair, selection surround - Math hover preview: tooltip when hovering over $...$ expressions - Enhanced syntax highlighting: bolder commands, better color differentiation - Fix compile error click: jump to line works for errors without explicit file path - Semi-transparent active line + selection highlight layering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13Fix terminal cwd, selection highlight, comment range preservationhaoyuren
- Terminal now spawns in project sync directory so Claude Code can read/write .tex files - Selection highlight uses semi-transparent color to layer above active line highlight - External edits use diff-match-patch for minimal changes instead of full doc replace, preserving comment highlight positions - Set connection state on project open so status bar shows Connected - Remove cursor:pointer from comment highlights Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13Update logo, app icon, fix shutdown crash, add READMEhaoyuren
- Simplified logo: cosmic latte cup on brown background with turquoise liquid and sparkle stars - Square app icon (.icns) for macOS dock - Fix crash on window close: guard all IPC sends against destroyed window - Include ws/chokidar/diff-match-patch in packaged app - Add README with features and install instructions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13Add AGPL-3.0 license and copyright headers to all source fileshaoyuren
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13Rename to LatteX, add LaTeX autocomplete, fix comment highlight positionsv0.1.0haoyuren
- Rename project from ClaudeTeX to LatteX (Cosmic Latte theme pun) - Add new coffee cup logo and branded welcome/project screens - Add 5-source LaTeX autocomplete: commands, environments, \ref, \cite, file paths - Fix comment highlight drift by decoding WebSocket-encoded UTF-8 lines and range text via decodeURIComponent(escape()), matching Overleaf's client implementation - Remove hacky byte-offset position remapping from index.ts - Add pinch-to-zoom on PDF viewer Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12Add collaborator cursors and project chathaoyuren
Collaborator cursors: - Real-time cursor positions via clientTracking Socket.IO events - CM6 extension renders colored cursor widgets with name labels - Throttled cursor position broadcasting (300ms) - Connected users count in toolbar and status bar Project chat: - Chat panel in right sidebar (toggleable) - Load message history via REST API - Send messages with real-time delivery via Socket.IO new-chat-message - Auto-scroll, avatars, timestamps Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12Add bidirectional file sync, OT system, comments, and real-time collaborationhaoyuren
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>
2026-03-11Initial commit: ClaudeTeX - LaTeX editor with Overleaf synchaoyuren
Features: - Electron + React + TypeScript app with Cosmic Latte theme - CodeMirror 6 editor with LaTeX syntax highlighting - PDF preview with pdf.js, zoom controls, SyncTeX double-click jump - File tree with context menu (new/rename/delete/reveal) - Overleaf Git clone with token auth + macOS Keychain storage - Git pull/push sync for Overleaf projects - Embedded terminal (xterm.js + node-pty) with Claude CLI integration - LaTeX compilation via latexmk with auto package install detection - Structured compile log (errors/warnings) with click-to-navigate - Main document setting (auto-detect or right-click to set) - Custom modal system (input/confirm/alert) - Resizable panel layout (file tree | editor | PDF + terminal) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>