feat: solo default, job completion reports, tools wave-1 (0.9.32)

Password Realm no longer auto-enables parliament (keeps task/worker tools);
finished jobs fan out to agent notes + TUI; raise PAR_MAX/grep caps and tag truncations.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
WHC
2026-10-29 19:48:02 +08:00
co-authored by Cursor
parent 5917c48bd0
commit f00aad9e3e
12 changed files with 351 additions and 44 deletions
+54 -6
View File
@@ -423,6 +423,7 @@ typedef struct {
volatile int turn_done;
int turn_rc;
char turn_err[512];
int jobs_done; /* background completions drained this session */
} tui_t;
/* --- UTF-8 helpers -------------------------------------------------------- */
@@ -2941,7 +2942,11 @@ static void draw_side(tui_t *t) {
/* WORK — todo + modified, or a designed idle line (no empty void). */
if (y + 2 < bottom) {
draw_ansi_at(s, y++, x, mw, "work", CP_SIDE_MUTED, 0, 0);
if (t->jobs_done > 0) {
snprintf(line, sizeof(line), "work %d done", t->jobs_done);
draw_ansi_at(s, y++, x, mw, line, CP_SIDE_MUTED, 0, 0);
} else
draw_ansi_at(s, y++, x, mw, "work", CP_SIDE_MUTED, 0, 0);
int total = 0;
int todo_n = 0;
if (t->show_todo && t->todo && todo_open_items(t->todo, &total) >= 0 &&
@@ -2987,13 +2992,17 @@ static void draw_side(tui_t *t) {
y++;
}
/* SYNC — parliament quiet / pending */
/* SYNC — parliament pending/quiet, or solo (local workers) */
if (y + 1 < bottom) {
draw_ansi_at(s, y++, x, mw, "sync", CP_SIDE_MUTED, 0, 0);
if (cst_parliament_sync_pending())
if (t->jobs_done > 0 && !cst_parliament_is_active()) {
snprintf(line, sizeof(line), "sync %d done", t->jobs_done);
draw_ansi_at(s, y++, x, mw, line, CP_SIDE_MUTED, 0, 0);
} else
draw_ansi_at(s, y++, x, mw, "sync", CP_SIDE_MUTED, 0, 0);
if (!cst_parliament_is_active())
draw_ansi_at(s, y++, x, mw, "solo", CP_SIDE_MUTED, 0, 0);
else if (cst_parliament_sync_pending())
draw_ansi_at(s, y++, x, mw, "pending", CP_SIDE_PRIMARY, 0, 0);
else if (cst_parliament_is_active())
draw_ansi_at(s, y++, x, mw, "quiet", CP_SIDE_MUTED, 0, 0);
else
draw_ansi_at(s, y++, x, mw, "quiet", CP_SIDE_MUTED, 0, 0);
y++;
@@ -3210,6 +3219,38 @@ static void redraw_all(tui_t *t) {
/* --- session reload ------------------------------------------------------- */
static void push_system_line(tui_t *t, const char *fmt, ...);
/* Push finished background jobs into the transcript (non-modal). */
static int drain_job_completions(tui_t *t) {
const cst_agent_config_t *cfg = cst_agent_config(t->agent);
if (!cfg || !cfg->runtime)
return 0;
cst_job_completion_t comps[8];
int n = cst_runtime_take_ui_completions(cfg->runtime, comps, 8);
for (int i = 0; i < n; i++) {
const char *mark =
!strcmp(comps[i].status, "completed")
? (g_ascii ? "*" : "✓")
: (!strcmp(comps[i].status, "cancelled") ? "-"
: (g_ascii ? "x" : "✗"));
if (comps[i].ms > 0)
push_system_line(t, "%s job %s %s exit=%d %.1fs%s%s", mark, comps[i].id,
comps[i].status, comps[i].exit_code,
comps[i].ms / 1000.0,
comps[i].summary[0] ? " — " : "",
comps[i].summary[0] ? comps[i].summary : "");
else
push_system_line(t, "%s job %s %s exit=%d%s%s", mark, comps[i].id,
comps[i].status, comps[i].exit_code,
comps[i].summary[0] ? " — " : "",
comps[i].summary[0] ? comps[i].summary : "");
}
if (n > 0)
t->jobs_done += n;
return n;
}
static void push_system_line(tui_t *t, const char *fmt, ...) {
char tmp[1024];
va_list ap;
@@ -5229,6 +5270,10 @@ static void cmd_realm(tui_t *t, char *arg, int *quit) {
push_system_line(t, "(no realm status)");
}
free(pst);
if (!cst_parliament_is_active())
push_system_line(t, "(solo mode: local task/worker tools on; set "
"CST_COLLABORATION=parliament or /realm login to "
"join a parliament)");
return;
}
if (!strcmp(sub, "stop")) {
@@ -7753,6 +7798,9 @@ int cst_tui_run(cst_agent_t *agent) {
t.turn_done = 0;
tui_unlock(&t);
if (drain_job_completions(&t))
dirty = 1;
if (relayout) {
layout(&t);
wtimeout(t.input, 80);