fix(contextWindowSize): fix context window size update on model switch and ACP agent config priority

- Fix contextWindowSize not updating when switching models via setModel()
- Fix ACP agent to respect provider-configured contextWindowSize before auto-detection
- Simplify getTruncateToolOutputThreshold to use static threshold
- Add support for GLM-4.7, Kimi-2.5, and MiniMax-M2.1 models
- Update context usage display to require explicit contextWindowSize

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
tanzhenxin 2026-01-29 20:51:03 +08:00
parent 1c5b74ebd9
commit d67206819a
9 changed files with 47 additions and 77 deletions

View file

@ -6,7 +6,6 @@
import { Text } from 'ink';
import { theme } from '../semantic-colors.js';
import { DEFAULT_TOKEN_LIMIT } from '@qwen-code/qwen-code-core';
export const ContextUsageDisplay = ({
promptTokenCount,
@ -15,14 +14,13 @@ export const ContextUsageDisplay = ({
}: {
promptTokenCount: number;
terminalWidth: number;
contextWindowSize?: number;
contextWindowSize: number;
}) => {
if (promptTokenCount === 0) {
return null;
}
const contextLimit = contextWindowSize ?? DEFAULT_TOKEN_LIMIT;
const percentage = promptTokenCount / contextLimit;
const percentage = promptTokenCount / contextWindowSize;
const percentageUsed = (percentage * 100).toFixed(1);
const label = terminalWidth < 100 ? '% used' : '% context used';