Finalize reviewed destination and skill changes

Preserve Settings as an independent navigation destination while landing the reviewed notification and skill-management updates. Keep the server and CLI skill contracts versioned and validated so the merged tree can be verified by the delivery gate.
This commit is contained in:
2026-11-12 11:30:17 +00:00
parent 26bb583f10
commit a733a927f3
33 changed files with 1344 additions and 42 deletions
@@ -65,6 +65,9 @@ AttentionKind? attentionKindOf(dynamic status) {
/// onto a waiting run must not hide a genuine human decision.
AttentionKind? attentionKindForRun(JsonMap run) {
final kind = attentionKindOf(run['status']);
if (kind == AttentionKind.failed && _word(run['failure_kind']) == 'expected') {
return null;
}
if (kind != AttentionKind.decision) return kind;
if (_positive(run['export_pending_sequence'])) return null;
return kind;
@@ -77,7 +80,10 @@ String attentionKey(int runId, AttentionKind kind) => '$runId:${kind.wireName}';
/// shows the server's own diagnostic when it recorded one.
String attentionDetail(AttentionKind kind, JsonMap run) {
if (kind == AttentionKind.decision) return 'Waiting for your decision';
final diagnostic = '${run['diagnostic'] ?? ''}'.trim();
final failureReason = '${run['failure_reason'] ?? ''}'.trim();
final diagnostic = failureReason.isNotEmpty
? failureReason
: '${run['diagnostic'] ?? ''}'.trim();
return diagnostic.isNotEmpty ? diagnostic : 'Run failed';
}
@@ -0,0 +1,113 @@
import 'dart:math' as math;
import 'dart:ui' show PathMetric;
import 'package:flutter/material.dart';
/// Arc-length geometry for the composer's running border.
///
/// The highlight is laid out by distance travelled along the outline, not by
/// angle around the centre, so equal time steps move it equal lengths around
/// a rounded rectangle: no racing along the long edges, no crawling at ends.
///
/// One lap is `progress` in [0, 1]; progress 1 is the same place as 0, so the
/// loop restarts without a jump.
/// The colour bands, as fractions of a lap measured forward from the origin.
/// They match the original sweep's stops and colours.
const List<double> runningHighlightStops = [0, .12, .24, .38, 1];
/// Half a device pixel of overlap so neighbouring segments leave no seam.
const double _seamOverlap = .5;
/// One piece of the outline and the highlight colour drawn over it.
class RunningArcSegment {
const RunningArcSegment({
required this.start,
required this.end,
required this.color,
});
/// Arc length from the outline's start where the piece begins.
final double start;
/// Arc length where the piece ends (exclusive, may overlap by a seam).
final double end;
final Color color;
}
/// The arc length of the highlight's origin along an outline of [length].
double runningHighlightOrigin(double progress, double length) {
final lap = progress - progress.floorToDouble();
return lap * length;
}
/// The highlight colour [fraction] of a lap ahead of its origin. Fractions
/// wrap, so `f` and `f + 1` are the same colour.
Color runningHighlightColorAt(double fraction, Color primary, Color tertiary) {
final colors = [
primary.withValues(alpha: 0),
primary,
tertiary,
tertiary.withValues(alpha: 0),
primary.withValues(alpha: 0),
];
final f = fraction - fraction.floorToDouble();
for (var i = 1; i < runningHighlightStops.length; i++) {
final stop = runningHighlightStops[i];
if (f <= stop) {
final from = runningHighlightStops[i - 1];
final t = (f - from) / (stop - from);
return Color.lerp(colors[i - 1], colors[i], t)!;
}
}
return colors.last;
}
/// Splits an outline of [length] into pieces about [step] long and colours
/// each by where it sits in the highlight at [progress]. Pieces with no
/// visible colour are left out.
List<RunningArcSegment> runningHighlightSegments({
required double progress,
required double length,
required Color primary,
required Color tertiary,
double step = 3,
}) {
if (length <= 0) return const [];
final count = math.max(1, (length / step).ceil());
final size = length / count;
final origin = runningHighlightOrigin(progress, length);
final segments = <RunningArcSegment>[];
for (var i = 0; i < count; i++) {
final mid = (i + .5) * size;
final color = runningHighlightColorAt(
(mid - origin) / length,
primary,
tertiary,
);
if (color.a == 0) continue;
segments.add(
RunningArcSegment(
start: math.max(0, i * size - _seamOverlap),
end: math.min(length, (i + 1) * size + _seamOverlap),
color: color,
),
);
}
return segments;
}
/// The part of an outline between arc lengths [start] and [end]. The outline
/// may be made of several contours, so the range is taken across all of them.
Path runningArcPath(List<PathMetric> metrics, double start, double end) {
final out = Path();
var offset = 0.0;
for (final metric in metrics) {
final from = math.max(start, offset) - offset;
final to = math.min(end, offset + metric.length) - offset;
if (to > from) out.addPath(metric.extractPath(from, to), Offset.zero);
offset += metric.length;
}
return out;
}
@@ -1,7 +1,7 @@
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'composer_running_arc.dart';
/// The composer's "agent is working" edge: a soft highlight that travels once
/// around the pill's rounded border in [primary] and [tertiary], with a faint
/// glow beneath it. Mount it only while a turn runs; disposing it stops the
@@ -22,8 +22,8 @@ class ComposerRunningBorder extends StatefulWidget {
final Color primary;
final Color tertiary;
/// One lap of the highlight around the border.
static const Duration period = Duration(seconds: 4);
/// One lap of the highlight around the border (about 2.5–3 s).
static const Duration period = Duration(milliseconds: 2750);
/// The stroke drawn just inside the pill's edge.
static const double strokeWidth = 2;
@@ -117,24 +117,29 @@ class _RunningBorderPainter extends CustomPainter {
);
glow.color = solid.withValues(alpha: solid.a * .4);
line.color = solid;
} else {
final shader = SweepGradient(
colors: [
primary.withValues(alpha: 0),
primary,
tertiary,
tertiary.withValues(alpha: 0),
primary.withValues(alpha: 0),
],
stops: const [0, .12, .24, .38, 1],
transform: GradientRotation(progress * 2 * math.pi),
).createShader(rect);
glow.shader = shader;
line.shader = shader;
canvas
..drawPath(path, glow)
..drawPath(path, line);
return;
}
// The highlight is laid along the outline by arc length, one piece at a
// time, so its speed is even around corners and straight edges alike.
final metrics = path.computeMetrics().toList();
final length = metrics.fold<double>(0, (sum, m) => sum + m.length);
final segments = runningHighlightSegments(
progress: progress,
length: length,
primary: primary,
tertiary: tertiary,
);
for (final segment in segments) {
final piece = runningArcPath(metrics, segment.start, segment.end);
glow.color = segment.color;
line.color = segment.color;
canvas
..drawPath(piece, glow)
..drawPath(piece, line);
}
canvas
..drawPath(path, glow)
..drawPath(path, line);
}
@override
@@ -119,6 +119,9 @@ JsonMap _mergeRunFields(JsonMap current, JsonMap frame) {
for (final key in ['outcome', 'current_stage', 'created_at', 'finished_at']) {
if (!_blank(frame[key])) merged[key] = frame[key];
}
for (final key in ['failure_kind', 'failure_reason']) {
if (frame[key] != null) merged[key] = frame[key];
}
// Snapshot and terminal frames carry the measured size; others omit it.
if (frame['size_bytes'] is num) merged['size_bytes'] = frame['size_bytes'];
final oldExport = _positiveInt(current['export_pending_sequence']);
@@ -168,6 +171,8 @@ JsonMap? newRunSummaryFromFrame(JsonMap frame) {
'finished_at': frame['finished_at'] ?? '',
'outcome': frame['outcome'] ?? '',
'current_stage': frame['current_stage'] ?? '',
'failure_kind': frame['failure_kind'] ?? '',
'failure_reason': frame['failure_reason'] ?? '',
'resource_wait': frame['resource_wait'],
'cancel_requested': frame['cancel_requested'] == true,
'cleanup_unconfirmed': frame['cleanup_unconfirmed'] == true,