Find the message/tool part inside common OpenCode event shapes.
(event: dict[str, Any])
| 250 | |
| 251 | |
| 252 | def _candidate_part(event: dict[str, Any]) -> dict[str, Any] | None: |
| 253 | """Find the message/tool part inside common OpenCode event shapes.""" |
| 254 | for key in ("part", "messagePart"): |
| 255 | value = event.get(key) |
| 256 | if isinstance(value, dict): |
| 257 | return value |
| 258 | |
| 259 | for container_key in ("properties", "data", "payload"): |
| 260 | container = event.get(container_key) |
| 261 | if not isinstance(container, dict): |
| 262 | continue |
| 263 | for key in ("part", "messagePart"): |
| 264 | value = container.get(key) |
| 265 | if isinstance(value, dict): |
| 266 | return value |
| 267 | return None |
| 268 | |
| 269 | |
| 270 | def _coerce_tool_input(value: Any) -> dict[str, Any]: |
no test coverage detected