fix: extend tool argument normalization to all tools and harden edge cases
- Extend STRING_ARGUMENT_TOOL_FIELDS to normalize Read, Write, Edit,
Glob, and Grep plain-string arguments (fixes "Invalid tool parameters"
errors reported by VennDev)
- Normalize streaming Bash args regardless of finish_reason, not only
when finish_reason is 'tool_calls'
- Broaden isLikelyStructuredObjectLiteral to catch malformed object-shaped
strings like {command:"pwd"} and {'command':'pwd'} (fixes CR2 from
Vasanthdev2004)
- Apply blank/object-literal guard to all tools, not just Bash
- Extract duplicated JSON repair suffix combinations into shared constant
- Add 32 isolated unit tests for toolArgumentNormalization
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1420,7 +1420,7 @@ test('does not normalize incomplete streamed Bash commands when finish_reason is
|
||||
.map(event => (event.delta as Record<string, unknown>).partial_json)
|
||||
.join('')
|
||||
|
||||
expect(streamedInput).toBe('rg --fi')
|
||||
expect(streamedInput).toBe('{"command":"rg --fi"}')
|
||||
})
|
||||
|
||||
test('does not repair truncated Bash objects that do not contain command', async () => {
|
||||
|
||||
Reference in New Issue
Block a user