mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #5091] [GUI] 聊天输入框的斜杠菜单里没有 /compact,上下文也没有"到自动压缩还剩多少"的预警:用户只能被动等它在中途压缩 #2375
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2375
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @xvcezrqpbxtpzblrt on GitHub (Nov 3, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5091
English TL;DR:
/compactalready works in the app — the harness plugindsh-command-compactis loaded by the app's own preset (apps/host/server/agent/preset.mjs:94), and the app itself sends/compactwhen a chat overflows (apps/host/src/lib/store.ts:1565-1571). What is missing is any way to see it coming and any way to choose it: the composer's slash menu lists nine commands and/compactis not one of them (apps/host/src/screens/Chat.tsx:545-558), and the context gauge lives inside a click-away popover (apps/host/src/components/TelemetryPopover.tsx:55) with no link to the compaction threshold. The threshold itself is a computed number the app already knows:DEFAULT_THRESHOLD_RATIO = .8(installedharness/node_modules/@deepseek-ai/dsh-compaction-basic/lib/index.js:15),thresholdTokens = floor(min(contextWindow × thresholdRatio, contextWindow − reservedCompletionTokens − headroomTokens))(:128-132), and Strata's own comment says the effective line is "about 60 percent" (apps/host/server/agent/profile.mjs:149-153). Compaction fires only at a step boundary (...:839agent/pre-step), which is exactly why a long turn gets compacted mid-task, with no warning. This asks for a visible entry point plus an always-visible remaining-budget warning, so the person compresses before the model runs out, not in the middle of a task.Area
[GUI] 聊天界面(桌面版窗口内、
--browser网页模式、STRATA_UI=window三种跑法共用同一份 Web UI)版本行(本机安装组件)
源码核对基准:tag
v0.2.10=ffa80d73(2026-11-03 06:37:27),与安装产物host\dist的 mtime06:37:26一致。现象(用户视角)
% of context环 + Context used / Context limit / Space remaining),要点开,而且它显示的是"已用多少",不告诉你压缩线在哪——60%这条线对普通用户不可见。/compact就压缩(Usage: /compact (no arguments))。但输入框的斜杠菜单列出的命令里没有它,所以用户不知道有这个东西,只能靠别人告诉。现状(全部核到 v0.2.10 =
ffa80d73/ 已安装产物)/compact由应用预设加载apps/host/server/agent/preset.mjs:94{ id: 'command-compact', name: '@deepseek-ai/dsh-command-compact' }harness/node_modules/@deepseek-ai/dsh-command-compact/lib/index.js:10const USAGE = "Usage: /compact (no arguments)";:22text: "Compaction is unavailable because this process has an active compaction, or the agent is not idle.";:26Compaction cancelled.;:30历史已变则记入会话日志/compactapps/host/src/lib/store.ts:1565-1571注释 “…summarise the older messages (the same as typing /compact)…” +await sendMessage('/compact');/compact)apps/host/src/screens/Chat.tsx:545-558:/time-skip、/goal、/plan、/research、/loop、/website、/preview(+ 演示模式的/subagents),再拼上getSlashCommands();apps/host/src/lib/commands.ts里带slash别名的只有new / export / setup / tune / monitor / serve / model / tasks / skillsdsh-compaction-basic/lib/index.js:15DEFAULT_THRESHOLD_RATIO = .8;:17DEFAULT_RETAIN_RATIO = .16;:128-132thresholdTokens = Math.floor(Math.min(contextWindow * policy.thresholdRatio, pressureBudgetTokens)),其中pressureBudgetTokens = contextWindow - reservedCompletionTokens - headroomTokensapps/host/server/agent/profile.mjs:151-153compactionHeadroom(context, outputBudget) = max(512, min(65536, floor((context - outputBudget) * 0.125)));:149注释 “…Compaction then starts at about 60 percent.”dsh-compaction-basic/lib/index.js:839ctx.on("agent/pre-step", … compactIfNeeded(agent, "pressure", signal))apps/host/src/components/TelemetryPopover.tsx:55:ContextRing环 +% of context+ 行 “Context used / Context limit / Space remaining”store.ts:2009从流帧取contextUsed/contextMax;:2032frame.contextTokens;:1878估算路径Math.ceil(len/4)且usageSource:'estimated';apps/host/src/lib/types.ts:351,355,478contextUsed/contextMax/statsAvailable;apps/host/src/app/ContextPanel.tsx:27,40-41已有 “Not available for every request” 与 “It is not a live reading of the model cache.” 的诚实标注想要什么(4 条,都落在 GUI,不改压缩策略本身)
/compact放进输入框的斜杠菜单(在Chat.tsx:545-558那份列表里加一项),提示语写清后果:压缩会把较早的消息收成摘要,当前任务会中断。菜单项在正在回答时禁用,并把 harness 已有的那句真话显示出来(Compaction is unavailable because … the agent is not idle.),不要让人点了才知道。% of context、Context limit、Space remaining)提到输入框上方一条常驻小条,文案形如「上下文已用 45%,到自动压缩还剩约 9,800 tokens」。压缩线用应用已知的那个数算:min(contextWindow × thresholdRatio, contextWindow − reservedCompletionTokens − headroomTokens)(上面已安装代码:128-132),Strata 侧注释说明实际约在 60%(profile.mjs:149)。pre-step,:839),所以一个长回合跑到中途时,人是无法预先安排的。estimated,store.ts:1878)必须标「估算」;statsAvailable === false时显示「不可用」,沿用ContextPanel.tsx:40-41已有的写法,不给假精确数。复现与验证状态(按 CONTRIBUTING 区分 passed / failed / not run)
/compact已加载与应用自发/compact(preset.mjs:94、store.ts:1565-1571);命令用法与忙时文案(dsh-command-compact/lib/index.js:10,22,26,30);斜杠菜单清单里无/compact(Chat.tsx:545-558+lib/commands.ts的slash别名集合);阈值算法与常量(dsh-compaction-basic/lib/index.js:15,17,128-132);headroom 覆盖与 60% 注释(profile.mjs:149-153);触发时机agent/pre-step(:839);上下文显示位置(TelemetryPopover.tsx:55)与取数/估算路径(store.ts:2009,2032,1878)ffa80d73时间一致(host\distmtime06:37:26);本机版本行如上面所贴(本机实测组件信息)影响面
聊天界面三个跑法共用同一份 Web UI:桌面窗口、
--browser网页模式、STRATA_UI=window。本需求只动 GUI(菜单项、常驻额度条、到线提醒),不动压缩算法、不动默认值,属可关闭的界面增强,符合 CONTRIBUTING 的"新功能默认不改既有路径"。相关已有 issue(先查过仓库,不重复)
.8与 headroom 的算术)—— 本 issue 是它的界面可见性一侧,不改策略compact、compress context、压缩上下文、context window 压缩、context meter、summarise older messages、token 剩余;没有覆盖"输入框暴露/compact+ 压缩线预警"的开放 issue本报告未包含
max-width断点下额度条的排版)未设计@xvcezrqpbxtpzblrt commented on GitHub (Nov 3, 2026):
顺带一个同类的"数字看不见"的问题,供参考 —— 它跟本 issue 不是同一个主题,列在这里只为把两处可见性缺口串起来,方便一次定位。
现象:界面"本轮消耗"面板里"思考"那一栏从来不出现,因为每轮回复的思考 token 数在中间层就丢了,客户端拿不到。
已核对的事实(本机实测,2026-11-03)
ffa80d73),自带 harness 包@deepseek-ai/dsh-llm-pi-ai版本0.2.1-alpha.3C:\Users\123\AppData\Local\Programs\Strata\harness\node_modules\@deepseek-ai\dsh-llm-pi-ai\lib\index.js第 1439–1447 行的mapUsage()只复制inputTokens/outputTokens/totalTokens/cacheReadTokens/cacheWriteTokens,没有reasoningTokenspackages/llm/llm-pi-ai/src/stream.ts(blob sha17b71581)第 24–32 行同样没有,整个文件reasoningTokens出现 0 次 → 单纯升级 harness 版本不会带来这个数@deepseek-ai/dsh-client-ui-chat的 TurnUsagePanel 里写的是usage.reasoningTokens !== undefined才渲染那一行(lib/client.js第 6902–6904 行),dsh-client-ui-trajectory里也有对应显示位。数字一到,界面就能显示completion_tokens_details.reasoning_tokens已有的公开材料:上游讨论 https://github.com/deepseek-ai/deepseek-harness/discussions/11352 (我在 10-28 提的;11-01 有社区用户贴了他 fork 里带测试的补丁,上游仓库关闭了 issue 与 pull request 通道,补丁送不进去)。那条回复里的测试数字属社区自述,未获官方证实。
为什么写在本 issue 下面:两条是同一件事的两端 —— 都卡在"给 AI 的消耗数字对用户不透明"。上下文压缩需要"到自动压缩还剩多少"的预警,思考 token 是"这一轮花了多少"的组成部分;两个数在 Strata 侧的显示位都已存在,缺的都是把数据传上来那一步。
没测的:没有跑真实模型请求验证社区补丁的效果,以上结论来自读代码与版本比对;对上游 master 的核对是 2026-11-03 做的,后续版本若有改动请以最新代码为准。