Class ActSpecFunctionTools

java.lang.Object
org.machanism.machai.gw.tools.ActSpecFunctionTools
All Implemented Interfaces:
FunctionTools

public class ActSpecFunctionTools extends Object implements FunctionTools
Provides AI-callable functional tools for episode navigation and control within an ActProcessor context.

This FunctionTools implementation registers tools for moving to a requested episode and for repeating the current episode in a project workflow. It is intended for use with ActProcessor and integrates with the ProcessProvider provider.

Both operations signal control-flow changes by throwing their corresponding exception; callers must therefore allow those exceptions to propagate to the act-processing workflow rather than treating these methods as ordinary business operations.

Author:
Viktor Tovstyi
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final org.slf4j.Logger
    Logger used to emit the optional response message before the current episode is repeated.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    moveToEpisode(int targetId, String name)
    AI functional tool that requests navigation to the episode identified by its id or name.
    void
    AI functional tool that repeats the current episode by terminating its execution and restarting the same episode while preserving its context.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • logger

      private static final org.slf4j.Logger logger
      Logger used to emit the optional response message before the current episode is repeated.
  • Constructor Details

    • ActSpecFunctionTools

      public ActSpecFunctionTools()
  • Method Details

    • moveToEpisode

      public void moveToEpisode(int targetId, String name)
      AI functional tool that requests navigation to the episode identified by its id or name. Use this tool only when the user explicitly requests a particular episode; the system handles sequential navigation to the next episode automatically.

      The method does not return normally. It throws a MoveToEpisodeException, which the surrounding act-processing flow interprets as a navigation request.

      Parameters:
      targetId - the identifier of the requested episode
      name - the name of the requested episode
      Throws:
      MoveToEpisodeException - always thrown to signal episode navigation
    • repeateEpisode

      public void repeateEpisode(String message)
      AI functional tool that repeats the current episode by terminating its execution and restarting the same episode while preserving its context.

      This method can re-execute an episode after a validation failure or when additional user input is required. When message is non-null and non-empty, it is emitted to the configured log before repetition is requested. The method does not return normally.

      Parameters:
      message - a custom response message to log before repeating the episode; null and empty messages are not logged
      Throws:
      RepeatEpisodeException - always thrown to signal the episode should be repeated