(event: UiEvent)
| 104 | #lastPromptTokenCount = 0; |
| 105 | |
| 106 | addEvent(event: UiEvent) { |
| 107 | switch (event['event.name']) { |
| 108 | case EVENT_API_RESPONSE: |
| 109 | this.processApiResponse(event); |
| 110 | break; |
| 111 | case EVENT_API_ERROR: |
| 112 | this.processApiError(event); |
| 113 | break; |
| 114 | case EVENT_TOOL_CALL: |
| 115 | this.processToolCall(event); |
| 116 | break; |
| 117 | default: |
| 118 | // We should not emit update for any other event metric. |
| 119 | return; |
| 120 | } |
| 121 | |
| 122 | this.emit('update', { |
| 123 | metrics: this.#metrics, |
| 124 | lastPromptTokenCount: this.#lastPromptTokenCount, |
| 125 | }); |
| 126 | } |
| 127 | |
| 128 | getMetrics(): SessionMetrics { |
| 129 | return this.#metrics; |
no test coverage detected