Skip to content

增加重型SPA页面的超时逻辑,增加raw mode避免cli页面agent猜测变量名的行为#841

Closed
YoungCan-Wang wants to merge 19 commits into
jackwener:mainfrom
YoungCan-Wang:main
Closed

增加重型SPA页面的超时逻辑,增加raw mode避免cli页面agent猜测变量名的行为#841
YoungCan-Wang wants to merge 19 commits into
jackwener:mainfrom
YoungCan-Wang:main

Conversation

@YoungCan-Wang
Copy link
Copy Markdown
Contributor

Description

Related issue:

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 🌐 New site adapter
  • 📝 Documentation
  • ♻️ Refactor
  • 🔧 CI / build / tooling

Checklist

  • I ran the checks relevant to this PR
  • I updated tests or docs if needed
  • I included output or screenshots when useful

Documentation (if adding/modifying an adapter)

  • Added doc page under docs/adapters/ (if new adapter)
  • Updated docs/adapters/index.md table (if new adapter)
  • Updated sidebar in docs/.vitepress/config.mts (if new adapter)
  • Updated README.md / README.zh-CN.md when command discoverability changed
  • Used positional args for the command's primary subject unless a named flag is clearly better
  • Normalized expected adapter failures to CliError subclasses instead of raw Error

Screenshots / Output

YoungCan-Wang and others added 19 commits April 4, 2026 15:16
feat: support image replies in twitter reply
…dd size limit

- Fix attachReplyImage fallback: use uploaded flag instead of checking
  page.setFileInput existence, so base64 fallback actually runs when
  CDP setFileInput throws "Unknown action"
- Restore execCommand('insertText') as primary text input method for
  Twitter's Draft.js editor, with paste event as fallback
- Add 20MB size limit for remote image downloads to prevent OOM
- Remove unsafe buttons[0] fallback that could click invisible buttons
…rning

Local images were not validated for size — a 100MB file would fail only
at upload time. Remote images already had MAX_IMAGE_SIZE_BYTES checks.
Also add a console.warn when using the base64 fallback with large
payloads, consistent with xiaohongshu/publish.ts behavior.
…rror 子类。适配器遇到这三类错误只能 throw new

  Error(...),CLI 渲染器无法匹配到正确图标,全部显示为通用的 💥。
…valuateFetch() 工具函数,目前每个站点各自实现,功能重叠但质量参差。提取为共享工具
…分歧。 共享 evaluateFetch() 工具函数,目前每个站点各自实现,功能重叠但质量参差。提取为共享工具"

This reverts commit 300efbd.
@YoungCan-Wang
Copy link
Copy Markdown
Contributor Author

Quick maintainer summary for this PR:

  • Main functional change: allow structured navigateBefore options (url, waitUntil, settleMs) so heavy SPA adapters can avoid the default pre-nav load/settle behavior when that causes timeouts.
  • Also adds --raw to print unformatted JSON for adapter development/debugging.
  • Also adds typed errors (NetworkError, ApiError, PageChangedError) and updates the documented exit-code mapping.

Current head is mergeable and the latest checks on 4332ab8 are green:

  • Doc Check
  • Security Audit
  • CI
  • E2E Headed Chrome

If you prefer, I can split --raw / error-class additions into a separate PR and keep this PR focused only on the SPA pre-navigation timeout change.

@jackwener
Copy link
Copy Markdown
Owner

@YoungCan-Wang Thanks for the work on this — revisiting after some time, the core problems this PR addresses are already handled on main:

  1. Heavy SPA pre-nav timeout: page.goto(url, { waitUntil: 'none', settleMs }) is already on main (src/browser/page.ts). Adapters that need custom pre-nav behavior can set navigateBefore: false and call page.goto() with those options directly in func() — no framework change needed. The declarative navigateBefore: { url, waitUntil, settleMs } object form you add here would be sugar on top, not a blocker.
  2. Typed errors (NetworkError / ApiError / PageChangedError): Existing CliError('NETWORK', ...) with custom codes already produces the same exit-code behavior. Adding named subclasses is a normalization rather than a fix for a broken path.
  3. --raw output: This one isn't on main, but --format json covers most of the adapter-development use case through the columns filter. Happy to take this as a separate focused PR if you'd like to pick it up.

Closing this since there's no blocking issue left. Really appreciate the contribution and sorry for the delay on review — if you want to carve out --raw as its own smaller PR, that's very welcome.

@jackwener jackwener closed this Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants