[PR #5092] [GUI] Offer /compact in the chat's command menu #5305

Open
opened 2026-11-07 16:34:12 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/5092
Author: @storm-ace
Created: 11/3/2026
Status: 🔄 Open

Base: main ← Head: fix/host-compact-menu


📝 Commits (1)

  • 1b37ba8 fix(host): offer /compact in the chat's command menu

📊 Changes

11 files changed (+31 additions, -9 deletions)

View changed files

📝 apps/host/src/locales/fix-de.json (+2 -1)
📝 apps/host/src/locales/fix-en.json (+2 -1)
📝 apps/host/src/locales/fix-es.json (+2 -1)
📝 apps/host/src/locales/fix-fr.json (+2 -1)
📝 apps/host/src/locales/fix-ja.json (+2 -1)
📝 apps/host/src/locales/fix-ko.json (+2 -1)
📝 apps/host/src/locales/fix-pt.json (+2 -1)
📝 apps/host/src/locales/fix-ru.json (+2 -1)
📝 apps/host/src/locales/fix-zh.json (+2 -1)
📝 apps/host/src/screens/Chat.tsx (+1 -0)
📝 apps/host/tests/context-ui.test.mjs (+12 -0)

📄 Description

Addresses part of #5091: the missing /compact entry in the slash menu. The warning before the automatic summary that #5091 also asks for is not in this PR. Related: #4847 makes the summary threshold a setting.

Problem

The host already handles /compact: it summarises the older messages of a chat (apps/host/server/index.mjs, compactCommand). The chat's command menu did not list it. Typing /compact showed "No command matches “/compact”", so the command looked like it did not exist.

This matters for speed. Decode slows as a chat grows, because every token reads the whole K/V cache. The automatic summary only starts near the end of the window (at most 80% of it), so a long chat that still fits is never made smaller by itself. /compact is how a person makes it smaller sooner.

Result

The menu lists /compact, with the hint "Summarize the older messages so the chat is faster and has room again". Picking it (click, Enter or Tab) clears the draft and sends /compact at once. Nothing else changes.

Approach

  • apps/host/src/screens/Chat.tsx: one entry in useSlashCommands. It sends with sendMessage('/compact'), the same call the "Summarize and continue" button already makes.
  • apps/host/src/locales/fix-*.json: the hint as fx86 in all nine languages.
  • apps/host/tests/context-ui.test.mjs: a test for the menu entry and that the hint is translated.

Validation

Passed

  • node --test tests/context-ui.test.mjs tests/locale-gaps.test.mjs tests/french-catalog.test.mjs: 15 of 15, the new test included.
  • By hand, on a separate host (STRATA_PORT=8795, its own STRATA_HOME, simulated engine, a build of this branch): typing /co shows /compact with its hint; Enter clears the draft and sends it. With no model loaded the page says "No model is loaded", as for any message.

Failed

  • Full npm test on Windows 11: 1,342 passed, 7 failed, 108 skipped. None of the seven touches these files. Six are host process and gateway tests. The seventh (#4783 in ui-do.test.mjs) expects LF line endings in src/lib/store.ts and the checkout has CRLF. I did not check whether they also fail without this change.

Not run

  • The summary itself with a model loaded. After sending, the path is the existing /compact path. The server tests for it in agent-context.test.mjs were skipped in this environment.

Limits

  • Opt-in: nothing happens unless a person picks the command. Typing /compact and pressing Enter behaved the same before this change.
  • The automatic summary threshold is unchanged.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/5092 **Author:** [@storm-ace](https://github.com/storm-ace) **Created:** 11/3/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/host-compact-menu` --- ### 📝 Commits (1) - [`1b37ba8`](https://github.com/Niko1221/Strata/commit/1b37ba881d57e9620caa243eb26213261132ac8d) fix(host): offer /compact in the chat's command menu ### 📊 Changes **11 files changed** (+31 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `apps/host/src/locales/fix-de.json` (+2 -1) 📝 `apps/host/src/locales/fix-en.json` (+2 -1) 📝 `apps/host/src/locales/fix-es.json` (+2 -1) 📝 `apps/host/src/locales/fix-fr.json` (+2 -1) 📝 `apps/host/src/locales/fix-ja.json` (+2 -1) 📝 `apps/host/src/locales/fix-ko.json` (+2 -1) 📝 `apps/host/src/locales/fix-pt.json` (+2 -1) 📝 `apps/host/src/locales/fix-ru.json` (+2 -1) 📝 `apps/host/src/locales/fix-zh.json` (+2 -1) 📝 `apps/host/src/screens/Chat.tsx` (+1 -0) 📝 `apps/host/tests/context-ui.test.mjs` (+12 -0) </details> ### 📄 Description Addresses part of #5091: the missing `/compact` entry in the slash menu. The warning before the automatic summary that #5091 also asks for is not in this PR. Related: #4847 makes the summary threshold a setting. ## Problem The host already handles `/compact`: it summarises the older messages of a chat (`apps/host/server/index.mjs`, `compactCommand`). The chat's command menu did not list it. Typing `/compact` showed "No command matches “/compact”", so the command looked like it did not exist. This matters for speed. Decode slows as a chat grows, because every token reads the whole K/V cache. The automatic summary only starts near the end of the window (at most 80% of it), so a long chat that still fits is never made smaller by itself. `/compact` is how a person makes it smaller sooner. ## Result The menu lists `/compact`, with the hint "Summarize the older messages so the chat is faster and has room again". Picking it (click, Enter or Tab) clears the draft and sends `/compact` at once. Nothing else changes. ## Approach - `apps/host/src/screens/Chat.tsx`: one entry in `useSlashCommands`. It sends with `sendMessage('/compact')`, the same call the "Summarize and continue" button already makes. - `apps/host/src/locales/fix-*.json`: the hint as `fx86` in all nine languages. - `apps/host/tests/context-ui.test.mjs`: a test for the menu entry and that the hint is translated. ## Validation **Passed** - `node --test tests/context-ui.test.mjs tests/locale-gaps.test.mjs tests/french-catalog.test.mjs`: 15 of 15, the new test included. - By hand, on a separate host (`STRATA_PORT=8795`, its own `STRATA_HOME`, simulated engine, a build of this branch): typing `/co` shows `/compact` with its hint; Enter clears the draft and sends it. With no model loaded the page says "No model is loaded", as for any message. **Failed** - Full `npm test` on Windows 11: 1,342 passed, 7 failed, 108 skipped. None of the seven touches these files. Six are host process and gateway tests. The seventh (`#4783` in `ui-do.test.mjs`) expects LF line endings in `src/lib/store.ts` and the checkout has CRLF. I did not check whether they also fail without this change. **Not run** - The summary itself with a model loaded. After sending, the path is the existing `/compact` path. The server tests for it in `agent-context.test.mjs` were skipped in this environment. ## Limits - Opt-in: nothing happens unless a person picks the command. Typing `/compact` and pressing Enter behaved the same before this change. - The automatic summary threshold is unchanged. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#5305
No description provided.