qwen-code/packages
jinye 637d00cebc
feat(core): render PDF pages to images when text extraction overflows or fails (#6585)
* feat(core): render PDF pages to images when text overflows or fails

Replace the PDF text-only 12000-token dead-end with a bounded page->image
fallback for vision-capable models, mirroring claude-code's approach.

- pdf.ts: add renderPDFPagesToImages / isPdftoppmAvailable (pdftoppm -jpeg
  -scale-to), with timeout, error mapping, and a total-bytes cap.
- fileUtils.ts: text-first, then four ordered fallbacks on overflow/failure:
  (1) render to the vision main model (explicit read, <=20 pages),
  (2) render <=4 pages to the vision bridge (text-only model, scanned @-PDF),
  (3) reference (no-pages @-attach), (4) text too-large guidance / error.
  Widen ProcessedFileReadResult.llmContent to PartListUnion.
- read-file.ts / readManyFiles.ts / pathReader.ts: handle the Part[] payload;
  pathReader now references large @-PDFs, aligning the two @ paths.

WIP: tests not yet migrated.

🤖 Generated with [Qwen Code](https://github.com/QwenLM/qwen-code)

* test(core): cover PDF page rendering and vision-bridge fallbacks

- pdf.test.ts: renderPDFPagesToImages (success/sort, page range, Infinity
  last page, unavailable, password, corrupt, empty output, byte-cap).
- fileUtils.test.ts: mock renderPDFPagesToImages and assert vision-model
  page/whole-doc/scanned rendering, >20-page guidance, truncation notes,
  renderer-unavailable fallback, and text-only bridge rendering (scanned @
  PDF -> <=4 pages, page-count note, text-first reference, no-flag error).

🤖 Generated with [Qwen Code](https://github.com/QwenLM/qwen-code)

* fix(core): never drop PDF pages silently when page count is unknown

Audit follow-up. Both image-render fallbacks could omit pages without a
note when pdfinfo is unavailable (page count null):

- vision no-pages render: when the size heuristic underestimates and the
  render fills the per-read page ceiling, add a note (previously only the
  byte-cap path was flagged).
- vision-bridge render: when the page count is unknown and the render hits
  the image cap, flag it (previously required a known count). Soften the
  note wording to not over-promise a later-range read on the @ path.

Adds regression tests for both unknown-page-count paths.

🤖 Generated with [Qwen Code](https://github.com/QwenLM/qwen-code)
2026-07-09 10:09:44 +00:00
..
acp-bridge feat(cli): Add session owner index for workspace runtimes (#6540) 2026-07-08 22:35:53 +00:00
audio-capture chore(release): v0.19.8 (#6549) 2026-07-08 15:51:03 +00:00
channels fix(channels): add chat payload diagnostics (#6539) 2026-07-08 23:23:47 +00:00
chrome-extension Gate browser automation MCP on external adapter (#6472) 2026-07-08 23:26:44 +00:00
cli Fix workspace skills for disabled extensions and ACP preheat (#6534) 2026-07-09 09:11:17 +00:00
core feat(core): render PDF pages to images when text extraction overflows or fails (#6585) 2026-07-09 10:09:44 +00:00
cua-driver fix(cua-driver): migrate Windows scripts + README rewrite (#6515) 2026-07-08 06:07:11 +00:00
desktop fix(desktop): preserve glued automation history records (#6344) 2026-07-05 23:53:49 +00:00
mobile-mcp fix(mobile-mcp): strip bounds attributes from UI hierarchy dump (#6568) 2026-07-09 03:59:00 +00:00
sdk-java fix(core): Align MCP OAuth guidance and docs (#5589) 2026-06-24 07:09:53 +08:00
sdk-python doc[sdk-python] Expand Python SDK usage documentation (#3995) 2026-05-12 15:27:00 +08:00
sdk-typescript Fix workspace skills for disabled extensions and ACP preheat (#6534) 2026-07-09 09:11:17 +00:00
vscode-ide-companion fix(core): configurable vision bridge timeout + retry with fresh budget (#6541) 2026-07-08 23:24:39 +00:00
web-shell Fix workspace skills for disabled extensions and ACP preheat (#6534) 2026-07-09 09:11:17 +00:00
web-templates chore(release): v0.19.8 (#6549) 2026-07-08 15:51:03 +00:00
webui Fix workspace skills for disabled extensions and ACP preheat (#6534) 2026-07-09 09:11:17 +00:00
zed-extension chore(deps): upgrade ink 6.2.3 → 7.0.2 + bump Node engine to 22 (#3860) 2026-05-11 17:29:50 +08:00