From 699fc7596a05a4364f819a95b1acf6a00706599a Mon Sep 17 00:00:00 2001 From: Bohdan Triapitsyn Date: Thu, 8 Jan 2026 21:10:38 +0200 Subject: [PATCH] feat: rename summarize command to compact and update related descriptions for session compression --- CHANGELOG.md | 1 + packages/ui/src/components/chat/ChatInput.tsx | 24 ++++++++++++++++--- .../ui/src/components/chat/ChatMessage.tsx | 2 +- .../components/chat/CommandAutocomplete.tsx | 6 ++--- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31066d5c..365d74d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. - Shortcuts: Switched agent cycling shortcut from TAB to Shift + TAB. - Skills: added autocomplete for skills on "/" when it is not the first character in input. - Autocomplete: added scope badges for commands/agents/skills. +- Compact: changed /summarize command to be /compact and use sdk for compaction. ## [1.4.4] - 2026-01-08 diff --git a/packages/ui/src/components/chat/ChatInput.tsx b/packages/ui/src/components/chat/ChatInput.tsx index 55838646..3630e0cb 100644 --- a/packages/ui/src/components/chat/ChatInput.tsx +++ b/packages/ui/src/components/chat/ChatInput.tsx @@ -458,9 +458,27 @@ export const ChatInput: React.FC = ({ onOpenSettings, scrollToBo setMessage(''); return; // Don't send to assistant } - // Existing: /summarize command scroll - else if (commandName === 'summarize') { - scrollToBottom?.({ instant: true, force: true }); + // /compact - call SDK summarize endpoint + else if (commandName === 'compact' && currentSessionId) { + try { + const { opencodeClient } = await import('@/lib/opencode/client'); + const directory = opencodeClient.getDirectory(); + const response = await opencodeClient.getApiClient().session.summarize({ + sessionID: currentSessionId, + directory: directory || undefined, + providerID: currentProviderId, + modelID: currentModelId, + }); + if (response.error) { + throw new Error('Failed to compact session'); + } + scrollToBottom?.({ instant: true, force: true }); + } catch (error) { + console.error('Failed to compact session:', error); + toast.error('Failed to compact session'); + } + setMessage(''); + return; // Don't send to assistant } } diff --git a/packages/ui/src/components/chat/ChatMessage.tsx b/packages/ui/src/components/chat/ChatMessage.tsx index 7e523a0e..b7d0ce7e 100644 --- a/packages/ui/src/components/chat/ChatMessage.tsx +++ b/packages/ui/src/components/chat/ChatMessage.tsx @@ -144,7 +144,7 @@ const ChatMessage: React.FC = ({ return message.parts.map((part) => { const rawPart = part as Record; if (rawPart.type === 'compaction') { - return { type: 'text', text: '/summarize' } as Part; + return { type: 'text', text: '/compact' } as Part; } return part; }); diff --git a/packages/ui/src/components/chat/CommandAutocomplete.tsx b/packages/ui/src/components/chat/CommandAutocomplete.tsx index 360464ea..3fce50f9 100644 --- a/packages/ui/src/components/chat/CommandAutocomplete.tsx +++ b/packages/ui/src/components/chat/CommandAutocomplete.tsx @@ -98,7 +98,7 @@ export const CommandAutocomplete = React.forwardRef(); @@ -142,7 +142,7 @@ export const CommandAutocomplete = React.forwardRef; case 'timeline': return ; - case 'summarize': + case 'compact': return ; case 'test': case 'build':