Package org.machanism.machai.gw.tools
Class CommandSpecFunctionTools
java.lang.Object
org.machanism.machai.gw.tools.CommandSpecFunctionTools
- All Implemented Interfaces:
FunctionTools
Provides function tools for task and process-execution control within an
AIFileProcessor workflow.
The tool infrastructure exposes the annotated methods to the AI provider. Invoking a tool signals task completion or application termination by throwing the corresponding control-flow exception; the workflow host is responsible for handling that signal.
- Author:
- Viktor Tovstyi
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringDefault explanatory message used when a control-flow tool is invoked without an explicit message. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCompletes the current task by throwing anEndTaskException.terminateExecution(String message, int exitCode, File projectDir) Requests application termination by throwing aProcessTerminationException.
-
Field Details
-
TASK_TERMINATED_BY_FUNCTION_TOOL_MESSAGE
Default explanatory message used when a control-flow tool is invoked without an explicit message.- See Also:
-
-
Constructor Details
-
CommandSpecFunctionTools
public CommandSpecFunctionTools()
-
-
Method Details
-
terminateExecution
Requests application termination by throwing aProcessTerminationException. The exception carries the supplied message and exit code for handling by the workflow host. When omitted by the caller, the tool infrastructure supplies the annotation-defined defaults formessageandexitCode.The
projectDirargument is supplied by the tool infrastructure as invocation context and is not used when constructing the termination request.- Parameters:
message- human-readable message exposed to the hostexitCode- process exit code requested from the hostprojectDir- project directory provided as invocation context; unused- Returns:
- never returns normally because it always requests termination
- Throws:
ProcessTerminationException- always, to request process termination
-
endTask
Completes the current task by throwing anEndTaskException. The host remains active and can accept subsequent tasks. When no message is supplied, the tool infrastructure uses its annotation-defined default message.- Parameters:
message- human-readable message describing task completion- Returns:
- never returns normally because it always signals task completion
- Throws:
EndTaskException- always, to request task completion
-