feat: integrate MinIO-backed user filesystem
This commit is contained in:
@ -6,7 +6,7 @@ import os
|
||||
from pathlib import Path
|
||||
|
||||
from beaver.tools import ObjectBackedTool, ToolContext
|
||||
from beaver.tools.builtins import ListDirectoryTool, ReadFileTool, SearchFilesTool
|
||||
from beaver.tools.builtins import ListDirectoryTool, PatchFileTool, ReadFileTool, SearchFilesTool, WriteFileTool
|
||||
|
||||
|
||||
def _run_tool(tool, arguments: dict, workspace: Path):
|
||||
@ -127,3 +127,23 @@ def test_read_file_rejects_binary_files(tmp_path: Path) -> None:
|
||||
assert payload["success"] is False
|
||||
assert "binary" in payload["error"]
|
||||
|
||||
|
||||
def test_workspace_tools_reject_user_file_virtual_paths(tmp_path: Path) -> None:
|
||||
workspace = tmp_path / "workspace"
|
||||
workspace.mkdir()
|
||||
|
||||
read = _run_tool(ReadFileTool(), {"path": "uploads/get_helm.sh"}, workspace)
|
||||
listed = _run_tool(ListDirectoryTool(), {"path": "outputs"}, workspace)
|
||||
written = _run_tool(WriteFileTool(), {"path": "shared/profile.json", "content": "{}"}, workspace)
|
||||
patched = _run_tool(
|
||||
PatchFileTool(),
|
||||
{"path": "tasks/task-123/draft.md", "old_text": "a", "new_text": "b"},
|
||||
workspace,
|
||||
)
|
||||
|
||||
for result in (read, listed, written, patched):
|
||||
payload = _payload(result)
|
||||
assert result.success is False
|
||||
assert payload["success"] is False
|
||||
assert "personal agent file system path" in payload["error"]
|
||||
assert "user_files_read" in payload["error"]
|
||||
|
||||
Reference in New Issue
Block a user