(task: OpenADETask, limit = 40)
| 135 | } |
| 136 | |
| 137 | function recentSnapshotFiles(task: OpenADETask, limit = 40): string[] { |
| 138 | const summaries: string[] = [] |
| 139 | const seen = new Set<string>() |
| 140 | |
| 141 | for (let index = task.events.length - 1; index >= 0 && summaries.length < limit; index--) { |
| 142 | const record = eventRecord(task.events[index]) |
| 143 | if (record?.type !== "snapshot") continue |
| 144 | const files = Array.isArray(record.files) ? record.files : [] |
| 145 | for (const value of files) { |
| 146 | const file = eventRecord(value) |
| 147 | if (!file) continue |
| 148 | const filePath = typeof file.path === "string" ? file.path : undefined |
| 149 | const status = typeof file.status === "string" ? file.status : undefined |
| 150 | if (!filePath || !status) continue |
| 151 | const oldPath = typeof file.oldPath === "string" ? file.oldPath : undefined |
| 152 | const summary = status === "renamed" && oldPath ? `renamed: ${oldPath} -> ${filePath}` : `${status}: ${filePath}` |
| 153 | if (seen.has(summary)) continue |
| 154 | seen.add(summary) |
| 155 | summaries.push(summary) |
| 156 | if (summaries.length >= limit) break |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | return summaries |
| 161 | } |
| 162 | |
| 163 | function notifyTaskChanged(server: RuntimeServer | undefined, repoId: string, taskId: string): void { |
| 164 | if (!server) return |
no test coverage detected