(jobId: string)
| 125 | } |
| 126 | |
| 127 | async function readCronRunLog(jobId: string): Promise<CronRunLogEntry[]> { |
| 128 | const logPath = join(getOpenClawConfigDir(), 'cron', 'runs', `${jobId}.jsonl`); |
| 129 | const raw = await readFile(logPath, 'utf8').catch(() => ''); |
| 130 | if (!raw.trim()) return []; |
| 131 | |
| 132 | const entries: CronRunLogEntry[] = []; |
| 133 | for (const line of raw.split(/\r?\n/)) { |
| 134 | const trimmed = line.trim(); |
| 135 | if (!trimmed) continue; |
| 136 | try { |
| 137 | const entry = JSON.parse(trimmed) as CronRunLogEntry; |
| 138 | if (!entry || entry.jobId !== jobId) continue; |
| 139 | if (entry.action && entry.action !== 'finished') continue; |
| 140 | entries.push(entry); |
| 141 | } catch { |
| 142 | // Ignore malformed log lines. |
| 143 | } |
| 144 | } |
| 145 | return entries; |
| 146 | } |
| 147 | |
| 148 | async function readSessionStoreEntry( |
| 149 | agentId: string, |
no test coverage detected