chore: 移除 cachedMCConfig stub 及 prompts.ts 的 CACHED_MICROCOMPACT 死代码

- 删除 src/services/compact/cachedMCConfig.ts(自动生成的 stub)
- 同步移除 src/constants/prompts.ts 中依赖该 stub 的代码:
  - getCachedMCConfigForFRC 变量(feature('CACHED_MICROCOMPACT') 守卫的 require)
  - getFunctionResultClearingSection 函数(约 18 行)
  - systemPrompt 数组中的 frc section 调用与注册

CACHED_MICROCOMPACT 不在 build.ts DEFAULT_BUILD_FEATURES 也不在 dev 默认列表,所有默认配置下整段为构建期死代码。

Co-Authored-By: glm-5.2 <zai-org@claude-code-best.win>
This commit is contained in:
claude-code-best
2026-06-20 11:37:31 +08:00
parent e252c5e8b4
commit bf57c9b11f
2 changed files with 0 additions and 36 deletions

View File

@@ -67,12 +67,6 @@ import { getCurrentMode } from 'src/modes/store.js'
// Dead code elimination: conditional imports for feature-gated modules
/* eslint-disable @typescript-eslint/no-require-imports */
const getCachedMCConfigForFRC = feature('CACHED_MICROCOMPACT')
? (
require('../services/compact/cachedMCConfig.js') as typeof import('../services/compact/cachedMCConfig.js')
).getCachedMCConfig
: null
const proactiveModule =
feature('PROACTIVE') || feature('KAIROS')
? require('../proactive/index.js')
@@ -454,7 +448,6 @@ ${CYBER_RISK_INSTRUCTION}`,
? null
: getMcpInstructionsSection(mcpClients),
getScratchpadInstructions(),
getFunctionResultClearingSection(model),
SUMMARIZE_TOOL_RESULTS_SECTION,
getProactiveSection(),
].filter(s => s !== null)
@@ -492,7 +485,6 @@ ${CYBER_RISK_INSTRUCTION}`,
'MCP servers connect/disconnect between turns',
),
systemPromptSection('scratchpad', () => getScratchpadInstructions()),
systemPromptSection('frc', () => getFunctionResultClearingSection(model)),
systemPromptSection(
'summarize_tool_results',
() => SUMMARIZE_TOOL_RESULTS_SECTION,
@@ -781,26 +773,6 @@ Only use \`/tmp\` if the user explicitly requests it.
The scratchpad directory is session-specific, isolated from the user's project, and can be used freely without permission prompts.`
}
function getFunctionResultClearingSection(model: string): string | null {
if (!feature('CACHED_MICROCOMPACT') || !getCachedMCConfigForFRC) {
return null
}
const config = getCachedMCConfigForFRC()
const isModelSupported = config.supportedModels?.some(pattern =>
model.includes(pattern),
)
if (
!config.enabled ||
!config.systemPromptSuggestSummaries ||
!isModelSupported
) {
return null
}
return `# Function Result Clearing
Old tool results will be automatically cleared from context to free up space. The ${config.keepRecent} most recent results are always kept.`
}
const SUMMARIZE_TOOL_RESULTS_SECTION = `When working with tool results, write down any important information you might need later in your response, as the original tool result may be cleared later.`
function getBriefSection(): string | null {

View File

@@ -1,8 +0,0 @@
// Auto-generated stub — replace with real implementation
export {}
export const getCachedMCConfig: () => {
enabled?: boolean
systemPromptSuggestSummaries?: boolean
supportedModels?: string[]
[key: string]: unknown
} = () => ({})