Class AiToolStatusUpdate

java.lang.Object
io.jmix.aitools.tool.AiToolStatusUpdate

public class AiToolStatusUpdate extends Object
Ephemeral status update emitted by an AI tool through AiToolStatusPublisher.

Two-phase semantics. A tool publishes the SAME message twice during its lifetime:

  1. first with resultSnippet == null — meaning "I started this step" (the consumer renders it as an in-flight indicator);
  2. then with the same message and a non-blank resultSnippet — meaning "this step finished, here is the short result" (the consumer folds the second into the first, marks it as completed and shows the snippet next to the base text).
Use isCompleted() to tell the two apart.
  • Field Details

    • message

      protected final String message
    • resultSnippet

      protected final @Nullable String resultSnippet
  • Constructor Details

    • AiToolStatusUpdate

      public AiToolStatusUpdate(String message, @Nullable String resultSnippet)
    • AiToolStatusUpdate

      public AiToolStatusUpdate(String message)
      Convenience constructor for an in-flight ("started, no result yet") update. Equivalent to new AiToolStatusUpdate(message, null).
      Parameters:
      message - status text describing the step that has started
  • Method Details

    • getMessage

      public String getMessage()
      Returns the status message.
      Returns:
      status message
    • getResultSnippet

      public @Nullable String getResultSnippet()
      Returns the short result snippet of a completed step.
      Returns:
      result snippet, or null for an in-flight update
    • isCompleted

      public boolean isCompleted()
      true if the update carries a non-blank resultSnippet (i.e. is the "completed" half of the two-phase publish).
      Returns:
      whether this update represents a completed step