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>
60 lines
2.8 KiB
C
60 lines
2.8 KiB
C
#ifndef CST_RUNTIME_H
|
|
#define CST_RUNTIME_H
|
|
#include "cst_agent.h"
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
typedef struct cst_runtime cst_runtime_t;
|
|
typedef int (*cst_job_fn)(void *data, volatile int *cancel, cst_tool_result_t *result);
|
|
typedef void (*cst_job_free_fn)(void *data);
|
|
|
|
/* One finished job ready for TUI / next-turn agent notes. */
|
|
typedef struct cst_job_completion {
|
|
char id[32];
|
|
char kind[24];
|
|
char status[32]; /* completed | failed | cancelled */
|
|
char summary[200];
|
|
int exit_code;
|
|
long ms;
|
|
} cst_job_completion_t;
|
|
|
|
cst_runtime_t *cst_runtime_open(const char *session_path);
|
|
void cst_runtime_close(cst_runtime_t *r);
|
|
unsigned long cst_runtime_begin(cst_runtime_t *r, const char *goal);
|
|
unsigned long cst_runtime_revision(cst_runtime_t *r);
|
|
int cst_runtime_steer(cst_runtime_t *r, const char *message, int readonly, int delegation);
|
|
char *cst_runtime_take_steering(cst_runtime_t *r);
|
|
int cst_runtime_controls(cst_runtime_t *r, int readonly, int delegation, int paused);
|
|
int cst_runtime_check(cst_runtime_t *r, unsigned long revision, int mutating, int delegate);
|
|
void cst_runtime_cancel(cst_runtime_t *r, const char *source, int force);
|
|
char *cst_runtime_evidence(cst_runtime_t *r, const char *tool, int exit_code,
|
|
const char *output, int mutating);
|
|
int cst_runtime_finish(cst_runtime_t *r, const char *status, const char *summary,
|
|
int action, char *err, size_t err_sz);
|
|
char *cst_runtime_json(cst_runtime_t *r);
|
|
int cst_job_start(cst_runtime_t *r, const char *kind, const char *resource,
|
|
int interruptible, cst_job_fn fn, void *data,
|
|
cst_job_free_fn destroy, char *id, size_t id_sz);
|
|
/* Waits at most timeout_ms; output is a JSON snapshot, not a destructive read. */
|
|
char *cst_job_read(cst_runtime_t *r, const char *id, int timeout_ms);
|
|
int cst_job_cancel(cst_runtime_t *r, const char *id, int force, const char *source);
|
|
int cst_runtime_jobs_pending(cst_runtime_t *r);
|
|
int cst_runtime_current_jobs_pending(cst_runtime_t *r);
|
|
int cst_runtime_resource_busy(cst_runtime_t *r, const char *resource);
|
|
int cst_runtime_wait(cst_runtime_t *r, int timeout_ms);
|
|
/* Drain finished-job reports for the agent loop (destructive). */
|
|
int cst_runtime_take_completions(cst_runtime_t *r, cst_job_completion_t *out,
|
|
int max);
|
|
/* Drain the UI fan-out queue (destructive; independent of take_completions). */
|
|
int cst_runtime_take_ui_completions(cst_runtime_t *r, cst_job_completion_t *out,
|
|
int max);
|
|
/* Model tools, shared by every front end. */
|
|
int cst_runtime_register_tools(void);
|
|
struct cst_tool_ctx;
|
|
int cst_runtime_shell(const struct cst_tool_ctx *ctx, const ctl_tool_call_t *call,
|
|
cst_tool_result_t *result);
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif
|