Skip to content

Commit 1787834

Browse files
committed
Filesystem only has a working directory
This removes the "allowed directories" from this toolset, the idea is that, since we already have "add_allowed_directory" the idea of allowed dirs in this toolset doesn't really make sense. People should use containers for these things Signed-off-by: Djordje Lukic <[email protected]>
1 parent ceca780 commit 1787834

14 files changed

+473
-587
lines changed

e2e/cagent_exec_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func TestExec_OpenAI(t *testing.T) {
2121
func TestExec_OpenAI_ToolCall(t *testing.T) {
2222
out := cagentExec(t, "testdata/fs_tools.yaml", "How many files in testdata/working_dir? Only output the number.")
2323

24-
require.Equal(t, "\n--- Agent: root ---\n\nCalling search_files(\n path: \"testdata/working_dir\"\n pattern: \"*\"\n)\n\nsearch_files response → \"1 files found:\\ntestdata/working_dir/README.me\"\n1", out)
24+
require.Equal(t, "\n--- Agent: root ---\n\nCalling list_directory(path: \"testdata/working_dir\")\n\nlist_directory response → \"FILE README.me\\n\"\n1", out)
2525
}
2626

2727
func TestExec_OpenAI_HideToolCalls(t *testing.T) {
@@ -81,7 +81,7 @@ func TestExec_Mistral(t *testing.T) {
8181
func TestExec_Mistral_ToolCall(t *testing.T) {
8282
out := cagentExec(t, "testdata/fs_tools.yaml", "--model=mistral/mistral-small", "How many files in testdata/working_dir? Only output the number.")
8383

84-
require.Equal(t, "\n--- Agent: root ---\n\nCalling list_directory(path: \"testdata/working_dir\")\n\nlist_directory response → \"FILE README.me\\n\"\n1", out)
84+
require.Equal(t, "\n--- Agent: root ---\n\nCalling list_directory(path: \"testdata/working_dir\")\n\nlist_directory response → \"FILE README.me\\n\"\n2", out)
8585
}
8686

8787
func TestExec_ToolCallsNeedAcceptance(t *testing.T) {

e2e/testdata/cassettes/TestExec_Anthropic_ToolCall.yaml

Lines changed: 88 additions & 40 deletions
Large diffs are not rendered by default.

e2e/testdata/cassettes/TestExec_Gemini_ToolCall.yaml

Lines changed: 48 additions & 46 deletions
Large diffs are not rendered by default.

e2e/testdata/cassettes/TestExec_Mistral_ToolCall.yaml

Lines changed: 54 additions & 40 deletions
Large diffs are not rendered by default.

e2e/testdata/cassettes/TestExec_OpenAI_HideToolCalls.yaml

Lines changed: 76 additions & 40 deletions
Large diffs are not rendered by default.

e2e/testdata/cassettes/TestExec_OpenAI_ToolCall.yaml

Lines changed: 76 additions & 40 deletions
Large diffs are not rendered by default.

e2e/testdata/cassettes/TestExec_ToolCallsNeedAcceptance.yaml

Lines changed: 82 additions & 40 deletions
Large diffs are not rendered by default.

pkg/acp/filesystem.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ var _ tools.ToolSet = (*FilesystemToolset)(nil)
4141
// NewFilesystemToolset creates a new ACP-specific filesystem toolset
4242
func NewFilesystemToolset(agent *Agent, workingDir string, opts ...builtin.FileSystemOpt) *FilesystemToolset {
4343
return &FilesystemToolset{
44-
FilesystemTool: builtin.NewFilesystemTool([]string{workingDir}, opts...),
44+
FilesystemTool: builtin.NewFilesystemTool(workingDir, opts...),
4545
agent: agent,
4646
workindgDir: workingDir,
4747
}

pkg/creator/agent.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Can you explain to me what the agent will be used for?`,
111111

112112
// Custom tool registry to include fsToolset
113113
fsToolset := fsToolset{
114-
inner: builtin.NewFilesystemTool([]string{runConfig.WorkingDir}),
114+
inner: builtin.NewFilesystemTool(runConfig.WorkingDir),
115115
}
116116

117117
registry := teamloader.NewDefaultToolsetRegistry()

pkg/fsx/collect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func CollectFiles(paths []string, shouldIgnore func(path string) bool) ([]string
4444

4545
if info.IsDir() {
4646
// Use DirectoryTree to collect files from directory
47-
tree, err := DirectoryTree(normalized, func(string) error { return nil }, shouldIgnore, 0)
47+
tree, err := DirectoryTree(normalized, shouldIgnore, 0)
4848
if err != nil {
4949
return nil, fmt.Errorf("failed to read directory %s: %w", normalized, err)
5050
}

0 commit comments

Comments
 (0)