Skip to content

v2.6.4

Choose a tag to compare

@github-actions github-actions released this 26 Oct 11:22
· 57 commits to main since this release
1fe50e4

PDF Craft v2.6.4

PDF Craft 2.6.4 unifies extraction and translation progress, counts source words
consistently, and starts independent metadata and PCEX translation work as soon as
its inputs are ready. This release includes breaking progress API changes; callback
consumers should follow the migration notes below. PCEX v4 is unchanged.

Unified work-unit progress

  • Extraction and translation now report ProgressEvent with only STARTED,
    PROGRESS, and COMPLETED. An operation starts with required per-kind
    unit_counts; translation also supplies pre-scanned source total_words.
  • Work units receive operation-local integer IDs only when execution begins.
    Each reports integer stage / max_stage values and a final UnitOutcome.
    Stages describe an individual unit, not a serial phase of the whole document.
  • Standard XML translation reports after each accepted or final-fallback round,
    including heading, metadata, furniture and chapter work. Retries do not count
    work twice. Allowed ignore, fallback, skip and cache paths settle their units
    and words; operation completion follows successful output publication.
  • EPUB pre-scans the same source tasks used for translation without buffering
    the book. Empty XML tasks settle as SKIPPED; assets are counted independently
    of request batches. EPUB navigation and document titles share NAVIGATION,
    while OPF book fields belong to METADATA.
  • See #546,
    #547, and the
    progress protocol and stage numbers.
    Fixes the progress-reporting gaps discussed in
    #544.

Shared source-word counting

  • All translation accounting uses one streaming implementation, exported as
    WordCounter, count_text_words, and MAX_WORD_LENGTH.
  • Each Han character counts as one word. Other consecutive Unicode letters and
    numbers count as ceil(length / 20) words; combining marks extend a word
    without increasing its length. Whitespace and punctuation separate words.
  • XML inline tags and streaming chunks do not split words; paragraph and field
    boundaries do. Original context prompts and reused headings are not counted
    as additional translation work. Counts use source text, not output or tokens.

Dependency-aware concurrency

  • OCR-based book metadata starts from committed front-page evidence while later
    OCR continues. Additional reads wait only for requested pages, up to twelve.
    Native-only metadata is reported before OCR and saved consistently regardless
    of whether content or progress callbacks are registered.
  • PCEX metadata, body, footnotes, image/table text and furniture share one bounded
    window and the existing translator executor. Internal group windows do not
    multiply that capacity; window=1 remains serial.
  • Furniture waiting for a heading occupies no execution slot. A final heading
    result releases its dependants immediately, including fallback. Assets wait
    only for necessary original-text context, never for translated body text.
  • Pending work and out-of-order results live on temporary disk. Body and footnote
    callbacks each preserve source order independently of the other channel and
    ordered output writing. Closing a content stream early cancels remaining work
    without reporting false operation completion.
  • Close progress SQLite connections explicitly and avoid waiting for replacement
    events on failed caches belonging to pages not selected for this operation.
  • See #548 and
    PCEX scheduling and delivery.

Breaking API migration

  • Replace root OCREvent / OCREventKind and TranslationEvent /
    TranslationEventKind / TranslationItemKind imports with the unified
    ProgressEvent, ProgressEventKind, OperationKind, UnitKind, and
    UnitOutcome API. Replace ExtractionOptions.on_ocr_event with
    on_extraction_event; translation keeps on_translation_event.
  • Replace the four *_characters event fields with *_words,
    TranslationTask.character_count with word_count, advanced translator
    total_characters with total_words, and source_character_count with
    source_word_count. The new numbers are words, not renamed character counts.
  • Remove advanced completed-word offsets and legacy scope/item event switches.
    Callback reporting now uses the same operation/unit lifecycle throughout.
    Replace old chapter/item event-field handling with unit_id, unit_kind,
    stages and outcomes; distinguish operation events by unit_id is None.
  • See the full English migration guide
    or 中文迁移说明.

Full Changelog: v2.6.3...v2.6.4