Repository navigation
v2.6.4
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
ProgressEventwith onlySTARTED,
PROGRESS, andCOMPLETED. An operation starts with required per-kind
unit_counts; translation also supplies pre-scanned sourcetotal_words. - Work units receive operation-local integer IDs only when execution begins.
Each reports integerstage/max_stagevalues and a finalUnitOutcome.
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 asSKIPPED; 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, andMAX_WORD_LENGTH. - Each Han character counts as one word. Other consecutive Unicode letters and
numbers count asceil(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
windowand the existing translator executor. Internal group windows do not
multiply that capacity;window=1remains 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/OCREventKindandTranslationEvent/
TranslationEventKind/TranslationItemKindimports with the unified
ProgressEvent,ProgressEventKind,OperationKind,UnitKind, and
UnitOutcomeAPI. ReplaceExtractionOptions.on_ocr_eventwith
on_extraction_event; translation keepson_translation_event. - Replace the four
*_charactersevent fields with*_words,
TranslationTask.character_countwithword_count, advanced translator
total_characterswithtotal_words, andsource_character_countwith
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 withunit_id,unit_kind,
stages and outcomes; distinguish operation events byunit_id is None. - See the full English migration guide
or 中文迁移说明.
Full Changelog: v2.6.3...v2.6.4