(input: { messages: MessageV2.WithParts[] })
| 184 | ) |
| 185 | |
| 186 | async function computeDiff(input: { messages: MessageV2.WithParts[] }) { |
| 187 | let from: string | undefined |
| 188 | let to: string | undefined |
| 189 | |
| 190 | // scan assistant messages to find earliest from and latest to |
| 191 | // snapshot |
| 192 | for (const item of input.messages) { |
| 193 | if (!from) { |
| 194 | for (const part of item.parts) { |
| 195 | if (part.type === "step-start" && part.snapshot) { |
| 196 | from = part.snapshot |
| 197 | break |
| 198 | } |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | for (const part of item.parts) { |
| 203 | if (part.type === "step-finish" && part.snapshot) { |
| 204 | to = part.snapshot |
| 205 | break |
| 206 | } |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | if (from && to) return Snapshot.diffFull(from, to) |
| 211 | return [] |
| 212 | } |
| 213 | } |
no outgoing calls
no test coverage detected