Skip to content

Commit 80cd3dd

Browse files
committed
Merge branch 'main' into fixType
2 parents ef374ec + c499bfb commit 80cd3dd

25 files changed

Lines changed: 331 additions & 89 deletions

File tree

contributors.svg

Lines changed: 34 additions & 28 deletions
Loading

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "claude-code-best",
3-
"version": "2.4.3",
3+
"version": "2.4.4",
44
"description": "Reverse-engineered Anthropic Claude Code CLI — interactive AI coding assistant in the terminal",
55
"type": "module",
66
"author": "claude-code-best <claude-code-best@proton.me>",

packages/@ant/model-provider/src/providers/gemini/streamAdapter.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ export async function* adaptGeminiStreamToAnthropic(
1616
let finishReason: string | undefined
1717
let inputTokens = 0
1818
let outputTokens = 0
19+
let cachedReadTokens = 0
1920

2021
for await (const chunk of stream) {
2122
const usage = chunk.usageMetadata
2223
if (usage) {
2324
inputTokens = usage.promptTokenCount ?? inputTokens
2425
outputTokens =
2526
(usage.candidatesTokenCount ?? 0) + (usage.thoughtsTokenCount ?? 0)
27+
cachedReadTokens = usage.cachedContentTokenCount ?? cachedReadTokens
2628
}
2729

2830
if (!started) {
@@ -41,7 +43,7 @@ export async function* adaptGeminiStreamToAnthropic(
4143
input_tokens: inputTokens,
4244
output_tokens: 0,
4345
cache_creation_input_tokens: 0,
44-
cache_read_input_tokens: 0,
46+
cache_read_input_tokens: cachedReadTokens,
4547
},
4648
},
4749
} as unknown as BetaRawMessageStreamEvent
@@ -204,7 +206,10 @@ export async function* adaptGeminiStreamToAnthropic(
204206
stop_sequence: null,
205207
},
206208
usage: {
209+
input_tokens: inputTokens,
207210
output_tokens: outputTokens,
211+
cache_creation_input_tokens: 0,
212+
cache_read_input_tokens: cachedReadTokens,
208213
},
209214
} as BetaRawMessageStreamEvent
210215

packages/@ant/model-provider/src/providers/gemini/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export type GeminiUsageMetadata = {
6868
candidatesTokenCount?: number
6969
thoughtsTokenCount?: number
7070
totalTokenCount?: number
71+
cachedContentTokenCount?: number
7172
}
7273

7374
export type GeminiCandidate = {

packages/builtin-tools/src/tools/AgentTool/builtInAgents.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ import type { AgentDefinition } from './loadAgentsDir.js'
1212

1313
export function areExplorePlanAgentsEnabled(): boolean {
1414
if (feature('BUILTIN_EXPLORE_PLAN_AGENTS')) {
15-
// 3P default: true — Bedrock/Vertex keep agents enabled (matches pre-experiment
16-
// external behavior). A/B test treatment sets false to measure impact of removal.
17-
return getFeatureValue_CACHED_MAY_BE_STALE('tengu_amber_stoat', true)
15+
return true
1816
}
1917
return false
2018
}

packages/builtin-tools/src/tools/ExecuteTool/ExecuteTool.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,29 @@ export const ExecuteTool = buildTool({
121121
}
122122
}
123123

124+
// Validate input before delegating — prevents crashes when the model
125+
// omits required params (e.g. TeamCreate without team_name →
126+
// sanitizeName(undefined).replace() TypeError).
127+
if (targetTool.validateInput) {
128+
const validation = await targetTool.validateInput(
129+
input.params as Record<string, unknown>,
130+
context,
131+
)
132+
if (!validation.result) {
133+
return {
134+
data: {
135+
result: null,
136+
tool_name: input.tool_name,
137+
},
138+
newMessages: [
139+
createUserMessage({
140+
content: `Invalid parameters for tool "${input.tool_name}": ${validation.message}`,
141+
}),
142+
],
143+
}
144+
}
145+
}
146+
124147
// Check permissions on the target tool
125148
const permResult = await targetTool.checkPermissions?.(
126149
input.params as Record<string, unknown>,
@@ -164,7 +187,7 @@ export const ExecuteTool = buildTool({
164187
}
165188
},
166189
renderToolUseMessage(input) {
167-
return `Executing ${input.tool_name}...`
190+
return `${input.tool_name}`
168191
},
169192
userFacingName() {
170193
return 'ExecuteExtraTool'

src/cli/print.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,6 @@ const cronJitterConfigModule =
377377
require('../utils/cronJitterConfig.js') as typeof import('../utils/cronJitterConfig.js')
378378
const cronGate =
379379
require('@claude-code-best/builtin-tools/tools/ScheduleCronTool/prompt.js') as typeof import('@claude-code-best/builtin-tools/tools/ScheduleCronTool/prompt.js')
380-
const extractMemoriesModule = feature('EXTRACT_MEMORIES')
381-
? (require('../services/extractMemories/extractMemories.js') as typeof import('../services/extractMemories/extractMemories.js'))
382-
: null
383380
/* eslint-enable @typescript-eslint/no-require-imports */
384381

385382
const SHUTDOWN_TEAM_PROMPT = `<system-reminder>
@@ -985,7 +982,14 @@ export async function runHeadless(
985982
// the forked agent mid-flight. Gated by isExtractModeActive so the
986983
// tengu_slate_thimble flag controls non-interactive extraction end-to-end.
987984
if (feature('EXTRACT_MEMORIES') && isExtractModeActive()) {
988-
await extractMemoriesModule!.drainPendingExtraction()
985+
try {
986+
const { drainPendingExtraction } = await import(
987+
'../services/extractMemories/extractMemories.js'
988+
)
989+
await drainPendingExtraction()
990+
} catch {
991+
// Module load failure — non-critical at shutdown
992+
}
989993
}
990994

991995
gracefulShutdownSync(

src/commands/autofix-pr/__tests__/AutofixProgress.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as React from 'react';
88
import { renderToString } from '../../../utils/staticRender.js';
99
import { AutofixProgress } from '../AutofixProgress.js';
1010

11-
describe('AutofixProgress', () => {
11+
describe.skipIf(!!process.env.CI)('AutofixProgress', () => {
1212
test('renders target in header', async () => {
1313
const out = await renderToString(<AutofixProgress phase="detecting" target="acme/myrepo#42" />);
1414
expect(out).toContain('acme/myrepo#42');

src/components/Spinner.tsx

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { getDefaultCharacters, type SpinnerMode } from './Spinner/index.js';
2323
import { SpinnerAnimationRow } from './Spinner/SpinnerAnimationRow.js';
2424
import { useSettings } from '../hooks/useSettings.js';
2525
import { isInProcessTeammateTask } from '../tasks/InProcessTeammateTask/types.js';
26+
import { isLocalAgentTask } from '../tasks/LocalAgentTask/LocalAgentTask.js';
2627
import { isBackgroundTask } from '../tasks/types.js';
2728
import { getAllInProcessTeammateTasks } from '../tasks/InProcessTeammateTask/InProcessTeammateTask.js';
2829
import { getEffortSuffix } from '../utils/effort.js';
@@ -209,15 +210,22 @@ function SpinnerWithVerbInner({
209210
const hasRunningTeammates = runningTeammates.length > 0;
210211
const allIdle = hasRunningTeammates && runningTeammates.every(t => t.isIdle);
211212

212-
// Gather aggregate token stats from all running swarm teammates
213-
// In spinner-tree mode, skip aggregation (teammates have their own lines in the tree)
213+
// Gather aggregate token stats from all running agents.
214+
// In spinner-tree mode, skip in-process teammates (they have their own
215+
// per-teammate lines in the tree) but still count local-agent tasks
216+
// (background agents) which have no dedicated tree rows.
214217
let teammateTokens = 0;
215-
if (!showSpinnerTree) {
216-
for (const task of Object.values(tasks)) {
217-
if (isInProcessTeammateTask(task) && task.status === 'running') {
218-
if (task.progress?.tokenCount) {
219-
teammateTokens += task.progress.tokenCount;
220-
}
218+
for (const task of Object.values(tasks)) {
219+
if (task.status !== 'running') continue;
220+
if (isInProcessTeammateTask(task)) {
221+
if (!showSpinnerTree && task.progress?.tokenCount) {
222+
teammateTokens += task.progress.tokenCount;
223+
}
224+
continue;
225+
}
226+
if (isLocalAgentTask(task)) {
227+
if (task.progress?.tokenCount) {
228+
teammateTokens += task.progress.tokenCount;
221229
}
222230
}
223231
}

src/components/permissions/ExitPlanModePermissionRequest/ExitPlanModePermissionRequest.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ export function ExitPlanModePermissionRequest({
450450
}));
451451

452452
setHasExitedPlanMode(true);
453+
setNeedsPlanModeExitAttachment(true);
453454
onDone();
454455
onReject();
455456
// Reject the tool use to unblock the query loop

0 commit comments

Comments
 (0)