Re-derive only the live turn's transcript rows per streamed delta

ChatTranscriptRows keeps each message run's rows while the run holds the
identical message objects; applyChatEvent and the controller keep untouched
messages' identity. Shown-item filtering, task-notice groups and row-key ids
are held per row object, and the view reads message ids once per list.
Tests check the incremental path equals a full derivation across streaming,
appends, shown items, cards, turn diffs and prepended pages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 18:24:02 +00:00
parent 58c72538d5
commit 9be31b8ba0
9 changed files with 698 additions and 199 deletions
@@ -414,10 +414,7 @@ class ChatThreadController extends ChangeNotifier {
// A frame for a cached message is fresh state the next read must not drop.
final changed = body['message_id'];
if (changed != null) _untouchedCached?.remove(changed);
_messages = (next['messages'] as List? ?? const [])
.whereType<Map>()
.map((message) => Map<String, dynamic>.from(message))
.toList();
_messages = chatMessageList(next['messages']);
_running = next['running'] == true;
if (!_running) {
_liveAssistantMessageId = null;