ebe79ebed0
Run detail gains a Findings tab (open-count badge) listing the server's findings ledger with status and minimum-severity filters and expandable event history; visit grants show as an Extra visits summary fact. The resume retry prompt can grant 1-5 extra visits to the exhausted stage or a chosen graph stage (never sent on restart), suggested when the run failed on a visit limit. A loop-exhaustion decision waiting on a model stage is now decidable from its recorded options, with readable labels, targets and the visit count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
96 lines
3.0 KiB
Dart
96 lines
3.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'retry_extra_visits.dart';
|
|
import 'retry_wording.dart';
|
|
|
|
/// The resume prompt's optional "Grant extra visits" choice: a checkbox, the
|
|
/// number of visits (1-5) and the stage they go to (the exhausted stage by
|
|
/// default). Null [visits] means the choice is off.
|
|
class RetryExtraVisitsField extends StatelessWidget {
|
|
const RetryExtraVisitsField({
|
|
super.key,
|
|
required this.visits,
|
|
required this.stage,
|
|
required this.stages,
|
|
required this.suggested,
|
|
required this.enabled,
|
|
required this.onVisitsChanged,
|
|
required this.onStageChanged,
|
|
});
|
|
|
|
final int? visits;
|
|
final String? stage;
|
|
final List<String> stages;
|
|
|
|
/// Whether the run failed on an exhausted loop, so the choice is suggested.
|
|
final bool suggested;
|
|
final bool enabled;
|
|
final ValueChanged<int?> onVisitsChanged;
|
|
final ValueChanged<String?> onStageChanged;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final count = visits;
|
|
return Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
if (suggested)
|
|
Padding(
|
|
padding: const EdgeInsets.only(top: 8),
|
|
child: Text(
|
|
retryExhaustedHint,
|
|
key: retryExhaustedHintKey,
|
|
style: Theme.of(context).textTheme.bodySmall,
|
|
),
|
|
),
|
|
CheckboxListTile(
|
|
key: retryExtraVisitsKey,
|
|
contentPadding: EdgeInsets.zero,
|
|
controlAffinity: ListTileControlAffinity.leading,
|
|
title: const Text(retryExtraVisitsLabel),
|
|
value: count != null,
|
|
onChanged: enabled
|
|
? (checked) => onVisitsChanged(checked == true ? 1 : null)
|
|
: null,
|
|
),
|
|
if (count != null)
|
|
Wrap(
|
|
spacing: 12,
|
|
runSpacing: 12,
|
|
children: [
|
|
DropdownMenu<int>(
|
|
key: retryExtraCountKey,
|
|
enabled: enabled,
|
|
label: const Text(retryExtraVisitsCountLabel),
|
|
initialSelection: count,
|
|
onSelected: (value) {
|
|
if (value != null) onVisitsChanged(value);
|
|
},
|
|
dropdownMenuEntries: [
|
|
for (var n = 1; n <= maxRetryExtraVisits; n++)
|
|
DropdownMenuEntry(value: n, label: '+$n'),
|
|
],
|
|
),
|
|
DropdownMenu<String?>(
|
|
key: retryExtraStageKey,
|
|
enabled: enabled,
|
|
label: const Text(retryExtraStageLabel),
|
|
initialSelection: stage,
|
|
onSelected: onStageChanged,
|
|
dropdownMenuEntries: [
|
|
const DropdownMenuEntry(
|
|
value: null,
|
|
label: retryExhaustedStageLabel,
|
|
),
|
|
for (final key in stages)
|
|
DropdownMenuEntry(value: key, label: key),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|