(data map[string]any)
| 945 | } |
| 946 | |
| 947 | func taskRecordFromMap(data map[string]any) *AgentTaskRecord { |
| 948 | b, _ := json.Marshal(data) |
| 949 | record := &AgentTaskRecord{} |
| 950 | _ = json.Unmarshal(b, record) |
| 951 | if record.TaskID == "" { |
| 952 | record.TaskID = fmt.Sprintf("task-%s", uuid.NewString()[:8]) |
| 953 | } |
| 954 | if record.ParentScopeID == "" { |
| 955 | record.ParentScopeID = "main" |
| 956 | } |
| 957 | if record.AgentType == "" { |
| 958 | record.AgentType = "general-purpose" |
| 959 | } |
| 960 | if record.Status == "" { |
| 961 | record.Status = "interrupted" |
| 962 | } |
| 963 | if record.CreatedAt == 0 { |
| 964 | record.CreatedAt = nowSeconds() |
| 965 | } |
| 966 | if record.UpdatedAt == 0 { |
| 967 | record.UpdatedAt = nowSeconds() |
| 968 | } |
| 969 | return record |
| 970 | } |
| 971 | |
| 972 | func firstNonEmptyString(values ...string) string { |
| 973 | for _, value := range values { |
no test coverage detected