feat(app): chat turns show reasoning above the answer and tool calls as one chip with a formatted call sheet, as the web

This commit is contained in:
2026-10-23 15:52:51 +01:00
parent c2f1a4cb94
commit 522729ad57
7 changed files with 516 additions and 48 deletions
@@ -124,14 +124,16 @@ void main() {
expect(find.textContaining('"payload": 7'), findsNothing);
expect(find.text('plain future text'), findsOneWidget);
// As the web: reasoning is a quiet line above the answer, the answer
// keeps its own order in the bubble, and the tool calls are one chip below.
double top(String text) => tester.getTopLeft(find.text(text)).dy;
expect(top('First answer'), lessThan(top('Reasoning')));
expect(top('Reasoning'), lessThan(top('shell')));
expect(top('shell'), lessThan(top('Second answer')));
expect(top('Reasoning'), lessThan(top('First answer')));
expect(top('First answer'), lessThan(top('Second answer')));
expect(
top('Second answer'),
lessThan(top('Unrecognised part: future_part')),
);
expect(top('Unrecognised part: future_part'), lessThan(top('1 tool')));
await tester.ensureVisible(find.text('Reasoning'));
await tester.pumpAndSettle();
@@ -139,11 +141,16 @@ void main() {
await tester.pumpAndSettle();
expect(find.text('private reasoning'), findsOneWidget);
await tester.ensureVisible(find.text('shell'));
// The chip opens the calls; a call opens to its formatted input.
await tester.ensureVisible(find.text('1 tool'));
await tester.tap(find.text('1 tool'));
await tester.pumpAndSettle();
await tester.tap(find.text('shell'));
await tester.tap(find.text('shell · ls'));
await tester.pumpAndSettle();
expect(find.text('INPUT'), findsOneWidget);
expect(find.textContaining('"command": "ls"'), findsOneWidget);
await tester.tapAt(const Offset(10, 10));
await tester.pumpAndSettle();
await tester.ensureVisible(find.text('Unrecognised part: future_part'));
await tester.pumpAndSettle();
@@ -247,9 +254,12 @@ void main() {
await tester.pumpAndSettle();
expect(find.text('thought'), findsOneWidget);
await tester.tap(find.text('read'));
await tester.tap(find.text('1 tool'));
await tester.pumpAndSettle();
expect(find.textContaining('"status": "error"'), findsOneWidget);
await tester.tap(find.text('read · failed'));
await tester.pumpAndSettle();
expect(find.text('ERROR'), findsOneWidget);
expect(find.text('(no output)'), findsOneWidget);
});
testWidgets('Cupertino disclosure announces its expanded state', (