App: dark-aware HTML views, run cards, changed/missing file notes, one card width, dense diff rows
show_html documents that declare dark support follow the app theme; others stay light. Tool description and skill docs say so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
/// Opens a run's detail from inside a chat (a `show_run` card). The app shell
|
||||
/// provides it above every chat surface; without one a run card is not
|
||||
/// activatable.
|
||||
class ChatRunOpener extends InheritedWidget {
|
||||
const ChatRunOpener({super.key, required this.openRun, required super.child});
|
||||
|
||||
final ValueChanged<int> openRun;
|
||||
|
||||
static ValueChanged<int>? maybeOf(BuildContext context) =>
|
||||
context.dependOnInheritedWidgetOfExactType<ChatRunOpener>()?.openRun;
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(ChatRunOpener oldWidget) =>
|
||||
openRun != oldWidget.openRun;
|
||||
}
|
||||
@@ -12,6 +12,8 @@ class ChatShownDiff {
|
||||
required this.base,
|
||||
required this.baseCommit,
|
||||
required this.head,
|
||||
this.headRevision = '',
|
||||
this.paths = const [],
|
||||
required this.committedOnly,
|
||||
required this.files,
|
||||
required this.additions,
|
||||
@@ -29,6 +31,12 @@ class ChatShownDiff {
|
||||
base: _text(body['base']),
|
||||
baseCommit: _text(body['base_commit']),
|
||||
head: _text(body['head']),
|
||||
headRevision: _text(body['head_revision']),
|
||||
paths: [
|
||||
if (body['paths'] case final List paths)
|
||||
for (final path in paths)
|
||||
if (_text(path).isNotEmpty) _text(path),
|
||||
],
|
||||
committedOnly: body['committed_only'] == true,
|
||||
files: _count(body['files']),
|
||||
additions: _count(body['additions']),
|
||||
@@ -43,6 +51,13 @@ class ChatShownDiff {
|
||||
final String base;
|
||||
final String baseCommit;
|
||||
final String head;
|
||||
|
||||
/// The revision compared instead of the work tree (`show_diff` head), or
|
||||
/// empty.
|
||||
final String headRevision;
|
||||
|
||||
/// The paths or globs the comparison is limited to; empty for all.
|
||||
final List<String> paths;
|
||||
final bool committedOnly;
|
||||
final int files;
|
||||
final int additions;
|
||||
@@ -57,14 +72,25 @@ class ChatShownDiff {
|
||||
return parts.isEmpty ? repo : parts.last;
|
||||
}
|
||||
|
||||
/// What was compared, in words: the branch against its base and whether
|
||||
/// uncommitted work is included.
|
||||
/// What was compared, in words: the branch (or the given revision) against
|
||||
/// its base, whether uncommitted work is included, and the paths it is
|
||||
/// limited to.
|
||||
String get comparison {
|
||||
final limited = paths.isEmpty
|
||||
? ''
|
||||
: ' · ${paths.length <= 3 ? paths.join(', ') : '${paths.take(3).join(', ')} +${paths.length - 3}'}';
|
||||
return '${_compared()}$limited';
|
||||
}
|
||||
|
||||
String _compared() {
|
||||
final where = repoName.isEmpty ? '' : '$repoName · ';
|
||||
if (headRevision.isNotEmpty) {
|
||||
return '$where$headRevision vs ${base.isEmpty ? 'HEAD' : base}';
|
||||
}
|
||||
final head = this.head.isEmpty ? 'HEAD' : this.head;
|
||||
final against = base.isEmpty
|
||||
? (baseCommit.isEmpty ? 'no commits yet' : 'uncommitted changes')
|
||||
: '$head vs $base${committedOnly ? ' · committed only' : ' · with uncommitted work'}';
|
||||
final where = repoName.isEmpty ? '' : '$repoName · ';
|
||||
return base.isEmpty ? '$where$head · $against' : '$where$against';
|
||||
}
|
||||
|
||||
|
||||
@@ -2,15 +2,18 @@ import '../../../core/api_gateway.dart';
|
||||
import 'chat_transcript.dart';
|
||||
|
||||
/// Entries a chat's model showed the operator through the Pipelines tools
|
||||
/// (`show_file`, `show_image`, `show_html`, `show_diff`, `notify`).
|
||||
/// (`show_file`, `show_image`, `show_html`, `show_diff`, `show_run`,
|
||||
/// `notify`).
|
||||
///
|
||||
/// The server keeps them per chat, outside the harness transcript: the
|
||||
/// `chat_subscribe` reply carries the retained list (oldest first) and a
|
||||
/// pushed `chat_shown` frame carries each new or updated item. Items are keyed
|
||||
/// by `id`; a later copy replaces the held one in place.
|
||||
/// by `id`; a later copy replaces the held one in place. The server sends one
|
||||
/// when the model replaces a card (`replace`) and when a shown run changes;
|
||||
/// either keeps the item's `created_at`, so the card stays where it was.
|
||||
|
||||
/// The recorded kinds.
|
||||
const chatShownKinds = {'file', 'image', 'html', 'diff', 'notify'};
|
||||
const chatShownKinds = {'file', 'image', 'html', 'diff', 'run', 'notify'};
|
||||
|
||||
/// The transcript row kind an item is drawn as.
|
||||
const String chatShownRowKind = 'shown';
|
||||
@@ -52,7 +55,7 @@ List<JsonMap> mergeChatShownItems(
|
||||
/// `pipelines/show_file`.
|
||||
final RegExp _pipelinesTool = RegExp(
|
||||
r'^(?:mcp__pipelines__|pipelines_|pipelines/)'
|
||||
r'(?:show_file|show_image|show_html|show_diff|notify)$',
|
||||
r'(?:show_file|show_image|show_html|show_diff|show_run|notify)$',
|
||||
);
|
||||
|
||||
/// Whether [part] is a call of a Pipelines tool whose result the transcript
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../pipelines/pipeline_format.dart' show formatDuration;
|
||||
import '../../runs/domain/run_events.dart' show isTerminalRunStatus;
|
||||
|
||||
/// A `show_run` item's run, as the server records it
|
||||
/// (`internal/protocol/chat_shown.go` ChatShownRunBody). The server pushes the
|
||||
/// item again whenever the run changes, so this is always its latest state.
|
||||
class ChatShownRun {
|
||||
const ChatShownRun({
|
||||
required this.id,
|
||||
required this.pipeline,
|
||||
required this.title,
|
||||
required this.status,
|
||||
required this.outcome,
|
||||
required this.currentStage,
|
||||
required this.startedAt,
|
||||
required this.finishedAt,
|
||||
});
|
||||
|
||||
/// The run of a `run` item, or null for any other item or a malformed one.
|
||||
static ChatShownRun? of(JsonMap item) {
|
||||
final body = item['run'];
|
||||
if (item['kind'] != 'run' || body is! Map) return null;
|
||||
final id = body['id'];
|
||||
if (id is! num || id <= 0) return null;
|
||||
return ChatShownRun(
|
||||
id: id.toInt(),
|
||||
pipeline: _text(body['pipeline']),
|
||||
title: _text(body['title']),
|
||||
status: _text(body['status']),
|
||||
outcome: _text(body['outcome']),
|
||||
currentStage: _text(body['current_stage']),
|
||||
startedAt: _millis(body['started_at']),
|
||||
finishedAt: _millis(body['finished_at']),
|
||||
);
|
||||
}
|
||||
|
||||
final int id;
|
||||
final String pipeline;
|
||||
final String title;
|
||||
final String status;
|
||||
final String outcome;
|
||||
final String currentStage;
|
||||
final int? startedAt;
|
||||
final int? finishedAt;
|
||||
|
||||
/// Whether the run has ended (succeeded, failed, canceled, interrupted).
|
||||
bool get finished => isTerminalRunStatus(status);
|
||||
|
||||
/// The status in words: the outcome of a finished run when it says more.
|
||||
String get statusLabel {
|
||||
final word = status.isEmpty ? 'unknown' : status;
|
||||
final label = '${word[0].toUpperCase()}${word.substring(1)}';
|
||||
return finished && outcome.isNotEmpty && outcome != status
|
||||
? '$label · $outcome'
|
||||
: label;
|
||||
}
|
||||
|
||||
/// How long it ran, or has been running at [now] (epoch milliseconds); null
|
||||
/// without a start time.
|
||||
String? duration(int now) {
|
||||
final start = startedAt;
|
||||
if (start == null) return null;
|
||||
final end = finishedAt ?? (finished ? null : now);
|
||||
if (end == null) return null;
|
||||
return formatDuration((end - start) ~/ 1000);
|
||||
}
|
||||
}
|
||||
|
||||
String _text(Object? value) => '${value ?? ''}'.trim();
|
||||
|
||||
int? _millis(Object? value) => value is num && value > 0 ? value.toInt() : null;
|
||||
@@ -8,6 +8,7 @@ import 'chat_shown_file_card.dart';
|
||||
import 'chat_shown_html_card.dart';
|
||||
import 'chat_shown_link_image.dart';
|
||||
import 'chat_shown_notify_row.dart';
|
||||
import 'chat_shown_run_card.dart';
|
||||
|
||||
/// One transcript row of kind `shown` ([withChatShownItems]): what the model
|
||||
/// showed through a Pipelines tool, drawn by its recorded kind. [endpoint] is
|
||||
@@ -37,6 +38,7 @@ class ChatShownCard extends StatelessWidget {
|
||||
'notify' => ChatShownNotifyRow(item: item),
|
||||
'html' => ChatShownHtmlCard(item: item, htmlBuilder: htmlBuilder),
|
||||
'diff' => ChatShownDiffCard(item: item),
|
||||
'run' => ChatShownRunCard(item: item),
|
||||
'image' when path.isEmpty => ChatShownLinkImage(
|
||||
item: item,
|
||||
openExternal: viewer.openExternal,
|
||||
|
||||
@@ -41,7 +41,6 @@ class _ChatShownDiffCardState extends State<ChatShownDiffCard> {
|
||||
: files.take(chatShownDiffPreviewFiles).toList();
|
||||
return ChatShownSurface(
|
||||
label: 'Shown diff $title',
|
||||
maxWidth: 720,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
@@ -92,6 +91,7 @@ class _ChatShownDiffCardState extends State<ChatShownDiffCard> {
|
||||
ChangeFileRow(
|
||||
key: ValueKey<String>('chat-shown-diff-file-${file.path}'),
|
||||
file: file,
|
||||
dense: true,
|
||||
onOpen: (file) =>
|
||||
showFileDiffViewer(context, file, files: files),
|
||||
),
|
||||
|
||||
@@ -32,6 +32,26 @@ DirectoryEntry chatShownEntry(JsonMap item) {
|
||||
);
|
||||
}
|
||||
|
||||
/// What happened to a shown file since: the server compares the live file
|
||||
/// with what was shown (or checks its snapshot still exists) when it lists a
|
||||
/// chat's items.
|
||||
enum ChatShownFileState { current, changed, missing }
|
||||
|
||||
ChatShownFileState chatShownFileState(JsonMap item) =>
|
||||
switch ('${item['state'] ?? ''}') {
|
||||
'changed' => ChatShownFileState.changed,
|
||||
'missing' => ChatShownFileState.missing,
|
||||
_ => ChatShownFileState.current,
|
||||
};
|
||||
|
||||
/// The https address a fetched web image came from, or empty.
|
||||
String chatShownSourceUrl(JsonMap item) {
|
||||
final uri = Uri.tryParse('${item['url'] ?? ''}'.trim());
|
||||
return uri != null && uri.scheme == 'https' && uri.host.isNotEmpty
|
||||
? uri.toString()
|
||||
: '';
|
||||
}
|
||||
|
||||
/// The largest logical height an inline shown image takes.
|
||||
const double chatShownImageMaxHeight = 280;
|
||||
|
||||
@@ -39,6 +59,12 @@ const double chatShownImageMaxHeight = 280;
|
||||
/// card with its kind glyph, name and size, and the first lines of a text
|
||||
/// document. Activating either opens the Files viewer (preview and download)
|
||||
/// over the chat machine's `/files` endpoint ([endpoint]).
|
||||
///
|
||||
/// A small file is a snapshot taken when it was shown, so later edits do not
|
||||
/// change the card. A larger one is the live file: the card says when it has
|
||||
/// changed since it was shown, and when it (or a snapshot) no longer exists,
|
||||
/// in which case nothing is loaded or opened. A web image the server fetched
|
||||
/// names the address it came from.
|
||||
class ChatShownFileCard extends StatelessWidget {
|
||||
const ChatShownFileCard({
|
||||
super.key,
|
||||
@@ -54,17 +80,25 @@ class ChatShownFileCard extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final entry = chatShownEntry(item);
|
||||
final urls = resolveFileUrls(endpoint, entry.path);
|
||||
final state = chatShownFileState(item);
|
||||
final missing = state == ChatShownFileState.missing;
|
||||
final urls = missing ? null : resolveFileUrls(endpoint, entry.path);
|
||||
final image = isThumbnailFile(entry.name) && urls != null;
|
||||
final source = chatShownSourceUrl(item);
|
||||
final kind = artifactKindLabel(
|
||||
artifactKind(fileContentType(entry.name), entry.name),
|
||||
);
|
||||
final title = chatShownTitle(item, entry.name);
|
||||
final subtitle = [
|
||||
if (title != entry.name) entry.name,
|
||||
kind,
|
||||
fileSizeLabel(entry.size),
|
||||
].join(' · ');
|
||||
final title = chatShownTitle(
|
||||
item,
|
||||
source.isEmpty ? entry.name : Uri.parse(source).host,
|
||||
);
|
||||
final subtitle = source.isNotEmpty
|
||||
? source
|
||||
: [
|
||||
if (title != entry.name) entry.name,
|
||||
kind,
|
||||
fileSizeLabel(entry.size),
|
||||
].join(' · ');
|
||||
void open() => viewer.open(context, endpoint: endpoint, entry: entry);
|
||||
final heading = Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
@@ -74,12 +108,26 @@ class ChatShownFileCard extends StatelessWidget {
|
||||
leading: image
|
||||
? null
|
||||
: Icon(
|
||||
fileIcon(entry),
|
||||
missing ? Icons.hide_source_outlined : fileIcon(entry),
|
||||
size: 32,
|
||||
color: chatShownSecondary(context),
|
||||
),
|
||||
),
|
||||
);
|
||||
final note = switch (state) {
|
||||
ChatShownFileState.current => null,
|
||||
ChatShownFileState.changed => (
|
||||
Icons.update,
|
||||
'Changed since shown',
|
||||
'The file has changed since it was shown; opening it shows the '
|
||||
'current version.',
|
||||
),
|
||||
ChatShownFileState.missing => (
|
||||
Icons.hide_source_outlined,
|
||||
'No longer exists',
|
||||
'The file was moved or deleted after it was shown.',
|
||||
),
|
||||
};
|
||||
final body = Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
@@ -91,6 +139,8 @@ class ChatShownFileCard extends StatelessWidget {
|
||||
fetch: viewer.fetch,
|
||||
),
|
||||
heading,
|
||||
if (note != null)
|
||||
_StateNote(icon: note.$1, label: note.$2, detail: note.$3),
|
||||
if (!image && urls != null)
|
||||
ChatShownFileLines(
|
||||
entry: entry,
|
||||
@@ -99,12 +149,53 @@ class ChatShownFileCard extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
);
|
||||
final isImage = image || '${item['kind']}' == 'image';
|
||||
return ChatShownSurface(
|
||||
label: image ? 'Shown image $title' : 'Shown file $title',
|
||||
child: Semantics(
|
||||
button: true,
|
||||
onTap: open,
|
||||
child: InkWell(onTap: open, child: body),
|
||||
label: isImage ? 'Shown image $title' : 'Shown file $title',
|
||||
child: missing
|
||||
? body
|
||||
: Semantics(
|
||||
button: true,
|
||||
onTap: open,
|
||||
child: InkWell(onTap: open, child: body),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// The line under a shown file's heading that says it changed or is gone.
|
||||
class _StateNote extends StatelessWidget {
|
||||
const _StateNote({
|
||||
required this.icon,
|
||||
required this.label,
|
||||
required this.detail,
|
||||
});
|
||||
|
||||
final IconData icon;
|
||||
final String label;
|
||||
final String detail;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final color = theme.colorScheme.tertiary;
|
||||
return Tooltip(
|
||||
message: detail,
|
||||
child: Padding(
|
||||
key: const Key('chat-shown-file-state'),
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(12, 0, 12, 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(icon, size: 18, color: color),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
label,
|
||||
style: theme.textTheme.labelMedium?.copyWith(color: color),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -138,7 +229,11 @@ class _ChatShownPicture extends StatelessWidget {
|
||||
return ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxHeight: chatShownImageMaxHeight),
|
||||
child: Image(
|
||||
image: ResizeImage.resizeIfNeeded((560 * ratio).round(), null, source),
|
||||
image: ResizeImage.resizeIfNeeded(
|
||||
(chatShownCardMaxWidth * ratio).round(),
|
||||
null,
|
||||
source,
|
||||
),
|
||||
fit: BoxFit.contain,
|
||||
semanticLabel: name,
|
||||
loadingBuilder: (_, child, progress) =>
|
||||
|
||||
@@ -73,7 +73,6 @@ class ChatShownHtmlCard extends StatelessWidget {
|
||||
);
|
||||
return ChatShownSurface(
|
||||
label: 'Shown view $title',
|
||||
maxWidth: 720,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../../core/api_gateway.dart';
|
||||
import '../../../chat_run_opener.dart';
|
||||
import '../../../domain/chat_shown_run.dart';
|
||||
import 'chat_shown_surface.dart';
|
||||
|
||||
/// The glyph of a run status.
|
||||
IconData chatShownRunIcon(String status) => switch (status) {
|
||||
'succeeded' => Icons.check_circle_outline,
|
||||
'failed' => Icons.error_outline,
|
||||
'canceled' => Icons.cancel_outlined,
|
||||
'interrupted' => Icons.pause_circle_outline,
|
||||
'waiting' => Icons.front_hand_outlined,
|
||||
'queued' => Icons.schedule,
|
||||
_ => Icons.play_circle_outline,
|
||||
};
|
||||
|
||||
Color _statusColor(ColorScheme colors, String status) => switch (status) {
|
||||
'succeeded' => colors.primary,
|
||||
'failed' || 'interrupted' => colors.error,
|
||||
'waiting' => colors.tertiary,
|
||||
_ => colors.onSurfaceVariant,
|
||||
};
|
||||
|
||||
/// A pipeline run the model showed through `show_run`: the pipeline, the
|
||||
/// run's title, its status, current stage and how long it has run. The server
|
||||
/// pushes the item again as the run changes; while it runs the duration ticks
|
||||
/// here. Activating it opens the run ([ChatRunOpener]).
|
||||
class ChatShownRunCard extends StatefulWidget {
|
||||
const ChatShownRunCard({super.key, required this.item, this.now});
|
||||
|
||||
final JsonMap item;
|
||||
|
||||
/// The clock, for tests.
|
||||
final DateTime Function()? now;
|
||||
|
||||
@override
|
||||
State<ChatShownRunCard> createState() => _ChatShownRunCardState();
|
||||
}
|
||||
|
||||
class _ChatShownRunCardState extends State<ChatShownRunCard> {
|
||||
Timer? _tick;
|
||||
|
||||
int get _now => (widget.now?.call() ?? DateTime.now()).millisecondsSinceEpoch;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_schedule();
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant ChatShownRunCard oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
_schedule();
|
||||
}
|
||||
|
||||
/// Ticks once a second while the run has not finished, so its duration
|
||||
/// keeps counting; a finished run's card is static.
|
||||
void _schedule() {
|
||||
final running = ChatShownRun.of(widget.item)?.finished == false;
|
||||
if (running && _tick == null) {
|
||||
_tick = Timer.periodic(const Duration(seconds: 1), (_) {
|
||||
if (mounted) setState(() {});
|
||||
});
|
||||
} else if (!running) {
|
||||
_tick?.cancel();
|
||||
_tick = null;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_tick?.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final run = ChatShownRun.of(widget.item);
|
||||
if (run == null) return const SizedBox.shrink();
|
||||
final theme = Theme.of(context);
|
||||
final colors = theme.colorScheme;
|
||||
final secondary = chatShownSecondary(context);
|
||||
final title = chatShownTitle(
|
||||
widget.item,
|
||||
run.title.isEmpty ? 'Run ${run.id}' : run.title,
|
||||
);
|
||||
final pipeline = run.pipeline.isEmpty ? 'Run' : run.pipeline;
|
||||
final duration = run.duration(_now);
|
||||
final status = run.statusLabel;
|
||||
final facts = [
|
||||
'#${run.id}',
|
||||
if (!run.finished && run.currentStage.isNotEmpty) run.currentStage,
|
||||
?duration,
|
||||
].join(' · ');
|
||||
final open = ChatRunOpener.maybeOf(context);
|
||||
final body = Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(12, 10, 12, 10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ChatShownHeading(
|
||||
title: title,
|
||||
subtitle: pipeline,
|
||||
leading: Icon(Icons.play_lesson_outlined, color: secondary),
|
||||
trailing: open == null
|
||||
? null
|
||||
: Icon(Icons.chevron_right, color: secondary),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 4,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
Chip(
|
||||
key: const Key('chat-shown-run-status'),
|
||||
avatar: Icon(
|
||||
chatShownRunIcon(run.status),
|
||||
color: _statusColor(colors, run.status),
|
||||
),
|
||||
label: Text(status),
|
||||
visualDensity: VisualDensity.compact,
|
||||
),
|
||||
Text(
|
||||
facts,
|
||||
key: const Key('chat-shown-run-facts'),
|
||||
style: theme.textTheme.bodySmall?.copyWith(color: secondary),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
return ChatShownSurface(
|
||||
label: 'Shown run $title',
|
||||
child: open == null
|
||||
? body
|
||||
: Semantics(
|
||||
button: true,
|
||||
onTap: () => open(run.id),
|
||||
child: InkWell(onTap: () => open(run.id), child: body),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -12,20 +12,18 @@ String chatShownTitle(JsonMap item, String fallback) {
|
||||
return title.isEmpty ? fallback : title;
|
||||
}
|
||||
|
||||
/// The width every shown card (file, image, view, diff, run) is held to, so
|
||||
/// the entries of one transcript line up whatever their kind.
|
||||
const double chatShownCardMaxWidth = 720;
|
||||
|
||||
/// The outlined card a shown entry sits in, on the agent's side of the
|
||||
/// transcript, at most [maxWidth] wide.
|
||||
/// transcript, at most [chatShownCardMaxWidth] wide.
|
||||
class ChatShownSurface extends StatelessWidget {
|
||||
const ChatShownSurface({
|
||||
super.key,
|
||||
required this.label,
|
||||
required this.child,
|
||||
this.maxWidth = 560,
|
||||
});
|
||||
const ChatShownSurface({super.key, required this.label, required this.child});
|
||||
|
||||
/// The entry's accessible name ("Shown file", "Shown view", ...).
|
||||
final String label;
|
||||
final Widget child;
|
||||
final double maxWidth;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -43,7 +41,7 @@ class ChatShownSurface extends StatelessWidget {
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: maxWidth),
|
||||
constraints: const BoxConstraints(maxWidth: chatShownCardMaxWidth),
|
||||
child: card,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user