A live, local dashboard for every Claude Code session — across all your projects. The conversation, the line-level diffs, and a reply box to pick up where the agent left off.
This one's real — open the diff, expand the response, or hit Send.
Add cursor-based pagination to the widgets endpoint. Keep the response shape backwards compatible — existing clients shouldn't break.
I'll add optional cursor and limit params and return a next_cursor, leaving items in place so nothing breaks.
export async function listWidgets(req) {- const items = await db.widgets.all()+ const limit = clamp(req.query.limit ?? 20, 1, 100)+ const cursor = req.query.cursor ?? null+ const items = await db.widgets.page({ cursor, limit }) return { items,+ next_cursor: items.at(-1)?.id ?? null, } }
Done. Here's what changed and why it stays backwards compatible:
Query params — limit defaults to 20 and is clamped to 1–100 so a client can't request an unbounded page. cursor is optional; when absent you get the first page exactly as before.
Paging — db.widgets.page() does keyset pagination on the primary key (id > cursor), which is stable under inserts and far cheaper than OFFSET on a large table.
Response — items is untouched, so existing clients keep working. New clients read next_cursor; when it's null they've reached the end.
I left the sort order as id ASC to match the current behaviour. If you page by created_at instead, say the word and I'll switch the keyset column.