Background
The recent /v1/files synthesis (#PR) folds R2 session-outputs entries into the listing when `scope_id` is set. Pagination is currently best-effort:
- `before_id` / `after_id` cursors only honor the D1 portion
- R2 `list({prefix, limit: 1000})` caps at 1000; we set `hasMore = true` on hit
- Caller paginating past 1000 R2 outputs would get nothing more
Work
- Design a unified cursor that encodes a position across both sets — e.g. `<d1_id>|<r2_continuation_token>`
- Honor it on subsequent LIST calls (deserialize, advance D1 + R2 in lockstep)
- Or: switch to a sort-merge over `(created_at, id)` ordering, materialize R2 entries' created_at into the cursor
Why deferred from #PR
No real-world session today exceeds 1000 output files per scope; classic premature complexity. Open this when the cap actually becomes load-bearing.
References
`apps/main/src/routes/files.ts` — `listSessionOutputAsFiles` + the LIST handler
Background
The recent /v1/files synthesis (#PR) folds R2 session-outputs entries into the listing when `scope_id` is set. Pagination is currently best-effort:
Work
Why deferred from #PR
No real-world session today exceeds 1000 output files per scope; classic premature complexity. Open this when the cap actually becomes load-bearing.
References
`apps/main/src/routes/files.ts` — `listSessionOutputAsFiles` + the LIST handler