* fix(chat): isolate PDF attachment extraction
Run PDF-bearing chat attachment extraction outside the API process and reuse the single PDF image pass for both page markers and embedded attachments. Addresses the chat attachment reproduction in #2865.
* perf(pdf): skip decoding images after the count cap
Keep lookups for previously accepted image references ahead of the quota check so repeated pictures are still mapped to each page.
* perf(chat): reuse native PDF markdown for text-only parsing
Match the stored attachment bytes and preserve the configured parser path for other engines and incomplete native results.
GitHub source sync kept only .md and .markdown, so a docs glob of *.mdx
reported success with zero files and left raw/ empty. Re-index then failed
because no supported source files were present. Treat .mdx as text next to
Markdown in the sync filter, the knowledge-base file router, and the chat
attachment list that mirrors it.
Fixes#2552
td/th were missing from _EPUB_BLOCK_TAGS, and nothing else emits a
separator between table cells. Both EPUB text renderers (_epub_render_text
and the _EpubHTMLTextParser fallback) only break on block tags, so they
relied on source whitespace between cells. Commercially produced EPUBs
often ship minified, whitespace-free XHTML, where a row like
<tr><td>Revenue</td><td>100</td><td>Q1</td></tr> extracts as the single
glued token "Revenue100Q1" — unreadable data fed to the model.
Add td and th to _EPUB_BLOCK_TAGS so each cell is separated, the same way
li/dd/dt already are. One constant fixes both renderers.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Finder's "Compress" does two things to an EPUB: it nests the whole book
under one folder, and it writes a parallel `__MACOSX/` tree of AppleDouble
resource forks that carry the content files' names and extensions.
The package lookup only ever looked for `META-INF/container.xml` at the
archive root, so a wrapped book found no container, no OPF and no spine,
and fell back to matching file extensions over the whole archive. That
fallback then read `__MACOSX/OEBPS/._index_split_000.xhtml` — 60 bytes of
binary resource fork — as a chapter. Hence the phantom `._…` sections in
the sidebar and "Could not load this section" on opening them (#1447).
Both halves of the same rule, in one place. Packaging residue (`__MACOSX`,
dotfiles) is not book content and never reaches either reader; the other
archive readers in this codebase already drop it. And a single wrapper
directory is resolved from wherever the container actually sits, so spine
order survives it.
The container/OPF chain was written out twice — once for the spine, once
for the navigation — so a wrapped book silently lost its whole outline
too, by a `return []` in the half nobody was looking at. One resolver now
answers "where is this book's package document" for both.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>