Files
pipelines/app/tool/chat_message_probe.dart
T
alan 9e4a925587 feat(app): add native chat transcript message row
Render one transcriptRows row with native controls: role-labelled user and
agent messages, verbatim user text, client and attachment names (own name,
URI basename, else file), ordered agent parts, and collapsed reasoning, tool
and unknown-part bodies using ExpansionTile or a Cupertino disclosure.

Blank known parts draw nothing so they no longer fall through to the
unknown-part disclosure; closed bodies build lazily. Adds focused widget
tests, the fixture probe pair and the C2 evidence note.
2026-10-21 20:44:00 +01:00

83 lines
2.3 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:pipelines_app/features/chat/domain/chat_transcript.dart';
import 'package:pipelines_app/features/chat/ui/transcript/chat_message_view.dart';
const _style = String.fromEnvironment(
'CHAT_MESSAGE_PROBE_STYLE',
defaultValue: 'material',
);
/// Visible fixture for one user row and one folded assistant turn. The unknown
/// part and the tool body start collapsed so the browser probe has to open them.
void main() {
final rows = transcriptRows([
{
'id': 'probe-user',
'role': 'user',
'client': 'Ada phone',
'parts': [
{
'type': 'text',
'text':
'Please keep every word of this prompt, including the trailing '
'detail that wraps onto another line at a narrow width.',
},
{'type': 'file', 'name': 'plan.md', 'uri': '/workspace/plan.md'},
{'type': 'file', 'uri': '/workspace/results/report.csv'},
],
},
{
'id': 'probe-assistant',
'role': 'assistant',
'parts': [
{
'type': 'text',
'text': 'I checked the transcript and kept the original order.',
},
{
'type': 'reasoning',
'text':
'The user asked for exact text, so the raw string stays as sent.',
},
{
'type': 'tool',
'name': 'shell',
'state': {
'status': 'completed',
'input': {'command': 'ls -la'},
},
},
{'type': 'text', 'text': 'Second answer line after the tool call.'},
{
'type': 'future_part',
'payload': {'kept': true, 'count': 2},
},
],
},
]);
final content = ListView(
padding: const EdgeInsets.all(16),
children: [for (final row in rows) ChatMessageView(row: row)],
);
if (_style == 'cupertino') {
runApp(
CupertinoApp(
theme: const CupertinoThemeData(brightness: Brightness.dark),
home: CupertinoPageScaffold(child: SafeArea(child: content)),
),
);
return;
}
runApp(
MaterialApp(
theme: ThemeData(
brightness: Brightness.dark,
platform: TargetPlatform.android,
),
home: Scaffold(body: SafeArea(child: content)),
),
);
}