* Collect all messages from iterateFullHistory into an array. * Usage rebuild needs every epoch for accurate totals.
(workspaceId: string)
| 101 | * Usage rebuild needs every epoch for accurate totals. |
| 102 | */ |
| 103 | private async collectFullHistory(workspaceId: string): Promise<MuxMessage[]> { |
| 104 | const messages: MuxMessage[] = []; |
| 105 | const result = await this.historyService.iterateFullHistory(workspaceId, "forward", (chunk) => { |
| 106 | messages.push(...chunk); |
| 107 | }); |
| 108 | if (!result.success) { |
| 109 | log.warn(`Failed to iterate history for ${workspaceId}: ${result.error}`); |
| 110 | return []; |
| 111 | } |
| 112 | return messages; |
| 113 | } |
| 114 | |
| 115 | private getFilePath(workspaceId: string): string { |
| 116 | return path.join(this.config.getSessionDir(workspaceId), this.SESSION_USAGE_FILE); |
no test coverage detected