summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/App.tsx
diff options
context:
space:
mode:
authorJacob MacDonald <[email protected]>2025-06-13 21:21:40 -0700
committerGitHub <[email protected]>2025-06-14 04:21:40 +0000
commitd5c6bb9740a52d87b71d812e698d0e88abf10caa (patch)
tree7cb990c0adbd1d76d60a655d3dfa15e22db033e3 /packages/cli/src/ui/App.tsx
parent1452bb4ca4ffe3b5c13aab81baaf510d4c45f06f (diff)
Add `/compress` command to force a compression of the context (#986)
Related to https://b.corp.google.com/issues/423605555 - I figured this might be a simpler solution to start with, while still also being useful on its own even if we do implement that.
Diffstat (limited to 'packages/cli/src/ui/App.tsx')
-rw-r--r--packages/cli/src/ui/App.tsx36
1 files changed, 23 insertions, 13 deletions
diff --git a/packages/cli/src/ui/App.tsx b/packages/cli/src/ui/App.tsx
index 7d8ef463..40935f93 100644
--- a/packages/cli/src/ui/App.tsx
+++ b/packages/cli/src/ui/App.tsx
@@ -170,7 +170,11 @@ const App = ({ config, settings, startupWarnings = [] }: AppProps) => {
}
}, [config, addItem]);
- const { handleSlashCommand, slashCommands } = useSlashCommandProcessor(
+ const {
+ handleSlashCommand,
+ slashCommands,
+ pendingHistoryItems: pendingSlashCommandHistoryItems,
+ } = useSlashCommandProcessor(
config,
history,
addItem,
@@ -186,6 +190,7 @@ const App = ({ config, settings, startupWarnings = [] }: AppProps) => {
showToolDescriptions,
setQuittingMessages,
);
+ const pendingHistoryItems = [...pendingSlashCommandHistoryItems];
const { rows: terminalHeight, columns: terminalWidth } = useTerminalSize();
const { stdin, setRawMode } = useStdin();
@@ -286,18 +291,23 @@ const App = ({ config, settings, startupWarnings = [] }: AppProps) => {
return editorType as EditorType;
}, [settings, openEditorDialog]);
- const { streamingState, submitQuery, initError, pendingHistoryItems } =
- useGeminiStream(
- config.getGeminiClient(),
- history,
- addItem,
- setShowHelp,
- config,
- setDebugMessage,
- handleSlashCommand,
- shellModeActive,
- getPreferredEditor,
- );
+ const {
+ streamingState,
+ submitQuery,
+ initError,
+ pendingHistoryItems: pendingGeminiHistoryItems,
+ } = useGeminiStream(
+ config.getGeminiClient(),
+ history,
+ addItem,
+ setShowHelp,
+ config,
+ setDebugMessage,
+ handleSlashCommand,
+ shellModeActive,
+ getPreferredEditor,
+ );
+ pendingHistoryItems.push(...pendingGeminiHistoryItems);
const { elapsedTime, currentLoadingPhrase } =
useLoadingIndicator(streamingState);
const showAutoAcceptIndicator = useAutoAcceptIndicator({ config });