(job: JsonRecord)
| 107 | } |
| 108 | |
| 109 | function getPayloadText(job: JsonRecord): string { |
| 110 | const payload = asRecord(job.payload); |
| 111 | if (!payload) return ""; |
| 112 | |
| 113 | if (payload.kind === "agentTurn") { |
| 114 | return readString(payload.message) || ""; |
| 115 | } |
| 116 | |
| 117 | if (payload.kind === "systemEvent") { |
| 118 | return readString(payload.text) || ""; |
| 119 | } |
| 120 | |
| 121 | return ""; |
| 122 | } |
| 123 | |
| 124 | function summarizeText(text: string): string { |
| 125 | const normalized = text.replace(/\s+/g, " ").trim(); |
no test coverage detected