Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion adk/filesystem/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

// FileInfo represents basic file metadata information.
type FileInfo struct {
// Path is the absolute path of the file or directory.
// Path is the path of the file or directory, which can be a filename, relative path, or absolute path.
Path string
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 Breaking API Changes Detected

Package: github.com/cloudwego/eino/adk/middlewares/reduction

Incompatible changes:

  • New: removed
Review Guidelines

Please ensure that:

  • The changes are absolutely necessary
  • They are properly documented
  • Migration guides are provided if needed

⚠️ Please resolve this thread after reviewing the breaking changes.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 Breaking API Changes Detected

Package: github.com/cloudwego/eino/adk/middlewares/patchtoolcalls

Incompatible changes:

  • Config: removed
  • NewMiddleware: removed
Review Guidelines

Please ensure that:

  • The changes are absolutely necessary
  • They are properly documented
  • Migration guides are provided if needed

⚠️ Please resolve this thread after reviewing the breaking changes.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 Breaking API Changes Detected

Package: github.com/cloudwego/eino/adk/middlewares/skill

Incompatible changes:

  • NewChatModelAgentMiddleware: removed
Review Guidelines

Please ensure that:

  • The changes are absolutely necessary
  • They are properly documented
  • Migration guides are provided if needed

⚠️ Please resolve this thread after reviewing the breaking changes.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 Breaking API Changes Detected

Package: github.com/cloudwego/eino/adk/middlewares/filesystem

Incompatible changes:

  • New: removed
Review Guidelines

Please ensure that:

  • The changes are absolutely necessary
  • They are properly documented
  • Migration guides are provided if needed

⚠️ Please resolve this thread after reviewing the breaking changes.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 Breaking API Changes Detected

Package: github.com/cloudwego/eino/adk/middlewares/summarization

Incompatible changes:

  • Config.ModelOptions: removed
Review Guidelines

Please ensure that:

  • The changes are absolutely necessary
  • They are properly documented
  • Migration guides are provided if needed

⚠️ Please resolve this thread after reviewing the breaking changes.


// IsDir indicates whether the entry is a directory.
Expand Down
35 changes: 23 additions & 12 deletions adk/filesystem/backend_inmemory.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import (
"strings"
"sync"
"time"

"github.com/bmatcuk/doublestar/v4"
)

type fileEntry struct {
Expand Down Expand Up @@ -71,7 +73,7 @@ func (b *InMemoryBackend) LsInfo(ctx context.Context, req *LsInfoRequest) ([]Fil
// The path itself is a file
if !seen[normalizedFilePath] {
result = append(result, FileInfo{
Path: normalizedFilePath,
Path: filepath.Base(normalizedFilePath),
IsDir: false,
Size: int64(len(entry.content)),
ModifiedAt: entry.modifiedAt.Format(time.RFC3339Nano),
Expand All @@ -94,14 +96,14 @@ func (b *InMemoryBackend) LsInfo(ctx context.Context, req *LsInfoRequest) ([]Fil
if !seen[childPath] {
if isDir {
dirInfo[childPath] = &FileInfo{
Path: childPath,
Path: parts[0],
IsDir: true,
Size: 0,
ModifiedAt: entry.modifiedAt.Format(time.RFC3339Nano),
}
} else {
result = append(result, FileInfo{
Path: childPath,
Path: parts[0],
IsDir: false,
Size: int64(len(entry.content)),
ModifiedAt: entry.modifiedAt.Format(time.RFC3339Nano),
Expand Down Expand Up @@ -588,31 +590,40 @@ func (b *InMemoryBackend) GlobInfo(ctx context.Context, req *GlobInfoRequest) ([
defer b.mu.RUnlock()

basePath := normalizePath(req.Path)
isAbsolutePattern := strings.HasPrefix(req.Pattern, "/")

var result []FileInfo

for filePath, entry := range b.files {
normalizedFilePath := normalizePath(filePath)

if basePath != "/" && !strings.HasPrefix(normalizedFilePath, basePath+"/") && normalizedFilePath != basePath {
continue
}
var matchPath string
var resultPath string

var relativePath string
if basePath == "/" {
relativePath = strings.TrimPrefix(normalizedFilePath, "/")
if isAbsolutePattern {
matchPath = normalizedFilePath
resultPath = normalizedFilePath
} else {
relativePath = strings.TrimPrefix(normalizedFilePath, basePath+"/")
if basePath != "/" && !strings.HasPrefix(normalizedFilePath, basePath+"/") && normalizedFilePath != basePath {
continue
}

if basePath == "/" {
matchPath = strings.TrimPrefix(normalizedFilePath, "/")
} else {
matchPath = strings.TrimPrefix(normalizedFilePath, basePath+"/")
}
resultPath = matchPath
}

matched, err := filepath.Match(req.Pattern, relativePath)
matched, err := doublestar.Match(req.Pattern, matchPath)
if err != nil {
return nil, fmt.Errorf("invalid glob pattern: %w", err)
}

if matched {
result = append(result, FileInfo{
Path: normalizedFilePath,
Path: resultPath,
IsDir: false,
Size: int64(len(entry.content)),
ModifiedAt: entry.modifiedAt.Format(time.RFC3339Nano),
Expand Down
Loading