返回 DeepSeek-Reasonix
session_preview_cached.go
根目录 / internal / agent / session_preview_cached.go
1 package agent
2
3 // SessionPreviewCached returns the preview line and user-turn count for one
4 // session, preferring the branch-meta sidecar when its counts are certified
5 // fresh and bound to the current transcript revision: no transcript decode.
6 // ok=false means the sidecar is absent or stale — the caller should fall
7 // back to SessionPreview's full decode.
8 func SessionPreviewCached(path string) (preview string, turns int, ok bool) {
9 meta, loaded, err := LoadBranchMeta(path)
10 if err != nil || !loaded {
11 return "", 0, false
12 }
13 if !sessionListingProjectionFresh(meta.SchemaVersion, meta.Turns, meta.Revision, meta.ListingRevision, meta.ContentDigest, meta.ListingContentDigest) {
14 return "", 0, false
15 }
16 return meta.Preview, meta.Turns, true
17 }
18
18 lines GO