@flue/react: expose bounded history (limit, before, loadOlder) in useFlueAgent
Problem
@flue/sdk 2.2.0 added bounded history reads (54cabb7): observe({ limit }), the before cursor on the observed state, and historyBefore(cursor, { limit }). @flue/react does not expose them. AgentSession.start() calls this.client.observe({ live }) with no limit, UseFlueAgentOptions has no limit option, and the public snapshot does not include before.
A React chat UI that uses useFlueAgent therefore downloads the whole conversation on each mount and each reconnect. To load only the newest messages, it must wrap the client to add limit, and hold the older pages outside the hook.
Requested API
- A
limitoption onuseFlueAgent, passed toobserve(). beforeon the hook's return value.- A
loadOlder({ limit })action that callshistoryBefore, prepends the page tomessages, and drops the loaded pages whenbeforechanges (a re-base). loadingOlder, andhasOlder(before !== null).
The hook already reconciles optimistic and canonical user messages in converge. If the hook holds the older pages, one message list keeps stable ids and keys, so each caller does not need its own merge.
Related: #339 (closed, older API).
Source: withastro/flue