fix: keep non-object tool arguments invalid under python -O

Closed
DE
1mo ago
+53-1

closes #10525

under python -O, the assert in BaseToolCallPart.args_as_dict() gets stripped, letting non-object json through to downstream consumers like capability_id and crashing.

replaced the assert with an explicit type check to preserve the invalid-argument contract across standard and optimized interpreters. added regression tests for non-object payloads and subprocess execution under -O.