(output string)
| 170 | } |
| 171 | |
| 172 | func parseOpenclawCronCount(output string) (int, error) { |
| 173 | if strings.TrimSpace(output) == "" { |
| 174 | return 0, nil |
| 175 | } |
| 176 | var payload interface{} |
| 177 | if err := json.Unmarshal([]byte(strings.TrimSpace(output)), &payload); err != nil { |
| 178 | return 0, err |
| 179 | } |
| 180 | switch value := payload.(type) { |
| 181 | case []interface{}: |
| 182 | return len(value), nil |
| 183 | case map[string]interface{}: |
| 184 | if total, ok := value["total"].(float64); ok { |
| 185 | return int(total), nil |
| 186 | } |
| 187 | if jobs, ok := value["jobs"].([]interface{}); ok { |
| 188 | return len(jobs), nil |
| 189 | } |
| 190 | return len(value), nil |
| 191 | default: |
| 192 | return 0, nil |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | func countOpenclawSessions(payload interface{}) int { |
| 197 | switch value := payload.(type) { |
no outgoing calls
no test coverage detected