Expand description
The live link (ADR-0047): how a tool reaches a build that is already
running, in a debug build with the backend’s link feature. The wire is
JSON lines, one UTF-8 JSON object per line: the client sends a
Request per line, and the build answers each with an Answer, in
order. The first line must be a Request::Hello with the build’s
token, or the connection is closed.
This module touches no device. A backend carries the lines (TCP on
loopback in shuyi-app) and the Server turns each into its answer
over the App it runs: it reads the screens, the frame as text, the
window’s picture (taken by the backend), the log, and the frames’
records with a heap snapshot (taken by the backend), and its only input
is raw device events the backend adds after the devices’ own in
Platform::poll_input, so they go where a
player’s go. It changes nothing any other way.
shuyi attach is the client, and shares these types with the build, so
the two ends can’t drift; VERSION says which wire they speak.
Modules§
- base64
- Base64 (RFC 4648 §4, the standard alphabet, with padding): how the link carries a picture in a JSON line, and how MCP carries an image.
Structs§
- LogAnswer
- The log’s lines a
Request::Logasked for. - LogEntry
- One line of the log, with its number in the ring.
- Perf
Answer - The frames’ records a
Request::Perfasked for, counted as the contract’sPerfReadcounts them. - Played
- What a
Request::Playdid. - Screenshot
- The window’s picture.
- Server
- The build’s end of the link, for one client: it turns the client’s
lines into answers over the
Appthe backend runs, and gives the backend a play’s input frame by frame. The backend makes one per connection. - Status
- Where a running build is.
Enums§
- Answer
- A line the build sends, tagged by
answer. - Handled
- What the
Servermade of a line. - Phase
- Which part of its life the game is in.
- Request
- A line a client sends, tagged by
op.
Constants§
- MAX_
LINE - The longest request line, in bytes: a longer one closes the link.
- MAX_
UNSENT - The most bytes of answers a client may leave unread: past it, the backend drops the client.
- MAX_
WAIT - The longest
Step::Waitof a play, in seconds: half an hour, played as the build’s frames at 60 a second (script::wait_frames). - PERF_
MAX - How many records a
Request::Perfanswers when it doesn’t say. - VERSION
- The link’s version: a client and a build speak the same, or the build closes the link after its hello.
Functions§
- check_
play - Whether a play’s
stepscan be played: each step (Step::check), waits of at mostMAX_WAITseconds, and no crank or debug step; an error names the step. An action’s name is looked up when the play starts.