fix: unblock input after ESC cancel, suppress abort errors, add hint

- Use Promise.race in handleSlashCommand so ESC abort immediately
  unblocks the submitQuery await chain (fixes /compress blocking input)
- Suppress abort error messages in /compress and /summary when
  cancelled via ESC (cancelSlashCommand already shows "Command cancelled")
- Add "(esc to cancel)" hint below pending slash command items
- Add i18n translations for the new hint in all 6 locales
This commit is contained in:
DragonnZhang 2026-02-11 11:10:40 +08:00
parent 66f754e203
commit 5376ca5873
13 changed files with 106 additions and 7 deletions

View file

@ -27,6 +27,7 @@ export const summaryCommand: SlashCommand = {
const { config } = context.services;
const { ui } = context;
const executionMode = context.executionMode ?? 'interactive';
const abortSignal = context.abortSignal;
if (!config) {
return {
@ -101,7 +102,7 @@ export const summaryCommand: SlashCommand = {
},
],
{},
new AbortController().signal,
abortSignal ?? new AbortController().signal,
config.getModel(),
);
@ -197,6 +198,10 @@ export const summaryCommand: SlashCommand = {
if (executionMode !== 'interactive') {
return;
}
// If cancelled via ESC, don't show error — cancelSlashCommand already handled UI
if (abortSignal?.aborted) {
return;
}
ui.setPendingItem(null);
ui.addItem(
{
@ -241,6 +246,9 @@ export const summaryCommand: SlashCommand = {
}> => {
emitInteractivePending('generating');
const markdownSummary = await generateSummaryMarkdown(history);
if (abortSignal?.aborted) {
throw new DOMException('Summary generation cancelled.', 'AbortError');
}
emitInteractivePending('saving');
const { filePathForDisplay } = await saveSummaryToDisk(markdownSummary);
completeInteractive(filePathForDisplay);