fix(chat): keep tool totals neutral and count individual errors

This commit is contained in:
2026-10-20 22:05:21 +01:00
parent e29be1181f
commit aa57fe8a04
8 changed files with 123 additions and 10 deletions
+5
View File
@@ -235,6 +235,11 @@ export function toolCallCount(parts) {
return (parts ?? []).filter((part) => part?.type === PART_TOOL).length;
}
/** Errors belong to individual calls, not the entire turn's tool total. */
export function toolFailureCount(parts) {
return (parts ?? []).filter((part) => part?.type === PART_TOOL && toolFailed(part.state)).length;
}
/** True while any tool call in [parts] is still in flight. */
export function toolsRunning(parts) {
return (parts ?? []).some((part) => toolRunning(part));