* Clear all messages
()
| 1164 | * Clear all messages |
| 1165 | */ |
| 1166 | clear(): void { |
| 1167 | if (this.persistor) { |
| 1168 | this.persistor.snapshotClear({ |
| 1169 | messages: this.processor.getMessages(), |
| 1170 | activeRunIds: this.activeRunIds, |
| 1171 | currentRunId: this.currentRunId, |
| 1172 | }) |
| 1173 | if (this.isLoading) { |
| 1174 | this.cancelInFlightStream({ setReadyStatus: true }) |
| 1175 | this.resetSessionGenerating() |
| 1176 | } else if (this.activeRunIds.size > 0) { |
| 1177 | this.resetSessionGenerating() |
| 1178 | } |
| 1179 | // Suppress persisting the empty snapshot that clearMessages emits, then |
| 1180 | // remove the stored conversation outright. |
| 1181 | this.persistor.beginClear() |
| 1182 | } |
| 1183 | this.processor.clearMessages() |
| 1184 | this.persistor?.remove() |
| 1185 | this.setError(undefined) |
| 1186 | this.events.messagesCleared() |
| 1187 | } |
| 1188 | |
| 1189 | /** |
| 1190 | * Add the result of a client-side tool execution |
nothing calls this directly
no test coverage detected