mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-19 06:45:50 +00:00
feat: 全部类型问题解决
This commit is contained in:
@@ -106,14 +106,14 @@ export function updateProgressFromMessage(
|
||||
if (message.type !== 'assistant') {
|
||||
return
|
||||
}
|
||||
const usage = message.message.usage as BetaUsage
|
||||
const usage = message.message!.usage as BetaUsage
|
||||
// Keep latest input (it's cumulative in the API), sum outputs
|
||||
tracker.latestInputTokens =
|
||||
(usage.input_tokens as number) +
|
||||
(usage.cache_creation_input_tokens ?? 0) +
|
||||
(usage.cache_read_input_tokens ?? 0)
|
||||
tracker.cumulativeOutputTokens += usage.output_tokens as number
|
||||
for (const content of (message.message.content ?? []) as Array<{ type: string; name?: string; input?: unknown }>) {
|
||||
for (const content of (message.message!.content ?? []) as Array<{ type: string; name?: string; input?: unknown }>) {
|
||||
if (content.type === 'tool_use') {
|
||||
tracker.toolUseCount++
|
||||
// Omit StructuredOutput from preview - it's an internal tool
|
||||
|
||||
@@ -423,11 +423,11 @@ export function startBackgroundSession({
|
||||
const contentBlocks = (msg.message?.content ?? []) as Array<{ type: string; text?: string; name?: string; input?: unknown }>
|
||||
for (const block of contentBlocks) {
|
||||
if (block.type === 'text') {
|
||||
tokenCount += roughTokenCountEstimation(block.text)
|
||||
tokenCount += roughTokenCountEstimation(block.text ?? '')
|
||||
} else if (block.type === 'tool_use') {
|
||||
toolCount++
|
||||
const activity: ToolActivity = {
|
||||
toolName: block.name,
|
||||
toolName: block.name ?? '',
|
||||
input: block.input as Record<string, unknown>,
|
||||
}
|
||||
recentActivities.push(activity)
|
||||
|
||||
@@ -29,6 +29,7 @@ import {
|
||||
type BackgroundRemoteSessionPrecondition,
|
||||
checkBackgroundRemoteSessionEligibility,
|
||||
} from '../../utils/background/remote/remoteSession.js'
|
||||
export type { BackgroundRemoteSessionPrecondition }
|
||||
import { logForDebugging } from '../../utils/debug.js'
|
||||
import { logError } from '../../utils/log.js'
|
||||
import { enqueuePendingNotification } from '../../utils/messageQueueManager.js'
|
||||
|
||||
Reference in New Issue
Block a user