SideBench
by mahirunox
README.md
# SideBench
English | [简体中文](./README.zh-CN.md)
**SideBench** is a native **Antigravity MCP App** side-panel plugin that brings interactive previewing, in-place editing, and Agent collaboration for local **Office, research, 3D CAD, and archive** files directly beside your conversation.
Native Antigravity renders PDF, Jupyter notebooks, Markdown, code, and media well, but binary Office documents, 3D meshes, e-books, and archives either show a download link or raw source text. SideBench registers an Antigravity **Custom File Viewer** (`type: "file"`) plus side-panel (`aux_pane`) and full-page (`global`) entrypoints so clicking matching files opens them directly inside Antigravity.
## Supported Formats
| Category | Extensions | Preview | Editing & Save | Agent Collaboration |
| :--- | :--- | :--- | :--- | :--- |
| **Word** | `.docx`, `.doc`, `.rtf` | High-fidelity layout via `docx-preview`, heading outline, zoom & fit-width (`.doc`/`.rtf` auto-converted via macOS `textutil` or LibreOffice) | Surgical in-place `word/document.xml` editing (preserves fonts, headers, footers, drawings, section breaks) + find & replace | Select text to ask Agent or attach context |
| **PowerPoint** | `.pptx` | Slide & continuous views via `pptx-preview` (native charts/tables), **OMML math equation unwrapping**, group zero-offset fix, speaker notes | Surgical in-place XML text, table cell, and speaker note editing (preserves theme, master, charts, media) | One-click "Ask current slide" (includes equations & notes) |
| **Spreadsheets** | `.xlsx`, `.xls`, `.csv`, `.tsv` | Multi-sheet tabs, sticky headers, formula bar, sorting, filtering, pagination, UTF-8 BOM / GB18030 auto-detection | Live cell & formula editing (`SUM`, `AVERAGE`, `MIN`, `MAX`, `COUNT`, arithmetic), add/delete rows & cols, undo, export CSV | Live selection stats + send selected range as Markdown table |
| **LaTeX** | `.tex` | Live **KaTeX** math rendering, section outline, `booktabs`/`tabularx` tables, `tcolorbox`/theorem callouts, `\definecolor`, local `\includegraphics` | Preview / live split-pane / full source editing + `Cmd/Ctrl+S` save | Select rendered text or send document outline & source |
| **JSONL** | `.jsonl`, `.ndjson` | Auto-inferred schema table, pagination, keyword filtering, malformed line indicators | JSON record inspector editor with live validation, add/delete records, raw edit, export CSV | Send selected JSON record to Agent |
| **E-Book** | `.epub` | Pure JSZip OPF / EPUB 3 Nav / EPUB 2 NCX multi-level TOC, inline embedded images, font size & sepia reading mode | Read-only | Select passage to ask Agent or attach context |
| **3D CAD** | `.stl` | Zero-dependency WebGL 3D viewer (Binary & ASCII), orbit/pan/zoom, Iso/Front/Right/Top views, Solid/Wireframe/Normals, bounding box, volume & surface area | Read-only | Send CAD dimensions, facet count, volume & area |
| **Archives** | `.zip`, `.tar`, `.tgz`, `.tar.gz`, `.gz` | Server-side instant collapsible directory tree, inline text/code/image preview, single-file extract, **nested full preview** for inner Office/LaTeX/STL/EPUB files | Read-only (extract individual entries) | Send directory tree or inner file excerpt |
## Key Engineering Highlights
- **Bypasses the 10 MiB Host File View Cap Cleanly**: Antigravity's `antigravity-file://` custom file viewer channel enforces a hard `10 MiB` limit. When opening a larger file directly from chat or the file tree, SideBench automatically locates the matching local file by exact filename and byte size and switches to its own chunked local streaming channel (`app_read_file_chunk`), while local archives parse their directory tree directly on the MCP server in milliseconds.
- **PowerPoint Math Formula Restoration**: PowerPoint wraps shapes containing OMML math (`<a14:m><m:oMath>`) inside `<mc:AlternateContent>`, causing standard web renderers to drop the entire text box. SideBench includes a 3-tier preview normalizer that restores Microsoft PowerPoint's pre-rendered Cambria Math fallback PNGs with `fillRect` compensation, falls back to vector/OMML Unicode math conversion, fixes grouped `x=0` coordinate scaling bugs, and resolves `+mj-lt`/`+mn-lt` theme font aliases.
- **Compact Single-File Bundle**: Strips redundant legacy `.ttf`/`.woff` KaTeX fonts (keeping `.woff2` only) and uses a pure WebGL STL engine so the entire self-contained MCP App HTML stays at **~3.1 MiB** (well within Antigravity's `10 MiB` `ui://` limit) under strict `default-src 'none'` CSP.
- **Safe Atomic Saves**: Local writes use temporary files + atomic rename and keep rolling backups inside `${PLUGIN_DATA}/backups/` without polluting your Git working tree.
## Installation
Prerequisites: **Node.js >= 20** and **Antigravity App (v2.34.0+)**.
### macOS / Linux
```bash
git clone https://github.com/mahirunox/side-bench.git
cd side-bench
npm install
bash install.sh --rebuild
```
### Windows (PowerShell)
```powershell
git clone https://github.com/mahirunox/side-bench.git
cd side-bench
npm install
powershell -ExecutionPolicy Bypass -File .\install.ps1 -Rebuild
```
This installs the compiled plugin bundle into `~/.gemini/config/plugins/side-bench/` (`%USERPROFILE%\.gemini\config\plugins\side-bench\` on Windows). Antigravity discovers it automatically:
- Click any supported file link in chat, **Overview → Documents**, or the file tree;
- Open **SideBench** from the side panel **`+`** menu or left sidebar **Plugins**;
- Ask the Agent to open a file via `open_side_bench` or inspect structure via `inspect_side_bench_file`.
### Uninstall
```bash
# macOS / Linux
bash uninstall.sh # remove plugin, keep backups & recent history
bash uninstall.sh --purge-data # also remove plugin data
# Windows (PowerShell)
.\uninstall.ps1
.\uninstall.ps1 -PurgeData
```
## Editing Fidelity & Known Limits
- **Word (`.docx`) & PowerPoint (`.pptx`)**: Surgical XML patching preserves original styles, images, headers/footers, themes, and charts. Editing a PPTX shape that contains native OMML equations converts that shape to plain text runs and clears its stale fallback image.
- **Excel (`.xlsx` / `.xls`)**: Powered by SheetJS Community Edition — saving preserves values, formulas, merged cells, and column widths, but does **not** preserve original cell fill colors or border styles. Local saves automatically create a rolling backup in `${PLUGIN_DATA}/backups/`.
- **Legacy `.doc` / `.rtf`**: Auto-converted via built-in `/usr/bin/textutil` on macOS, or headless LibreOffice (`soffice`) on Windows/Linux if installed. Legacy binary `.ppt` (Office 97–2003) is not supported.
- **Environment variables**: Set `SIDE_BENCH_ROOT_DIR` to pin a preferred default root directory in the file browser; `SIDE_BENCH_DATA_DIR` controls where `recent.json`, `settings.json`, and `backups/` are stored.
## Companion Project
For deep academic PDF reading with Zotero integration, multi-engine selection translation, formula snipping, and Obsidian note synthesis, see [paper-lens](https://github.com/mahirunox/paper-lens).
## Development & Tests
```bash
npm run typecheck # Strict TypeScript check
npm run build # Build dist/index.html (single-file MCP App) and dist/server.mjs
npm test # Self-contained unit & MCP stdio end-to-end tests
```
## Third-Party Acknowledgments
Built with `@modelcontextprotocol/sdk`, `@modelcontextprotocol/ext-apps`, `docx-preview`, `pptx-preview`, `xlsx` (SheetJS CE), `katex`, `jszip`, `fflate`, `papaparse`, `lucide-react`, and `react`.
## License
[MIT](./LICENSE)
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues