Merge branch 'worktree-agent-a86b9c8a03da895c2'

This commit is contained in:
2026-11-22 18:24:30 +00:00
9 changed files with 698 additions and 199 deletions
@@ -234,6 +234,12 @@ class _ChatThreadViewState extends State<ChatThreadView> {
ChatShellRunsController(widget.gateway, widget.sessionId)
..addListener(_reportFinishedRuns);
late ChatRowKeys _rowKeys = ChatRowKeys();
// Keeps the rows of unchanged turns across builds; a streamed delta only
// re-derives the live turn.
ChatTranscriptRows _transcriptRows = ChatTranscriptRows();
// The last [_messageIds] and the message list it was read from.
List<JsonMap>? _idsSource;
List<String> _ids = const [];
final _sentEntrances = ChatSentEntrances();
final _rowWidgets = ChatRowWidgets();
@@ -711,6 +717,7 @@ class _ChatThreadViewState extends State<ChatThreadView> {
_controller = _attach();
_composer = _attachComposer();
_rowKeys = ChatRowKeys();
_transcriptRows = ChatTranscriptRows();
_rowWidgets.clear();
_chrome.clear();
_dismissals = ChatNoticeDismissals();
@@ -797,10 +804,21 @@ class _ChatThreadViewState extends State<ChatThreadView> {
/// The ids of the transcript's messages in view order. Cards are conversation
/// state, not messages, so a pending approval does not count as an arrival.
List<String> _messageIds() => [
for (final message in _visibleMessages())
if ('${message['id'] ?? ''}'.trim().isNotEmpty) '${message['id']}'.trim(),
];
///
/// The controller replaces its message list on every change, so the ids are
/// read once per list rather than on every call within a build.
List<String> _messageIds() {
final messages = _visibleMessages();
if (!identical(messages, _idsSource)) {
_idsSource = messages;
_ids = List.unmodifiable([
for (final message in messages)
if ('${message['id'] ?? ''}'.trim().isNotEmpty)
'${message['id']}'.trim(),
]);
}
return _ids;
}
String? _newestMessageId() {
final ids = _messageIds();
@@ -1119,7 +1137,7 @@ class _ChatThreadViewState extends State<ChatThreadView> {
groupSettledQuestions(
groupSettledPermissions(
withChatShownItems(
transcriptRows(
_transcriptRows.rows(
messages,
trailing: cards,
running: