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
+37 -13
View File
@@ -25,11 +25,30 @@
#define RANGE_OUT_MAX (256 * 1024)
#define RANGE_DEFAULT_LINES 2000
#define LIST_MAX 500
#define GLOB_MAX 200
#define GREP_MAX_MATCHES 200
#define GLOB_MAX_DEFAULT 500
#define GREP_MAX_MATCHES_DEFAULT 500
#define GREP_MAX_FILES 20000
#define GREP_LINE_MAX 300
static int glob_max_hits(void) {
const char *e = getenv("CST_GLOB_MAX");
int n = e && e[0] ? atoi(e) : GLOB_MAX_DEFAULT;
if (n < 50)
n = 50;
if (n > 5000)
n = 5000;
return n;
}
static int grep_max_matches(void) {
const char *e = getenv("CST_GREP_MAX");
int n = e && e[0] ? atoi(e) : GREP_MAX_MATCHES_DEFAULT;
if (n < 50)
n = 50;
if (n > 5000)
n = 5000;
return n;
}
static int resolve(const cst_tool_ctx_t *ctx, const char *path, char *full,
size_t n) {
return cst_sandbox_resolve(ctx->workspace_root, path, full, n);
@@ -1128,7 +1147,7 @@ static int glob_cb(walker_t *w, const char *rel, const char *full,
u->mtimes[u->n] = st->mtime;
if (u->hits[u->n])
u->n++;
if (u->n >= GLOB_MAX * 20) {
if (u->n >= glob_max_hits() * 20) {
u->truncated = 1;
return 1;
}
@@ -1184,17 +1203,22 @@ int cst_tool_glob(const cst_tool_ctx_t *ctx, const ctl_tool_call_t *c,
hs[i].mtime = u.mtimes[i];
}
qsort(hs, (size_t)u.n, sizeof(*hs), hit_by_mtime);
for (int i = 0; i < u.n && i < GLOB_MAX; i++)
int gmax = glob_max_hits();
for (int i = 0; i < u.n && i < gmax; i++)
cst_buf_printf(&b, "%s\n", hs[i].path);
}
free(hs);
if (u.n == 0)
cst_buf_printf(&b, "(no files match %s)\n", pattern);
else if (u.n > GLOB_MAX || u.truncated)
cst_buf_printf(&b, "… %s%d more files (showing the %d newest of %s%d; "
"narrow the pattern or path)\n",
u.truncated ? "over " : "", u.n - GLOB_MAX, GLOB_MAX,
u.truncated ? "over " : "", u.n);
else {
int gmax = glob_max_hits();
if (u.n > gmax || u.truncated)
cst_buf_printf(&b,
"… %s%d more files (showing the %d newest of %s%d; "
"narrow the pattern or path)\n",
u.truncated ? "over " : "", u.n - gmax, gmax,
u.truncated ? "over " : "", u.n);
}
for (int i = 0; i < u.n; i++)
free(u.hits[i]);
free(u.hits);
@@ -1335,7 +1359,7 @@ static void grep_file(grep_ud_t *u, const char *rel, const char *full) {
fm++;
if (++u->matches >= GREP_COUNT_MAX)
u->truncated = 1;
if (fshown < GREP_PER_FILE && u->shown < GREP_MAX_MATCHES) {
if (fshown < GREP_PER_FILE && u->shown < grep_max_matches()) {
int from = i - u->context < 0 ? 0 : i - u->context;
if (from <= last_printed)
from = last_printed + 1;
@@ -1482,9 +1506,9 @@ int cst_tool_grep(const cst_tool_ctx_t *ctx, const ctl_tool_call_t *c,
u.matches, u.matches == 1 ? "" : "es", u.hit_files,
u.hit_files == 1 ? "" : "s");
if (u.shown < u.matches)
cst_buf_printf(&out, " (showing %d; narrow with path/glob or a tighter "
"pattern)",
u.shown);
cst_buf_printf(&out, " (showing %d of %d%s; narrow with path/glob or a "
"tighter pattern)",
u.shown, u.matches, u.truncated ? "+" : "");
cst_buf_puts(&out, "\n");
cst_buf_append(&out, u.b.buf, u.b.len);
cst_buf_free(&u.b);