Documentation
¶
Overview ¶
Package tuihelper is `magpie tui-helper`: internal/tuidrive's terminal for a program that isn't Go, a plugin that drives an agent's interactive mode (the agy-tui plugin drives agy's). The helper runs one program in a terminal of its own and speaks JSON, one object a line:
It reads, on stdin:
{"tools": [{"name", "description", "inputSchema"}, …]}
first, when the agent is to have the caller's tools
{"start": {"path": …, "args": […], "env": […], "dir": …,
"replies": [{"ask": …, "answer": …}]}} once
{"write": "…"} typed to the program
{"result": {"id", "content", "isError", "tools"}} answers a call
{"stop": true} ends it
and writes, on stdout:
{"mcp": {"command": …, "args": […]}} told tools: the stdio MCP server
(magpie's tuitools.RunMCP) to give the agent before
it starts, as its own configuration names one
{"started": true}
{"listed": true} the agent has listed the tools: send the first
message after it
{"call": {"id", "name", "arguments"}} the agent called a tool; it
waits until a result with that id is given
{"dropped": "id"} the agent stopped waiting for that call
{"screen": "…"} the screen as it stands (tuidrive's Now), each time
it changed, no more often than every screenWait
{"exit": {"code": n, "error": "…"}} last: the program ended
{"error": "…"} last: it couldn't be started; before then, a line
that couldn't be done (a write, a result)
The tools are served through tuitools.Bridge: a callback on loopback under a token kept in a 0600 file, never on a command line. Calls still held when the program ends are refused.
The environment is the one given, whole (tuidrive adds nothing); with none ("env" left out), the helper's own, as its caller started it. The program ends with the helper: on stdin closing (its caller gone), on "stop", and on the signals tuidrive names (EndSignals).
Index ¶
Constants ¶
const Command = "tui-helper"
Command is the hidden subcommand that runs it.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.