v0.8.6: general mode, clipboard text, PDF text extraction
Working mode: --mode coding|general (CST_MODE, settings.json, /mode, WebUI run settings). general swaps the default framing for a general assistant one -- workflow, safety notes, tool wording (run_shell, the subagents) -- and /status shows it; minimal (the paper profile) stays byte-frozen. The prompt state carries the mode so a switch leaves a system note in history. Clipboard: clipboard_read / clipboard_write tools (16 MiB cap read, default 64 KiB window; writing is a WRITE permission with a preview) on pbcopy / wl-copy / xclip / pbpaste / wl-paste / xclip and the Win32 clipboard. In the TUI, /attach paste falls back to clipboard text when there is no image on it. PDF: a dependency-free text extractor (src/pdf_text.c): inflate, Flate/ASCIIHex/ASCII85, PNG/TIFF predictors, layout-independent object scan, object streams, page tree walk with inherited resources, content lexer (Tj/TJ/'/" and the Td/TD/T*/Tm spacing heuristics), per-font ToUnicode CMaps and inline images skipped. Encrypted files and pages with no text layer are refused with the reason. Attachments: /attach (a path or files dropped on the terminal) now take images, PDFs and text. A PDF is stored as its text layer with the mime still saying application/pdf and its page count; anything else has to be UTF-8 text. Documents travel inline as text parts, so CST_NO_IMAGES and text-only models no longer drop them, while images keep their old path. Tests: test_pdf_text (plain, bare and zlib-framed Flate, inline image, CID + ToUnicode, object stream, error paths), documents in test_attach, inlined documents in test_llm_body, mode in test_config.
This commit is contained in:
+16
-2
@@ -66,8 +66,9 @@ static const cst_tool_def_t TOOLS[] = {
|
||||
{"detail", S, 0, "low or high (provider hint; default auto)"}},
|
||||
CST_TP_READ, 0, cst_tool_view_image, NULL, NO_DYN},
|
||||
{"run_shell",
|
||||
"Run a non-interactive shell command in the workspace root for builds, "
|
||||
"tests, git and other CLIs (stdin is empty; long runs are killed). "
|
||||
"Run a non-interactive shell command in the workspace root: builds, "
|
||||
"tests, git, scripts, computations, data processing, other CLIs "
|
||||
"(stdin is empty; long runs are killed). "
|
||||
"Returns stdout+stderr with colors stripped and long output cut to head "
|
||||
"+ tail. Prefer read_file/grep/glob/list_dir over cat/grep/find.",
|
||||
"Run a shell command in the workspace root (non-interactive, stdin is "
|
||||
@@ -158,6 +159,19 @@ static const cst_tool_def_t TOOLS[] = {
|
||||
{{"question", S, 1, "the question"},
|
||||
{"options", S, 0, "suggested answers, one per line"}},
|
||||
CST_TP_ASK, 0, cst_tool_ask_user, NULL, NO_DYN},
|
||||
{"clipboard_read",
|
||||
"Read the text on the system clipboard — what the user copied outside "
|
||||
"the workspace. Returns UTF-8 text.",
|
||||
NULL,
|
||||
{{"max_bytes", I, 0, "cap on the returned text (default 65536)"}},
|
||||
CST_TP_READ, 0, cst_tool_clipboard_read, NULL, NO_DYN},
|
||||
{"clipboard_write",
|
||||
"Replace the system clipboard with text, so the user can paste it into "
|
||||
"another app. Overwrites what they had copied.",
|
||||
NULL,
|
||||
{{"text", S, 1, "text to put on the clipboard"}},
|
||||
CST_TP_WRITE, 0, cst_tool_clipboard_write, cst_preview_clipboard_write,
|
||||
NO_DYN},
|
||||
};
|
||||
#define NTOOLS ((int)(sizeof(TOOLS) / sizeof(TOOLS[0])))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user