AutoPDF now models a document as an immutable component tree. A component is
promoted through an exact (kind, variant, target) catalog definition, rendered
to a content-addressed fragment, and assembled into a deterministic render
manifest. The manifest records child/dependency edges, source assets, hashes,
and editor source locations.
The LaTeX target maps layout coupling—not user-authored commands—to files:
flowbecomes a\inputfragment.- top-level
sectionbecomes an\includeunit and may participate in\includeonlyfocused builds. artifactembeds a separately resolved PDF or image.
\input by itself does not make TeX incrementally compile only that file. Fast
feedback comes from the whole pipeline: component hash caching avoids rerendering
unchanged fragments, bounded workers render independent components concurrently,
only changed workspace files are written, the preview session retains TeX aux
files, \includeonly skips unrelated section units, superseded builds are
cancelled, and only changed page payloads are returned to the UI.
Production PDF generation remains behind the existing stable api.Result
boundary. Preview is deliberately a separate, revisioned lifecycle so stale
output can never replace a newer browser revision.
- Create immutable component definitions and freeze a
component.Catalog, or useapi.NewDefaultDocumentEngine("latex", config). - Call
DocumentEngine.Projectfor a pure manifest/projection, orDocumentEngine.Generatewith a productionProjectionGenerator. - For interactive use, retain one
preview.Sessionper editor document and submit edits throughDocumentEngine.Preview. - Give mutable external assets a new URI or
AssetRef.Digestwhenever their bytes change; this intentionally invalidates the relevant fragment/source.
The compiler and asset resolver are explicit effect ports. This keeps component renderers deterministic and makes caches safe to share across requests.
api.NewProjectionGeneratormaterializes a projection in an isolated production workspace, resolves versioned assets, and calls the canonicalEngine.Generatepipeline while preservingapi.Result.preview.NewLaTeXCompilerretains TeX auxiliary state in each session, terminates superseded compiler processes through context cancellation, and performs full-resolution rasterization only for changed page fingerprints.rest.NewPreviewAPIexposes monotonic revisions and replayable SSE events. A browser reducer replaceschangedPages, deletesremovedPages, and ignores older revisions.
Layered budgets and the browser paint hook are documented in Preview performance.