Artifact b42a99ee40fee78b22f8ee2f3048382372d501be7d69350e9173b920b0bab327:
- File
src/input.h
— part of check-in
[bb88ac58ac]
at
2026-11-19 20:35:01
on branch templates
— Prompt templates, as Pi's
Markdown files in ~/.pic/prompts/ and, once the workspace is trusted, WORKSPACE/.pic/prompts/ become /name commands: Pi's frontmatter (description, argument-hint), shell-like arguments and substitutions ($1, $@, $ARGUMENTS, ${1:-default}, ${@:N}, ${@:N:L}). They expand where text becomes a request, so ask, chat and the terminal agree; the slash menu lists them, built-in commands win a name clash, and /reload re-reads them. pic prompts [--json] lists them. Files are read through the platform's input reader, which gains a directory listing. Fixes a pollfd array one entry too small when a catalog refresh runs during a reply. (user: dmestas, size: 1042) [annotate] [blame] [check-ins using] [more...]
/* Inputs that are files by nature (input.c): AGENTS.md and the other * instruction files, models.json, the certificate bundle, and the prompt templates (prompts.c, which * lists their directories through pic_platform's input_list). They are read through this one function so a build * without a filesystem can supply them another way. */ #ifndef PIC_INPUT_H #define PIC_INPUT_H #include <stddef.h> enum { /* Refuse a file not owned by the user or root, or writable by others, * or in such a directory (errno EPERM): for the certificate bundle. */ PIC_INPUT_TRUSTED = 1, /* Over max: return the first max bytes and set *truncated, instead of * failing with EFBIG. */ PIC_INPUT_TRUNCATE = 2, }; /* The whole regular file at PATH (malloc'd, NUL-terminated, *len bytes), or * NULL with errno: ENOENT when it is missing (or not a regular file), EFBIG * when over MAX, EPERM when PIC_INPUT_TRUSTED refuses it. */ char *pic_input_read(const char *path, size_t max, int flags, size_t *len, int *truncated); #endif