fix(tools): keep send_file refs forget-only
Mark send_file media registrations as forget-only so cleanup drops the ref without deleting the original workspace file. Refs #1886
This commit is contained in:
parent
1ba6211cb6
commit
bbe127f7b0
2 changed files with 12 additions and 3 deletions
|
|
@ -136,6 +136,7 @@ func (t *SendFileTool) Execute(ctx context.Context, args map[string]any) *ToolRe
|
|||
Filename: filename,
|
||||
ContentType: mediaType,
|
||||
Source: "tool:send_file",
|
||||
CleanupPolicy: media.CleanupPolicyForgetOnly,
|
||||
}, scope)
|
||||
if err != nil {
|
||||
return ErrorResult(fmt.Sprintf("failed to register media: %v", err))
|
||||
|
|
|
|||
|
|
@ -104,6 +104,14 @@ func TestSendFileTool_Success(t *testing.T) {
|
|||
if result.Media[0][:8] != "media://" {
|
||||
t.Errorf("expected media:// ref, got %q", result.Media[0])
|
||||
}
|
||||
|
||||
_, meta, err := store.ResolveWithMeta(result.Media[0])
|
||||
if err != nil {
|
||||
t.Fatalf("ResolveWithMeta failed: %v", err)
|
||||
}
|
||||
if meta.CleanupPolicy != media.CleanupPolicyForgetOnly {
|
||||
t.Errorf("CleanupPolicy = %q, want %q", meta.CleanupPolicy, media.CleanupPolicyForgetOnly)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSendFileTool_CustomFilename(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue