feat(app): start a pipeline from the detail view

Native Run action opens the web's prompt/workspace/notify dialog, sends the exact run_pipeline body against the pinned resolved version with one request key per confirmed attempt, keeps refusals in the dialog, reconciles a lost reply by key, and opens only the server-named run through the existing run route with one fresh Runs list read.

Adds a shared failure-reason helper so operators never see Dart runtime prefixes, and records the slice boundary in notes/P3-run.md.
This commit is contained in:
2026-10-22 02:07:49 +01:00
parent 92706a290e
commit 53a8f668ca
24 changed files with 2644 additions and 19 deletions
@@ -74,6 +74,20 @@ class RunsRepository {
'run_detail',
);
/// Reads a run by the idempotency key of a launch whose reply was lost.
///
/// This is a read, not a launch: a server that never admitted the key answers
/// without a run detail, which is reported as null rather than invented.
Future<JsonMap?> runByRequestKey(String requestKey) async {
final key = requestKey.trim();
if (key.isEmpty) {
throw const RunsRepositoryException('A launch request key is required.');
}
final reply = await _gateway.call('get_run', {'request_key': key});
final detail = reply['run_detail'];
return detail is Map ? Map<String, dynamic>.from(detail) : null;
}
Future<JsonMap> startRun({
required num pipelineId,
required num version,
@@ -82,7 +96,7 @@ class RunsRepository {
required String requestKey,
String title = '',
String outputFormat = '',
String notifyMode = 'auto',
String? notifyMode,
}) async {
final fields = <String, dynamic>{
'pipeline_id': pipelineId,
@@ -93,7 +107,7 @@ class RunsRepository {
};
if (title.trim().isNotEmpty) fields['title'] = title.trim();
if (outputFormat.isNotEmpty) fields['output_format'] = outputFormat;
final mode = notifyMode.trim().toLowerCase();
final mode = (notifyMode ?? '').trim().toLowerCase();
if (mode == 'on' || mode == 'off') fields['notify_mode'] = mode;
return _required(await _gateway.call('run_pipeline', fields), 'run_detail');
}