Render Pipelines-shown files, images, HTML views and phone notifications in the chat transcript

This commit is contained in:
2026-11-09 16:17:34 +00:00
parent 57679d9591
commit 3ab029cd7b
20 changed files with 1585 additions and 15 deletions
@@ -6,6 +6,7 @@ import '../../../core/api_gateway.dart';
import '../data/chat_repository.dart';
import '../domain/chat_account_usage.dart';
import '../domain/chat_sessions.dart';
import '../domain/chat_shown_items.dart';
import '../domain/chat_transcript.dart';
import 'chat_server_queue.dart';
import 'chat_thread_cards.dart';
@@ -65,6 +66,7 @@ class ChatThreadController extends ChangeNotifier {
void Function(JsonMap queue)? onQueue;
List<JsonMap> _messages = const [];
List<JsonMap> _shown = const [];
bool _running = false;
bool _loaded = false;
bool _loading = false;
@@ -108,6 +110,10 @@ class ChatThreadController extends ChangeNotifier {
List<JsonMap> get messages => _messages;
/// What the model showed through the Pipelines tools ([chatShownItemsOf]),
/// as the server retains it, oldest first.
List<JsonMap> get shown => _shown;
/// The prompts the server still holds for this session, in delivery order.
List<JsonMap> get queuedPrompts => _queue.prompts;
@@ -302,6 +308,7 @@ class ChatThreadController extends ChangeNotifier {
_subscribed = true;
_subscriptionError = null;
_applyQueue(reply['chat_queue']);
_applyShown(reply['chat_shown'], replace: true);
} catch (error) {
// History stays usable, but the UI must report that live updates failed.
if (_disposed) return;
@@ -330,8 +337,20 @@ class ChatThreadController extends ChangeNotifier {
_notify();
}
/// Adopts the subscribe reply's retained list, or one pushed item.
void _applyShown(Object? body, {bool replace = false}) {
final items = chatShownItemsOf(body, sessionId);
if (items == null) return;
_shown = mergeChatShownItems(_shown, items, replace: replace);
_notify();
}
void _onFrame(JsonMap envelope) {
if (_disposed) return;
if (envelope['type'] == 'chat_shown') {
_applyShown(envelope['chat_shown']);
return;
}
if (envelope['type'] == 'chat_queue') {
_applyQueue(envelope['chat_queue']);
return;