Skip to content

Commit 7d256fc

Browse files
💾 Feat(Workflow): 添加 RunWorkflowWithDetailsAsync 方法以返回完整执行结果和 Print() 输出
1 parent c1671fa commit 7d256fc

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

‎KitX Core Contracts/KitX.Core.Contract/Event/WorkflowEventArgs.cs‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections.Generic;
23

34
namespace KitX.Core.Contract.Event;
45

@@ -79,10 +80,19 @@ public class WorkflowExecutionResultEventArgs : EventArgs
7980
/// </summary>
8081
public string? ErrorMessage { get; }
8182

82-
public WorkflowExecutionResultEventArgs(string workflowId, bool isSuccess, string? errorMessage = null)
83+
/// <summary>
84+
/// Lines of Print() output produced during execution (null if not captured).
85+
/// Surfaced to the Debug activity log so users can see what the workflow printed
86+
/// without opening the editor's output panel.
87+
/// </summary>
88+
public IReadOnlyList<string>? Output { get; }
89+
90+
public WorkflowExecutionResultEventArgs(string workflowId, bool isSuccess,
91+
string? errorMessage = null, IReadOnlyList<string>? output = null)
8392
{
8493
WorkflowId = workflowId;
8594
IsSuccess = isSuccess;
8695
ErrorMessage = errorMessage;
96+
Output = output;
8797
}
8898
}

‎KitX Core Contracts/KitX.Core.Contract/Workflow/IWorkflowService.cs‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ public interface IWorkflowManagementService
3030
/// </summary>
3131
Task<bool> RunWorkflowAsync(string workflowId);
3232

33+
/// <summary>
34+
/// Runs a workflow and returns the full execution result including Print() output.
35+
/// Use this when the caller needs the execution output (e.g. the Debug activity log).
36+
/// </summary>
37+
Task<WorkflowRunResult> RunWorkflowWithDetailsAsync(string workflowId);
38+
3339
/// <summary>
3440
/// Stops a workflow
3541
/// </summary>
@@ -195,3 +201,11 @@ public interface IWorkflowCase
195201
/// </summary>
196202
TriggerConfig? TriggerConfig { get; set; }
197203
}
204+
205+
/// <summary>
206+
/// Result of a workflow run, including the Print() output lines captured during execution.
207+
/// </summary>
208+
public record WorkflowRunResult(
209+
bool IsSuccess,
210+
string? ErrorMessage,
211+
IReadOnlyList<string>? Output);

0 commit comments

Comments
 (0)