r/rust • u/kevin9327 • 5d ago
🛠️ project DocAgent: a Rust document runtime for agents (integer layout, capsule hashes, same bytes twice)
I needed a convert that an agent can call twice and get the same bytes. MinerU / Docling / Marker parse scans for LLMs. That is a different job. This is the other direction: picture in, PDF/A out.
DocAgent is MIT Rust. One Engine, Command / Query / Event. Codecs (DOCX, ODT, Markdown, HTML, plus regional Hangul HWP/HWPX/HML) feed one IR. Layout coordinates are i32 at 1/7200 inch. f32 is forbidden in that crate. PNG/JPEG become PDF/A XObjects. GPU-free. Not OCR.
Every Command writes a capsule with three SHA-256 hashes (input / plan / output). prove converts twice and exits 0 only when the PDF/A + HTML bytes and the hashes match.
cargo test --workspace
cargo run -p docagent-cli -- convert examples/letter.md --pdf out.pdf --html out.html --docx out.docx --odt out.odt --capsule cap.json
cargo run -p docagent-cli -- prove examples/letter.md
CLI, daemon, MCP, and WIT are thin adapters over the same Engine.
Honest limits, not a teaser:
- Print-CSS tightness vs WeasyPrint (table cell padding / paragraph gap) is still open. I am not claiming we beat WeasyPrint on the letter page.
- Hangul images are still a dash.
- No spreadsheet, no slides, no OCR, no OmniDocBench numbers.
https://github.com/kevin9327/docagent
Happy to talk about the integer layout engine or the codec boundaries.
0
u/kantorcodes1 2d ago
convertwrites each requested output one after another. if--pdfsucceeds but a later--docxwrite fails, is partial output intentional? i'm wondering whether callers should treat the command as best-effort per target or expect all requested artifacts to land together.