List system views through thread list

Merged
CO
3d ago
+1310-20

What changed

HEY's Sent, Spam, Trash and Everything views had no listing in the CLI, so this adds one read-only command:

  • hey thread list --in sent
  • hey thread list --in spam
  • hey thread list --in trash
  • hey thread list --in everything

It supports --limit, opaque --page, --all, and the standard listing output flags. Every JSON row carries topic_id explicitly. Both id and topic_id are thread IDs for hey thread read and hey restore, not box item IDs for organization actions. Styled and Markdown output sanitize server-provided titles, subjects and sender names.

Pages come from the SDK's typed reads in hey-sdk v0.37.0: Topics().GetSpamPage, GetTrashPage, GetEverythingPage and GetSentPage. They keep the next-page cursor and, for every view but Sent, X-Total-Count. The bump to v0.37.0 brings the MCP model snapshot and the Nix vendor hash with it.

HEY builds a Sent page by taking a page of thread ids and only then dropping threads that aren't active, so a Sent page can come back short or empty with more after it. --all and --limit read past an empty Sent page while its cursor is new, up to the 100-page cap; every other view, and every other listing in the CLI, still ends at an empty page. Sent carries no total_count, since HEY counts none for it.

Validation

  • make check passes.
  • Against the latest haystack in dev, through the smoke harness, where Sent's first page is empty: --all reads all 67 Sent threads and --limit 1 reads past the empty page.
  • Also through the smoke harness: TestThreadListSystemViews and TestThreadListPage pass. Walking every page with no topic repeated, Sent gives 67 threads, Spam 3 of 3 and Trash 135 of 135.
  • Everything gives 365 of the 389 haystack counts. The rest are topics with no active_at, which haystack's Everything paging never serves, though its count includes them. --all says so in its notice: "Showing 365 of 389 results; HEY returned no additional page cursor."