mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-19 00:15:05 +00:00
fix(sandbox): support write_file append in FsBridge (#650)
- Add appendMode bool param to FsBridge.WriteFile (>> vs >) - Pass appendMode through sandbox path in WriteFileTool - EditTool always uses overwrite mode (false) Closes #650
This commit is contained in:
1 parent
80c2c0e0ee
commit
72025698bb
3 files changed
+36
-23
No files matched your search
@@ -14,13 +14,13 @@ import (
|
||||
// EditTool performs search-and-replace edits on files.
|
||||
// Supports context file interceptor and sandbox routing.
|
||||
type EditTool struct {
|
||||
workspace string
|
||||
restrict bool
|
||||
deniedPrefixes []string // path prefixes to deny access to (e.g. .goclaw)
|
||||
sandboxMgr sandbox.Manager
|
||||
contextFileIntc *ContextFileInterceptor
|
||||
memIntc *MemoryInterceptor
|
||||
permStore store.ConfigPermissionStore // nil = no group write restriction
|
||||
workspace string
|
||||
restrict bool
|
||||
deniedPrefixes []string // path prefixes to deny access to (e.g. .goclaw)
|
||||
sandboxMgr sandbox.Manager
|
||||
contextFileIntc *ContextFileInterceptor
|
||||
memIntc *MemoryInterceptor
|
||||
permStore store.ConfigPermissionStore // nil = no group write restriction
|
||||
}
|
||||
|
||||
// DenyPaths adds path prefixes that edit must reject.
|
||||
@@ -215,7 +215,7 @@ func (t *EditTool) executeInSandbox(ctx context.Context, path, oldStr, newStr st
|
||||
return result
|
||||
}
|
||||
|
||||
if err := bridge.WriteFile(ctx, containerPath, newContent); err != nil {
|
||||
if err := bridge.WriteFile(ctx, containerPath, newContent, false); err != nil {
|
||||
return ErrorResult(fmt.Sprintf("failed to write file: %v", err) + MaybeFsBridgeHint(err))
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user