返回 DeepSeek-Reasonix
tool_call_plan.go
根目录 / internal / agent / tool_call_plan.go
1 package agent
2
3 import (
4 "context"
5 "encoding/json"
6
7 "reasonix/internal/evidence"
8 "reasonix/internal/provider"
9 "reasonix/internal/tool"
10 )
11
12 // toolCallPlan is the resolved, policy-checked state owned by one executeOne.
13 type toolCallPlan struct {
14 call provider.ToolCall
15 tool tool.Tool
16 canonicalName string
17 permName string
18 permArgs json.RawMessage
19 execTool tool.Tool
20 execArgs json.RawMessage
21 evidenceName string
22 evidenceArgs json.RawMessage
23 readOnly bool
24 resolved tool.ResolvedCall
25 resolvedMeta *tool.ResolvedCall
26 effects evidence.ToolEffects
27 profile evidence.EffectProfile
28 verification bool
29 runTool tool.Tool
30 runArgs json.RawMessage
31 // readTaskID is the logical read a continuation call joined, empty for a
32 // fresh read.
33 readTaskID string
34 readEnvelope *tool.ReadResultEnvelope
35 readActiveMillis int64
36 readSnapshot string
37 expectedWriteSource tool.EvidenceTargetInfo
38 cctx context.Context
39 // mcpApp collects the call's Apps presentation from the executing tool.
40 mcpApp *tool.MCPAppResult
41 presentedFiles func() []tool.PresentedFile
42 releaseParentWrite, releaseMutationWrite, releaseLease func()
43 mutationPath string
44 mutationObserved, mutationAfterDone, executed bool
45 hooksMayMutateWorkspace bool
46 perCallWriteRoots []string
47 skipOrdinaryGate bool
48 permissionPreset string
49 }
50
51 func cloneEvidenceTarget(target tool.EvidenceTargetInfo) tool.EvidenceTargetInfo {
52 target.Ranges = append([]tool.ReadRange(nil), target.Ranges...)
53 target.Hashes = append([]string(nil), target.Hashes...)
54 return target
55 }
56
57 func (p *toolCallPlan) classifyEffects() {
58 p.effects = evidence.ClassifyToolCall(p.evidenceName, p.evidenceArgs, p.readOnly)
59 }
60
60 lines GO