Windows Shell-Ausführung: Temp-Script statt stdin/ShellArguments, background_execute Tool, konfigurierbarer Timeout

Execute-Tools (execute, background_execute, SessionEndpoint.HandleExec):
- Windows: Befehl in temp .cmd-Datei statt cmd.exe stdin (interaktiver Modus,
  &-Parsing, Mehr?-Prompt) oder ShellArguments (falsches \"-Escaping für cmd.exe)
- Linux: weiterhin stdin an /bin/bash (funktioniert zuverlässig)
- Script-Cleanup in allen Codepfaden (Success, Timeout, Error)

Neues Tool background_execute:
- Startet Prozesse losgelöst ohne Warten, gibt PID zurück
- Temp-Script-Ansatz: funktioniert auch mit mehrzeiligen Befehlen
- Windows: .cmd mit del "%~f0" (Selbstlöschung)
- Linux: .sh mit rm -f (Selbstlöschung)

Konfigurierbarer Execute-Timeout:
- Neues Server-Setting ExecuteTimeout (Default: 180s)
- IConfiguration in ToolService injected
- Tool-Description zeigt aktuellen Timeout dynamisch an

SessionEndpoint.HandleExec (foreground):
- Pipe-Deadlock-Fix: ReadToEndAsync vor WaitForExitAsync
- Gleicher Temp-Script-Ansatz wie ToolService

WorkspaceHelper.ShellArguments() entfernt (keine Aufrufer mehr)
This commit is contained in:
Meleki committed 2026-03-09 18:45:26 +01:00
1 parent 3e590a6d03
commit d6d7b6c04f
5 files changed
+102 -20

No files matched your search

-8
View File
@@ -40,14 +40,6 @@ public static class WorkspaceHelper
/// </summary>
internal static string ShellExecutable => IsWindows ? "cmd.exe" : "/bin/bash";
/// <summary>
/// Gibt die Shell-Argumente zurück um einen Befehl auszuführen.
/// Windows: /c "command", Linux: via stdin.
/// </summary>
internal static string ShellArguments(string command)
=> IsWindows ? $"/c \"{command.Replace("\"", "\\\"")}\"" : "";
/// <summary>
/// Löst den Workspace-Pfad einer Session auf.
/// session.Workspace ist relativ zum user.DefaultPath.