mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 14:25:51 +00:00
style: 完成所有文件的lint
This commit is contained in:
@@ -823,11 +823,12 @@ export async function getAttachments(
|
||||
suppressNextDiscovery = false
|
||||
return []
|
||||
}
|
||||
const result = await skillSearchModules.prefetch.getTurnZeroSkillDiscovery(
|
||||
input,
|
||||
messages ?? [],
|
||||
context,
|
||||
)
|
||||
const result =
|
||||
await skillSearchModules.prefetch.getTurnZeroSkillDiscovery(
|
||||
input,
|
||||
messages ?? [],
|
||||
context,
|
||||
)
|
||||
return result ? [result] : []
|
||||
}),
|
||||
]
|
||||
@@ -1016,11 +1017,13 @@ export async function getAttachments(
|
||||
|
||||
clearTimeout(timeoutId)
|
||||
// Defensive: a getter leaking [undefined] crashes .map(a => a.type) below.
|
||||
return ([
|
||||
...userAttachmentResults.flat(),
|
||||
...threadAttachmentResults.flat(),
|
||||
...mainThreadAttachmentResults.flat(),
|
||||
] as Attachment[]).filter(a => a !== undefined && a !== null)
|
||||
return (
|
||||
[
|
||||
...userAttachmentResults.flat(),
|
||||
...threadAttachmentResults.flat(),
|
||||
...mainThreadAttachmentResults.flat(),
|
||||
] as Attachment[]
|
||||
).filter(a => a !== undefined && a !== null)
|
||||
}
|
||||
|
||||
async function maybe<A>(label: string, f: () => Promise<A[]>): Promise<A[]> {
|
||||
@@ -1547,7 +1550,8 @@ export function getAgentListingDeltaAttachment(
|
||||
if (msg.type !== 'attachment') continue
|
||||
if (msg.attachment!.type !== 'agent_listing_delta') continue
|
||||
for (const t of msg.attachment!.addedTypes as string[]) announced.add(t)
|
||||
for (const t of msg.attachment!.removedTypes as string[]) announced.delete(t)
|
||||
for (const t of msg.attachment!.removedTypes as string[])
|
||||
announced.delete(t)
|
||||
}
|
||||
|
||||
const currentTypes = new Set(filtered.map(a => a.agentType))
|
||||
@@ -1770,7 +1774,6 @@ export function memoryFilesToAttachments(
|
||||
isPartialView: memoryFile.contentDiffersFromDisk,
|
||||
})
|
||||
|
||||
|
||||
// Fire InstructionsLoaded hook for audit/observability (fire-and-forget)
|
||||
if (shouldFireHook && isInstructionsMemoryType(memoryFile.type)) {
|
||||
const loadReason = memoryFile.globs
|
||||
@@ -2279,7 +2282,11 @@ export function collectSurfacedMemories(messages: ReadonlyArray<Message>): {
|
||||
let totalBytes = 0
|
||||
for (const m of messages) {
|
||||
if (m.type === 'attachment' && m.attachment!.type === 'relevant_memories') {
|
||||
for (const mem of m.attachment!.memories as { path: string; content: string; mtimeMs: number }[]) {
|
||||
for (const mem of m.attachment!.memories as {
|
||||
path: string
|
||||
content: string
|
||||
mtimeMs: number
|
||||
}[]) {
|
||||
paths.add(mem.path)
|
||||
totalBytes += mem.content.length
|
||||
}
|
||||
@@ -2393,7 +2400,8 @@ export function startRelevantMemoryPrefetch(
|
||||
}
|
||||
|
||||
// Poor mode: skip the side-query to save tokens
|
||||
const { isPoorModeActive } = require('../commands/poor/poorMode.js') as typeof import('../commands/poor/poorMode.js')
|
||||
const { isPoorModeActive } =
|
||||
require('../commands/poor/poorMode.js') as typeof import('../commands/poor/poorMode.js')
|
||||
if (isPoorModeActive()) {
|
||||
return undefined
|
||||
}
|
||||
@@ -2503,7 +2511,11 @@ export function collectRecentSuccessfulTools(
|
||||
if (!m) continue
|
||||
if (isHumanTurn(m) && m !== lastUserMessage) break
|
||||
if (m.type === 'assistant' && typeof m.message!.content !== 'string') {
|
||||
for (const block of m.message!.content as Array<{type: string; id: string; name: string}>) {
|
||||
for (const block of m.message!.content as Array<{
|
||||
type: string
|
||||
id: string
|
||||
name: string
|
||||
}>) {
|
||||
if (block.type === 'tool_use') useIdToName.set(block.id, block.name)
|
||||
}
|
||||
} else if (
|
||||
@@ -2511,7 +2523,7 @@ export function collectRecentSuccessfulTools(
|
||||
'message' in m &&
|
||||
Array.isArray(m.message!.content)
|
||||
) {
|
||||
for (const block of m.message!.content as Array<{type: string}>) {
|
||||
for (const block of m.message!.content as Array<{ type: string }>) {
|
||||
if (isToolResultBlock(block)) {
|
||||
resultByUseId.set(block.tool_use_id, block.is_error === true)
|
||||
}
|
||||
@@ -2532,7 +2544,6 @@ export function collectRecentSuccessfulTools(
|
||||
return [...succeeded].filter(t => !failed.has(t))
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Filters prefetched memory attachments to exclude memories the model already
|
||||
* has in context via FileRead/Write/Edit tool calls (any iteration this turn)
|
||||
@@ -4025,7 +4036,6 @@ export function getContextEfficiencyAttachment(
|
||||
return [{ type: 'context_efficiency' }]
|
||||
}
|
||||
|
||||
|
||||
function isFileReadDenied(
|
||||
filePath: string,
|
||||
toolPermissionContext: ToolPermissionContext,
|
||||
|
||||
Reference in New Issue
Block a user