chore: full Biome lint cleanup — zero errors, zero warnings

- Remove 203 unused biome-ignore suppression comments (noConsole rule is off)
- Apply all FIXABLE transforms: Math.pow->**, parseInt radix,
  noUselessContinue, noUselessUndefinedInitialization, useIndexOf,
  useRegexLiterals, useShorthandFunctionType, noPrototypeBuiltins
- Add targeted suppressions for 31 intentional patterns
- Format all src/ files via Biome (quote style, import line width)
- Result: 0 errors, 0 warnings across 2649 files
This commit is contained in:
unraid
2026-04-14 19:56:13 +08:00
parent ee369549a8
commit 4c409df35d
1556 changed files with 49552 additions and 61067 deletions

View File

@@ -41,7 +41,11 @@ import { type Tools, type ToolUseContext, toolMatchesName } from './Tool.js'
import type { AgentDefinition } from '@claude-code-best/builtin-tools/tools/AgentTool/loadAgentsDir.js'
import { SYNTHETIC_OUTPUT_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/SyntheticOutputTool/SyntheticOutputTool.js'
import type { APIError } from '@anthropic-ai/sdk'
import type { CompactMetadata, Message, SystemCompactBoundaryMessage } from './types/message.js'
import type {
CompactMetadata,
Message,
SystemCompactBoundaryMessage,
} from './types/message.js'
import type { OrphanedPermission } from './types/textInputTypes.js'
import { createAbortController } from './utils/abortController.js'
import type { AttributionState } from './utils/commitAttribution.js'
@@ -708,7 +712,8 @@ export class QueryEngine {
message.subtype === 'compact_boundary'
) {
const compactMsg = message as SystemCompactBoundaryMessage
const tailUuid = compactMsg.compactMetadata?.preservedSegment?.tailUuid
const tailUuid =
compactMsg.compactMetadata?.preservedSegment?.tailUuid
if (tailUuid) {
const tailIdx = this.mutableMessages.findLastIndex(
m => m.uuid === tailUuid,
@@ -768,7 +773,10 @@ export class QueryEngine {
// streamed responses, this is null at content_block_stop time;
// the real value arrives via message_delta (handled below).
const msg = message as Message
const stopReason = msg.message?.stop_reason as string | null | undefined
const stopReason = msg.message?.stop_reason as
| string
| null
| undefined
if (stopReason != null) {
lastStopReason = stopReason
}
@@ -798,11 +806,15 @@ export class QueryEngine {
break
}
case 'stream_event': {
const event = (message as unknown as { event: Record<string, unknown> }).event
const event = (
message as unknown as { event: Record<string, unknown> }
).event
if (event.type === 'message_start') {
// Reset current message usage for new message
currentMessageUsage = EMPTY_USAGE
const eventMessage = event.message as { usage: BetaMessageDeltaUsage }
const eventMessage = event.message as {
usage: BetaMessageDeltaUsage
}
currentMessageUsage = updateUsage(
currentMessageUsage,
eventMessage.usage,
@@ -851,7 +863,15 @@ export class QueryEngine {
void recordTranscript(messages)
}
const attachment = msg.attachment as { type: string; data?: unknown; turnCount?: number; maxTurns?: number; prompt?: string; source_uuid?: string; [key: string]: unknown }
const attachment = msg.attachment as {
type: string
data?: unknown
turnCount?: number
maxTurns?: number
prompt?: string
source_uuid?: string
[key: string]: unknown
}
// Extract structured output from StructuredOutput tool calls
if (attachment.type === 'structured_output') {
@@ -892,10 +912,7 @@ export class QueryEngine {
return
}
// Yield queued_command attachments as SDK user message replays
else if (
replayUserMessages &&
attachment.type === 'queued_command'
) {
else if (replayUserMessages && attachment.type === 'queued_command') {
yield {
type: 'user',
message: {
@@ -923,10 +940,7 @@ export class QueryEngine {
// never shrinks (memory leak in long SDK sessions). The subtype
// check lives inside the injected callback so feature-gated strings
// stay out of this file (excluded-strings check).
const snipResult = this.config.snipReplay?.(
msg,
this.mutableMessages,
)
const snipResult = this.config.snipReplay?.(msg, this.mutableMessages)
if (snipResult !== undefined) {
if (snipResult.executed) {
this.mutableMessages.length = 0
@@ -936,10 +950,7 @@ export class QueryEngine {
}
this.mutableMessages.push(msg)
// Yield compact boundary messages to SDK
if (
msg.subtype === 'compact_boundary' &&
msg.compactMetadata
) {
if (msg.subtype === 'compact_boundary' && msg.compactMetadata) {
const compactMsg = msg as SystemCompactBoundaryMessage
// Release pre-compaction messages for GC. The boundary was just
// pushed so it's the last element. query.ts already uses
@@ -959,11 +970,18 @@ export class QueryEngine {
subtype: 'compact_boundary' as const,
session_id: getSessionId(),
uuid: msg.uuid,
compact_metadata: toSDKCompactMetadata(compactMsg.compactMetadata),
compact_metadata: toSDKCompactMetadata(
compactMsg.compactMetadata,
),
}
}
if (msg.subtype === 'api_error') {
const apiErrorMsg = msg as Message & { retryAttempt: number; maxRetries: number; retryInMs: number; error: APIError }
const apiErrorMsg = msg as Message & {
retryAttempt: number
maxRetries: number
retryInMs: number
error: APIError
}
yield {
type: 'system',
subtype: 'api_retry' as const,
@@ -980,7 +998,10 @@ export class QueryEngine {
break
}
case 'tool_use_summary': {
const msg = message as Message & { summary: unknown; precedingToolUseIds: unknown }
const msg = message as Message & {
summary: unknown
precedingToolUseIds: unknown
}
// Yield tool use summary messages to SDK
yield {
type: 'tool_use_summary' as const,
@@ -1089,7 +1110,10 @@ export class QueryEngine {
const edeResultType = result?.type ?? 'undefined'
const edeLastContentType =
result?.type === 'assistant'
? (last(result.message!.content as import('@anthropic-ai/sdk/resources/beta/messages/messages.js').BetaContentBlock[])?.type ?? 'none')
? (last(
result.message!
.content as import('@anthropic-ai/sdk/resources/beta/messages/messages.js').BetaContentBlock[],
)?.type ?? 'none')
: 'n/a'
// Flush buffered transcript writes before yielding result.
@@ -1147,7 +1171,10 @@ export class QueryEngine {
let isApiError = false
if (result.type === 'assistant') {
const lastContent = last(result.message!.content as import('@anthropic-ai/sdk/resources/beta/messages/messages.js').BetaContentBlock[])
const lastContent = last(
result.message!
.content as import('@anthropic-ai/sdk/resources/beta/messages/messages.js').BetaContentBlock[],
)
if (
lastContent?.type === 'text' &&
!SYNTHETIC_MESSAGES.has(lastContent.text)