Compare commits

..

5 Commits

Author SHA1 Message Date
claude-code-best
f2b751f659 chore: 2.6.5 2026-05-22 21:05:06 +08:00
claude-code-best
d4a601475f fix: 修复 BriefTool 循环依赖导致 isBriefEnabled 未定义
将模块顶层 require() 改为懒加载函数 getBriefToolModule(),
延迟到实际调用时才加载模块,避免循环依赖时模块尚未完成初始化。
2026-05-22 21:04:17 +08:00
claude-code-best
897c186f28 docs: effort 级别描述去掉模型名限制 2026-05-22 20:11:12 +08:00
claude-code-best
03598d3f84 refactor: 移除 resolveAppliedEffort 中的 max/xhigh 降级分支 2026-05-22 20:09:53 +08:00
claude-code-best
7b52054ff5 feat: 解除 max/xhigh effort 级别的模型白名单限制 2026-05-22 20:09:10 +08:00
5 changed files with 91 additions and 53 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "claude-code-best",
"version": "2.6.0",
"version": "2.6.5",
"description": "Reverse-engineered Anthropic Claude Code CLI — interactive AI coding assistant in the terminal",
"type": "module",
"author": "claude-code-best <claude-code-best@proton.me>",

View File

@@ -155,7 +155,7 @@ export async function call(onDone: LocalJSXCommandOnDone, _context: unknown, arg
if (COMMON_HELP_ARGS.includes(args)) {
onDone(
'Usage: /effort [low|medium|high|xhigh|max|auto]\n\nEffort levels:\n- low: Quick, straightforward implementation\n- medium: Balanced approach with standard testing\n- high: Comprehensive implementation with extensive testing\n- xhigh: Extra high reasoning for supported models, including ChatGPT Codex models\n- max: Maximum capability with deepest reasoning where supported (Opus 4.6/4.7, DeepSeek V4 Pro); maps to xhigh for ChatGPT Codex models\n- auto: Use the default effort level for your model',
'Usage: /effort [low|medium|high|xhigh|max|auto]\n\nEffort levels:\n- low: Quick, straightforward implementation\n- medium: Balanced approach with standard testing\n- high: Comprehensive implementation with extensive testing\n- xhigh: Extended reasoning beyond high, short of max; including ChatGPT Codex models\n- max: Maximum capability with deepest reasoning; maps to xhigh for ChatGPT Codex models\n- auto: Use the default effort level for your model',
);
return;
}

View File

@@ -82,10 +82,11 @@ const BRIEF_PROACTIVE_SECTION: string | null =
require('@claude-code-best/builtin-tools/tools/BriefTool/prompt.js') as typeof import('@claude-code-best/builtin-tools/tools/BriefTool/prompt.js')
).BRIEF_PROACTIVE_SECTION
: null
const briefToolModule =
feature('KAIROS') || feature('KAIROS_BRIEF')
function getBriefToolModule() {
return feature('KAIROS') || feature('KAIROS_BRIEF')
? (require('@claude-code-best/builtin-tools/tools/BriefTool/BriefTool.js') as typeof import('@claude-code-best/builtin-tools/tools/BriefTool/BriefTool.js'))
: null
}
const DISCOVER_SKILLS_TOOL_NAME: string | null = feature(
'EXPERIMENTAL_SKILL_SEARCH',
)
@@ -800,7 +801,7 @@ function getBriefSection(): string | null {
// Whenever the tool is available, the model is told to use it. The
// /brief toggle and --brief flag now only control the isBriefOnly
// display filter — they no longer gate model-facing behavior.
if (!briefToolModule?.isBriefEnabled()) return null
if (!getBriefToolModule()?.isBriefEnabled()) return null
// When proactive is active, getProactiveSection() already appends the
// section inline. Skip here to avoid duplicating it in the system prompt.
if (
@@ -864,5 +865,5 @@ Do not narrate each step, list every file you read, or explain routine actions.
The user context may include a \`terminalFocus\` field indicating whether the user's terminal is focused or unfocused. Use this to calibrate how autonomous you are:
- **Unfocused**: The user is away. Lean heavily into autonomous action — make decisions, explore, commit, push. Only pause for genuinely irreversible or high-risk actions.
- **Focused**: The user is watching. Be more collaborative — surface choices, ask before committing to large changes, and keep your output concise so it's easy to follow in real time.${BRIEF_PROACTIVE_SECTION && briefToolModule?.isBriefEnabled() ? `\n\n${BRIEF_PROACTIVE_SECTION}` : ''}`
- **Focused**: The user is watching. Be more collaborative — surface choices, ask before committing to large changes, and keep your output concise so it's easy to follow in real time.${BRIEF_PROACTIVE_SECTION && getBriefToolModule()?.isBriefEnabled() ? `\n\n${BRIEF_PROACTIVE_SECTION}` : ''}`
}

View File

@@ -224,6 +224,22 @@ describe('getEffortLevelDescription', () => {
const desc = getEffortLevelDescription('max')
expect(desc).toContain('Maximum')
})
test('max description does not contain model names', () => {
const desc = getEffortLevelDescription('max')
expect(desc).not.toContain('Opus')
expect(desc).not.toContain('DeepSeek')
})
test("returns description for 'xhigh'", () => {
const desc = getEffortLevelDescription('xhigh')
expect(desc).toContain('Extended reasoning')
})
test('xhigh description does not contain model names', () => {
const desc = getEffortLevelDescription('xhigh')
expect(desc).not.toContain('Opus')
})
})
// ─── resolvePickerEffortPersistence ────────────────────────────────────
@@ -274,3 +290,61 @@ describe('resolvePickerEffortPersistence', () => {
expect(result).toBeUndefined()
})
})
// ─── modelSupportsMaxEffort ────────────────────────────────────────────
describe('modelSupportsMaxEffort', () => {
test('returns true for opus-4-7', async () => {
const { modelSupportsMaxEffort } = await import('src/utils/effort.js')
expect(modelSupportsMaxEffort('claude-opus-4-7-20250918')).toBe(true)
})
test('returns true for opus-4-6', async () => {
const { modelSupportsMaxEffort } = await import('src/utils/effort.js')
expect(modelSupportsMaxEffort('claude-opus-4-6-20250514')).toBe(true)
})
test('returns true for sonnet models', async () => {
const { modelSupportsMaxEffort } = await import('src/utils/effort.js')
expect(modelSupportsMaxEffort('claude-sonnet-4-6-20250514')).toBe(true)
})
test('returns true for haiku models', async () => {
const { modelSupportsMaxEffort } = await import('src/utils/effort.js')
expect(modelSupportsMaxEffort('claude-haiku-4-5-20251001')).toBe(true)
})
test('returns true for deepseek models', async () => {
const { modelSupportsMaxEffort } = await import('src/utils/effort.js')
expect(modelSupportsMaxEffort('deepseek-v4-pro')).toBe(true)
})
test('returns true for unknown models', async () => {
const { modelSupportsMaxEffort } = await import('src/utils/effort.js')
expect(modelSupportsMaxEffort('some-random-model')).toBe(true)
})
})
// ─── modelSupportsXhighEffort ──────────────────────────────────────────
describe('modelSupportsXhighEffort', () => {
test('returns true for opus-4-7', async () => {
const { modelSupportsXhighEffort } = await import('src/utils/effort.js')
expect(modelSupportsXhighEffort('claude-opus-4-7-20250918')).toBe(true)
})
test('returns true for sonnet models', async () => {
const { modelSupportsXhighEffort } = await import('src/utils/effort.js')
expect(modelSupportsXhighEffort('claude-sonnet-4-6-20250514')).toBe(true)
})
test('returns true for haiku models', async () => {
const { modelSupportsXhighEffort } = await import('src/utils/effort.js')
expect(modelSupportsXhighEffort('claude-haiku-4-5-20251001')).toBe(true)
})
test('returns true for unknown models', async () => {
const { modelSupportsXhighEffort } = await import('src/utils/effort.js')
expect(modelSupportsXhighEffort('some-random-model')).toBe(true)
})
})

View File

@@ -67,51 +67,22 @@ export function modelSupportsEffort(model: string): boolean {
return getAPIProvider() === 'firstParty'
}
// @[MODEL LAUNCH]: Add the new model to the allowlist if it supports 'max' effort.
// Per API docs, 'max' is Opus 4.6/4.7 only for public models — other models return an error.
// However, DeepSeek V4 Pro also supports max effort when using Anthropic-compatible API.
export function modelSupportsMaxEffort(model: string): boolean {
const supported3P = get3PModelCapabilityOverride(model, 'max_effort')
// Effort max/xhigh restrictions removed — all models that support effort
// can now use these levels. API errors are the user's responsibility.
export function modelSupportsMaxEffort(_model: string): boolean {
const supported3P = get3PModelCapabilityOverride(_model, 'max_effort')
if (supported3P !== undefined) {
return supported3P
}
// Support DeepSeek V4 Pro specifically (Anthropic-compatible API)
if (model.toLowerCase().includes('deepseek-v4-pro')) {
return true
}
if (
model.toLowerCase().includes('opus-4-7') ||
model.toLowerCase().includes('opus-4-6')
) {
return true
}
if (process.env.USER_TYPE === 'ant' && resolveAntModel(model)) {
return true
}
return false
return true
}
// @[MODEL LAUNCH]: Add the new model to the allowlist if it supports 'xhigh' effort.
// 'xhigh' was introduced with Opus 4.7 as a level between 'high' and 'max'.
export function modelSupportsXhighEffort(model: string): boolean {
const supported3P = get3PModelCapabilityOverride(model, 'xhigh_effort')
export function modelSupportsXhighEffort(_model: string): boolean {
const supported3P = get3PModelCapabilityOverride(_model, 'xhigh_effort')
if (supported3P !== undefined) {
return supported3P
}
if (
getAPIProvider() === 'openai' &&
isChatGPTAuthMode() &&
isChatGPTCodexReasoningModel(model)
) {
return true
}
if (model.toLowerCase().includes('opus-4-7')) {
return true
}
if (process.env.USER_TYPE === 'ant' && resolveAntModel(model)) {
return true
}
return false
return true
}
export function isEffortLevel(value: string): value is EffortLevel {
@@ -214,10 +185,6 @@ export function resolveAppliedEffort(
}
const resolved =
envOverride ?? appStateEffortValue ?? getDefaultEffortForModel(model)
// API rejects 'xhigh' on pre-Opus-4.7 models — downgrade to 'high'.
if (resolved === 'xhigh' && !modelSupportsXhighEffort(model)) {
return 'high'
}
// OpenAI Responses uses xhigh as its highest public reasoning effort.
// Keep /effort max usable as a familiar alias in ChatGPT subscription mode.
if (
@@ -228,10 +195,6 @@ export function resolveAppliedEffort(
) {
return 'xhigh'
}
// API rejects 'max' on non-Opus-4.6 models — downgrade to 'high'.
if (resolved === 'max' && !modelSupportsMaxEffort(model)) {
return 'high'
}
return resolved
}
@@ -299,9 +262,9 @@ export function getEffortLevelDescription(level: EffortLevel): string {
case 'high':
return 'Comprehensive implementation with extensive testing and documentation'
case 'xhigh':
return 'Extended reasoning beyond high, short of max (Opus 4.7 only)'
return 'Extended reasoning beyond high, short of max'
case 'max':
return 'Maximum capability with deepest reasoning (Opus 4.6/4.7/DeepSeek V4 Pro)'
return 'Maximum capability with deepest reasoning'
}
}