Expand description
The tool bridge: a program the agent wrote, calling the agent’s own tools.
A script is only as useful as what it can reach. Without a bridge, a script the model writes can read files and run programs, and that is all — every decision it would want to make with a tool (search this, patch that, ask that endpoint) has to come back to the model as twenty round trips, each one re-sending the conversation. With a bridge, the loop lives in the script where a loop belongs, and the model sees one result.
The protocol is one JSON line each way over a Unix socket. The parent listens; the child
gets the path in ENV_TOOL_SOCKET and sends {"name": …, "arguments": {…}}, and reads back
{"ok": true, "output": …} or {"ok": false, "error": …}. No framing beyond a newline, no
handshake, no version: there is one writer and one reader, and the child is the one we just
started. eclipse tool <name> [json] is the client, so a script in any language can reach the
bridge with curl --unix-socket or with four lines of anything.
A call through the bridge is a call. It goes to
[ToolRegistry::dispatch_scoped], so the tool named faces [tools] disabled, its policy, the
plugin hooks, the approval prompt on its own describe_call, and the output cap — the same
funnel a call from the model goes through. The bridge is a transport, not a privilege: the
only thing it adds is that the caller is a program.
The wait is a select!, not a spawn. The child’s tool calls are answered on the same task
that is waiting for it, so the registry and the run scope are borrowed for the duration and
nothing needs an Arc back into the registry. The output readers are their own tasks — a
child that fills its stdout pipe must not stop serving its own requests.
Structs§
- Bridge
- A listening socket for the length of one run, removed when it goes out of scope.
Constants§
- ENV_
TOOL_ SOCKET - Where the child finds the bridge. Set for every process Eclipse starts; absent means there is
no bridge, which is what
eclipse tooloutside a run reports.
Functions§
- call_
over_ bridge - One tool call over the bridge, from the child’s side: what
eclipse toolruns. - run_
with_ bridge - Run
cmdwith a bridge: bounded bytimeout, killed as a group, output capped, and its tool calls answered until it exits. - run_
with_ bridge_ built run_with_bridgefor a child that has to be built again if starting it is refused —ETXTBSYon a script another thread was writing, say. The bridge socket is bound once, so the retry is the same bridge with a new process.