fn read_session_preview(
filestore: &FileStore,
block_id: &str,
) -> (String, usize)Expand description
Read the per-block output.state.json snapshot from filestore and
extract a (preview, node_count) pair for the AgentPicker’s
“Recent sessions” list.
The snapshot shape is owned by the frontend (see
frontend/app/view/agent/agent-view.tsx::writeSnapshotNow):
{ schemaVersion, savedAt, highWaterMark, historyOffset, nodes: [DocumentNode...] }.
We only touch two fields:
nodes.length→node_count.- The first node with
type === "user_message",messagefield →preview(trimmed, newlines collapsed, max 240 chars).
On any error (snapshot missing, malformed JSON, no user message),
returns ("", 0). Callers treat that the same as “no preview”.