返回 DeepSeek-Reasonix
contract_shadow.go
根目录 / internal / agent / contract_shadow.go
1 package agent
2
3 import (
4 "reasonix/internal/completion"
5 "reasonix/internal/event"
6 )
7
8 // emitTurnShadows records end-of-turn facts without a quality decision.
9 func (a *Agent) emitTurnShadows(input string) {
10 if a.task.ledger == nil {
11 return
12 }
13 rep := completion.BuildFacts(a.task.ledger, a.writeWorkspaceRoot, a.scratchRoots())
14 a.turn.completion = &rep
15 }
16
17 // CompletionReceipt returns the turn's completion record for the host to
18 // deliver, or nil when the turn had nothing to judge. The host renders it; the
19 // agent never writes the user-facing text, which is the whole point.
20 func (a *Agent) CompletionReceipt() *event.CompletionReceipt {
21 if a == nil {
22 return nil
23 }
24 if a.turn.completion == nil {
25 // Error/cancellation paths can leave before the normal shadow report.
26 // Preserve already-observed checks without changing execution policy.
27 return completionReceipt(completion.BuildFacts(a.task.ledger, a.writeWorkspaceRoot, a.scratchRoots()))
28 }
29 return completionReceipt(*a.turn.completion)
30 }
31
31 lines GO