Skip to content
pi-c Documentation
Login

Documentation

/* The committed transcript as items that can be drawn again (transcript.c).
 * Ctrl+O and Ctrl+T change how tool calls, "!" commands and thinking look,
 * and Pi draws the ones already shown again; other output is kept as the
 * lines it was committed as. Pure functions: no terminal. */
#ifndef PIC_TUI_TRANSCRIPT_H
#define PIC_TUI_TRANSCRIPT_H
#include <stddef.h>
#include "view.h"
#include "width.h"

typedef struct tui_transcript tui_transcript;

tui_transcript *tui_transcript_new(void);
void tui_transcript_free(tui_transcript *t);
/* Adds an item; its strings are copied. 0 or -1 (out of memory). */
int tui_transcript_lines(tui_transcript *t, const char *const *lines, size_t n);
int tui_transcript_tool(tui_transcript *t, const tui_tool *tool);
int tui_transcript_bash(tui_transcript *t, const tui_bash *bash);
int tui_transcript_thinking(tui_transcript *t, const char *text);
/* Lines with two forms, the second shown while tool output is expanded (Pi's
 * branch summary: a one-line note, or the summary itself). */
int tui_transcript_expandable(tui_transcript *t, const char *const *collapsed, size_t nc, const char *const *expanded,
                              size_t ne);
/* Forgets every item. */
void tui_transcript_clear(tui_transcript *t);
/* Every item as lines for cols columns, tool output and "!" output expanded
 * or not, thinking hidden or not, appended to out. 0 or -1. */
int tui_transcript_render(const tui_transcript *t, int expanded, int hide_thinking, size_t cols, tui_lines *out);

/* Pi's thinking block: the text as markdown in the thinkingText colour,
 * italic; hidden, Pi's one-line "Thinking..." label. 0 or -1. */
int tui_thinking_lines(const char *text, int hidden, size_t cols, tui_lines *out);
/* The thinking style (an SGR sequence, the current theme's). */
const char *tui_thinking_style(void);
#endif