(part: &opencode_session::MessagePart)
| 804 | } |
| 805 | |
| 806 | fn part_to_info(part: &opencode_session::MessagePart) -> PartInfo { |
| 807 | let (synthetic, ignored) = match &part.part_type { |
| 808 | opencode_session::PartType::Text { |
| 809 | synthetic, ignored, .. |
| 810 | } => (*synthetic, *ignored), |
| 811 | _ => (None, None), |
| 812 | }; |
| 813 | PartInfo { |
| 814 | id: part.id.clone(), |
| 815 | part_type: part_type_name(&part.part_type).to_string(), |
| 816 | text: match &part.part_type { |
| 817 | opencode_session::PartType::Text { text, .. } => Some(text.clone()), |
| 818 | opencode_session::PartType::Reasoning { text } => Some(text.clone()), |
| 819 | _ => None, |
| 820 | }, |
| 821 | file: if let opencode_session::PartType::File { |
| 822 | url, |
| 823 | filename, |
| 824 | mime, |
| 825 | } = &part.part_type |
| 826 | { |
| 827 | Some(MessageFileInfo { |
| 828 | url: url.clone(), |
| 829 | filename: filename.clone(), |
| 830 | mime: mime.clone(), |
| 831 | }) |
| 832 | } else { |
| 833 | None |
| 834 | }, |
| 835 | tool_call: if let opencode_session::PartType::ToolCall { id, name, input } = &part.part_type |
| 836 | { |
| 837 | Some(ToolCallInfo { |
| 838 | id: id.clone(), |
| 839 | name: name.clone(), |
| 840 | input: input.clone(), |
| 841 | }) |
| 842 | } else { |
| 843 | None |
| 844 | }, |
| 845 | tool_result: if let opencode_session::PartType::ToolResult { |
| 846 | tool_call_id, |
| 847 | content, |
| 848 | is_error, |
| 849 | } = &part.part_type |
| 850 | { |
| 851 | Some(ToolResultInfo { |
| 852 | tool_call_id: tool_call_id.clone(), |
| 853 | content: content.clone(), |
| 854 | is_error: *is_error, |
| 855 | }) |
| 856 | } else { |
| 857 | None |
| 858 | }, |
| 859 | synthetic, |
| 860 | ignored, |
| 861 | } |
| 862 | } |
| 863 |
nothing calls this directly
no test coverage detected