feat(native): improve anchored chat scrolling and history loading

Add viewport-driven paging with layout acknowledgements, bounded retries, cancellation gates, and epoch-safe history retention.

Preserve transcript anchors and expansion state, fix tool-group identity collisions, and serialize Android history coordination on Main.

Reduce per-scroll composition and layout work; add native regression tests, CI coverage, and profiling guidance.
This commit is contained in:
weishu
2026-09-10 16:22:36 +08:00
parent e2518b6fba
commit c2e3d16b7e
63 changed files with 4010 additions and 453 deletions
@@ -13,8 +13,8 @@ struct ToolCallBlockView: View {
let block: ToolCallBlock
let basePath: String?
@State private var expanded: Bool
@State private var childrenOpen: Bool
@ChatStoredState private var expanded: Bool
@ChatStoredState private var childrenOpen: Bool
@Environment(\.hapiTheme) private var theme
@Environment(\.chatInteractions) private var interactions
@@ -22,8 +22,8 @@ struct ToolCallBlockView: View {
self.block = block
self.basePath = basePath
let pending = block.tool.permission?.status == .pending
_expanded = State(initialValue: pending)
_childrenOpen = State(initialValue: pending)
_expanded = ChatStoredState(wrappedValue: pending, id: block.id, field: "expanded")
_childrenOpen = ChatStoredState(wrappedValue: pending, id: block.id, field: "children")
}
var body: some View {