mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-17 13:55:50 +00:00
feat: 问就是封包
This commit is contained in:
@@ -760,17 +760,17 @@ export async function* runAgent({
|
||||
// so TTFT/OTPS update during subagent execution.
|
||||
if (
|
||||
message.type === 'stream_event' &&
|
||||
message.event.type === 'message_start' &&
|
||||
message.ttftMs != null
|
||||
(message as any).event.type === 'message_start' &&
|
||||
(message as any).ttftMs != null
|
||||
) {
|
||||
toolUseContext.pushApiMetricsEntry?.(message.ttftMs)
|
||||
toolUseContext.pushApiMetricsEntry?.((message as any).ttftMs)
|
||||
continue
|
||||
}
|
||||
|
||||
// Yield attachment messages (e.g., structured_output) without recording them
|
||||
if (message.type === 'attachment') {
|
||||
// Handle max turns reached signal from query.ts
|
||||
if (message.attachment.type === 'max_turns_reached') {
|
||||
if ((message as any).attachment.type === 'max_turns_reached') {
|
||||
logForDebugging(
|
||||
`[Agent
|
||||
: $
|
||||
@@ -779,13 +779,13 @@ export async function* runAgent({
|
||||
}
|
||||
] Reached max turns limit ($
|
||||
{
|
||||
message.attachment.maxTurns
|
||||
(message as any).attachment.maxTurns
|
||||
}
|
||||
)`,
|
||||
)
|
||||
break
|
||||
}
|
||||
yield message
|
||||
yield message as Message
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ function EditRejectionBody(t0) {
|
||||
patch,
|
||||
firstLine,
|
||||
fileContent
|
||||
} = use(promise);
|
||||
} = use(promise) as any;
|
||||
let t1;
|
||||
if ($[0] !== fileContent || $[1] !== filePath || $[2] !== firstLine || $[3] !== patch || $[4] !== style || $[5] !== verbose) {
|
||||
t1 = <FileEditToolUseRejectedMessage file_path={filePath} operation="update" patch={patch} firstLine={firstLine} fileContent={fileContent} style={style} verbose={verbose} />;
|
||||
|
||||
@@ -899,11 +899,11 @@ async function callInner(
|
||||
parsedRange ?? undefined,
|
||||
)
|
||||
if (!extractResult.success) {
|
||||
throw new Error(extractResult.error.message)
|
||||
throw new Error((extractResult as any).error.message)
|
||||
}
|
||||
logEvent('tengu_pdf_page_extraction', {
|
||||
success: true,
|
||||
pageCount: extractResult.data.file.count,
|
||||
pageCount: (extractResult as any).data.file.count,
|
||||
fileSize: extractResult.data.file.originalSize,
|
||||
hasPageRange: true,
|
||||
})
|
||||
@@ -970,7 +970,7 @@ async function callInner(
|
||||
} else {
|
||||
logEvent('tengu_pdf_page_extraction', {
|
||||
success: false,
|
||||
available: extractResult.error.reason !== 'unavailable',
|
||||
available: (extractResult as any).error.reason !== 'unavailable',
|
||||
fileSize: stats.size,
|
||||
})
|
||||
}
|
||||
@@ -986,7 +986,7 @@ async function callInner(
|
||||
|
||||
const readResult = await readPDF(resolvedFilePath)
|
||||
if (!readResult.success) {
|
||||
throw new Error(readResult.error.message)
|
||||
throw new Error((readResult as any).error.message)
|
||||
}
|
||||
const pdfData = readResult.data
|
||||
logFileOperation({
|
||||
@@ -1158,12 +1158,12 @@ export async function readImageWithTokenBudget(
|
||||
const sharpModule = await import('sharp')
|
||||
const sharp =
|
||||
(
|
||||
sharpModule as {
|
||||
sharpModule as unknown as {
|
||||
default?: typeof sharpModule
|
||||
} & typeof sharpModule
|
||||
).default || sharpModule
|
||||
|
||||
const fallbackBuffer = await sharp(imageBuffer)
|
||||
const fallbackBuffer = await (sharp as any)(imageBuffer)
|
||||
.resize(400, 400, {
|
||||
fit: 'inside',
|
||||
withoutEnlargement: true,
|
||||
|
||||
@@ -826,7 +826,7 @@ export const SendMessageTool: Tool<InputSchema, SendMessageToolOutput> =
|
||||
prompt: input.message,
|
||||
toolUseContext: context,
|
||||
canUseTool,
|
||||
invokingRequestId: assistantMessage?.requestId,
|
||||
invokingRequestId: assistantMessage?.requestId as string | undefined,
|
||||
})
|
||||
return {
|
||||
data: {
|
||||
@@ -853,7 +853,7 @@ export const SendMessageTool: Tool<InputSchema, SendMessageToolOutput> =
|
||||
prompt: input.message,
|
||||
toolUseContext: context,
|
||||
canUseTool,
|
||||
invokingRequestId: assistantMessage?.requestId,
|
||||
invokingRequestId: assistantMessage?.requestId as string | undefined,
|
||||
})
|
||||
return {
|
||||
data: {
|
||||
|
||||
Reference in New Issue
Block a user