| 12 | const TASK_HISTORY_WAIT_TIMEOUT_MS = 2_000 |
| 13 | |
| 14 | function extractTaskHistory(message: ExtensionMessage): HistoryItem[] | undefined { |
| 15 | if (message.type === "state" && Array.isArray(message.state?.taskHistory)) { |
| 16 | return message.state.taskHistory as HistoryItem[] |
| 17 | } |
| 18 | |
| 19 | if (message.type === "taskHistoryUpdated" && Array.isArray(message.taskHistory)) { |
| 20 | return message.taskHistory as HistoryItem[] |
| 21 | } |
| 22 | |
| 23 | return undefined |
| 24 | } |
| 25 | |
| 26 | function getMostRecentTaskId(taskHistory: HistoryItem[], workspacePath: string): string | undefined { |
| 27 | const workspaceTasks = taskHistory.filter( |