(record SessionRecapRecord)
| 937 | } |
| 938 | |
| 939 | func sessionRecapBundle(record SessionRecapRecord) outputBundle { |
| 940 | return outputBundle{ |
| 941 | jsonValue: record, |
| 942 | human: func() (string, error) { |
| 943 | blocks := []string{ |
| 944 | renderHumanSection("Session Recap", []keyValue{ |
| 945 | {Label: sessionSessionValue, Value: stringOrDash(record.Session.ID)}, |
| 946 | {Label: sessionBadgeValue, Value: stringOrDash(string(record.Session.Badge))}, |
| 947 | {Label: "Markers", Value: strconv.Itoa(len(record.RecentMarkers))}, |
| 948 | {Label: "Messages", Value: strconv.Itoa(len(record.RecentMessages))}, |
| 949 | {Label: "Event Cursor", Value: strconv.FormatInt(record.Snapshot.EventCursor, 10)}, |
| 950 | {Label: "Consistency", Value: stringOrDash(record.Snapshot.Consistency)}, |
| 951 | }), |
| 952 | } |
| 953 | if len(record.RecentMarkers) > 0 { |
| 954 | items := make([]keyValue, 0, len(record.RecentMarkers)) |
| 955 | for _, marker := range record.RecentMarkers { |
| 956 | items = append(items, keyValue{ |
| 957 | Label: stringOrDash(marker.Kind), |
| 958 | Value: stringOrDash(marker.Summary), |
| 959 | }) |
| 960 | } |
| 961 | blocks = append(blocks, renderHumanSection("Recent Markers", items)) |
| 962 | } |
| 963 | return renderHumanBlocks(blocks...), nil |
| 964 | }, |
| 965 | toon: func() (string, error) { |
| 966 | return renderToonObject("recap", []string{ |
| 967 | sessionSessionIDKey, |
| 968 | sessionBadgeKey, |
| 969 | "markers", |
| 970 | sessionMessagesKey, |
| 971 | "event_cursor", |
| 972 | "consistency", |
| 973 | }, []string{ |
| 974 | record.Session.ID, |
| 975 | string(record.Session.Badge), |
| 976 | strconv.Itoa(len(record.RecentMarkers)), |
| 977 | strconv.Itoa(len(record.RecentMessages)), |
| 978 | strconv.FormatInt(record.Snapshot.EventCursor, 10), |
| 979 | record.Snapshot.Consistency, |
| 980 | }), nil |
| 981 | }, |
| 982 | } |
| 983 | } |
| 984 | |
| 985 | func sessionSandboxBackend(info SessionRecord) string { |
| 986 | if info.Sandbox == nil { |
no test coverage detected