Files
CST-agent/include/cst_clipboard.h
T
WHC 895b47274c v0.7.0: image input, model registry, prefix-cache savings
Images
- vision gate: text-only models get a note instead of image parts and no
  view_image tool; unknown models retry once without images on HTTP 400
- paste: Ctrl+V and /attach paste read the clipboard (wl-paste, xclip,
  pngpaste/osascript, Win32 PNG or CF_DIB converted to PNG); pasting image
  file paths attaches them
- MCP image content is stored in the session and sent with the tool result
- attach: rel path validation, base64 decode, /retry keeps images

Model registry
- built-in src/models_builtin.json embedded at build time, merged with
  <config>/models.json and cached GET /models metadata (context, vision,
  pricing); most specific rule wins per field
- /model labels, /status source, --list-models [provider]

Cache and cost
- stable request prefix (frozen tools, notes as messages), DeepSeek prefix
  completion, OpenAI/Anthropic cache hints, /cost and hit rate in the status
2026-10-08 20:34:09 +08:00

36 lines
1.2 KiB
C

#ifndef CST_CLIPBOARD_H
#define CST_CLIPBOARD_H
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Image bytes on the system clipboard (PNG, or BMP from a Windows DIB).
* Wayland: wl-paste; X11: xclip; macOS: pngpaste or osascript; Windows: the
* clipboard API. Returns 0 with *data malloc'd, or -1 with err filled in
* ("no image on the clipboard", "install wl-clipboard", ...). */
int cst_clipboard_image(char **data, size_t *n, char *err, size_t err_sz);
/* Windows CF_DIB bytes (BITMAPINFOHEADER + pixels) as an image file: a PNG
* for uncompressed 24/32-bit bitmaps, else a BMP. NULL when malformed. */
char *cst_dib_to_image(const void *dib, size_t sz, size_t *n);
#define CST_PASTE_MAX_PATHS 8
#define CST_PASTE_PATH_MAX 1024
/* Split pasted text into file paths the way terminals paste dropped files:
* whitespace- or newline-separated, '...' / "..." quoting, file:// URIs
* (percent-decoded) and, outside Windows, backslash escapes. Returns the
* count, or -1 when the text is empty or holds more than max paths. Whether
* the paths exist is up to the caller. */
int cst_paste_paths(const char *text, size_t len,
char out[][CST_PASTE_PATH_MAX], int max);
#ifdef __cplusplus
}
#endif
#endif