Skip to main content

Module bridge

Module bridge 

Source
Expand description

The bridge between tabs: the agent of one tab lists the other agent tabs of its workspace and sends one of them a message.

Three parts, each in its own place:

  • a small MCP server (SCRIPT) a harness starts inside its container, with two tools, list_tabs and send_message. It decides nothing; it asks QCode through a socket;
  • the socket, one per open workspace in the workspace’s Containers/MCP/ folder, which profile containers see read-only at MCP_DIR (socket), and the line of JSON each question and answer is (protocol);
  • the rules QCode answers by (rules): the person approves the first message between two tabs, a tab without the network never sends to one with it, and a chain of messages and a busy sender are both cut off.

The server is registered in each harness’s own user settings in the workspace’s home volume (config), so the harness starts it like any server the person added.

Which tab asks is known from a token: every harness tab is started with one in TOKEN_VARIABLE, the server hands it back with every question, and QCode looks the tab up by it. A token is random rather than the tab’s number, so an agent cannot speak for a tab it is not in by guessing.

Modules§

config
Registering the bridge’s server in a harness’s own settings, beside whatever the person keeps there.
protocol
What goes over the workspace’s socket: one line of JSON from the server in a container, one line of JSON back from QCode, and the connection closes.
rules
The rules a message between two tabs has to pass, and what QCode remembers to apply them.
socket
The workspace’s socket: QCode listens on it while the workspace is open, and the server in every profile container of the workspace asks its questions through it.

Constants§

SCRIPT
The MCP server a harness starts, carried inside the binary and written into each open workspace’s Containers/MCP/ folder, so the server a container starts is always the one this QCode speaks with.
SCRIPT_NAME
The name of the server’s file in Containers/MCP/.
SERVER_NAME
The name the server is registered under in every harness’s settings.
SOCKET_NAME
The name of the socket in Containers/MCP/. The server finds it beside itself.
TOKEN_VARIABLE
The environment variable a harness tab carries its token in.

Functions§

script_in_container
Where the server is inside a profile container.
token
A new token for a tab: 128 bits nobody outside this process can predict.