Skip to content
pi-c Artifact [214782be5b]
Login

Artifact [214782be5b]

Artifact 214782be5bb4b69a4536b308f391365c5410ede42425a3f2f46ab9bba752f900:


/* pic attach (attach.c): a read-only view of a conversation another
 * process runs, rebuilt from the journal's committed rows as Pi's JSON
 * events (or a short text form), caught up from a seq and then followed.
 * With -i, each line of stdin goes to the conversation's inbox (inbox.h)
 * while a request runs, and starts one (in a pic ask child) when none does.
 * It opens the journal narrowly, takes no lease and writes nothing itself
 * but inbox rows. Streamed text is not journaled, so it shows only committed
 * messages. */
#ifndef PIC_ATTACH_H
#define PIC_ATTACH_H

typedef struct {
    const char *db;      /* the journal */
    const char *session; /* an id, a unique prefix, or "latest" */
    long long from;      /* entries after this seq; -1: from the latest request's start */
    int text;            /* --format text: lines for a person */
    int interactive;     /* -i: stdin lines become steers (follow-ups when idle) */
    int follow;          /* 0 (--no-follow): what is committed, then exit */
    /* -i, nothing running: a line starts a request in a child, SELF --db DB
     * --workspace WORKSPACE [--model MODEL] [--thinking THINKING] ask
     * --session ID TEXT, which takes the lease; NULL model or thinking:
     * ask's own default. */
    const char *self, *workspace, *model, *thinking;
} pic_attach_options;

/* The process's exit status: 0, or 1 with a message on stderr. */
int pic_attach_main(const pic_attach_options *o);

#endif