* Format a Codex bash call with HTML details * Uses the shared formatToolCallAsDetails helper for consistent rendering across all engines. * @param {string} command - The bash command * @param {string} response - The response as plain text * @param {string} statusIcon - The status icon (✅, ❌, or
(command, response, statusIcon)
| 922 | * @returns {string} Formatted HTML details string |
| 923 | */ |
| 924 | function formatCodexBashCall(command, response, statusIcon) { |
| 925 | // Calculate token estimate from command + response |
| 926 | const totalTokens = estimateTokens(command) + estimateTokens(response); |
| 927 | |
| 928 | // Format metadata |
| 929 | let metadata = ""; |
| 930 | if (totalTokens > 0) { |
| 931 | metadata = `<code>~${totalTokens}t</code>`; |
| 932 | } |
| 933 | |
| 934 | const summary = `<code>bash: ${truncateString(command, 60)}</code>`; |
| 935 | |
| 936 | // Build sections array |
| 937 | const sections = []; |
| 938 | |
| 939 | sections.push({ |
| 940 | label: "Command", |
| 941 | content: command, |
| 942 | language: "bash", |
| 943 | }); |
| 944 | |
| 945 | if (response && response.trim()) { |
| 946 | sections.push({ |
| 947 | label: "Output", |
| 948 | content: response, |
| 949 | }); |
| 950 | } |
| 951 | |
| 952 | return formatToolCallAsDetails({ |
| 953 | summary, |
| 954 | statusIcon, |
| 955 | metadata, |
| 956 | sections, |
| 957 | }); |
| 958 | } |
| 959 | |
| 960 | // Export for testing |
| 961 | if (typeof module !== "undefined" && module.exports) { |
no test coverage detected