Skip to content

v1.4.0 - Structured-output tiers, SFX artwork preservation, and layered-reader hover fix

Choose a tag to compare

@Unheat Unheat released this 10 Nov 21:40
· 220 commits to main since this release

Summary

Version 1.4.0 gives custom API profiles real structured-output control, stops the pipeline from erasing hand-lettered sound effects, fixes the hover button on layered manga readers, and closes out the first popup/Studio/site UX audit:

  • Custom API Structured-Output Tiers: New per-profile Output Constraints control with three tiers (prompt-only, json-object, json-schema). The tier is auto-detected from the endpoint host — native json_schema hosts (OpenAI, OpenRouter, Groq, Fireworks, Together, Mistral, Cerebras, SambaNova, xAI, Nebius, DeepInfra), json_object-only hosts (DeepSeek, Novita, Hyperbolic, Lepton), and prompt-only for everything unproven (proxies, Ollama/vLLM, search endpoints). The detected tier can be overridden per profile.
  • Schema Actually Reaches The Wire: CustomApiEngine previously discarded the per-batch schema and asked for b0..bN keys in prompt text only, so small models dropped or hallucinated keys. OpenAI-shaped endpoints now receive response_format in the same body shape the community pool already uses, with OpenRouter provider.require_parameters so a downstream backend cannot silently ignore it.
  • Safe Degradation: An endpoint that answers HTTP 400 to the structured request is downgraded to prompt-only once per engine instance instead of failing the page; 401/429/5xx keep their existing transient-retry behavior. Gemini and Claude stay prompt-only because this engine does not send their provider-specific schema fields, and the control is hidden for them.
  • No Migration Required: The tier is validated against the shared catalog on read, and an unknown or retired value is dropped rather than trusted, so profiles saved before 1.4.0 keep working unchanged.
  • Popup, Studio, and Site UX Audit: "Open Edit Studio" no longer sits inside the disabled/paused dimming wrapper (turning Kites off could lock users out of the editor), helper text gets a real --color-muted role (was ~2:1 contrast on --color-dust), the accent splits into text and fill values, Studio drops its second neon pink and off-brand purple accents, and the site uses one flat accent fill with accessible store-badge text and a scrollable section-link strip under 860px.
  • Studio Canvas Toolbar: The top bar clamps its left cluster with min-w-0/overflow-hidden and yields project name, size readout, and the Hide Boxes label in priority order instead of painting over the document URL and pushing Export out of the bar; the three unlabelled fit glyphs collapse to one best-fit button (Fit Width/Height stay in the zoom menu).
  • OCR Fix: Multi-character native-script dialogue (2+ chars) now uses a 0.20 noise floor instead of 0.60, so genuine low-scoring CJK dialogue is no longer suppressed as screentone or clothing-fold noise.
  • Sound-Effect Artwork Preservation: New Sound Effects setting in Reading & Interaction with two policies — Leave as artwork (default, never inpainted or overlaid) and Translate plainly. The OCR pipeline now carries an artwork role per block: sound-effect (kana onomatopoeia lexicon over the 557-entry J-Ono dataset, katakana→hiragana folding, one-glyph OCR drift tolerance, plus the existing CJK/Hangul shout rule), display-lettering (glyphs ≥ 2.0× the page's body-size baseline, measured rather than chosen: brush lettering scored 5.63×, the largest genuine line 1.52×), and fragment (≤ 2 CJK glyphs, no sentence punctuation — always preserved). On the reported page erased area dropped from 21.2% to 7.6% while all 13 dialogue/caption blocks still translated. Latin text is never classified as artwork, so an English HUH? still gets translated. Classifiers compose behind one ISoundEffectClassifier contract; the lexicon regenerates byte-for-byte with scripts/generate-sfx-lexicon.mjs (MIT notice in src/shared/sfx/ATTRIBUTION.md). No dependency on the optional bubble tier — see ADR-012.
  • Brush Strokes Read As Text: A 716×349 patch of hand lettering OCR'd as こブンャっー used to be translated and inpainted, erasing 249,884 px² (10.8% of the page) in one box; single-glyph readings (糸, 名0, 房) became SILK, NAME, FATE. Those blocks are now artwork roles, so the same page erases 7.6% instead of 21.2%.
  • Whole-Balloon Duplicate Readings: Two translations no longer overlap inside one balloon. A region is dropped when it swallows ≥ 2 other readings (each ≥ 60% inside it), shares no 3-glyph run with any of them, and is no longer than their combined text. Checked against the donor's deduplicate_and_unify_regions first — its branches do not fire on this geometry (IoU 0.32), so the rule is ours.
  • Hover Button on Layered Readers (issue #48): Readers that stack pages in a fixed overlay above the artwork page's own <img> (Pixiv reading mode) anchored the button to the covered image and queued that first page no matter which page was hovered. Hover resolution now takes the topmost usable candidate in elementsFromPoint paint order instead of ranking by rendered area — a covered image that rounding made 0.1px wider used to win. The control is also placed from measured getBoundingClientRect() values through one shared requestAnimationFrame tracker with a composited translate3d, replacing CSS Anchor Positioning, whose anchor() offsets go stale inside nested scroll containers and resolved against the wrong coordinate space inside the fixed viewer. Verified on a live reader: hovering pages 1–4 places the control on each page, follows inner scroll, and queues the hovered page's own URL.
  • Settings Layout: Max Queue Capacity moved out of Reading & Interaction into Advanced & Integrations, where a throughput limit belongs; same binding, same bounds, same hint.
  • Worker Structured Output: Google Gemma 4 (26b-a4b-it, 31b-it) and Cloudflare Workers AI Llama 3.2 1B routes configured for json-schema output, with @types/node added so the worker CI typecheck resolves Node globals.
  • Community Standards: SECURITY.md, CODE_OF_CONDUCT.md, issue/PR templates, and CONTRIBUTING.md aligned with CodePath conventions.

Verification

  • Extension suite: 1,417 tests / 123 files passing (npx vitest run src/)
  • Extension typecheck: clean (npx tsc -b), lint clean (exit 0); no findings in touched files
  • Hover placement: real-page verification with the packed extension in Chrome for Testing — pages 1–4 each anchor the control on the hovered page, a 130px inner scroll moves it with the image, and clicking page 2 queues ..._p1_master1200.jpg
  • Sound-effect classifier: 9 pages / 100 OCR blocks measured; 0 false positives on every page containing real dialogue
  • Transport smoke: engine driven over real TCP against local accept/reject servers — schema fields, bearer credential, token floor, 400 downgrade body, and downgrade memoization all asserted
  • Production build: clean, dist/manifest.json at 1.4.0
  • Version: package.json and manifest.json bumped from 1.3.2 to 1.4.0

Compatibility

Drop-in for existing installs. Saved custom API profiles, popup state, and the community pool contract are unchanged; the only new persisted fields are optional — outputMode (structured-output tier, auto-detected) and sfxPolicy (defaults to the non-destructive preserve), so older profiles simply omit them.