Skip to content
pi-c Documentation
Login

Documentation

/* Peers (docs/design/grapevine.md, stage 4): the send_message tool, by which one conversation
 * messages another of the same user, in this workspace or another, through the receiver's inbox
 * (inbox.h); the frame its text arrives in; and the wake component, which starts a pic run for a
 * conversation with nothing running when grapevine.wake allows. Bundled: core records each
 * message, its hops and what it made; what the model may send, and when to wake, are decided here. */
#ifndef PIC_PEER_H
#define PIC_PEER_H

#include <stdio.h>

#include "pic.h"
#include "toolreg.h"

/* The tool's definition sent to providers, and its registration (toolreg.h). */
extern const char pic_peer_schema[];
extern const pic_tool_def pic_peer_tool;

/* send_message: HOOKS->journal, effect and input name the call (its key is
 * fx:JOURNAL_ID:EFFECT, so a replay after a crash sends nothing new). */
char *pic_peer_send(const char *workspace, const pic_tool_args *args, const pic_tool_hooks *hooks, int *is_error);

/* Whether send_message is in the default tool set: yes unless grapevine.sendMessage is false. */
int pic_peer_default(void);

/* This executable, which a wake runs as pic run; main sets it once. */
void pic_peer_self(const char *path);

/* pic sessions --all: every workspace this user has opened, with its conversations, one line
 * each (WORKSPACE  ID  NAME  REQUESTS  FIRST), live ones marked. 0, or -1 with ERR. */
int pic_peer_sessions_all(FILE *out, char *err, size_t cap);

#endif