Extensions: skills, plugins, MCP, sub-agents; configurable keys
ci / linux (clang) (push) Canceled after 0s
ci / linux (gcc) (push) Canceled after 0s
ci / sanitizers (push) Canceled after 0s
ci / musl (push) Canceled after 0s
ci / macos (push) Canceled after 0s

- Skills (SKILL.md discovery, skill tool, /skills /skill)
- plugin.json exec tools with permission prompts, timeouts and workspace trust (/plugins)
- MCP stdio client: JSON-RPC initialize/tools/list/tools/call, mcp__server__tool, /mcp and sidebar status
- task tool with general/explore/plan and .agent/agents/*.md roles, parallel read-only runs, cancel propagation, /agents
- Keymap with Ctrl+X leader, keybinds.json overrides and /keys panel
- Collapsed thinking, throttled streaming Markdown, leaner tool output, parallel read-only tools
- Spawn: close-on-exec pipes and a process-wide fork lock
- Tests for keymap, skills, plugins, MCP, sub-agents, shell compaction; docs/plugins.md
This commit is contained in:
WHC
2026-10-05 14:55:31 +08:00
parent c81df42f0b
commit 7d3ec9fcb9
38 changed files with 8356 additions and 399 deletions
+40
View File
@@ -41,6 +41,13 @@ typedef struct cst_tool_ctx {
void (*set_todo)(const char *text, void *ud);
void *todo_ud;
int sandbox; /* run_shell: confine to the workspace (cst_sandbox.h) */
/* Information-dense output (read_file headers and line numbers, cleaned
* run_shell output). Off for `--tools minimal` so paper runs see the
* original bytes. */
int compact;
/* The calling agent and its turn hooks (task runs sub-agents). */
cst_agent_t *agent;
const cst_agent_hooks_t *hooks;
} cst_tool_ctx_t;
typedef int (*cst_tool_run_fn)(const cst_tool_ctx_t *ctx,
@@ -51,6 +58,10 @@ typedef int (*cst_tool_run_fn)(const cst_tool_ctx_t *ctx,
typedef int (*cst_tool_preview_fn)(const cst_tool_ctx_t *ctx,
const ctl_tool_call_t *call, char **out);
typedef int (*cst_tool_run_ex_fn)(const cst_tool_ctx_t *ctx,
const ctl_tool_call_t *call,
cst_tool_result_t *r, void *ud);
typedef struct {
const char *name;
const char *desc;
@@ -62,8 +73,32 @@ typedef struct {
int minimal; /* member of `--tools minimal` (the original four) */
cst_tool_run_fn run;
cst_tool_preview_fn preview;
/* Dynamic tools (skills, plugins, MCP, sub-agents). */
const char *schema_json; /* JSON Schema object for the arguments; when set
params[] is unused */
cst_tool_run_ex_fn run_ex;
void *ud;
const char *owner; /* "plugin:<name>", "mcp:<server>", ... */
/* Non-READ tools that may still join a parallel batch for this call. */
int (*parallel)(const ctl_tool_call_t *call, void *ud);
} cst_tool_def_t;
/* Add a tool at runtime (strings are copied, ud is not). Safe while turns
* run; returns 0, or -1 when the name is taken or the table is full. */
int cst_tool_register(const cst_tool_def_t *def);
/* Drop every dynamic tool of owner (call only while no turn runs). */
int cst_tool_unregister_owner(const char *owner);
/* Arguments of call as a JSON object text, typed by the tool's schema
* (numbers/booleans/objects stay JSON). malloc'd. */
char *cst_tool_args_json(const cst_tool_def_t *t, const ctl_tool_call_t *call);
/* Turn a name into a valid tool name ([A-Za-z0-9_-], at most 63 bytes). */
void cst_tool_sanitize_name(const char *in, char *out, size_t out_sz);
/* Per-config switches by name (/tools on|off). */
int cst_tool_disabled(const cst_agent_config_t *cfg, const char *name);
void cst_tool_set_disabled(cst_agent_config_t *cfg, const char *name,
int off);
typedef enum { CST_TOOLS_DEFAULT = 0, CST_TOOLS_MINIMAL } cst_tool_profile_t;
int cst_tool_profile_parse(const char *s, int *out);
@@ -95,6 +130,11 @@ int cst_tool_preview(const cst_tool_ctx_t *ctx, const ctl_tool_call_t *call,
* Returns the count written into paths. */
int cst_tool_targets(const ctl_tool_call_t *call, char paths[][1024], int max);
/* Shell output cleaned for a model: ANSI escapes removed, `\r` progress
* redraws folded to their final state, runs of identical lines collapsed,
* very long output cut to head + tail. Returns malloc'd text. */
char *cst_shell_compact(const char *s, size_t n, size_t *out_len);
/* Unified diff (3 lines of context, GNU `diff -u` layout) with
* `--- a/<label>` / `+++ b/<label>` headers. Returns malloc'd text; "" when
* identical. */