feat(task): 暴露任务取消控制状态

This commit is contained in:
chengcheng
2026-06-25 17:01:32 +08:00
parent 6089aa6085
commit f4e1db1279
4 changed files with 49 additions and 0 deletions
+4
View File
@@ -1598,6 +1598,10 @@ func boolValue(body map[string]any, key string) bool {
func (s *Server) getTask(w http.ResponseWriter, r *http.Request) {
task, err := s.store.GetTask(r.Context(), r.PathValue("taskID"))
if err == nil {
cancelState := runner.DescribeTaskCancellation(task)
task.Cancellable = &cancelState.Cancellable
task.Submitted = &cancelState.Submitted
task.Message = cancelState.Message
writeJSON(w, http.StatusOK, task)
return
}