feat: 全部类型问题解决

This commit is contained in:
claude-code-best
2026-04-11 10:24:00 +08:00
parent 7088fe3c8b
commit 6a70056910
135 changed files with 671 additions and 503 deletions

View File

@@ -346,8 +346,8 @@ export class StreamingToolExecutor {
const isErrorResult =
update.message.type === 'user' &&
Array.isArray(update.message.message.content) &&
update.message.message.content.some(
Array.isArray(update.message.message!.content) &&
update.message.message!.content.some(
_ => _.type === 'tool_result' && _.is_error === true,
)

View File

@@ -815,7 +815,7 @@ async function checkPermissionsAndCallTool(
tool,
processedInput,
toolUseID,
assistantMessage.message.id,
assistantMessage.message.id!,
requestId,
mcpServerType,
mcpServerBaseUrl,
@@ -1497,7 +1497,7 @@ async function checkPermissionsAndCallTool(
toolUseContext,
tool,
toolUseID,
assistantMessage.message.id,
assistantMessage.message.id!,
processedInput,
toolOutput,
requestId,

View File

@@ -67,7 +67,7 @@ export async function* runPostToolUseHooks<Input extends AnyObject, Output>(
// IMPORTANT: We emit a cancelled event per hook
if (
result.message?.type === 'attachment' &&
result.message.attachment.type === 'hook_cancelled'
result.message.attachment!.type === 'hook_cancelled'
) {
logEvent('tengu_post_tool_hooks_cancelled', {
toolName: sanitizeToolNameForAnalytics(tool.name),
@@ -96,7 +96,7 @@ export async function* runPostToolUseHooks<Input extends AnyObject, Output>(
result.message &&
!(
result.message.type === 'attachment' &&
result.message.attachment.type === 'hook_blocking_error'
result.message.attachment!.type === 'hook_blocking_error'
)
) {
yield { message: result.message as AttachmentMessage | ProgressMessage<HookProgress> }
@@ -223,7 +223,7 @@ export async function* runPostToolUseFailureHooks<Input extends AnyObject>(
// Check if we were aborted during hook execution
if (
result.message?.type === 'attachment' &&
result.message.attachment.type === 'hook_cancelled'
result.message.attachment!.type === 'hook_cancelled'
) {
logEvent('tengu_post_tool_failure_hooks_cancelled', {
toolName: sanitizeToolNameForAnalytics(tool.name),
@@ -248,7 +248,7 @@ export async function* runPostToolUseFailureHooks<Input extends AnyObject>(
result.message &&
!(
result.message.type === 'attachment' &&
result.message.attachment.type === 'hook_blocking_error'
result.message.attachment!.type === 'hook_blocking_error'
)
) {
yield { message: result.message as AttachmentMessage | ProgressMessage<HookProgress> }