Use consistent plain-language snapshot reasons
This commit is contained in:
@@ -371,7 +371,7 @@ private struct SnapWhere: View {
|
||||
HStack(spacing: 0) {
|
||||
Text("snapshot #\(n)")
|
||||
if let snap {
|
||||
Text(" · \(snap.trigger.rawValue) · \(clockText(snap.createdAt))")
|
||||
Text(" · \(snap.reason) · \(clockText(snap.createdAt))")
|
||||
}
|
||||
Text(" · ")
|
||||
step(n - 1, "← #\(n - 1)", snaps)
|
||||
|
||||
@@ -1929,7 +1929,7 @@ private struct SnapshotRow: View {
|
||||
}
|
||||
.font(Fonts.font(11))
|
||||
.foregroundStyle(Palette.muted)
|
||||
.help("\(snap.trigger.rawValue.replacingOccurrences(of: "_", with: " ")) · \(time)")
|
||||
.help("\(snap.reason) · \(time)")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -165,6 +165,21 @@ func isoText(_ date: Date) -> String {
|
||||
date.formatted(Date.ISO8601FormatStyle(includingFractionalSeconds: true))
|
||||
}
|
||||
|
||||
extension Snapshot {
|
||||
var reason: String {
|
||||
switch trigger {
|
||||
case .message: "agent message"
|
||||
case .turnEnd: "turn ended"
|
||||
case .toolCall: "tool call"
|
||||
case .askHuman: "question asked"
|
||||
case .timer: "periodic snapshot"
|
||||
case .requested: "snapshot requested"
|
||||
case .answer: "before delivering an answer"
|
||||
case .fork: "before forking"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func clockText(_ d: Date) -> String {
|
||||
d.formatted(Date.VerbatimFormatStyle(format: "\(hour: .twoDigits(clock: .twentyFourHour, hourCycle: .zeroBased)):\(minute: .twoDigits):\(second: .twoDigits)", timeZone: .current, calendar: .current))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user