merge(app): land live Chat destination after retained-deadline recovery

This commit is contained in:
2026-10-21 22:58:45 +01:00
19 changed files with 2365 additions and 48 deletions
+18 -1
View File
@@ -7,6 +7,10 @@ void main() {
expect(AppRoute.parse('/runs'), AppRoute.runs);
expect(AppRoute.parse('/runs/12'), AppRoute.run(12));
expect(AppRoute.parse('/chat'), AppRoute.chat);
expect(
AppRoute.parse('/chat/abc_DEF-123'),
AppRoute.chatSession('abc_DEF-123'),
);
expect(AppRoute.parse('/settings'), AppRoute.settings);
});
@@ -18,6 +22,14 @@ void main() {
AppRoute.run(7),
);
expect(AppRoute.parse('/runs/7/'), AppRoute.run(7));
expect(
AppRoute.parse('/chat/session/?x=1'),
AppRoute.chatSession('session'),
);
expect(
AppRoute.parse('/chat/probe%2Dchat'),
AppRoute.chatSession('probe-chat'),
);
});
test('a malformed or unknown location is the default Pipelines route', () {
@@ -29,7 +41,9 @@ void main() {
'/runs/-1',
'/runs/1/extra',
'/pipelines/2',
'/chat/session',
'/chat/a/b',
'/chat/%2F',
'/chat/${'x' * 201}',
'/unknown',
'/runs/%E0%A4%A',
]) {
@@ -43,10 +57,13 @@ void main() {
AppRoute.runs,
AppRoute.run(3),
AppRoute.chat,
AppRoute.chatSession('probe_open-1'),
AppRoute.settings,
]) {
expect(AppRoute.parse(route.path), route);
}
expect(AppRoute.run(3).path, '/runs/3');
expect(AppRoute.chatSession('probe_open-1').path, '/chat/probe_open-1');
expect(AppRoute.chatSession('bad id').path, '/chat');
});
}
+31
View File
@@ -0,0 +1,31 @@
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/application/app_route.dart';
import 'package:pipelines_app/application/app_router.dart';
AppRouterDelegate delegate(AppRoute initial, {void Function()? onChat}) =>
AppRouterDelegate(
builder: (context, route) => const SizedBox.shrink(),
onPopToRuns: () {},
onPopToChat: onChat ?? () {},
cupertino: false,
initial: initial,
);
void main() {
test('system Back leaves one chat session for the chat list', () async {
var left = 0;
final router = delegate(AppRoute.chatSession('s1'), onChat: () => left++);
addTearDown(router.dispose);
expect(await router.popRoute(), isTrue);
expect(left, 1);
});
test('system Back on a list destination stays with the platform', () async {
final router = delegate(AppRoute.chat);
addTearDown(router.dispose);
expect(await router.popRoute(), isFalse);
});
}
@@ -0,0 +1,113 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/application/app_session.dart';
import 'package:pipelines_app/application/chat_destination.dart';
import 'package:pipelines_app/core/transport/pipelines_client.dart';
import 'package:pipelines_app/features/chat/conversation/chat_thread_view.dart';
import '../core/transport/pipelines_client_test.dart' show FakeChannel;
import 'chat_registration_test.dart'
show
replyHistory,
replySessions,
replySubscribe,
requestOf,
waitForRequest,
webServer;
Widget host(AppSession session, {String? initialSessionId}) => MaterialApp(
home: Scaffold(
body: ChatDestination(
session: session,
server: webServer(),
initialSessionId: initialSessionId,
),
),
);
void main() {
testWidgets('nothing is requested before the shared socket is ready', (
tester,
) async {
final channel = FakeChannel();
final client = PipelinesClient(channelFactory: (_) => channel);
final server = webServer();
final session = AppSession(endpoint: server.uri, client: client);
addTearDown(session.dispose);
final starting = session.start();
await tester.pumpWidget(host(session, initialSessionId: 's1'));
expect(find.text('Connecting to Pipelines…'), findsOneWidget);
expect(find.byType(ChatThreadView), findsNothing);
expect(channel.outgoing, isEmpty);
channel.readyCompleter.complete();
await starting;
});
testWidgets('a reconnect resyncs the open session without losing it', (
tester,
) async {
final first = FakeChannel()..readyCompleter.complete();
final second = FakeChannel()..readyCompleter.complete();
var sockets = 0;
final client = PipelinesClient(
channelFactory: (_) => sockets++ == 0 ? first : second,
backoffBase: const Duration(milliseconds: 10),
);
final server = webServer();
final session = AppSession(endpoint: server.uri, client: client);
addTearDown(session.dispose);
await session.start();
await tester.pumpWidget(host(session, initialSessionId: 's1'));
await tester.pump();
await replySessions(tester, first);
await replySubscribe(tester, first);
await replyHistory(tester, first);
expect(find.text('The stored reply stays readable.'), findsOneWidget);
first.incoming.addError(StateError('network drop'));
await tester.pump();
expect(find.byType(ChatThreadView), findsOneWidget);
expect(find.text('The stored reply stays readable.'), findsOneWidget);
// The mounted session list re-reads on reconnect: a session created while
// the socket was gone must not stay invisible until Refresh. Requests are
// serialized, so this reply also lets the thread's resync proceed.
final relisted = await waitForRequest(tester, second, 'chat_sessions');
second.incoming.add(
jsonEncode({
'id': relisted['id'],
'type': 'chat_sessions',
'chat_sessions': [
{'id': 's1', 'title': 'Wire chat'},
{'id': 's2', 'title': 'Created while offline'},
],
}),
);
await tester.pump();
final resubscribe = await waitForRequest(tester, second, 'chat_subscribe');
second.incoming.add(
jsonEncode({'id': resubscribe['id'], 'type': 'chat_subscribe'}),
);
await tester.pump();
await replyHistory(tester, second, text: 'Refreshed after reconnect.');
expect(find.byType(ChatThreadView), findsOneWidget);
expect(find.text('Refreshed after reconnect.'), findsOneWidget);
expect(find.text('The stored reply stays readable.'), findsNothing);
expect(requestOf(second, 'chat_messages')!['chat_query'], {
'session_id': 's1',
'limit': 200,
'cursor': '',
});
expect(
find.text('Created while offline', skipOffstage: false),
findsOneWidget,
);
});
}
@@ -0,0 +1,235 @@
import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/application/pipelines_app.dart';
import 'package:pipelines_app/application/server_endpoint.dart';
import 'package:pipelines_app/core/transport/pipelines_client.dart';
import 'package:pipelines_app/features/chat/conversation/chat_thread_view.dart';
import 'package:pipelines_app/features/chat/ui/sessions/chat_sessions_screen.dart';
import '../core/transport/pipelines_client_test.dart' show FakeChannel;
ServerEndpoint webServer() => ServerEndpoint.resolve(
base: Uri.parse('http://127.0.0.1:8096/'),
web: true,
);
Map<String, dynamic>? requestOf(
FakeChannel channel,
String type, {
int index = 0,
}) => channel.outgoing
.map((frame) => jsonDecode(frame as String) as Map<String, dynamic>)
.where((frame) => frame['type'] == type)
.skip(index)
.firstOrNull;
Future<Map<String, dynamic>> waitForRequest(
WidgetTester tester,
FakeChannel channel,
String type, {
int index = 0,
}) async {
for (var attempt = 0; attempt < 80; attempt++) {
final request = requestOf(channel, type, index: index);
if (request != null) return request;
await tester.pump(const Duration(milliseconds: 5));
}
fail('Timed out waiting for $type #$index');
}
Future<void> replySessions(
WidgetTester tester,
FakeChannel channel, {
int index = 0,
}) async {
final request = await waitForRequest(
tester,
channel,
'chat_sessions',
index: index,
);
channel.incoming.add(
jsonEncode({
'id': request['id'],
'type': 'chat_sessions',
'chat_sessions': [
{'id': 's1', 'title': 'Wire chat', 'directory': '/workspace/demo'},
],
}),
);
await tester.pump();
}
Future<void> replySubscribe(
WidgetTester tester,
FakeChannel channel, {
int index = 0,
}) async {
final request = await waitForRequest(
tester,
channel,
'chat_subscribe',
index: index,
);
channel.incoming.add(
jsonEncode({'id': request['id'], 'type': 'chat_subscribe'}),
);
await tester.pump();
await tester.pump();
}
Future<void> replyHistory(
WidgetTester tester,
FakeChannel channel, {
int index = 0,
String text = 'The stored reply stays readable.',
}) async {
final request = await waitForRequest(
tester,
channel,
'chat_messages',
index: index,
);
channel.incoming.add(
jsonEncode({
'id': request['id'],
'type': 'chat_history',
'chat_history': {
'messages': [
{
'id': 'u1',
'role': 'user',
'parts': [
{'type': 'text', 'text': 'Open this chat from its route.'},
],
},
{
'id': 'a1',
'role': 'assistant',
'parts': [
{'type': 'text', 'text': text},
{'type': 'reasoning', 'text': 'Kept behind a native disclosure.'},
{'type': 'tool', 'name': 'shell'},
],
},
],
'next_cursor': '',
'has_more': false,
},
}),
);
await tester.pump();
await tester.pump();
}
void main() {
for (final cupertino in [false, true]) {
testWidgets(
'a /chat/s1 deep link renders that thread and Back returns to /chat ($cupertino)',
(tester) async {
tester.view.physicalSize = const Size(900, 900);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
if (cupertino) {
tester.platformDispatcher.platformBrightnessTestValue =
Brightness.dark;
addTearDown(
tester.platformDispatcher.clearPlatformBrightnessTestValue,
);
}
final channel = FakeChannel()..readyCompleter.complete();
final client = PipelinesClient(channelFactory: (_) => channel);
final provider = PlatformRouteInformationProvider(
initialRouteInformation: RouteInformation(uri: Uri.parse('/chat/s1')),
);
addTearDown(provider.dispose);
await tester.pumpWidget(
PipelinesApp(
server: webServer(),
client: client,
cupertino: cupertino,
routeInformationProvider: provider,
),
);
await tester.pump();
await replySessions(tester, channel);
await replySubscribe(tester, channel);
await replyHistory(tester, channel);
expect(provider.value.uri.path, '/chat/s1');
expect(find.byType(ChatThreadView), findsOneWidget);
// The exact route names the session; the request carries the same id.
expect(requestOf(channel, 'chat_subscribe')!['chat_subscribe'], {
'session_id': 's1',
});
expect(requestOf(channel, 'chat_messages')!['chat_query'], {
'session_id': 's1',
'limit': 200,
'cursor': '',
});
expect(find.text('The stored reply stays readable.'), findsOneWidget);
expect(find.text('Reasoning'), findsOneWidget);
expect(find.text('shell'), findsOneWidget);
expect(find.text('Kept behind a native disclosure.'), findsNothing);
// One shell bar only: the embedded list/thread adds no second one.
if (cupertino) {
expect(find.byType(CupertinoNavigationBar), findsOneWidget);
expect(find.byType(AppBar), findsNothing);
} else {
expect(find.byType(AppBar), findsOneWidget);
expect(find.byType(CupertinoNavigationBar), findsNothing);
}
// A live frame updates the held thread.
channel.incoming.add(
jsonEncode({
'type': 'chat_event',
'chat_event': {
'session_id': 's1',
'message_id': 'a1',
'kind': 'text',
'part': {'id': 'p2', 'type': 'text'},
'delta': 'A live line arrived.',
},
}),
);
await tester.pump();
await tester.pump();
expect(find.text('A live line arrived.'), findsOneWidget);
await tester.tap(find.text(cupertino ? 'Back' : 'Back to chats'));
await tester.pump();
expect(provider.value.uri.path, '/chat');
expect(find.byType(ChatThreadView), findsNothing);
expect(find.byType(ChatSessionsScreen), findsOneWidget);
expect(find.text('Wire chat'), findsOneWidget);
// Browser Forward re-opens the same session through its route.
await provider.didPushRouteInformation(
RouteInformation(uri: Uri.parse('/chat/s1')),
);
await tester.pump();
expect(provider.value.uri.path, '/chat/s1');
await replySubscribe(tester, channel, index: 1);
await replyHistory(
tester,
channel,
index: 1,
text: 'Reopened from the route.',
);
expect(find.text('Reopened from the route.'), findsOneWidget);
await tester.pumpWidget(const SizedBox.shrink());
await tester.pump();
},
);
}
}
@@ -0,0 +1,101 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/chat/conversation/chat_row_keys.dart';
import 'package:pipelines_app/features/chat/domain/chat_transcript.dart';
import 'chat_thread_fixtures.dart';
JsonMap _assistant(String id) => chatMessage(
id,
'assistant',
parts: [
{'type': 'reasoning', 'id': 'r-$id', 'text': 'reasoning $id'},
{'type': 'text', 'id': 't-$id', 'text': 'answer $id'},
],
);
JsonMap _user(String id) => chatMessage(
id,
'user',
parts: [
{'type': 'text', 'text': 'question $id'},
],
);
void main() {
test('an older page prepended into a folded turn keeps its key', () {
final keys = ChatRowKeys();
final newest = keys.forRows(
transcriptRows([_assistant('msg_6'), _assistant('msg_4')]),
);
final paged = keys.forRows(
transcriptRows([
_assistant('msg_2'),
_assistant('msg_0'),
_assistant('msg_6'),
_assistant('msg_4'),
]),
);
expect(newest, hasLength(1));
expect(paged, hasLength(1));
expect(paged.single, newest.single);
});
test('a live assistant message appended to a folded turn keeps its key', () {
final keys = ChatRowKeys();
final newest = keys.forRows(transcriptRows([_assistant('msg_6')]));
final streamed = keys.forRows(
transcriptRows([_assistant('msg_6'), _assistant('msg_live')]),
);
expect(streamed.single, newest.single);
});
test('user rows keep their key and folded turns stay distinct', () {
final keys = ChatRowKeys();
final first = keys.forRows(
transcriptRows([
_user('u1'),
_assistant('a1'),
_user('u2'),
_assistant('a2'),
]),
);
final paged = keys.forRows(
transcriptRows([
_user('u0'),
_assistant('a0'),
_user('u1'),
_assistant('a1'),
_user('u2'),
_assistant('a2'),
]),
);
expect(first.toSet(), hasLength(4));
expect(paged.toSet(), hasLength(6));
expect(paged.sublist(2), first);
});
test('an id-less prepended turn never collides with a held key', () {
final keys = ChatRowKeys();
keys.forRows(transcriptRows([_assistant('a1')]));
final paged = keys.forRows(
transcriptRows([
// No id: only a positional fallback is possible.
chatMessage(
'',
'assistant',
parts: [
{'type': 'text', 'text': 'anonymous older answer'},
],
),
_user('u1'),
_assistant('a1'),
]),
);
expect(paged.toSet(), hasLength(paged.length));
});
}
@@ -0,0 +1,368 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/chat/conversation/chat_thread_view.dart';
import 'chat_thread_fixtures.dart';
Widget host(Widget child) => MaterialApp(
theme: ThemeData(platform: TargetPlatform.android),
home: Scaffold(body: child),
);
Widget cupertinoHost(Widget child) => CupertinoApp(
theme: const CupertinoThemeData(brightness: Brightness.dark),
home: CupertinoPageScaffold(child: child),
);
void main() {
testWidgets('live-subscription refusal is separate from readable history', (
tester,
) async {
final gateway = FakeChatGateway();
addTearDown(gateway.close);
gateway.subscribe = () async => throw StateError('live watch refused');
gateway.history = (_) async => chatPage([
chatMessage(
'u1',
'user',
parts: [
{'type': 'text', 'text': 'History still renders.'},
],
),
]);
await tester.pumpWidget(
host(ChatThreadView(gateway: gateway, sessionId: 's', onBack: () {})),
);
await tester.pumpAndSettle();
expect(find.text('History still renders.'), findsOneWidget);
expect(find.byKey(const Key('chat-live-error')), findsOneWidget);
expect(find.textContaining('Live updates unavailable'), findsOneWidget);
expect(find.textContaining('live watch refused'), findsOneWidget);
expect(find.byKey(const Key('chat-history-error')), findsNothing);
// A later resync that attaches clears only the live notice.
gateway.subscribe = () async => const {};
gateway.history = (_) async => chatPage([
chatMessage(
'u1',
'user',
parts: [
{'type': 'text', 'text': 'History still renders.'},
],
),
]);
var attempts = 0;
for (
var i = 0;
i < 80 && find.byKey(const Key('chat-live-error')).evaluate().isNotEmpty;
i++
) {
if (attempts == 0) {
await tester.tap(find.text('Retry').last);
attempts++;
}
await tester.pump(const Duration(milliseconds: 5));
}
expect(find.byKey(const Key('chat-live-error')), findsNothing);
});
testWidgets('Load older passes the server cursor back and shows older text', (
tester,
) async {
final gateway = FakeChatGateway();
addTearDown(gateway.close);
gateway.history = (_) async => chatPage(
[
chatMessage(
'a2',
'assistant',
parts: [
{'type': 'text', 'text': 'Newest reply.'},
],
),
],
cursor: 'opaque/next?x=1',
hasMore: true,
);
await tester.pumpWidget(
host(ChatThreadView(gateway: gateway, sessionId: 's', onBack: () {})),
);
await tester.pumpAndSettle();
expect(find.text('Newest reply.'), findsOneWidget);
expect(find.text('Load older'), findsOneWidget);
final older = Completer<JsonMap>();
gateway.history = (_) => older.future;
await tester.tap(find.text('Load older'));
await tester.pump();
expect(gateway.calls.last.fields['chat_query'], {
'session_id': 's',
'limit': 200,
'cursor': 'opaque/next?x=1',
});
older.complete(
chatPage(
[
chatMessage(
'a1',
'assistant',
parts: [
{'type': 'text', 'text': 'Older stored reply.'},
],
),
],
cursor: '',
hasMore: false,
),
);
await tester.pumpAndSettle();
expect(find.text('Older stored reply.'), findsOneWidget);
expect(find.text('Newest reply.'), findsOneWidget);
expect(find.text('Load older'), findsNothing);
});
// Paging prepends messages, so an unkeyed transcript would reuse the element
// at a message's old index: the operator's open reasoning would move to the
// previous answer, or be dropped when `Load older` disappears.
for (final cupertino in [false, true]) {
testWidgets(
'an open reasoning block stays on its answer while has_more remains '
'($cupertino)',
(tester) async {
final gateway = FakeChatGateway();
addTearDown(gateway.close);
var reads = 0;
gateway.history = (_) async => ++reads == 1
? pagedChatPage(
'a2',
'NEWEST reasoning body that belongs to the newest answer.',
cursor: 'opaque/older',
hasMore: true,
)
: pagedChatPage(
'a1',
'OLDER reasoning body that must not steal the newest disclosure.',
cursor: 'opaque/older-2',
hasMore: true,
);
await tester.pumpWidget(
(cupertino ? cupertinoHost : host)(
ChatThreadView(gateway: gateway, sessionId: 's', onBack: () {}),
),
);
await tester.pumpAndSettle();
await tester.tap(find.text('Reasoning'));
await tester.pumpAndSettle();
expect(
find.text('NEWEST reasoning body that belongs to the newest answer.'),
findsOneWidget,
);
await tester.tap(find.text('Load older'));
await tester.pumpAndSettle();
// Both answers are present; only the one the operator opened is open.
expect(find.text('Reasoning'), findsNWidgets(2));
expect(find.text('Load older'), findsOneWidget);
expect(
find.text('NEWEST reasoning body that belongs to the newest answer.'),
findsOneWidget,
);
expect(
find.text(
'OLDER reasoning body that must not steal the newest disclosure.',
),
findsNothing,
);
},
);
testWidgets(
'an open reasoning block survives the removal of Load older ($cupertino)',
(tester) async {
final gateway = FakeChatGateway();
addTearDown(gateway.close);
var reads = 0;
gateway.history = (_) async => ++reads == 1
? pagedChatPage(
'a2',
'NEWEST reasoning body that belongs to the newest answer.',
cursor: 'opaque/older',
hasMore: true,
)
: pagedChatPage(
'a1',
'OLDER reasoning body that must not steal the newest disclosure.',
cursor: '',
hasMore: false,
);
await tester.pumpWidget(
(cupertino ? cupertinoHost : host)(
ChatThreadView(gateway: gateway, sessionId: 's', onBack: () {}),
),
);
await tester.pumpAndSettle();
await tester.tap(find.text('Reasoning'));
await tester.pumpAndSettle();
expect(
find.text('NEWEST reasoning body that belongs to the newest answer.'),
findsOneWidget,
);
await tester.tap(find.text('Load older'));
await tester.pumpAndSettle();
expect(find.text('Reasoning'), findsNWidgets(2));
expect(find.text('Load older'), findsNothing);
expect(
find.text('NEWEST reasoning body that belongs to the newest answer.'),
findsOneWidget,
);
expect(
find.text(
'OLDER reasoning body that must not steal the newest disclosure.',
),
findsNothing,
);
},
);
}
// The repository's own paged-history fixture pages consecutive assistant
// messages, so an older page can prepend into the one folded turn. Its first
// message id changes; the row must still be the same element and keep the
// operator's open disclosure.
for (final cupertino in [false, true]) {
for (final keepsControl in [true, false]) {
testWidgets(
'an open reasoning block in a folded assistant turn survives paging '
'(keeps Load older: $keepsControl, $cupertino)',
(tester) async {
final gateway = FakeChatGateway();
addTearDown(gateway.close);
var reads = 0;
gateway.history = (_) async => ++reads == 1
? assistantFoldPage(
const ['msg_6', 'msg_4'],
const [
'NEWEST folded reasoning body.',
'FOURTH folded reasoning body.',
],
cursor: 'opaque/fold',
hasMore: true,
)
: assistantFoldPage(
const ['msg_2', 'msg_0'],
const [
'SECOND folded reasoning body.',
'OLDEST folded reasoning body.',
],
cursor: keepsControl ? 'opaque/fold-2' : '',
hasMore: keepsControl,
);
await tester.pumpWidget(
(cupertino ? cupertinoHost : host)(
ChatThreadView(gateway: gateway, sessionId: 's', onBack: () {}),
),
);
await tester.pumpAndSettle();
// Before paging the turn holds two messages, so two disclosures.
expect(find.text('Reasoning'), findsNWidgets(2));
await tester.tap(find.text('Reasoning').first);
await tester.pumpAndSettle();
expect(find.text('NEWEST folded reasoning body.'), findsOneWidget);
await tester.tap(find.text('Load older'));
await tester.pumpAndSettle();
// All four assistant messages now fold into the same turn. The
// newest block stays open; no older block may open.
expect(find.text('Reasoning'), findsNWidgets(4));
expect(find.text('NEWEST folded reasoning body.'), findsOneWidget);
expect(find.text('FOURTH folded reasoning body.'), findsNothing);
expect(find.text('SECOND folded reasoning body.'), findsNothing);
expect(find.text('OLDEST folded reasoning body.'), findsNothing);
expect(
find.text('Load older'),
keepsControl ? findsOneWidget : findsNothing,
);
},
);
}
}
}
/// The paged-history fixture shape: a page of consecutive assistant messages,
/// each with its own reasoning and text part.
JsonMap assistantFoldPage(
List<String> ids,
List<String> reasoning, {
required String cursor,
required bool hasMore,
}) => chatPage(
[
for (var index = 0; index < ids.length; index++)
chatMessage(
ids[index],
'assistant',
parts: [
{
'type': 'reasoning',
'id': 'r-${ids[index]}',
'text': reasoning[index],
},
{
'type': 'text',
'id': 't-${ids[index]}',
'text': 'Answer stored as ${ids[index]}.',
},
],
),
],
cursor: cursor,
hasMore: hasMore,
);
/// A newest page with one user prompt and one answer carrying [reasoning].
JsonMap pagedChatPage(
String answerId,
String reasoning, {
required String cursor,
required bool hasMore,
}) => chatPage(
[
chatMessage(
'u-$answerId',
'user',
parts: [
{'type': 'text', 'text': 'A question for $answerId.'},
],
),
chatMessage(
answerId,
'assistant',
parts: [
{'type': 'reasoning', 'text': reasoning},
{'type': 'text', 'text': 'The answer stored as $answerId.'},
],
),
],
cursor: cursor,
hasMore: hasMore,
);