()
| 2196 | // ========================================================================= |
| 2197 | |
| 2198 | updateActivityPane(): void { |
| 2199 | const effectiveMode = this.resolveActivityPaneMode(); |
| 2200 | const tipKind = loadingTipKind(effectiveMode); |
| 2201 | // Pick a fresh loading tip when the loading kind changes. The same kind |
| 2202 | // covers waiting/tool (both moon spinners) and any intermediate thinking |
| 2203 | // phase, so a continuous burst of tool calls does not flip tips. Clear the |
| 2204 | // cache only when there is no loading UI at all. |
| 2205 | if (effectiveMode === 'idle' || effectiveMode === 'session' || effectiveMode === 'hidden') { |
| 2206 | this.currentLoadingTip = undefined; |
| 2207 | } else if ( |
| 2208 | tipKind !== undefined && |
| 2209 | (this.currentLoadingTip === undefined || this.currentLoadingTip.kind !== tipKind) |
| 2210 | ) { |
| 2211 | const previousTip = this.currentLoadingTip?.tip; |
| 2212 | this.currentLoadingTip = { |
| 2213 | kind: tipKind, |
| 2214 | tip: pickRandomWorkingTip(previousTip)?.text, |
| 2215 | }; |
| 2216 | } |
| 2217 | this.syncTerminalProgress(this.shouldShowTerminalProgress(effectiveMode)); |
| 2218 | const placeSpinnerInAgentSwarm = this.shouldPlaceActivitySpinnerInAgentSwarm(effectiveMode); |
| 2219 | const activityModeKey = `${effectiveMode}:${placeSpinnerInAgentSwarm ? 'swarm' : 'pane'}`; |
| 2220 | |
| 2221 | if ( |
| 2222 | activityModeKey === this.lastActivityMode && |
| 2223 | (effectiveMode === 'waiting' || effectiveMode === 'thinking' || effectiveMode === 'tool') |
| 2224 | ) { |
| 2225 | if (placeSpinnerInAgentSwarm) { |
| 2226 | this.syncAgentSwarmActivitySpinner(this.state.activitySpinner?.instance); |
| 2227 | } |
| 2228 | return; |
| 2229 | } |
| 2230 | |
| 2231 | this.lastActivityMode = activityModeKey; |
| 2232 | this.state.activityContainer.clear(); |
| 2233 | |
| 2234 | switch (effectiveMode) { |
| 2235 | case 'hidden': |
| 2236 | this.stopActivitySpinner(); |
| 2237 | this.syncAgentSwarmActivitySpinner(undefined); |
| 2238 | this.state.ui.requestRender(); |
| 2239 | return; |
| 2240 | case 'waiting': { |
| 2241 | const spinner = this.ensureActivitySpinner('moon'); |
| 2242 | this.syncAgentSwarmActivitySpinner(placeSpinnerInAgentSwarm ? spinner : undefined); |
| 2243 | if (placeSpinnerInAgentSwarm) break; |
| 2244 | this.state.activityContainer.addChild( |
| 2245 | new ActivityPaneComponent({ |
| 2246 | mode: 'waiting', |
| 2247 | spinner, |
| 2248 | tip: this.currentLoadingTip?.tip, |
| 2249 | }), |
| 2250 | ); |
| 2251 | break; |
| 2252 | } |
| 2253 | case 'thinking': { |
| 2254 | this.stopActivitySpinner(); |
| 2255 | this.syncAgentSwarmActivitySpinner(undefined); |
no test coverage detected