readSummary method
User-code tree — the agent's reading surface. The full tree is also read to extract overlay/dialog content, appended to the summary root so Scene.findByGlintId can address those nodes too.
Implementation
Future<Scene> readSummary() async {
await _ensurePubRoots();
final groupName = _inspector.nextReadGroup();
final root = await _inspector.readSummaryTree(groupName: groupName);
final degenerate = isDegenerateTree(root);
if (root.children.isNotEmpty) onDrawnTree?.call();
// Mark offstage IndexedStack children BEFORE id assignment so stable-id
// generation skips them and firstAddressableId()/hoistPage are unaffected.
await _markOffstageSubtrees(root, groupName);
// Before id assignment so overlay nodes get stable ids in the same pass.
final overlay = await _tryReadOverlay(root);
StableIdGenerator().assignIds(root);
_rememberLocations(root);
return Scene._(
root: root,
groupName: groupName,
inspector: _inspector,
knownLocations: _seenLocations,
overlayRoots: overlay?.contentRoots ?? const [],
hasBarrierOverlay: overlay?.hasBarrier ?? false,
topBarrier: overlay?.topBarrier,
fullGroupName: overlay?.groupName,
degenerate: degenerate,
);
}