|
41 | 41 | ) |
42 | 42 | from ralphify import _brand |
43 | 43 | from ralphify._agent import CLAUDE_BINARY |
44 | | -from ralphify._output import format_duration |
| 44 | +from ralphify._output import format_count, format_duration |
45 | 45 |
|
46 | 46 | _ICON_SUCCESS = "✓" |
47 | 47 | _ICON_FAILURE = "✗" |
@@ -182,14 +182,6 @@ def _extract_tool_arg(name: str, tool_input: dict[str, Any]) -> str: |
182 | 182 | return ", ".join(sorted(tool_input.keys())) |
183 | 183 |
|
184 | 184 |
|
185 | | -def _format_tool_summary(name: str, tool_input: dict[str, Any]) -> str: |
186 | | - """Return a compact one-liner describing a tool call.""" |
187 | | - arg = _extract_tool_arg(name, tool_input) |
188 | | - if arg: |
189 | | - return f"{name} {arg}" |
190 | | - return name |
191 | | - |
192 | | - |
193 | 185 | # ── Helpers ─────────────────────────────────────────────────────────── |
194 | 186 |
|
195 | 187 |
|
@@ -502,23 +494,11 @@ def _format_tokens(self) -> str: |
502 | 494 | parts: list[str] = [] |
503 | 495 | total_in = self._input_tokens |
504 | 496 | if total_in > 0: |
505 | | - parts.append(f"ctx {self._format_count(total_in)}") |
| 497 | + parts.append(f"ctx {format_count(total_in)}") |
506 | 498 | if self._output_tokens > 0: |
507 | | - parts.append(f"out {self._format_count(self._output_tokens)}") |
| 499 | + parts.append(f"out {format_count(self._output_tokens)}") |
508 | 500 | return " · ".join(parts) |
509 | 501 |
|
510 | | - @staticmethod |
511 | | - def _format_count(n: int) -> str: |
512 | | - if n >= 1_000_000: |
513 | | - return f"{n / 1_000_000:.1f}M" |
514 | | - if n >= 1_000: |
515 | | - # Use rounded value to avoid "1000.0k" when rounding crosses |
516 | | - # into the next unit (same guard as format_duration's 59.95→1m). |
517 | | - if round(n / 1_000, 1) >= 1_000: |
518 | | - return f"{n / 1_000_000:.1f}M" |
519 | | - return f"{n / 1_000:.1f}k" |
520 | | - return str(n) |
521 | | - |
522 | 502 | def _format_categories(self) -> str: |
523 | 503 | if not self._tool_categories: |
524 | 504 | return "" |
|
0 commit comments