From 70111a941bb353371eeddf68b32d4c44b7a60aea Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Mar 2026 01:02:10 +0000 Subject: [PATCH 1/2] Initial plan From f0626747cc94ec2310c96c720cb462c9f462c085 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Mar 2026 01:05:03 +0000 Subject: [PATCH 2/2] test: fix read_dir callback expectations Co-authored-by: sawka <2722291+sawka@users.noreply.github.com> --- pkg/aiusechat/tools_readdir_test.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pkg/aiusechat/tools_readdir_test.go b/pkg/aiusechat/tools_readdir_test.go index 7560a73a4d..7d91f7dfca 100644 --- a/pkg/aiusechat/tools_readdir_test.go +++ b/pkg/aiusechat/tools_readdir_test.go @@ -11,6 +11,7 @@ import ( "testing" "github.com/wavetermdev/waveterm/pkg/aiusechat/uctypes" + "github.com/wavetermdev/waveterm/pkg/util/fileutil" ) func TestReadDirCallback(t *testing.T) { @@ -64,16 +65,16 @@ func TestReadDirCallback(t *testing.T) { t.Errorf("Expected 3 entries, got %d", entryCount) } - entries, ok := resultMap["entries"].([]map[string]any) + entries, ok := resultMap["entries"].([]fileutil.DirEntryOut) if !ok { - t.Fatalf("entries is not a slice of maps") + t.Fatalf("entries is not a slice of DirEntryOut") } // Check that we have the expected entries foundFiles := 0 foundDirs := 0 for _, entry := range entries { - if entry["is_dir"].(bool) { + if entry.Dir { foundDirs++ } else { foundFiles++ @@ -208,12 +209,15 @@ func TestReadDirSortBeforeTruncate(t *testing.T) { } resultMap := result.(map[string]any) - entries := resultMap["entries"].([]map[string]any) + entries, ok := resultMap["entries"].([]fileutil.DirEntryOut) + if !ok { + t.Fatalf("entries is not a slice of DirEntryOut") + } // Count directories in the result dirCount := 0 for _, entry := range entries { - if entry["is_dir"].(bool) { + if entry.Dir { dirCount++ } } @@ -225,7 +229,7 @@ func TestReadDirSortBeforeTruncate(t *testing.T) { // First 3 entries should be directories for i := 0; i < 3; i++ { - if !entries[i]["is_dir"].(bool) { + if !entries[i].Dir { t.Errorf("Expected entry %d to be a directory, but it was a file", i) } }