42b21b86cd
Adds HumanDecisionAction plus its native prompt, wording constants and tests. The action renders only while pendingDecision() reports a genuine human wait, sends decide_run only after an option is chosen and Confirm pressed, sends the pending stage/trimmed option/optional feedback, blocks double submits, shows server refusals verbatim with the draft intact, and re-reads the run so the owner always receives server truth.
25 lines
1.0 KiB
Dart
25 lines
1.0 KiB
Dart
import 'package:flutter/widgets.dart';
|
|
|
|
import '../domain/run_decisions.dart';
|
|
|
|
/// The browser client's decision wording, kept verbatim.
|
|
const decisionWaitingTitle = 'Waiting for your decision';
|
|
const decisionActionLabel = 'Decide';
|
|
const decisionFeedbackLabel = 'Feedback (optional)';
|
|
const decisionCancelLabel = 'Cancel';
|
|
const decisionConfirmLabel = 'Confirm decision';
|
|
const decisionSendingLabel = 'Sending…';
|
|
|
|
/// Stable test/semantics keys shared by the action and its prompt.
|
|
const decisionActionKey = ValueKey<String>('human-decision-action');
|
|
const decisionFeedbackKey = ValueKey<String>('human-decision-feedback');
|
|
const decisionErrorKey = ValueKey<String>('human-decision-error');
|
|
|
|
/// `{stage} · run {id} · {label}`, as the web decision card shows it.
|
|
String decisionMeta(PendingDecision decision) =>
|
|
'${decision.stageKey} · run ${decision.runId} · ${decision.runLabel}';
|
|
|
|
/// The option's target line, `→ {target}`, or "" when no target was declared.
|
|
String decisionTargetText(String target) =>
|
|
target.trim().isEmpty ? '' : '→ $target';
|