(b)
| 797 | } |
| 798 | |
| 799 | function renderTool(b) { |
| 800 | const list = ensureGroup(); |
| 801 | S.currentGroupCount++; |
| 802 | S.currentGroup.querySelector('.step-count').textContent = S.currentGroupCount + ' steps'; |
| 803 | |
| 804 | const desc = toolDesc(b.name, b.input); |
| 805 | const item = document.createElement('div'); |
| 806 | item.className = 'step-item loading'; |
| 807 | item.dataset.toolId = b.id || ''; |
| 808 | item.dataset.toolName = b.name || ''; |
| 809 | item.innerHTML = ` |
| 810 | <div class="step-icon">${iconFor(b.name)}</div> |
| 811 | <span class="step-name">${esc(b.name)}</span> |
| 812 | <span class="step-desc">${esc(trunc(desc, 40))}</span> |
| 813 | <span class="step-duration" id="dur-${b.id}"></span> |
| 814 | <span class="step-arrow"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18l6-6-6-6"/></svg></span> |
| 815 | `; |
| 816 | |
| 817 | const detail = document.createElement('div'); |
| 818 | detail.className = 'step-detail'; |
| 819 | detail.id = `detail-${b.id}`; |
| 820 | const inputFull = toolInputFull(b.name, b.input); |
| 821 | const isEdit = b.name === 'Edit' && b.input && b.input.old_string !== undefined; |
| 822 | if (isEdit) { |
| 823 | detail.innerHTML = buildDiffHtml(b.input.old_string, b.input.new_string, b.input.file_path, b.input._startLine); |
| 824 | } else { |
| 825 | detail.innerHTML = ` |
| 826 | <div class="detail-input">${esc(inputFull)}</div> |
| 827 | <div class="detail-result" id="result-${b.id}"></div> |
| 828 | `; |
| 829 | } |
| 830 | |
| 831 | list.appendChild(item); |
| 832 | list.appendChild(detail); |
| 833 | S.toolMap.set(b.id, { item, detail, name: b.name, group: S.currentGroup }); |
| 834 | } |
| 835 | |
| 836 | function attachResult(b) { |
| 837 | const info = S.toolMap.get(b.tool_use_id); |
no test coverage detected