v0.4.0
PDF extraction overhaul, envelope routing for the rest of the --json surface,
typed exit codes wired up across all command error paths, and a CI repair pass.
schema_version bumps to 1.1.0.
Added
- MinerU PDF extractor alongside the existing pymupdf-based extractor, with
a newBasePdfExtractorabstract class and automatic fallback when MinerU
fails (zot pdf KEY --extractor mineru). Configure via[pdf] extractor,
[pdf] mineru_token, orMINERU_TOKEN/ZOT_PDF_EXTRACTORenv vars. zot pdf --outline— list every heading in the document as a numbered
outline so agents can navigate without dumping the full text.zot pdf --section N— extract just the content under the N-th heading
from--outline. Useful for "show me the methods section" workflows.zot workspace index --extractor— choose the PDF extractor used during
RAG indexing.- Embedding provider router with first-class support for Aliyun
(DashScope, OpenAI-compatible) and Jina endpoints. Routes via the new
[embedding] provider,[embedding] aliyun_api_keyconfig keys plus
ZOT_EMBEDDING_PROVIDER/ZOT_EMBEDDING_ALIYUN_KEYenv vars. - Attachment resolver that handles
storage:paths,file://URLs,
Zotero'sattachments:paths, Windows drive letters, and base-attachment
prefs. PDFs in non-default storage directories now resolve correctly. progress_callbackplumbing through the PDF extraction path so MinerU
batch operations and per-PDF extraction surface progress to the caller.
Changed
- Envelope routing extended to the remaining
--jsoncommands:
zot pdf(incl.--outline/--section),zot workspace list,
zot workspace query, andzot config cache listnow emit the standard
{ok, data, meta}envelope.workspace querydatabecomes
{mode, results}rather than the bare results list. schema_version1.0.0 → 1.1.0 to reflect the envelope-coverage extension
and the typed-exit-code parity.docs/agent-interface.mdupdated.- Typed exit codes wired across all command error paths. Previously many
error paths calledprint_error(...); return, printing the error message
but silently exiting 0. They now useemit_error(...)with the appropriate
typed code:not_found(4): item / PDF / workspace / collection / profile / index /
section missing — affectscite,export,summarize,open,pdf,
workspace delete/add/remove/show/export/import/search/index/query,
config profile_set.validation_error(3): bad page range inpdf, missing required source
flag inworkspace import, invalid workspace name.auth_missing(2): alltag/trash restore/collection
write commands when API credentials aren't configured.conflict(6):workspace newwhen the workspace already exists,
andzot duplicatesnow exits 6 when duplicates are found so
agents can branch onif zot duplicates …; then …; else act_on_dups; fi.runtime_error(1): caughtPdfExtractionErrorinpdfand
ZoteroWriteErrorincollection move/delete/rename.
zot relate KEYwith no related items is now a normal exit-0 outcome
(matchingzot searchon no matches) rather than an error message.config cache listrobustness: graceful fallback when the cache DB is
unreachable; closes the connection in afinallyblock.
Fixed
- 20 pre-existing test failures on
mainrepaired (some were envelope-shape
drift between tests and production; the rest were genuine exit-code
regressions covered by the migration above). Theci.ymlpytest run goes
green again. tests/test_extracts_textno longer breaks on hosts without
~/.config/zot/config.toml. The previous over-broadPath.existsmock
also patchedload_pdf_config's file-existence check; tightened to a
targetedload_pdf_configmock.
Breaking
- Tools / agents parsing
--jsonoutput fromzot pdf,zot workspace list,zot workspace query, orzot config cache listneed to unwrap
the standard envelope (result["data"]). Other commands were already
enveloped; this brings the rest of the surface into line. - Error paths that previously exited 0 with a printed message now exit
with their typed code (1, 2, 3, 4, or 6). Scripts that ran
zot cite NONEXIST && echo okand similar will now correctly fail. zot duplicatesexits 6 (CONFLICT) when duplicates are detected.
Scripts that ignored the exit code or usedif zot duplicates; then
will need to invert the branch.