Class ServerShellTools

java.lang.Object
com.tnsai.server.tools.ServerShellTools

public class ServerShellTools extends Object
Function-shape shell-execute tool with risk classification (ADR-8). Replaces the legacy ShellTool (Phase 3b sweep, issue #188). Risk classification is preserved verbatim from the legacy tool; the dispatcher still respects requiresConfirmation() via the WsToolApprovalFilter on the WebSocket layer.

Single typed @Tool method:

MethodIdempotent
shellExecute(java.lang.String)false (arbitrary commands may mutate state)
Since:
0.5.7 (Phase 3b — server-tool migration to function shape, see #188)
  • Constructor Details

    • ServerShellTools

      public ServerShellTools(Path workingDirectory)
    • ServerShellTools

      public ServerShellTools(Path workingDirectory, long timeoutSeconds)
  • Method Details

    • shellExecute

      @Tool(name="shell", description="Execute a shell command in the project directory. Returns a JSON {stdout, stderr, exitCode}. Path traversal (../) is blocked. {sudo, su, doas, pkexec, runas} are always rejected. The dispatcher\'s approval filter checks risk level (READ_ONLY / BUILD_TEST / WRITE / DESTRUCTIVE / NETWORK / UNKNOWN) before execution.", keywords={"shell","exec","command","bash","process"}, idempotent=false) public String shellExecute(@ToolParam(description="Shell command to execute") String command) throws IOException, InterruptedException
      Throws:
      IOException
      InterruptedException
    • classifyCommand

      public static ToolRisk classifyCommand(String command)
      Risk classification (preserved verbatim from legacy ShellTool).