forked from WHC/Hermit
- 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
66 lines
2.1 KiB
C
66 lines
2.1 KiB
C
#ifndef CST_SUBAGENT_H
|
|
#define CST_SUBAGENT_H
|
|
|
|
/*
|
|
* Sub-agents: the task(description, prompt, agent?) tool runs one turn of a
|
|
* child agent with its own context and returns its final report.
|
|
*
|
|
* Roles: built-in general / explore / plan, plus Markdown files in
|
|
* <ws>/.agent/agents/ and <config>/agents/ (the workspace wins, both win
|
|
* over built-ins). Frontmatter: name, description, model, tools (allowlist),
|
|
* max_steps, readonly; the body is the role's instructions.
|
|
*
|
|
* Transcripts: <ws>/.agent/sessions/<parent-id>/sub-<n>.jsonl, with a
|
|
* sub-<n>.json summary next to each (not listed as sessions).
|
|
*/
|
|
|
|
#include <stddef.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define CST_ROLES_MAX 32
|
|
|
|
typedef struct {
|
|
char name[64];
|
|
char desc[256];
|
|
char source[16]; /* "builtin" | "workspace" | "user" */
|
|
char model[128]; /* empty = the parent's */
|
|
char tools[1024]; /* ",a,b," allowlist; empty = all but task */
|
|
int max_steps; /* 0 = default */
|
|
int read_only;
|
|
char *prompt; /* role instructions (malloc'd) */
|
|
} cst_agent_role_t;
|
|
|
|
/* Roles sorted built-ins first, then by name. Free with cst_roles_free. */
|
|
int cst_roles_list(const char *workspace, cst_agent_role_t *out, int max);
|
|
void cst_roles_free(cst_agent_role_t *v, int n);
|
|
/* System prompt section listing the roles (malloc'd), or NULL. */
|
|
char *cst_subagent_index(const char *workspace);
|
|
/* Register the task tool (owner "builtin:task") for workspace. */
|
|
int cst_subagent_register_tool(const char *workspace);
|
|
|
|
typedef struct {
|
|
char file[64]; /* "sub-3" */
|
|
char role[64];
|
|
char desc[160];
|
|
char status[32]; /* "done" | "error" | "cancelled" | "running" */
|
|
int steps, tools;
|
|
double ms;
|
|
long long mtime;
|
|
} cst_subagent_rec_t;
|
|
|
|
/* This parent session's sub-agent runs, newest first. */
|
|
int cst_subagent_list(const char *workspace, const char *parent_id,
|
|
cst_subagent_rec_t *out, int max);
|
|
/* Full path of a transcript (sub-<n>.jsonl). */
|
|
int cst_subagent_path(const char *workspace, const char *parent_id,
|
|
const char *file, char *out, size_t out_sz);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|