返回 DeepSeek-Reasonix
final_readiness_history.go
根目录 / desktop / final_readiness_history.go
1 package main
2
3 import (
4 "fmt"
5 "reasonix/internal/agent"
6 "reasonix/internal/event"
7 "reasonix/internal/provider"
8 "strings"
9 )
10
11 func historyLocalOnlyRows(m provider.Message) ([]HistoryMessage, bool) {
12 if !m.LocalOnly {
13 return nil, false
14 }
15 if m.ReadPause != nil {
16 return []HistoryMessage{{Role: "notice", Code: event.TurnOutcomeIncompleteRead, Level: "info", ReadPause: m.ReadPause}}, true
17 }
18 if m.ReadCompletion != nil {
19 return []HistoryMessage{{Role: "notice", Code: "read_completion", Level: "info", Content: "Partial read coverage was accepted for this turn.", Detail: formatReadCompletionDetail(m.ReadCompletion), ReadCompletion: m.ReadCompletion}}, true
20 }
21 if len(m.ProtocolRecovery) > 0 {
22 if r, ok := provider.DecodeProtocolRecovery(m.ProtocolRecovery); ok && r.State == "pending" {
23 return []HistoryMessage{{Role: "notice", Code: "protocol_recovery", Level: "info", Pending: true, ProtocolRecovery: &provider.ProtocolRecoveryAction{ID: r.ID}}}, true
24 }
25 return nil, true
26 }
27 if readiness := agent.HistoricalChecks(m.FinalReadinessRecovery); readiness != nil {
28 return []HistoryMessage{{Role: "notice", Code: agent.HistoricalChecksNoticeCode, Level: "info",
29 Content: agent.HistoricalChecksNoticeText, Readiness: readiness}}, true
30 }
31 return historySteerRows(m.Content, true)
32 }
33
34 func formatReadCompletionDetail(r *provider.ReadCompletion) string {
35 if r == nil {
36 return ""
37 }
38 parts := make([]string, 0, len(r.Reads))
39 for _, read := range r.Reads {
40 parts = append(parts, fmt.Sprintf("%s · %s · covered=%v", read.Path, read.Verdict, read.Covered))
41 }
42 return strings.Join(parts, "\n")
43 }
44
44 lines GO