返回 DeepSeek-Reasonix
scratch_scope.go
根目录 / internal / agent / scratch_scope.go
1 package agent
2
3 import (
4 "strings"
5
6 "reasonix/internal/evidence"
7 )
8
9 func (a *Agent) scratchRoots() []string {
10 if a == nil || a.svc.sessionTemp == nil {
11 return nil
12 }
13 dir := strings.TrimSpace(a.svc.sessionTemp.Dir())
14 if dir == "" {
15 return nil
16 }
17 return []string{dir}
18 }
19
20 func (a *Agent) stampReceiptDeliveryScope(rec *evidence.Receipt) {
21 if a == nil || rec == nil || !rec.Success || !(rec.Mutation || rec.Write) {
22 return
23 }
24 roots := a.scratchRoots()
25 if len(rec.Paths) > 0 {
26 for _, path := range rec.Paths {
27 if evidence.ClassifyWriteScope(path, a.writeWorkspaceRoot, roots) != evidence.WriteScopeScratch {
28 return
29 }
30 }
31 rec.DeliveryScope = evidence.WriteScopeScratch
32 return
33 }
34 }
35
35 lines GO