centaurus-cli 2.9.6 → 2.9.7

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.
@@ -1797,19 +1797,43 @@ export const App = ({ onMessage, onCancelRequest, initialModel, initialPlanMode,
1797
1797
  }
1798
1798
  };
1799
1799
  }
1800
- // Update current message if it's a tool with matching name
1800
+ // Update tool in currentMessage if it matches
1801
+ let updatedCurrentMessage = prev.currentMessage;
1801
1802
  if (prev.currentMessage?.role === 'tool' &&
1802
- prev.currentMessage.toolExecution?.toolName === update.toolName) {
1803
+ prev.currentMessage.toolExecution?.toolName === update.toolName &&
1804
+ prev.currentMessage.toolExecution?.status === 'executing') {
1803
1805
  const existingOutput = prev.currentMessage.toolExecution.streamingOutput || '';
1804
- return {
1805
- ...prev,
1806
- currentMessage: {
1807
- ...prev.currentMessage,
1806
+ updatedCurrentMessage = {
1807
+ ...prev.currentMessage,
1808
+ toolExecution: {
1809
+ ...prev.currentMessage.toolExecution,
1810
+ streamingOutput: existingOutput + update.chunk
1811
+ }
1812
+ };
1813
+ }
1814
+ // Also update any matching executing tool in messageHistory
1815
+ let messageHistoryChanged = false;
1816
+ const updatedHistory = prev.messageHistory.map(msg => {
1817
+ if (msg.role === 'tool' &&
1818
+ msg.toolExecution?.toolName === update.toolName &&
1819
+ msg.toolExecution?.status === 'executing') {
1820
+ messageHistoryChanged = true;
1821
+ const existingOutput = msg.toolExecution.streamingOutput || '';
1822
+ return {
1823
+ ...msg,
1808
1824
  toolExecution: {
1809
- ...prev.currentMessage.toolExecution,
1825
+ ...msg.toolExecution,
1810
1826
  streamingOutput: existingOutput + update.chunk
1811
1827
  }
1812
- }
1828
+ };
1829
+ }
1830
+ return msg;
1831
+ });
1832
+ if (updatedCurrentMessage !== prev.currentMessage || messageHistoryChanged) {
1833
+ return {
1834
+ ...prev,
1835
+ currentMessage: updatedCurrentMessage,
1836
+ messageHistory: updatedHistory
1813
1837
  };
1814
1838
  }
1815
1839
  return prev;
@@ -2251,24 +2275,29 @@ export const App = ({ onMessage, onCancelRequest, initialModel, initialPlanMode,
2251
2275
  return; // Don't submit empty values
2252
2276
  // Check if this is a slash command
2253
2277
  const isSlashCommand = trimmedValue.startsWith('/');
2254
- // Check if this is the /clear command
2255
- if (trimmedValue === '/clear' || trimmedValue === '/cls' || trimmedValue === '/reset') {
2256
- // Clear the screen and reset state
2257
- clearScreen();
2278
+ // Check if this is the clear command (slash or no slash)
2279
+ const lowerValue = trimmedValue.toLowerCase();
2280
+ if (lowerValue === '/clear' || lowerValue === 'clear' || lowerValue === '/cls' || lowerValue === 'cls' || lowerValue === '/reset') {
2281
+ // Soft Clear: Push history up by creating a blank space
2282
+ // We do NOT use clearScreen() here because that wipes the scrollback buffer (\x1b[3J)
2283
+ // Instead, we add a "spacer" message that pushes previous content up out of the viewport
2284
+ const height = process.stdout.rows || 24;
2285
+ // Use \u200B (Zero Width Space) to prevent trim() from emptying the string
2286
+ // in MessageDisplay.tsx, which would cause it to not render.
2287
+ const spacer = Array(height).fill('\u200B\n').join('');
2288
+ const clearMessage = {
2289
+ id: `clear-${Date.now()}`,
2290
+ role: 'system',
2291
+ content: spacer,
2292
+ timestamp: new Date(),
2293
+ isSpacer: true
2294
+ };
2258
2295
  setState(prev => ({
2259
2296
  ...prev,
2260
- messageHistory: [],
2297
+ messageHistory: [...prev.messageHistory, clearMessage],
2261
2298
  currentMessage: null,
2262
- isLoading: false,
2263
- currentTokens: 0
2299
+ // We don't reset other state (tokens, loading) to preserve context
2264
2300
  }));
2265
- // Still call onMessage to clear backend history
2266
- try {
2267
- await onMessage(trimmedValue);
2268
- }
2269
- catch (error) {
2270
- // Ignore errors for clear command
2271
- }
2272
2301
  return;
2273
2302
  }
2274
2303
  // Check if this is the /clean-ui command (refresh UI without clearing history)
@@ -2640,7 +2669,7 @@ export const App = ({ onMessage, onCancelRequest, initialModel, initialPlanMode,
2640
2669
  ShellInputAgent.terminateSession(shellId);
2641
2670
  quickLog(`[${new Date().toISOString()}] [AgentControl] Terminated ShellInputAgent session for ${shellId}\n`);
2642
2671
  }
2643
- }, onWarpifySession: async () => {
2672
+ }, onWarpifySession: state.shellState?.isBackgroundTask ? undefined : async () => {
2644
2673
  // Warpify: Detect if there's an active remote session and establish ssh2 connection
2645
2674
  const shellCommand = state.shellState?.command || '';
2646
2675
  const currentOutput = state.shellState?.output || '';