Shut down the worker and release owned resources, including any live bash * process groups. */
| 9468 | |
| 9469 | static void build_prompt_text(const agent_status *st, char *buf, size_t len) { |
| 9470 | (void)st; |
| 9471 | snprintf(buf, len, "ds4-agent> "); |
| 9472 | } |
| 9473 | |
| 9474 | static void agent_progress_bar(int done, int total, double tps, |
| 9475 | char *buf, size_t len, bool color) { |
| 9476 | if (len == 0) return; |
| 9477 | if (total <= 0) total = 1; |
| 9478 | if (done < 0) done = 0; |
| 9479 | if (done > total) done = total; |
| 9480 | int filled = (int)(((long long)done * AGENT_PROGRESS_BAR_WIDTH) / total); |
| 9481 | if (filled < 0) filled = 0; |
| 9482 | if (filled > AGENT_PROGRESS_BAR_WIDTH) filled = AGENT_PROGRESS_BAR_WIDTH; |
| 9483 | if (color && filled == 0 && done < total) filled = 1; |
| 9484 | char rate[32] = {0}; |
| 9485 | size_t rate_len = 0; |
| 9486 | if (tps > 0.0 && filled < AGENT_PROGRESS_BAR_WIDTH) { |
| 9487 | snprintf(rate, sizeof(rate), " %.0ft/s", tps); |
| 9488 | rate_len = strlen(rate); |
| 9489 | } |
| 9490 | size_t pos = 0; |
| 9491 | agent_progress_append(buf, len, &pos, "["); |
| 9492 | if (color) agent_progress_append(buf, len, &pos, AGENT_STATUS_BAR_FILL); |
no test coverage detected