Package com.tnsai.server.tools
Class ServerShellTools
java.lang.Object
com.tnsai.server.tools.ServerShellTools
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:
| Method | Idempotent |
|---|---|
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 Summary
ConstructorsConstructorDescriptionServerShellTools(Path workingDirectory) ServerShellTools(Path workingDirectory, long timeoutSeconds) -
Method Summary
Modifier and TypeMethodDescriptionstatic ToolRiskclassifyCommand(String command) Risk classification (preserved verbatim from legacy ShellTool).shellExecute(String command)
-
Constructor Details
-
ServerShellTools
-
ServerShellTools
-
-
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:
IOExceptionInterruptedException
-
classifyCommand
Risk classification (preserved verbatim from legacy ShellTool).
-