返回 DeepSeek-Reasonix
diagnostic_json.go
根目录 / internal / control / diagnostic_json.go
1 package control
2
3 import (
4 "bytes"
5 "encoding/json"
6
7 "reasonix/internal/secrets"
8 "reasonix/internal/session"
9 )
10
11 // Shared by live and cold exports: textual redaction of serialized JSON can
12 // turn numeric token counters into unquoted redaction markers.
13 func marshalDiagnosticCommit(commit session.Commit) ([]byte, error) {
14 encoded, err := json.Marshal(commit)
15 if err != nil {
16 return nil, err
17 }
18 encoded, err = secrets.RedactJSON(encoded)
19 if err != nil {
20 return nil, err
21 }
22 var formatted bytes.Buffer
23 if err := json.Indent(&formatted, encoded, " ", " "); err != nil {
24 return nil, err
25 }
26 return formatted.Bytes(), nil
27 }
28
28 lines GO