#ifndef CST_PLUGINS_H #define CST_PLUGINS_H /* * Plugins: /plugins//plugin.json (always loaded) and * /.agent/plugins//plugin.json (only for trusted workspaces). * * {"name": "jira", "description": "...", * "tools": [{"name": "jira_search", "description": "...", * "parameters": {JSON Schema}, * "command": ["python3", "search.py"], (or a shell string) * "perm": "read|write|shell|net", "timeout": 60}], * "skills": "skills", * "mcpServers": {"name": {"command": "...", "args": [], "env": {}}}} * * A tool call runs the command in the workspace with the arguments as JSON * on stdin (CST_PLUGIN_DIR / CST_WORKSPACE in the environment); stdout + * stderr is the result and the exit status its exit code. Relative argv * entries that exist in the plugin directory are made absolute. */ #include "os_compat.h" #ifdef __cplusplus extern "C" { #endif #define CST_PLUGINS_MAX 32 typedef struct { char name[64]; char dir[OS_PATH_MAX]; char source[16]; /* "user" | "workspace" */ char desc[200]; int ntools; int nmcp; int nskills_root; /* 1 when it adds a skills directory */ char error[200]; /* load problem, "" when fine */ } cst_plugin_info_t; /* Load plugins; workspace ones only when ws_trusted. Returns the number of * plugins loaded; *untrusted (optional) counts skipped workspace plugins. */ int cst_plugins_load(const char *workspace, int ws_trusted, int *untrusted); void cst_plugins_unload(void); int cst_plugins_info(cst_plugin_info_t *out, int max); #ifdef __cplusplus } #endif #endif