Class WorkflowCompleteEvent

java.lang.Object
ai.redouble.nucleo.events.AbstractJobEvent
ai.redouble.nucleo.events.WorkflowCompleteEvent
All Implemented Interfaces:
WorkflowTerminationEvent, HumanReadable, JobEvent, Serializable

public final class WorkflowCompleteEvent extends AbstractJobEvent implements WorkflowTerminationEvent, HumanReadable
Terminal event signaling that an entire workflow has completed (successfully or not).

Published by the job dispatcher when the root job of a workflow finishes. This is the definitive signal for the UI to stop spinners, show results, or display errors. Only published for root jobs - sub-job completions/failures are internal to the workflow.

Implements both WorkflowTerminationEvent (triggers observer self-cleanup) and HumanReadable (a workflow-scoped observer forwards it to the person watching).

Distinct from MessageCompleteEvent which signals completion of a single message exchange within a long-lived chat session.

Carries the outcome and the reason, which is also its message; the one-argument form is a success reading Workflow completed successfully. A success answers COMPLETING under the title Workflow Complete, a failure FAILING under Workflow Failed.

Since:
0.1 (2025-10-11)
Author:
Andrey Santrosyan
See Also:
  • Constructor Details

    • WorkflowCompleteEvent

      public WorkflowCompleteEvent(JobSnapshot snapshot, boolean successful, String reason)
      Creates a workflow complete event.
      Parameters:
      snapshot - the root job's snapshot
      successful - whether the workflow completed successfully
      reason - description of the outcome
    • WorkflowCompleteEvent

      public WorkflowCompleteEvent(JobSnapshot snapshot)
      Creates a successful workflow complete event.
      Parameters:
      snapshot - the root job's snapshot
  • Method Details

    • getTerminationReason

      public String getTerminationReason()
      Description copied from interface: WorkflowTerminationEvent
      The reason for workflow termination: one of the two questions every member of this category answers.
      Specified by:
      getTerminationReason in interface WorkflowTerminationEvent
      Returns:
      a human-readable description of why the workflow terminated
    • isSuccessful

      public boolean isSuccessful()
      Description copied from interface: WorkflowTerminationEvent
      Whether the workflow completed successfully: the other question every member of this category answers.
      Specified by:
      isSuccessful in interface WorkflowTerminationEvent
      Returns:
      true if the workflow completed all its tasks successfully, false if it was terminated due to error or cancellation
    • msgType

      public MsgType msgType()
    • title

      public String title()
    • jobState

      public JobState jobState()
    • getHumanMessage

      public String getHumanMessage()
      Description copied from interface: HumanReadable
      Returns a plain-text message suitable for display to end users.
      Specified by:
      getHumanMessage in interface HumanReadable
      Returns:
      user-friendly message
    • getReason

      public String getReason()