feat: Windows-Kompatibilität

- WorkspaceHelper: Zentrale Hilfsmethoden (IsWindows, TempDir, IsSubPathOf,
  GetRelativePath, ShellExecutable, ShellArguments)
- ToolService: execute nutzt cmd.exe auf Windows, GetRelativePath mit
  Forward-Slashes, IsSubPathOf für case-insensitive Pfadprüfung
- SessionEndpoint: /tmp → Path.GetTempPath(), bash → cmd.exe,
  Fire-and-forget via .bat statt systemd-run auf Windows
- ChatService: /tmp → WorkspaceHelper.TempDir
- MemoryService: IsSubPathOf + GetRelativePath
- WorkspaceEndpoint: HandleBrowse zeigt Laufwerke auf Windows,
  IsSubPathOf statt StartsWith
- InfoEndpoint: gott.exe auf Windows, isWindows-Flag in API-Response
- Frontend: File-Explorer mit Laufwerks-Navigation auf Windows
This commit is contained in:
Meleki committed 2026-03-09 11:35:04 +01:00
1 parent 79899a6981
commit 5d090e160b
9 files changed
+155 -61

No files matched your search

+4 -4
View File
@@ -81,7 +81,7 @@ public class MemoryService
? baseDir
: Path.GetFullPath(Path.Combine(baseDir, subPath));
if (!targetDir.StartsWith(baseDir))
if (!WorkspaceHelper.IsSubPathOf(targetDir, baseDir))
throw new Exception("Zugriff außerhalb des Memory-Verzeichnisses nicht erlaubt");
if (!Directory.Exists(targetDir))
@@ -89,9 +89,9 @@ public class MemoryService
var entries = new List<string>();
foreach (var dir in Directory.GetDirectories(targetDir))
entries.Add(Path.GetRelativePath(baseDir, dir) + "/");
entries.Add(WorkspaceHelper.GetRelativePath(baseDir, dir) + "/");
foreach (var file in Directory.GetFiles(targetDir))
entries.Add(Path.GetRelativePath(baseDir, file));
entries.Add(WorkspaceHelper.GetRelativePath(baseDir, file));
return entries;
}
@@ -148,7 +148,7 @@ public class MemoryService
{
var baseDir = GetAgentMemoryDir(agentId);
var full = Path.GetFullPath(Path.Combine(baseDir, fileName));
if (!full.StartsWith(baseDir))
if (!WorkspaceHelper.IsSubPathOf(full, baseDir))
return null;
return full;
}