MCPcopy Create free account
hub / github.com/antirez/ds4 / agent_worker_free

Function agent_worker_free

ds4_agent.c:9470–9489  ·  view source on GitHub ↗

Shut down the worker and release owned resources, including any live bash * process groups. */

Source from the content-addressed store, hash-verified

9468
9469static void build_prompt_text(const agent_status *st, char *buf, size_t len) {
9470 (void)st;
9471 snprintf(buf, len, "ds4-agent> ");
9472}
9473
9474static 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);

Callers 2

run_agentFunction · 0.85

Calls 5

worker_stopFunction · 0.85
agent_bash_jobs_freeFunction · 0.85
ds4_web_freeFunction · 0.85
ds4_session_freeFunction · 0.85
ds4_tokens_freeFunction · 0.85

Tested by

no test coverage detected