feat: add v2 task control and asynchronous isolated workers

This commit is contained in:
WHC
2026-10-20 14:46:57 +08:00
parent 143dba203b
commit d971cb02b0
26 changed files with 1590 additions and 66 deletions
+5
View File
@@ -112,14 +112,17 @@ typedef struct {
/* Sub-agents (task tool). */
int depth; /* 0 = top-level; sub-agents run at 1 */
int orchestrate; /* coordinator delegates write/shell work */
struct cst_runtime *runtime; /* V2 task controller; parent-owned */
int orchestrate_override; /* CLI: 1 force on, -1 force off */
int subagent_steps, subagent_tasks, subagent_total;
void *worker_budget; /* owned by the top-level agent */
int (*request_gate)(void *); /* reserve budget before each HTTP attempt */
void *request_gate_ud;
unsigned long task_revision;
char cache_namespace[128];
int read_only; /* no write / shell tools */
char tools_only[1024]; /* ",a,b," allowlist; empty = every tool */
char worker_scope[2048]; /* isolated worker's JSON path allowlist */
const char *role_prompt; /* role instructions (not owned) */
char undo_sid[128]; /* snapshot into this session's undo... */
char undo_tag[64]; /* ...under this turn tag (the parent's) */
@@ -387,6 +390,8 @@ cst_session_t *cst_agent_session(cst_agent_t *a);
const cst_agent_config_t *cst_agent_config(const cst_agent_t *a);
cst_agent_config_t *cst_agent_config_mut(cst_agent_t *a);
void cst_agent_request_cancel(cst_agent_t *a);
int cst_agent_steer(cst_agent_t *a, const char *message, int readonly, int delegation);
int cst_agent_control(cst_agent_t *a, int readonly, int delegation, int paused);
int cst_agent_new_session(cst_agent_t *a, char *id_out, size_t id_sz);
int cst_agent_switch_session(cst_agent_t *a, const char *id);
/* Re-root the agent at another directory. Per-workspace state (permission