Class LocalShell
java.lang.Object
uno.anahata.ai.tools.spi.LocalShell
A tool provider that allows the AI model to execute commands in the local
bash shell.
This tool is powerful and should be used with caution. It captures standard output, standard error, and execution metadata.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
LocalShell
public LocalShell()
-
-
Method Details
-
runShell
Executes a shell command usingbash -c.- Parameters:
command- The shell command to execute.- Returns:
- A map containing execution results:
threadId: The name of the thread that initiated the command.pid: The process ID of the shell command.startTime: ISO-8601 start timestamp.endTime: ISO-8601 end timestamp.executionTimeMs: Total duration in milliseconds.exitCode: The process exit code (0 for success).stdout: The captured standard output.stderr: The captured standard error.
- Throws:
Exception- if the command fails to start or execution is interrupted.
-
