Engine: check stages, harness-agnostic delivery, read-only enforcement, complete captures

- New `type=check` stage: the server runs a `commands` block (sh -c, per
  command_timeout, workspace env) and routes on pass/fail; per-command status,
  exit code, duration and bounded output are recorded and the failing output is
  the handoff. With delivery=true it is the landing gate (commit leftovers,
  merge moved main, checks in a fresh candidate worktree, fast-forward main).
  Parser/registry, lint (silent guards), format docs, CLI inspect, app graph and
  run detail rendering.
- delivery=true is accepted on every harness (and on check stages).
- permissions.shell on claude stages maps to Bash(cmd) / Bash(prefix:*) rules
  instead of a bare Bash allow; stages without edit that change the workspace
  fail the visit with the changed files listed (allow_workspace_changes=true
  opts out; artifacts, public and harness state dirs are ignored).
- File-change capture: symlinks compared by target, untouched protected files no
  longer make captures partial, untracked caches/dependency/build output left
  out, lockfiles listed without patch, huge files compared by metadata, raised
  patch/line limits. Outcome repair follow-ups are logged and counted on the
  step (control.outcome_repairs).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 12:52:16 +00:00
parent c4de1de27b
commit 87016ef5dc
47 changed files with 2674 additions and 129 deletions
@@ -45,10 +45,7 @@ class GraphStageNode extends StatelessWidget {
return status != null && status.trim().isNotEmpty ? status : null;
}
String get _label {
final status = _status;
return status == null ? node.label : '${node.label}\n$status';
}
String get _label => graphNodeSemanticsLabel(node, _status);
@override
Widget build(BuildContext context) {
@@ -112,11 +109,13 @@ class GraphStageNode extends StatelessWidget {
graphStatusState(status),
Theme.of(context).colorScheme,
);
final caption = node.kindCaption;
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(_breakable(node.label), softWrap: true),
if (caption != null) _kind(context, caption),
if (status != null)
Row(
mainAxisSize: MainAxisSize.min,
@@ -144,6 +143,29 @@ class GraphStageNode extends StatelessWidget {
);
}
/// A check stage's kind under its name: the check icon (a gate icon for the
/// delivery gate) and `Check`/`Delivery gate` in the muted label role.
Widget _kind(BuildContext context, String caption) {
final theme = Theme.of(context);
final color = theme.colorScheme.onSurfaceVariant;
final style = (theme.textTheme.labelSmall ?? const TextStyle()).copyWith(
color: color,
);
return Row(
key: ValueKey('graph-node-kind-${node.key}'),
mainAxisSize: MainAxisSize.min,
children: [
Icon(
checkStageIcon(delivery: node.delivery),
size: (style.fontSize ?? 11) * 1.4,
color: color,
),
const SizedBox(width: 4),
Flexible(child: Text(caption, style: style, softWrap: true)),
],
);
}
/// The web node uses `overflow-wrap: anywhere`; Flutter text does not break a
/// long unbroken key, so the same invisible break opportunities are added.
/// The visible text and the semantics label stay unchanged.
@@ -265,6 +287,18 @@ class StageActivityHaloPainter extends CustomPainter {
oldDelegate.color != color || oldDelegate.progress != progress;
}
/// The icon for a check stage; the delivery gate gets the landing icon.
IconData checkStageIcon({required bool delivery}) =>
delivery ? Icons.verified_outlined : Icons.fact_check_outlined;
/// A node's accessible name: its label, a check stage's kind, then the run's
/// recorded status when there is one.
String graphNodeSemanticsLabel(GraphNode node, String? status) => [
node.label,
?node.kindCaption,
if (status != null && status.trim().isNotEmpty) status,
].join('\n');
/// The run state a recorded step status colours as: done is green, an error or
/// a block is red, running is blue, waiting teal, anything else grey.
String graphStatusState(String status) {
@@ -341,7 +341,7 @@ class RunGraphNode extends StatelessWidget {
}
return Semantics(
container: true,
label: status == null ? node.label : '${node.label}\n$status',
label: graphNodeSemanticsLabel(node, status),
child: ExcludeSemantics(
child: IgnorePointer(
child: GraphStageNode(
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import '../../../ui/adaptive/segmented_bar.dart';
import '../../../ui/text/markdown_source_view.dart';
import '../../../ui/text/monospace.dart';
import '../../chat/ui/transcript/chat_markdown_view.dart';
import '../../../core/api_gateway.dart';
import '../../../ui/adaptive/floating_bar_layout.dart';
@@ -190,8 +191,15 @@ class _StageDefinitionFieldView extends StatelessWidget {
children: [
Text(field.label, style: style.label),
const SizedBox(height: 4),
// Commands are literal code: verbatim and monospace in either mode.
if (field.monospace)
_SelectableDefinitionText(
key: ValueKey('stage-definition-${field.label}'),
value: field.value,
style: style.value.copyWith(fontFamily: appMonospaceFamily),
)
// An authored text block (a prompt) is markdown: rendered or raw.
if (field.block && raw)
else if (field.block && raw)
_SelectableDefinitionText(value: field.value, style: style.value)
else if (field.block)
ChatMarkdownView(text: field.value)
@@ -215,7 +223,11 @@ class _StageDefinitionFieldView extends StatelessWidget {
/// fallback font with taller metrics and double-space only that block. It is
/// the host's own line metrics, not a font override or a fixed height.
class _SelectableDefinitionText extends StatelessWidget {
const _SelectableDefinitionText({required this.value, required this.style});
const _SelectableDefinitionText({
super.key,
required this.value,
required this.style,
});
final String value;
final TextStyle style;