@dreb/coding-agent 2.21.0 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1977,6 +1977,12 @@ export class InteractiveMode {
1977
1977
  this.ui.requestRender();
1978
1978
  }
1979
1979
  else if (event.message.role === "assistant") {
1980
+ // Defensive: remove stale streaming component if one exists (e.g. missed stream_retry)
1981
+ if (this.streamingComponent) {
1982
+ this.chatContainer.removeChild(this.streamingComponent);
1983
+ this.streamingComponent = undefined;
1984
+ this.streamingMessage = undefined;
1985
+ }
1980
1986
  this.streamingComponent = new AssistantMessageComponent(undefined, this.hideThinkingBlock, this.getMarkdownThemeWithSettings());
1981
1987
  this.streamingMessage = event.message;
1982
1988
  this.chatContainer.addChild(this.streamingComponent);
@@ -2086,11 +2092,15 @@ export class InteractiveMode {
2086
2092
  break;
2087
2093
  }
2088
2094
  case "agent_end":
2095
+ if (this.retryLoader) {
2096
+ this.retryLoader.stop();
2097
+ this.retryLoader = undefined;
2098
+ }
2089
2099
  if (this.loadingAnimation) {
2090
2100
  this.loadingAnimation.stop();
2091
2101
  this.loadingAnimation = undefined;
2092
- this.statusContainer.clear();
2093
2102
  }
2103
+ this.statusContainer.clear();
2094
2104
  if (this.streamingComponent) {
2095
2105
  this.chatContainer.removeChild(this.streamingComponent);
2096
2106
  this.streamingComponent = undefined;
@@ -2189,6 +2199,33 @@ export class InteractiveMode {
2189
2199
  this.ui.requestRender();
2190
2200
  break;
2191
2201
  }
2202
+ case "stream_retry": {
2203
+ // Remove the ghost streaming component left from the dropped stream
2204
+ if (this.streamingComponent) {
2205
+ this.chatContainer.removeChild(this.streamingComponent);
2206
+ this.streamingComponent = undefined;
2207
+ this.streamingMessage = undefined;
2208
+ }
2209
+ // Clear any pending tool components from the failed partial
2210
+ for (const [, component] of this.pendingTools.entries()) {
2211
+ this.chatContainer.removeChild(component);
2212
+ }
2213
+ this.pendingTools.clear();
2214
+ // Show retry status
2215
+ this.statusContainer.clear();
2216
+ if (this.loadingAnimation) {
2217
+ this.loadingAnimation.stop();
2218
+ this.loadingAnimation = undefined;
2219
+ }
2220
+ if (this.retryLoader) {
2221
+ this.retryLoader.stop();
2222
+ this.retryLoader = undefined;
2223
+ }
2224
+ this.retryLoader = new Loader(this.ui, (spinner) => theme.fg("warning", spinner), (text) => theme.fg("muted", text), `Stream dropped, retrying (${event.attempt}/${event.maxAttempts})... (${keyText("app.interrupt")} to cancel)`);
2225
+ this.statusContainer.addChild(this.retryLoader);
2226
+ this.ui.requestRender();
2227
+ break;
2228
+ }
2192
2229
  case "background_agent_start":
2193
2230
  case "background_agent_end": {
2194
2231
  this.updateBackgroundAgentStatus();