返回 DeepSeek-Reasonix
recovery.go
根目录 / internal / control / recovery.go
1 package control
2
3 import (
4 "fmt"
5 "strings"
6 "unicode/utf8"
7
8 "reasonix/internal/agent"
9 "reasonix/internal/recovery"
10 )
11
12 // ResolveRecovery is retained as a wire-compatible endpoint for older clients.
13 // Auto Guard is retired: historical cards are read-only and cannot authorize or
14 // replay an operation.
15 func (c *Controller) ResolveRecovery(id string, action agent.RecoveryAction, feedback string) error {
16 c.promptResolveMu.Lock()
17 defer c.promptResolveMu.Unlock()
18 return c.resolveRecoveryLocked(id, action, feedback)
19 }
20
21 func (c *Controller) resolveRecoveryLocked(id string, action agent.RecoveryAction, feedback string) error {
22 return fmt.Errorf("recovery_retired: Auto Guard actions are read-only historical records and cannot confirm or replay operations")
23 }
24
25 func clipUTF8(s string, n int) string {
26 s = strings.TrimSpace(s)
27 if n <= 0 || len(s) <= n {
28 return s
29 }
30 for n > 0 && !utf8.RuneStart(s[n]) {
31 n--
32 }
33 return s[:n]
34 }
35
36 // These lifecycle methods remain as no-op source-compatibility hooks while old
37 // session containers and sidecars remain readable. They never construct a gate,
38 // restore an Episode, emit a prompt, or persist retired runtime state.
39 func (c *Controller) loadRecoveryState(string) {}
40 func (c *Controller) resetRecoveryForNewSession(string) {}
41 func (c *Controller) carryRecoveryState(string) {}
42 func (c *Controller) CarryRecoveryFrom(*Controller) {}
43 func (c *Controller) flushRecoveryPersistence(string) {}
44 func (c *Controller) saveRecoveryState(string) {}
45 func (c *Controller) ReplayUnresolvedRecoveries() {}
46
47 // RecoveryMetrics remains for consumers compiled against the old API. With no
48 // Auto Guard runtime it always reports zero.
49 func (c *Controller) RecoveryMetrics() recovery.Metrics { return recovery.Metrics{} }
50 func (c *Controller) DrainRecoveryMetrics() recovery.Metrics {
51 return recovery.Metrics{}
52 }
53
53 lines GO