serve and attach
Docs/Automate/serve and attach

serve, the node and attach

Edit on GitHub
docs-site/automate/serve-attach.md

A kernel can run without a client, and any number of clients can attach to it: a second terminal, the ADE, a script.

orrery serve

Starts one kernel, prints its endpoints, and keeps running until stopped:

orrery serve
pipe:orrery-<session>
http://127.0.0.1:53124

stdout is only the endpoints, most local first. --listen pipe:<name> or --listen <host:port> picks one transport.

orrery node: one per machine

The node is the long-running form: one kernel per machine, holding many sessions. Any terminal on the same machine reaches it without a token.

orrery node up              # start it in the background
orrery node up --install    # ...and at every login
orrery node status          # pid, endpoints, sessions (--json for a script)
orrery node token --name ci # a token for a client on another machine
orrery node down            # stop it (--uninstall also stops it starting at login)

node up --listen <addr> binds its HTTP listener; anything other than loopback takes clients with a token only. Sessions survive node down and a restart: they come back hibernated and resume on the first attach or message.

orrery attach

At a terminal, attach is the whole TUI on that session. With -p, --json or a pipe, it watches one run and exits.

TargetReaches
nothingThis machine's node, its first session.
<session> · newThat session, or a new one, on this machine's node.
<machine>/<session>A session on another machine, through the relay (orrery login first).
http(s)://[token@]host:portA node's or serve's listener, over its WebSocket /ws. ?session=<id|new> picks one.
ws(s)://…A WebSocket as given.
pipe:<name>A pipe.
orrery attach new
orrery attach 01a0df68 -p "carry on"
orrery attach http://10.0.0.5:7400 --token "$ORRERY_NODE_TOKEN"
orrery attach pipe:orrery-01a0df68 --since 120    # replay from sequence 120

A consent prompt can be answered from any attached terminal; the first answer wins.

Other machines

With an Orrery Cloud account, a node joined to a relay is reachable from anywhere you are signed in:

orrery node join https://<relay>     # once: device code, then it dials out and starts at login
orrery login https://<relay>         # on this terminal
orrery machines                      # your machines, and whether each is online
orrery sessions                      # their sessions
orrery attach <machine>/<session>
orrery handoff <session> --to <machine>   # move a session, with its uncommitted work

The relay carries frames and keeps nothing but routing. Joining twice changes nothing. See Orrery Cloud and your machines.

Next