summaryrefslogtreecommitdiffhomepage
path: root/internal/llm/tools/patch.go
diff options
context:
space:
mode:
authoradamdottv <[email protected]>2025-05-12 09:44:56 -0500
committeradamdottv <[email protected]>2025-05-12 09:44:56 -0500
commitdfe5fd8d970f76af9db0a7bf9a1e6f0bc01a291c (patch)
treeebf8123a492626a31b7767b18a60594879cd70b0 /internal/llm/tools/patch.go
parented9fba99c9e230094ed5d468c88f81469d60c911 (diff)
downloadopencode-dfe5fd8d970f76af9db0a7bf9a1e6f0bc01a291c.tar.gz
opencode-dfe5fd8d970f76af9db0a7bf9a1e6f0bc01a291c.zip
wip: refactoring
Diffstat (limited to 'internal/llm/tools/patch.go')
-rw-r--r--internal/llm/tools/patch.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/llm/tools/patch.go b/internal/llm/tools/patch.go
index e0c0bf5bc..d70e6a451 100644
--- a/internal/llm/tools/patch.go
+++ b/internal/llm/tools/patch.go
@@ -193,6 +193,7 @@ func (p *patchTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error
dir := filepath.Dir(path)
patchDiff, _, _ := diff.GenerateDiff("", *change.NewContent, path)
p := p.permissions.Request(
+ ctx,
permission.CreatePermissionRequest{
SessionID: sessionID,
Path: dir,
@@ -220,6 +221,7 @@ func (p *patchTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error
patchDiff, _, _ := diff.GenerateDiff(currentContent, newContent, path)
dir := filepath.Dir(path)
p := p.permissions.Request(
+ ctx,
permission.CreatePermissionRequest{
SessionID: sessionID,
Path: dir,
@@ -239,6 +241,7 @@ func (p *patchTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error
dir := filepath.Dir(path)
patchDiff, _, _ := diff.GenerateDiff(*change.OldContent, "", path)
p := p.permissions.Request(
+ ctx,
permission.CreatePermissionRequest{
SessionID: sessionID,
Path: dir,
@@ -313,7 +316,7 @@ func (p *patchTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error
totalRemovals += removals
// Update history
- file, err := p.files.GetByPathAndSession(ctx, absPath, sessionID)
+ file, err := p.files.GetLatestByPathAndSession(ctx, absPath, sessionID)
if err != nil && change.Type != diff.ActionAdd {
// If not adding a file, create history entry for existing file
_, err = p.files.Create(ctx, sessionID, absPath, oldContent)