style: 完成所有文件的lint

This commit is contained in:
claude-code-best
2026-05-01 21:39:30 +08:00
parent d136872cc9
commit 6182015005
1333 changed files with 68255 additions and 77882 deletions

View File

@@ -384,7 +384,9 @@ async function countBuiltInToolTokens(
// Check if tool search is enabled
const { isToolSearchEnabled } = await import('./toolSearch.js')
const { isDeferredTool } = await import('@claude-code-best/builtin-tools/tools/ToolSearchTool/prompt.js')
const { isDeferredTool } = await import(
'@claude-code-best/builtin-tools/tools/ToolSearchTool/prompt.js'
)
const isDeferred = await isToolSearchEnabled(
model ?? '',
tools,
@@ -668,7 +670,9 @@ export async function countMcpToolTokens(
// Check if tool search is enabled - if so, MCP tools are deferred
// isToolSearchEnabled handles threshold calculation internally for TstAuto mode
const { isToolSearchEnabled } = await import('./toolSearch.js')
const { isDeferredTool } = await import('@claude-code-best/builtin-tools/tools/ToolSearchTool/prompt.js')
const { isDeferredTool } = await import(
'@claude-code-best/builtin-tools/tools/ToolSearchTool/prompt.js'
)
const isDeferred = await isToolSearchEnabled(
model,
@@ -786,12 +790,18 @@ function processAssistantMessage(
breakdown: MessageBreakdown,
): void {
// Process each content block individually
const contentBlocks = Array.isArray(msg.message!.content) ? msg.message!.content : []
const contentBlocks = Array.isArray(msg.message!.content)
? msg.message!.content
: []
for (const block of contentBlocks) {
const blockStr = jsonStringify(block)
const blockTokens = roughTokenCountEstimation(blockStr)
if (typeof block !== 'string' && 'type' in block && block.type === 'tool_use') {
if (
typeof block !== 'string' &&
'type' in block &&
block.type === 'tool_use'
) {
breakdown.toolCallTokens += blockTokens
const toolName = ('name' in block ? block.name : undefined) || 'unknown'
breakdown.toolCallsByType.set(
@@ -819,7 +829,7 @@ function processUserMessage(
}
// Process each content block individually
for (const block of (msg.message!.content ?? [])) {
for (const block of msg.message!.content ?? []) {
const blockStr = jsonStringify(block)
const blockTokens = roughTokenCountEstimation(blockStr)
@@ -875,10 +885,16 @@ async function approximateMessageTokens(
for (const msg of microcompactResult.messages) {
if (msg.type === 'assistant' && Array.isArray(msg.message!.content)) {
for (const block of msg.message!.content) {
if (typeof block !== 'string' && 'type' in block && block.type === 'tool_use') {
if (
typeof block !== 'string' &&
'type' in block &&
block.type === 'tool_use'
) {
const toolUseId = 'id' in block ? (block.id as string) : undefined
const toolName =
(('name' in block ? block.name : undefined) as string | undefined) || 'unknown'
(('name' in block ? block.name : undefined) as
| string
| undefined) || 'unknown'
if (toolUseId) {
toolUseIdToName.set(toolUseId, toolName)
}