github xberg-io/xberg v1.5.0

57 minutes ago

Added

  • models: the experimental candidate inventory (crates/xberg/src/candidate_models/inventory.json) is now the only pin store. It records every staged artifact's owned repository, immutable revision, SHA-256, size, license and per-file source, and selects an explicit fp32 or int8 subset per task so a consumer never downloads another task's graphs. The NLI preparation path derives both its SHA-256 and size manifests from the inventory and rejects a truncated or extended file before reading it; a wrong or floating revision fails before any byte is checked. A caller-supplied LocalNliModel must now also provide size_manifest, and an omitted size fails closed. Every entry stays experimental and unqualified; none is a default or a supported preset. (#2336)
  • classification: LocalNliModel::staged builds the experimental zero-shot NLI descriptor from the candidate inventory, selecting the host graph through CandidateModel::files_for_target (the fp32 NLI graph exceeds the adapter's cap; an unsupported architecture fails instead of substituting one). LocalClassificationMode records that caller labels are zero-shot, and LocalTextClassifier::classify_trained_taxonomy rejects a trained-taxonomy request while no fixed-taxonomy head is staged. Still behind classification-onnx, still unqualified. (#2335)
  • captioning: the experimental captioning-onnx feature adds a CPU-only local image captioner over the staged SmolVLM-256M/500M graphs (xberg::local_captioning). It selects fp32 or int8 through the candidate inventory, stages or verifies every artifact by SHA-256 and exact size, preprocesses and prompts the export, runs a bounded greedy decoder with cancellation and deadlines, and never falls back to a provider. Florence-2 pins and descriptor validation are included, but the adapter refuses that family explicitly because its encoder-decoder, task-token and per-task post-processing pipeline is not implemented. LocalCaptioningModel::staged and LocalImageCaptioner::stage/prepare are Rust-only and unqualified; the default feature set and the liter-llm captioning path are unchanged. (#2335)
  • captioning: SmolVLM preprocessing follows the pinned Idefics3 processor's do_image_splitting path: the image is resized to the processor's size, split into max_image_size tiles tagged <row_N_col_M> in row-major order, and closed by the squashed global frame. Tile count and total image tokens are bounded before inference, the prompt's token ids match the pinned processor for a 2x2 grid, and the single global-frame expansion is unchanged. Florence-2 stays refused explicitly: the earlier merged-decoder failure does not reproduce on the bundled ONNX Runtime 1.31.0, where both pinned quantizations load and run cached steps; the blocker is the unimplemented encoder-decoder/task-token/post-processing pipeline, recorded in the module docs. (#2335)
  • cli: xberg cache warm and xberg doctor can select the experimental local candidates with --captioning-model/--classification-model, --*-precision and --*-backend, and report the selected/effective backend plus the prepared model identity. Doctor's offline output lists every pinned candidate artifact with its id, revision, size, SHA-256 and staged/missing state; cache warm stages, verifies and prepares the selection so the first request performs no network access. LocalTextClassifier gains the matching stage and artifacts surface. The CLI features (captioning-onnx, classification-onnx) stay opt-in and are absent from default/all/full; no candidate is a default preset. (#2335)
  • pdf: pdf_options.extract_vector_geometry (default false) returns each PDF page's vector geometry on pages[].geometry: every painted path's subpaths, segments, bounding box, fill colour, stroke colour/width/dash, and Optional Content layer, in page coordinates with the content-stream and Form XObject transforms applied. The coordinate frame is the same one text bounds use, so a label can be matched to the shape it annotates. Off by default because a dense drawing sheet can hold more than ten thousand paths. (#2966)
  • pdf: measured annotation and viewport data. PdfAnnotation now carries vertices for Line, Polygon and PolyLine annotations, ink_list for Ink, and measure for the /Measure dictionary (producer scale text plus the /X, /Y, /D, /A, /T and /S number-format arrays). pages[].viewports carries every /VP page viewport with its bounds, name and measure. A native writer appends a Polygon annotation with a copied measure dictionary to an existing PDF as an incremental update, preserving every original byte and other object. (#2966)
  • pdf: pdf_options.plan_regions (opt-in plan-regions Cargo feature, default off) closes line segments from the vector geometry into a planar graph, bridges door-sized gaps up to gap_tolerance, splits crossings and returns each bounded face on pages[].geometry.regions with its area in square page points and the page text inside it. snap_tolerance, gap_tolerance and max_segments are settings; work is bounded and degeneracies are skipped. The one added dependency is geo (MIT OR Apache-2.0), reachable only through that feature. (#2966)
  • pdf: extraction::plan_geometry::DrawingSetText parses the text conventions of a construction drawing set: title-block sheet number, title and revision; feet-and-inch dimension strings (12'-0 5/8" to 144.625 inches) paired with the caller's text position; and architectural or ratio scale notes (3/8" = 1'-0" to 1:32, 1:100 to 100). Every field is optional and no parser invents a value. (#2966)
  • ocr: OrtSessionOptions (memory_pattern, cpu_arena) now applies to PaddleOCR detection, classification and recognition ONNX Runtime sessions (max_threads does not affect PaddleOCR), and set_ort_session_options / ort_session_options are exposed to the language bindings, so variable-size documents can run with a bounded memory footprint. PaddleOCR engines are pooled per option set. (#3284)
  • api: XBERG_API_TOKEN enables bearer-token authentication on every REST route except GET /health, and on the MCP HTTP transport (xberg mcp --transport http). The token must be ASCII. The Helm chart takes the token from a Secret (xberg.apiTokenSecret).

Changed

  • release: Every published CLI archive (Linux gnu/musl, macOS, Windows) and the core/full/cli Docker images now build libheif decode-only: the Linux and Docker builds pass -DWITH_X265=OFF/-DWITH_X264=OFF, the macOS CLI uses the source-built decode profile instead of Homebrew's x265-linked bottle, and the Windows vcpkg install requests libheif[core,aom,libde265] instead of the port's default hevc feature. A release gate opens each archive and fails on an x265 file, symbol or DT_NEEDED/load-command reference. HEIC/HEIF decoding is unchanged, but HEIF/HEIC image output via ImageOutputFormat::Heif now reports EncoderUnavailable on these artifacts instead of linking the GPL-2.0 encoder; the macOS Elixir NIF keeps its deliberate encoder profile and is conveyed under GPL-3.0-or-later with a written corresponding-source offer (GPL-SOURCE-OFFER.txt, valid three years, contact contact@xberg.io). (#3338)
  • release (windows): The Windows x64 CLI ZIP now links the LGPL-3.0 libheif and libde265 as shared libraries from vcpkg's dynamic x64-windows triplet instead of embedding them in xberg.exe, and bundles only the codec DLLs reachable from heif.dll (plus libde265.dll, aom.dll and their closure), LGPL-3.0.txt, GPL-3.0.txt, the upstream codec notices and a GPL-SOURCE-OFFER.txt offer of the Corresponding Source for three years. That is the LGPL-3.0 §4(d)(1) shared-library route rather than the §4(d)(0) relink material a static link needs, and it covers the §3/GPL-3.0 §6 source obligation because the vcpkg ports patch the codecs (THIRD_PARTY_LICENSES.md records the method and the §2 modification notice). A new release gate reads the archive's PE imports, notices and offer and fails a Windows CLI ZIP whose executable stops importing heif.dll, whose codec DLL closure is incomplete, or that omits a text or the offer. (#3339)
  • api: Breaking. The REST server and the MCP HTTP transport now refuse to start on a non-loopback host (the Docker images bind 0.0.0.0) unless XBERG_API_TOKEN is set or XBERG_ALLOW_UNAUTHENTICATED=true opts out (only for a trusted network). CORS is denied unless XBERG_CORS_ORIGINS lists origins (* allows all); the library serve* functions now read XBERG_CORS_ORIGINS and XBERG_JOB_TIMEOUT_SECS from the environment as the CLI does. ServerConfig.cors_allows_all() and is_origin_allowed() (exposed in the bindings) change meaning: an empty cors_origins list now denies instead of allowing every origin, and only * allows all. Also, DELETE /cache/clear and POST /cache/warm now count against the concurrency limit. Migration: set XBERG_API_TOKEN and send Authorization: Bearer <token>, or set XBERG_ALLOW_UNAUTHENTICATED=true behind a trusted proxy; add browser origins to XBERG_CORS_ORIGINS. (#3165)
  • Breaking (libheif): In the Rust-only xberg-libheif crate, ImageHandle, Track, RegionItem and the Region geometry types carry the input lifetime (ImageHandle<'a>, Region<'a>) and share ownership of the context's native state and input, so they stay valid after the HeifContext is dropped but cannot outlive a borrowed input; a live region also keeps the context from loading another image, since libheif resolves its transformed getters against that context's image properties. Reader now requires Send and is called under a lock, since libheif may read from worker threads. HeifContext is no longer Send. read_file, read_reader and read_bytes return a usage error while handles derived from the context are alive, and methods that take an ImageHandle reject one from another context. The image integration buffers its input in memory (up to 512 MiB). The removed internal ImageHandle::context() wrapped the shared native context without carrying its source. (#3229)
  • Breaking (tesseract): xberg-tesseract iterators are tied to the engine and its current recognition result. PageIterator, ResultIterator, ChoiceIterator and MutableIterator gain an <'api> lifetime and cannot outlive the TesseractAPI that produced them. Their new constructors and public handle fields are removed, and TesseractAPI::handle is pub(crate). ResultIterator::choices() replaces raw ChoiceIterator construction, and get_mutable_iterator returns MutableIterator. An iterator call made after Init, set_image, recognize, clear, layout analysis or another call that replaces the result fails with the new TesseractError::StaleIterator. TesseractError is now #[non_exhaustive]. (#3228)
  • Breaking (tesseract): Pix::grayscale_bytes returns InvalidParameterError for an image that is not 8 bpp or has a colormap, instead of narrowing raw pixel values. (#3228)
  • pdf/ocr: Embedded-image OCR reads identical image bytes once and shares the result with every occurrence, so a native PDF that paints one image on every page no longer pays an OCR read per page. (#3260)
  • pdf: Scan grading is skipped when PDF metadata output is off and OCR is disabled or absent from the build, removing an extra pass over the pages; with OCR enabled or metadata requested the grade and the OCR routing it feeds are unchanged. (#3386)

Fixed

  • pdf: A fixed-arity operator reads its trailing operands, as other readers apply them, so an operand leaked by an unknown operator ahead of it (bcolor [0], pagesize width 597.5pt height 845pt) no longer shifts a matrix or drops the operator. [0] 1 0 0 1 -72 -779 cm applies the documented translate instead of a shifted matrix, and a page whose text it places no longer extracts empty. (#3383)
  • pdf: A Form XObject's text survives the large-stream prescan: a Do region now includes the /Name operand that precedes it, so pages over 256 KiB of glyph outlines with an invisible OCR text layer in a form extract their text instead of nothing. (#3384)
  • pdf: Two ruled schedules side by side on one sheet, sharing row bands and separated by a wide graphics-free gap, are returned as separate tables instead of one whose bbox spans both; a cell wider than 60 points is only closed when a horizontal rule spans it, so a shared banded table bridged by its rules stays one table. (#3377)
  • api: The drawing-set types (SheetMetadata, ParsedScale) and PolygonAnnotationInput serialize, so the Java, Kotlin, C# and FFI JSON bridges for the new geometry surface exist instead of naming symbols the native library never exported. (#2966)
  • pdf: Separately titled tables printed as one band are split at each title again, both when a ruled detector joins stacked tables whose rules line up and when three titled tables sit side by side in one borderless band. Each title stays a full-width row and the header band that follows it stays with its own table; a spanning row inside a body and a header band that repeats without a title do not split. (#3348)
  • pdf: A ruled table split by a taller row gap under a subtotal is rejoined into one table when adjacent bands repeat their column tracks and one family of long rules spans both, keeping the wrapped header and the first-column row span. (#3349)
  • pdf: A two-column page letterhead in the top band is no longer emitted as a table; it stays text, while ruled tables and tables with retained grids remain tables. (#3350)
  • ocr: Default preprocessing measures a raster's own paper level instead of comparing it with a fixed near-white value, so a lightly tinted or shaded scan page is still read as a page and takes the 300 DPI resample. A 100 DPI tinted table with 9 px digits keeps 72 of its 72 numbers instead of 65, and its 7 px variant 71 of 72 instead of 49, while a 300 DPI page is not resampled. (#3337)
  • pdf: A leading ruled band whose cells wrap over several lines is one header row again, with each column's lines joined by position, instead of one body row per wrapped line that pushed the body down and dropped the header role. (#3346)
  • pdf: A stacked header keeps the leaf band under its spanning title as header cells in the table grid and plain HTML output, spans intact, so those labels are no longer body cells there; Markdown and the styled HTML renderer still mark one header row, the spanning title. (#3347)
  • layout: serve and extract read layout models from the Xberg cache (XBERG_CACHE_DIR/layout, the platform cache directory by default) before the Hugging Face cache, so the models the Docker image warms at build time are used instead of downloaded again; a warmed model now resolves with HF_HUB_OFFLINE=1 and no Hub request. cache warm defaults to the same root as the runtime instead of .xberg in the current directory, and xberg::cache::resolve_cache_base_dir() exposes the resolved root. (#3320)
  • pdf: Native extraction keeps a raised ordinal suffix (2nd, 24th) in its sentence when the mark is a multi-glyph run set up to 0.5em above its base, while a lone raised mark keeps the narrower reach. (#3317)
  • ocr: A recognized dot-leader table row is no longer printed beside the row the detected table already carries. The row claim now compares rows without the leader artifacts a recognizer adds between a label and its values, including a leader that picked up a stray dash, while letters, digits, signs and currency still have to match in order. (#2503)
  • ocr: A leader-aware table proof now also claims the rows it leaves behind, matching whole rows only and never every line inside the table's rectangle. On a 150 dpi six-column dot-leader scan read with PSM 6, HTML printed the row whose short leader the table cell did not carry beside the table that already carried it; the table is now emitted once. (#2503)
  • tesseract: The text getters on TesseractAPI (UTF-8, hOCR, ALTO, TSV, box, LSTM box, word-str box, UNLV) free the native text when UTF-8 conversion fails. (#3228)
  • pdf: Honor global OCR disable settings by skipping inline-image OCR and image loading requested only for OCR. (#3389)
  • pdf: A born-digital equation line is written as display math ($$...$$) and an equation inside a sentence as inline math ($...$) in Markdown, instead of plain text; Plain keeps the undelimited source. (#2331)
  • pdf: A running header or footer whose only change is its page number no longer stays in the body, on native and scanned pages. Scanned pages also strip cross-page furniture by default, matching ContentFilterConfig::strip_repeating_text. (#2331)
  • release: The non-musl Go archive ships LICENSE and THIRD_PARTY_LICENSES.md beside the FFI library and link metadata, matching the musl archive, so the five Go downloads carry the notices for the libheif, libwpd and ONNX Runtime bytes they redistribute. (#3342)

Don't miss a new xberg release

NewReleases is sending notifications on new releases.