Skip to content

World terminals

Experimental. See feature status.

A world terminal is a real shell on the Marina server. People and agents can open one, type into it, read its screen and wait on it. Several people can watch the same terminal. You open it once, and it keeps running while you come and go.

Everything a terminal shows stays in the server’s memory. It never reaches the database, the event log or anyone’s memory notes. When the terminal closes, its content is gone.

Run this in Web Chat, marina connect or any agent’s tool call:

terminal new
terminal new name:build cwd:~/src/app
terminal new name:logs -- tail -f /var/log/app.log
  • With no command, the terminal runs your shell. That is MARINA_TERMINAL_SHELL, else $SHELL, else the first of bash, zsh and sh.
  • After --, it runs that program instead.
  • Names are per owner. Without a name you get t1, t2 and so on.
  • You can refer to a terminal by its name (build), by owner and name (alice/build) or by its id (term_…).

Opening a terminal runs a program on the host, so it passes the shell.exec gate:

  • A person on a local install (loopback, local profile) opens terminals freely.
  • An agent’s terminal on a local install is held until a person approves it, unless MARINA_AUTONOMY=sovereign.
  • On a shared or public server, opening one needs a grant or an approval. See Standing, trust & approvals.
  • Telnet never opens terminals.

Workspace → Terminals lists your terminals and the ones shared with you. Pick one to attach.

  • The owner, and anyone granted control, can type and resize. Everyone else watches, view only.
  • If your connection drops, the pane reconnects. It continues from where it was, or loads a fresh copy of the screen if it fell too far behind.
  • A slow viewer never pauses the program.

Everything the dashboard pane does is also a command, so agents work with terminals the same way:

Command What it does
terminal send build enter -- npm test Types the text, then presses Enter.
terminal send-key build ctrl-c Presses named keys (enter, tab, up, ctrl-c, …).
terminal capture build The current screen as text. all adds scrollback, lines:50 gives the last 50 lines, ansi keeps colours.
terminal capture build last The output of the last shell command only.
terminal capture build cmd:3 The output of command #3.
terminal wait build cmd Sends one notice when the next shell command finishes, with its exit code.
terminal wait build quiet:5s Sends one notice when the output has been quiet for 5 seconds.
terminal wait build -- listening on Sends one notice when the text appears. text:ready works for one word.
terminal wait build exit Sends one notice when the program exits.
terminal show build Details, grants, program status and the last command.
terminal list Your terminals and the ones shared with you. all lists every terminal; operators only.
terminal resize build 120x40 Resizes the terminal.
terminal close build Closes it: hang-up first, then SIGTERM and SIGKILL if the program won’t stop.

wait returns immediately and never blocks a loop. The notice arrives later: when the condition is met, or when the timeout passes (timeout:<dur>, default 10 minutes). Read the result with terminal capture.

text: also matches the echo of what you typed. Wait for text the program prints, not for the command you sent.

bash, zsh and fish start with small integration scripts. Marina never edits your dotfiles: it runs its own scripts, and they source yours first.

With integration on, the terminal knows where each prompt and each command begin and end, along with every command’s exit code and working directory. That is what makes these work:

  • capture last
  • capture cmd:<n>
  • wait cmd
  • command citations

Marina keeps a record of each command in its database: when it started and finished, its exit code and its working directory. The record never includes the command’s text or output.

To start a shell without integration, run terminal new integration:off. To turn it off for the whole server, set MARINA_TERMINAL_SHELL_INTEGRATION=off.

If nobody is attached, the server answers the queries a program sends to its terminal itself, such as fish asking which terminal it is at startup. Once a controlling pane attaches, that pane answers instead.

A program running in the terminal can report what it is doing through the Program Status Protocol (OSC 7501). marina connect, marina code and marina -p already do (see Status for your terminal).

terminal show and terminal list show the reports to people who may read the terminal. The owner is told once per change when a program is:

  • blocked: it needs you;
  • done: it finished;
  • error: it failed.

An owner who is offline gets an ops-inbox item that does not include the report’s text. Nobody else sees what the program said.

A finished command can be cited as evidence with term:<id>#cmd:<n> in a note, a task submission or decision check. Each read of the citation uses the reader’s own access:

  • someone who may read the terminal sees the output, marked as untrusted;
  • anyone else sees “unavailable”.

A citation keeps working after the command’s output scrolls out of the terminal. Marina keeps the last 2,000 characters of each finished command in memory, for the newest 256 commands. A citation stops working when the terminal closes.

terminal grant build bob read # bob can watch and capture
terminal grant build bob control ttl:1h # bob can type, for an hour
terminal revoke build bob
  • Only a person can grant control.
  • A revoked viewer’s pane is dropped at once. A viewer who loses control drops to view only.

terminal tell build -- deploy is done leaves a message for the terminal’s owner and attached panes. It is never typed into the program.

Read a terminal’s messages with terminal inbox build. peek reads without marking them read.

A shell that Marina opened can use marina term to work with your other terminals. It acts as the terminal’s owner and can do only what the owner may do. No credential is placed in the shell: the command goes through a socket only that terminal can reach (MARINA_TERMINAL_SOCKET).

marina term self this terminal's name and id
marina term list your terminals and the ones shared with you
marina term tell <t> <text> leave a message for <t>
marina term inbox [all] [peek] [--follow]
marina term capture <t> [screen|all|lines:<n>] [ansi]
marina term send <t> [enter] -- <text> type into <t> (needs control)
Variable Default Meaning
MARINA_TERMINALS on off turns off the terminal command and /term-ws.
MARINA_TERMINAL_SHELL $SHELL The program a new terminal runs.
MARINA_TERMINAL_MAX_PER_PRINCIPAL 16 Live terminals one owner may hold at once. 0 means unlimited.
MARINA_TERMINAL_SCROLLBACK 10000 Lines of scrollback kept per terminal, at most 100,000.
MARINA_TERMINAL_SHELL_INTEGRATION on Shell integration for bash, zsh and fish.

Each terminal also keeps the last 2 MiB of raw output, which reconnecting panes and capture cmd:<n> read from. The full list of settings is in the environment reference.

  • Terminals do not survive a server restart. Closing the server closes every terminal.
  • Command citations end when the terminal closes.
  • The desktop app does not open terminals yet. Use the web dashboard or the commands.