Commit b31fcf2
committed
fix: convert null tool args to empty object to prevent GenericFailure
When an LLM returns a ToolUse with null input (valid JSON), the JS
callback throws TypeError accessing args.input on null. This was wrapped
by napi-rs as GenericFailure.
Fix: convert Value::Null args to empty object {} in PreToolUse and
PostToolUse hook events, and in GenerateEnd tool_calls.
Fixes: A3S-Lab#23 (GenericFailure / TypeError variant)1 parent a9a8212 commit b31fcf2
1 file changed
Lines changed: 24 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1423 | 1423 | | |
1424 | 1424 | | |
1425 | 1425 | | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
1426 | 1432 | | |
1427 | 1433 | | |
1428 | 1434 | | |
1429 | | - | |
| 1435 | + | |
1430 | 1436 | | |
1431 | 1437 | | |
1432 | 1438 | | |
| |||
1449 | 1455 | | |
1450 | 1456 | | |
1451 | 1457 | | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
1452 | 1464 | | |
1453 | 1465 | | |
1454 | 1466 | | |
1455 | | - | |
| 1467 | + | |
1456 | 1468 | | |
1457 | 1469 | | |
1458 | 1470 | | |
| |||
1499 | 1511 | | |
1500 | 1512 | | |
1501 | 1513 | | |
1502 | | - | |
1503 | | - | |
1504 | | - | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
1505 | 1524 | | |
1506 | 1525 | | |
1507 | 1526 | | |
| |||
0 commit comments