feat: add persistent multi-model workers and orchestration budgets
This commit is contained in:
@@ -5288,6 +5288,13 @@ static void show_subagent(tui_t *t, const char *pid,
|
||||
push_system_line(t, "── %s · %s: %s (%s · %d steps · %d tool calls · %.1f s)",
|
||||
rec->file, rec->role, rec->desc, rec->status, rec->steps,
|
||||
rec->tools, rec->ms / 1000.0);
|
||||
push_system_line(t, " model: %s/%s · requests: %d/%d · input/output: %ld/%ld",
|
||||
rec->provider, rec->model, rec->requests, rec->max_steps,
|
||||
rec->prompt_tokens, rec->output_tokens);
|
||||
if (rec->cache_known)
|
||||
push_system_line(t, " cache read/write: %ld/%ld", rec->cached_tokens, rec->cache_write_tokens);
|
||||
else push_system_line(t, " cache: unknown (not reported by provider)");
|
||||
if (rec->priced) push_system_line(t, " cost: %s%.6f", rec->currency, rec->cost);
|
||||
int n = cst_session_count(s);
|
||||
const char *final = NULL;
|
||||
for (int i = 0; i < n; i++) {
|
||||
@@ -5323,8 +5330,31 @@ static void show_subagent(tui_t *t, const char *pid,
|
||||
|
||||
static void cmd_agents(tui_t *t, char *arg, int *quit) {
|
||||
(void)quit;
|
||||
(void)arg;
|
||||
const char *ws = cst_agent_config(t->agent)->workspace_root;
|
||||
if (arg && strcmp(arg, "budget") == 0) {
|
||||
char *s = cst_workers_budget_json(cst_agent_config(t->agent));
|
||||
push_system_line(t, "%s", s ? s : "unavailable"); free(s);
|
||||
return;
|
||||
}
|
||||
if (arg && strncmp(arg, "config ", 7) == 0) {
|
||||
char err[256];
|
||||
int rc = cst_workers_config_set(ws, arg + 7, err, sizeof(err));
|
||||
if (rc == 0) cst_workers_config_apply(cst_agent_config_mut(t->agent));
|
||||
push_system_line(t, "%s", rc == 0 ? "Worker configuration saved" : err);
|
||||
return;
|
||||
}
|
||||
if (arg && strcmp(arg, "config") == 0) {
|
||||
char *s = cst_workers_config_get(ws);
|
||||
push_system_line(t, "%s", s ? s : "cannot read worker config");
|
||||
free(s);
|
||||
return;
|
||||
}
|
||||
if (arg && strncmp(arg, "cancel ", 7) == 0) {
|
||||
char sid[128]; cst_agent_session_id(t->agent, sid, sizeof(sid));
|
||||
push_system_line(t, "%s", cst_worker_cancel(ws, sid, arg + 7) == 0 ?
|
||||
"Worker cancellation requested" : "Running worker not found");
|
||||
return;
|
||||
}
|
||||
cst_agent_role_t *roles = calloc(CST_ROLES_MAX, sizeof(*roles));
|
||||
if (!roles)
|
||||
return;
|
||||
@@ -5333,15 +5363,19 @@ static void cmd_agents(tui_t *t, char *arg, int *quit) {
|
||||
cst_agent_session_id(t->agent, pid, sizeof(pid));
|
||||
static cst_subagent_rec_t recs[64];
|
||||
int nrec = cst_subagent_list(ws, pid, recs, 64);
|
||||
for (int i = 0; i < nrec; i++)
|
||||
if (!recs[i].cache_known)
|
||||
recs[i].cached_tokens = -1; /* unknown, not zero cache hits */
|
||||
/* one picker: roles insert a prompt prefix, runs open their transcript */
|
||||
static char items[CST_ROLES_MAX + 64][128];
|
||||
int n = 0;
|
||||
for (int i = 0; i < nr; i++)
|
||||
snprintf(items[n++], sizeof(items[0]), "role %-14.14s %-9.9s %.90s",
|
||||
roles[i].name, roles[i].source, roles[i].desc);
|
||||
roles[i].name, roles[i].profile[0] ? roles[i].profile : "inherit", roles[i].desc);
|
||||
for (int i = 0; i < nrec; i++)
|
||||
snprintf(items[n++], sizeof(items[0]), "run %-7.7s %-10.10s %-9.9s %.80s",
|
||||
recs[i].file, recs[i].role, recs[i].status, recs[i].desc);
|
||||
snprintf(items[n++], sizeof(items[0]), "run %.12s %.20s %.12s %d/%d req cache %ld/%ld",
|
||||
recs[i].file, recs[i].model, recs[i].status, recs[i].requests,
|
||||
recs[i].max_steps, recs[i].cached_tokens, recs[i].prompt_tokens);
|
||||
if (cst_tool_find("task") == NULL)
|
||||
push_system_line(t, "(the task tool is off: --tools minimal)");
|
||||
int pick = picker_run(t, "Agents (Enter: role → ask for it · run → view "
|
||||
|
||||
Reference in New Issue
Block a user