(
terminal: (toolName: string) => string,
)
| 102 | * `✅` on finish, `⚠️ … (cancelled)` on error/interrupt). |
| 103 | */ |
| 104 | const drainToolStatuses = async ( |
| 105 | terminal: (toolName: string) => string, |
| 106 | ): Promise<void> => { |
| 107 | if (toolStatusIds.size === 0) return; |
| 108 | const tasks: Promise<void>[] = []; |
| 109 | for (const [toolCallId, messageId] of Array.from(toolStatusIds.entries())) { |
| 110 | const captured = capturedToolCalls.find( |
| 111 | (c) => c.toolCallId === toolCallId, |
| 112 | ); |
| 113 | const toolName = captured?.toolCallName ?? "tool"; |
| 114 | tasks.push( |
| 115 | args |
| 116 | .editAt(messageId, telegramHtml(terminal(toolName))) |
| 117 | .catch((err) => |
| 118 | console.error("[telegram-renderer] tool-status drain failed:", err), |
| 119 | ), |
| 120 | ); |
| 121 | } |
| 122 | toolStatusIds.clear(); |
| 123 | await Promise.all(tasks); |
| 124 | }; |
| 125 | |
| 126 | const captureToolCall = ( |
| 127 | toolCallId: string, |
no test coverage detected
searching dependent graphs…