Skip to main content

Module terminal

Module terminal 

Source
Expand description

Terminal contracts used by AI6’s supervisor and AgentHandlers, as Guatiao kinds.

A Terminal provider starts a program on a terminal and hands back a TerminalRun the caller owns. A provider is a guatiao library in any language; the supervisor finds it on a search path and drives it through these tables. Slot order is the ABI: append, never reorder.

Re-exports§

pub use guatiao;

Structs§

ExitInfo
How a program ended, or that it has not. At most one of code and signal is set, and neither while running.
JsonLines
Splits a terminal’s output into the JSON values a harness wrote one per line.
Spec
What to start. Crosses as a value: {"argv": [..], "cwd": .., "env": {..}, "rows": .., "cols": ..}.
TerminalBridge
Wraps an AI6-discovered terminal provider in the object handle passed to AgentHandlers.
TerminalOffer
An available terminal provider, as choose_terminal weighs it.

Enums§

HarnessStdio
How the harness an AgentHandler starts talks over its standard input and output, as the handler declares it; the Station picks a terminal provider that suits it.
StreamLine
One line of a harness’s output, as JsonLines splits it.
TerminalRefusal
Why no terminal provider suits a harness.

Constants§

DEFAULT_PIPE
The terminal provider preferred for a harness that speaks JSON over standard input and output.
DEFAULT_TERMINAL
The terminal provider preferred for a harness that may want a terminal.
READ_TIMED_OUT
read answers this when nothing arrived within the timeout.
STREAM_COLS
The widest terminal every provider accepts: ConPTY takes its size as signed 16-bit numbers. A handler whose harness writes one JSON value per line asks for it, so that few lines wrap; JsonLines rejoins the ones that still do.

Traits§

AgentTerminal
The object handle AgentHandlers use to ask AI6’s selected terminal provider to spawn.
Terminal
Starts programs on terminals.
TerminalRun
One running program on one terminal. Every slot takes &self, so a caller may write, resize or kill from one thread while another blocks in read.

Functions§

choose_terminal
The terminal provider for a harness that talks over stdio, among the available offers.
exit_code_text
An ExitInfo::code as a person reads it: the number, followed for a negative one by its 32-bit value in hex, which is how Windows names an NTSTATUS (-1073741510 (0xC000013A)).
strip_controls
bytes without terminal control sequences: CSI (ESC [ ... final), OSC (ESC ] ..., ended by BEL, ESC \ or a line break) and two-byte escapes. Other bytes, line breaks included, are kept. A CSI with more than csi_bytes parameter and intermediate bytes is not a sequence, and only its ESC [ is dropped.