Expose recorded background task timing and progress metadata
This commit is contained in:
@@ -51,7 +51,19 @@ func (c *Chat) recordCommand(thread string, i item, emit bool) {
|
||||
status = protocol.ChatShellRunning
|
||||
}
|
||||
snapshot := old
|
||||
snapshot.shell = protocol.ChatShell{ID: id, Command: i.Command, Status: status, Exit: i.ExitCode}
|
||||
snapshot.shell.ID, snapshot.shell.Status = id, status
|
||||
snapshot.shell.Command, snapshot.shell.Exit = i.Command, i.ExitCode
|
||||
snapshot.shell.TaskType = "command"
|
||||
if i.startedAtMS > 0 && i.startedAtMS <= 8640000000000000 && snapshot.shell.StartedAt == 0 {
|
||||
snapshot.shell.StartedAt = i.startedAtMS
|
||||
}
|
||||
if i.completedAtMS > snapshot.shell.UpdatedAt && i.completedAtMS <= 8640000000000000 {
|
||||
snapshot.shell.UpdatedAt = i.completedAtMS
|
||||
}
|
||||
if i.DurationMS != nil && *i.DurationMS >= 0 && (snapshot.shell.DurationMS == nil || *i.DurationMS >= *snapshot.shell.DurationMS) {
|
||||
duration := *i.DurationMS
|
||||
snapshot.shell.DurationMS = &duration
|
||||
}
|
||||
if snapshot.shell.Command == "" {
|
||||
snapshot.shell.Command = old.shell.Command
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user