* Updates a task in the task history and optionally broadcasts the updated history to the webview. * Now delegates to TaskHistoryStore for per-task file persistence. * * @param item The history item to update or add * @param options.broadcast Whether to broadcast the updated history to the w
(item: HistoryItem, options: { broadcast?: boolean } = {})
| 2701 | * @returns The updated task history array |
| 2702 | */ |
| 2703 | async updateTaskHistory(item: HistoryItem, options: { broadcast?: boolean } = {}): Promise<HistoryItem[]> { |
| 2704 | const { broadcast = true } = options |
| 2705 | |
| 2706 | const history = await this.taskHistoryStore.upsert(item) |
| 2707 | this.recentTasksCache = undefined |
| 2708 | |
| 2709 | // Broadcast the updated history to the webview if requested. |
| 2710 | // Prefer per-item updates to avoid repeatedly cloning/sending the full history. |
| 2711 | if (broadcast && this.isViewLaunched) { |
| 2712 | const updatedItem = this.taskHistoryStore.get(item.id) ?? item |
| 2713 | await this.postMessageToWebview({ type: "taskHistoryItemUpdated", taskHistoryItem: updatedItem }) |
| 2714 | } |
| 2715 | |
| 2716 | return history |
| 2717 | } |
| 2718 | |
| 2719 | /** |
| 2720 | * Schedule a debounced write-through of task history to globalState. |
no test coverage detected