tuihelper

package
v0.1.5259 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const Command = "tui-helper"

Command is the hidden subcommand that runs it.

Variables

This section is empty.

Functions

func Run

func Run(args []string) error

Run is the helper, on os.Stdin and os.Stdout.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL