Show dismissed commands as an answer footer chip; move Copy to the left gutter
Dismissed shell runs leave the transcript and fold into a "N commands" chip in the footer of the first answer at or after each run (the last answer for newer runs, or a row of its own without any answer). The chip opens the turn sheet (wide) or a full-screen page (narrow) listing the commands; each opens its output read-only with Copy output, Send to agent and Restore. On a wide conversation the answer's Copy button moves out of the footer into a 48 px gutter left of the reading column (chatCopyGutter), shown on hover or focus on desktops and always on touch; narrow widths keep it in the footer.
This commit is contained in:
@@ -10,6 +10,7 @@ import 'chat_attachment_gallery.dart';
|
||||
import '../../domain/chat_tool_calls.dart';
|
||||
import '../../domain/chat_transcript.dart';
|
||||
import 'chat_copy_button.dart';
|
||||
import 'chat_copy_gutter.dart';
|
||||
import 'chat_link_text.dart';
|
||||
import 'chat_message_bubble.dart';
|
||||
import 'chat_turn_activity_view.dart';
|
||||
@@ -49,6 +50,9 @@ class ChatMessageView extends StatelessWidget {
|
||||
final role = user ? 'User' : 'Assistant';
|
||||
final cupertino = _isCupertino(context);
|
||||
final content = user ? _userParts(context) : _agentParts(context);
|
||||
// A wide window draws an answer's Copy in the gutter left of the reading
|
||||
// column; without room it stays at the start of the answer's footer.
|
||||
final gutter = user ? 0.0 : ChatCopyGutter.of(context);
|
||||
// No visible role label: side and surface say who spoke and the row's
|
||||
// semantics label names the role. The operator's turn is a neutral bubble
|
||||
// that shrinks to its content; the agent's answer sits on the page with no
|
||||
@@ -79,14 +83,15 @@ class ChatMessageView extends StatelessWidget {
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: user
|
||||
? (constraints.maxWidth * 0.85).clamp(0, 560).toDouble()
|
||||
: 720,
|
||||
: 720 + gutter,
|
||||
),
|
||||
child: user
|
||||
? _userTurn(cupertino, content, body)
|
||||
: _agentTurn(
|
||||
: _agentRow(
|
||||
context,
|
||||
content,
|
||||
ChatAgentSurface(cupertino: cupertino, child: body),
|
||||
gutter,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -174,9 +179,34 @@ class ChatMessageView extends StatelessWidget {
|
||||
return widgets;
|
||||
}
|
||||
|
||||
/// The answer, with its Copy button in the [gutter] to its left when there
|
||||
/// is one, or else first in its footer.
|
||||
Widget _agentRow(
|
||||
BuildContext context,
|
||||
List<Widget> content,
|
||||
Widget answer,
|
||||
double gutter,
|
||||
) {
|
||||
final copyText = row['streaming'] == true ? '' : _answerText(_partsOf(row));
|
||||
final copy = copyText.isEmpty
|
||||
? null
|
||||
: ChatCopyButton(text: copyText, cupertino: _isCupertino(context));
|
||||
if (gutter <= 0) return _agentTurn(context, content, answer, copy);
|
||||
return ChatCopyGutterRow(
|
||||
width: gutter,
|
||||
copy: copy,
|
||||
child: _agentTurn(context, content, answer, null),
|
||||
);
|
||||
}
|
||||
|
||||
/// Stable activity precedes the answer; permission summaries and recorded
|
||||
/// model remain beneath it. Pending interaction cards are rendered separately.
|
||||
Widget _agentTurn(BuildContext context, List<Widget> content, Widget answer) {
|
||||
Widget _agentTurn(
|
||||
BuildContext context,
|
||||
List<Widget> content,
|
||||
Widget answer,
|
||||
Widget? copy,
|
||||
) {
|
||||
final parts = _partsOf(row);
|
||||
final reasoning = [
|
||||
for (final part in parts)
|
||||
@@ -189,10 +219,8 @@ class ChatMessageView extends StatelessWidget {
|
||||
if (isChatToolPart(part)) part,
|
||||
];
|
||||
final model = '${row['model'] ?? ''}'.trim();
|
||||
final copyText = row['streaming'] == true ? '' : _answerText(parts);
|
||||
final footer = <Widget>[
|
||||
if (copyText.isNotEmpty)
|
||||
ChatCopyButton(text: copyText, cupertino: _isCupertino(context)),
|
||||
?copy,
|
||||
...this.footer,
|
||||
if (model.isNotEmpty)
|
||||
Text(
|
||||
|
||||
Reference in New Issue
Block a user