Usability pass: tool registry, TUI polish, saved keys and settings
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

Tools
- Table-driven tool registry with permission classes and default/minimal
  profiles; new tools: edit_file, list_dir, glob, grep, delete_file,
  move_file, todo_write, web_fetch, ask_user (plus read_file paging).
- Built-in Myers diff; write tools return unified diffs.
- Persistent permission rules (.agent/permissions.json), per-turn undo
  snapshots (.agent/undo), AGENTS.md project notes, auto-compact at 80%
  of the model context, cancellable run_shell with process-group kill.

TUI
- Table-driven slash commands: /provider /key /effort /status /tools
  /permissions /yolo /undo /retry /diff /export /copy /rename /delete
  /init /max-steps /todo, with / and @ completion.
- Permission modal with diff and prefix rules, ask_user modal, todo
  panel, header with model/effort/context, bracketed paste, line editing,
  wide-char cursor, NO_COLOR and ASCII fallback; Esc never quits.

Startup and configuration
- API keys are entered in the TUI (hidden) and saved per provider in
  <config>/credentials (0600); env variables are only a fallback.
- Last provider, per-provider model and reasoning effort are remembered
  in <config>/settings.json; --effort/-e and /effort send
  reasoning_effort (low|medium|high|max) to models that accept it.
- DeepSeek preset uses deepseek-flash / deepseek-v4-pro.
- Session flags --new/--continue/--resume/--list-sessions, --yolo,
  --confirm.

Compatibility and tests
- ncurses detection, macOS/Homebrew support, make install, XDG config
  dir, POSIX cleanups; Gitea CI (gcc/clang/asan/musl/macOS).
- Unit tests for diff, fs tools, registry, undo/perms and config;
  e2e fixtures multi_file_refactor and ask_or_todo; vendored cJSON.
This commit is contained in:
WHC
2026-10-05 01:47:01 +08:00
parent 9877ff48b6
commit 2fde898da0
105 changed files with 19348 additions and 3786 deletions
+31
View File
@@ -0,0 +1,31 @@
#ifndef CST_PERMS_H
#define CST_PERMS_H
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct cst_perms cst_perms_t;
/* Loads <workspace>/.agent/permissions.json (missing file = no rules). */
cst_perms_t *cst_perms_open(const char *workspace);
void cst_perms_close(cst_perms_t *p);
int cst_perms_tool_allowed(const cst_perms_t *p, const char *tool);
/* Prefix rule match; commands with ; & | ` $ < > ( ) never match. */
int cst_perms_shell_allowed(const cst_perms_t *p, const char *cmd);
/* Add a rule and save. */
int cst_perms_allow_tool(cst_perms_t *p, const char *tool);
int cst_perms_allow_prefix(cst_perms_t *p, const char *prefix);
int cst_perms_reset(cst_perms_t *p);
char *cst_perms_describe(const cst_perms_t *p);
/* Reasonable prefix rule for a command ("" when it should not have one). */
void cst_perms_suggest_prefix(const char *cmd, char *out, size_t out_sz);
#ifdef __cplusplus
}
#endif
#endif