Files
wehub-resource-sync 9b395f5cc3
E2E Headed Chrome / e2e-headed (macos-15) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (ubuntu-latest) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (windows-latest) (push) Has been cancelled
CI / build (macos-latest) (push) Has been cancelled
CI / build (ubuntu-latest) (push) Has been cancelled
CI / build (windows-latest) (push) Has been cancelled
CI / unit-test (push) Has been cancelled
CI / bun-test (push) Has been cancelled
CI / adapter-test (push) Has been cancelled
CI / smoke-test (macos-latest) (push) Has been cancelled
CI / smoke-test (ubuntu-latest) (push) Has been cancelled
Security Audit / audit (push) Has been cancelled
Build Chrome Extension / build (push) Has been cancelled
Trigger Website Rebuild (Docs Updated) / dispatch (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:39:48 +08:00

1.7 KiB
Raw Permalink Blame History

schema_version, workflow_id, intent, last_verified, source
schema_version workflow_id intent last_verified source
1.1 read-story read a HN story and its top-level comments 2026-06-02 global

Goal

拿到一条 HN story 的:标题 / URL / score / author / 时间 / top-level comments 列表。

State signature

  • entry: 任意 pagestory id 或 URL 已知
  • success: 拿到 story object + comments array

Best path

  • adapter: opencli hackernews story
  • adapter_health: healthy
  • preconditions: story id 已知
  • estimated_turns: 1

Fallback path

如果 adapter 抛 typed error / 空 result(触发 adapter_health_update: opencli hackernews story -> suspect):

  1. opencli browser open https://news.ycombinator.com/item?id=<id>
  2. action:expand_comment_tree in pages/item.md(如果有折叠)
  3. opencli browser state 拿 DOM
  4. parse story header (tr.athing[id="<id>"]) + comment tree (tr.comtr ids 数组)
  • estimated_turns: 3-4

Avoid

  • 不要从 /news 列表 page 推断 story 内容(列表只有标题 + score,无评论)
  • 不要 scrape 原文 URLtitle link 指向外站,不是 HN 评论)
  • 不要并发 fan-out 全 comment tree 走 item/<kid_id>.json (rate limit 风险;用 adapter 已 throttle)

Re-entry checkpoints

  • 已 open /item?id=DOM ready → step 2 起
  • DOM 拿到但 expand 未做 → step 2 起
  • story + comments 已收集 → 完成

State validation

  • story.title 非空
  • comments array 长度 ≥ 0dead story 可能 0
  • 至少 story.by + story.time 字段存在

Stale markers

  • HN HTML 结构非常稳(10+ 年不大改)
  • Firebase API 是 read-only 公开服务,几乎不漂;endpoint:item 返回 schema 变化是大事件