Artifact c59394ebf5c30126e13c7b2026b69f92ed95be08d5a07d19de4077238c0b3d4d:
- File
src/commands.h
— part of check-in
[af92ae84b2]
at
2026-11-19 22:04:56
on branch steering
— Durable steering and follow-ups, as Pi's
With --json --commands, a running pic reads Pi's RPC command lines on stdin (steer, follow_up, clear_queue, abort, set_steering_mode, set_follow_up_mode) wherever it already waits, and answers as Pi does. Each accepted message is journaled (pic_queued, journal version 8) before it is acknowledged. Steering becomes a user entry after the turn's tool results, before the next model call (and after a compaction); follow-ups become the next request when the answer is recorded, in the same transaction. Messages belong to the request that accepted them; on a failure or an abort they are marked returned and listed in a queue_returned event, never run later. pic check verifies each delivered entry against its queued row. Bash commands get /dev/null on stdin, as in Pi. (user: dmestas, size: 875) [annotate] [blame] [check-ins using] [more...]
/* --commands (commands.c): while pic runs a request, Pi's RPC command lines * on a descriptor (stdin) steer it. Supported: steer, follow_up (prompt * templates expanded), clear_queue, abort (Ctrl-C's cancel), * set_steering_mode and set_follow_up_mode ("all" or "one-at-a-time"). * Each gets Pi's response line on the events' out; anything else is an * error response and the run goes on. The descriptor is read only when pic * waits (net.h's side descriptor) and at each step of the loop, never inside * a transaction; accepted messages are journaled before the response. */ #ifndef PIC_COMMANDS_H #define PIC_COMMANDS_H #include "pic.h" /* expand returns a template's expansion of TEXT (malloc'd), or NULL to keep it. */ void pic_commands_start(pic_store *s, int fd, char *(*expand)(void *ctx, const char *text), void *ctx); void pic_commands_stop(void); #endif