feat: add persistent multi-model workers and orchestration budgets

This commit is contained in:
WHC
2026-10-19 11:29:26 +08:00
parent 235652604d
commit 143dba203b
14 changed files with 1043 additions and 32 deletions
+11
View File
@@ -111,6 +111,13 @@ typedef struct {
char tools_off[1024]; /* ",name,name," tools switched off (/tools off) */
/* Sub-agents (task tool). */
int depth; /* 0 = top-level; sub-agents run at 1 */
int orchestrate; /* coordinator delegates write/shell work */
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;
char cache_namespace[128];
int read_only; /* no write / shell tools */
char tools_only[1024]; /* ",a,b," allowlist; empty = every tool */
const char *role_prompt; /* role instructions (not owned) */
@@ -267,6 +274,7 @@ typedef struct {
long http_status;
char finish_reason[32];
long prompt_tokens;
int cache_reported;
long completion_tokens;
long cached_tokens; /* prompt tokens read from the provider's cache */
long cache_miss_tokens; /* prompt tokens billed at the full input price */
@@ -283,6 +291,8 @@ typedef struct {
const char *api_key;
const char *model;
const char *reasoning_effort; /* NULL = not sent */
int (*request_gate)(void *);
void *request_gate_ud;
const cst_message_t *msgs;
int nmsgs;
cst_llm_on_delta_fn on_delta;
@@ -433,6 +443,7 @@ long cst_agent_last_prompt_tokens(const cst_agent_t *a);
/* Token use since the session was opened, and of the latest turn. */
typedef struct {
int requests;
int cache_known_requests;
long prompt, cached, miss, write, out;
double cost; /* in currency; valid when priced */
int priced; /* every request had a known price */