fix(session-recovery): fix SDK fallback part.tool mapping and nosuchtoolarror typo

This commit is contained in:
YeonGyu-Kim
2026-02-21 05:30:04 +09:00
parent d08fa728b4
commit db9df55e41
2 changed files with 1 additions and 2 deletions

View File

@@ -89,7 +89,6 @@ export function detectErrorType(error: unknown): RecoveryErrorType {
message.includes("dummy_tool") ||
message.includes("unavailable tool") ||
message.includes("model tried to call unavailable") ||
message.includes("nosuchtoolarror") ||
message.includes("nosuchtoolerror") ||
message.includes("no such tool")
) {

View File

@@ -51,7 +51,7 @@ async function readPartsFromSDKFallback(
return target.parts.map((part) => ({
type: part.type === "tool" ? "tool_use" : part.type,
id: "callID" in part ? (part as { callID?: string }).callID : part.id,
name: "name" in part && typeof part.name === "string" ? part.name : undefined,
name: "name" in part && typeof part.name === "string" ? part.name : ("tool" in part && typeof (part as { tool?: unknown }).tool === "string" ? (part as { tool: string }).tool : undefined),
}))
} catch {
return []