Resolve-Lume: Least-Privilege Agent Runtime

🇨🇳 中文版

Resolve-Lume: Least-Privilege Agent Runtime

C Runtime + Host Sidecar + Node Gateway

Why cut it this way? One of the biggest differences between an agent runtime and a conventional web app is that it may need not only to serve HTTP requests, but also to run a shell, read and write the filesystem, spawn child processes, and call external tools. Put all of that into one container or process and the application's privileges grow with its tool capabilities—just so the agent can write to disk, the entire web service inherits write access on the host. Resolve-Lume therefore divides runtime boundaries by privilege requirements, not by programming language: the C Runtime only runs the agent loop; the in-container Node Gateway only serves static assets and proxies the API; and the host Sidecar owns protocol adaptation (SSE frame translation, request-shape conversion, prompt discipline injection), tool bridging, and the system operations that need extra authorization. Each layer keeps only the capabilities its job requires.

resolve-lume is a reimplementation of the core of resolve-studio on the lume stack—the original project is left untouched, and only its multi-agent workbench is rewritten with lume + lume-core + React. The container boundaries in this system are not split by tech stack, but by privilege requirements: the backend container is slimmed down to just the C-compiled agent-httpd with neither Node nor Python installed; the frontend container keeps a lightweight Node service for static assets and API proxying only (it injects X-Sidecar-Token when forwarding); protocol adaptation, tool bridging, and the layer that can run a shell, write to disk, and spawn child processes are moved out of the containers onto the host sidecar. The following three layers—the in-container C runtime, the sidecar process on the host, and the self-written Node reverse proxy inside the container—each layer's ownership can be found as criteria in the source code, and each can also find footnotes in the source comments about where the line was originally drawn wrong.

Overview: Two Containers + One Host Process

figure 1 · resolve-lume execution chain: four layers from browser to host sidecar (logical view; sse translation and request-shape conversion actually live in the host sidecar, aggregated onto the gateway node here)

There is only one layered call chain: the browser hits :18085 → the Node service in the frontend container → /api/* goes through host.docker.internal:3000 to land on the host sidecar, /react/* goes through the compose internal network to the backend's :8080.

Key assertion: the sidecar is not inside compose; it is a host process. In docker-compose.yml, the sidecar service has been commented out and removed, leaving only an explanatory block; what starts it is the Makefile's sidecar-host-start, which uses nohup node sidecar/launcher.js to start a Node on the host machine. This will be expanded in layer 3 below—the reason it must land on the host is not a matter of taste, but that the capabilities it needs to reach simply do not exist inside the container.

Layer 2 · Frontend Container: Why Not Mount nginx and Instead Write a 200-Line Node Reverse Proxy Yourself

The image bypasses nginx. The reason is that this layer must inject X-Sidecar-Token while forwarding (frontend/server-entrypoint.mjs:14; it refuses to start without the token), which pure static configuration cannot do. One ownership note before the code below: the SSE frame translation and request-shape conversion expanded in this section do not live in the frontend container—they live in the host Sidecar's agent.js / chatBody.js; the 200-line Node service in the frontend only serves static files and proxies.

The relationship between the sidecar and the C binary agent-httpd is stated plainly in the file-header comment of agent.js—it is merely a gateway that forwards requests to the C binary and rewrites the latter's SSE frames into a format the frontend understands (sidecar/agent.js:4):

sidecar/agent.js:4

// agent-httpd speaks its own SSE dialect: each frame is `data: {"t":"delta","d":"..."}`
// (no `event:` line; the type lives in the JSON `t` field). The resolve-studio
// frontend expects the OpenAI-style dialect: `event: <type>\ndata: <json>\n\n`.
// This module rewrites agent-httpd frames into that dialect on the fly, so the
// ported frontend can consume lume's runtime unchanged.

And the entry that actually points at the C binary backend is at sidecar/agent.js:13:

const AGENT_URL = process.env.AGENT_HTTPD_URL || 'http://backend:8080'

The C binary agent-httpd emits its own SSE dialect: each frame has only data: {"t":"delta","d":"..."}, with no event: line, and the type is hidden in the JSON's t field (sidecar/agent.js:4). But the ported frontend only recognizes the OpenAI-style event: <type>\ndata: <json> (sidecar/agent.js:6). Neither side changes, so the cost falls on this middle layer: translateFrame (sidecar/agent.js:83) rewrites frame by frame, mapping t into an event: line, so the frontend can consume lume's runtime as-is.

This layer also carries the sediment of an incident. The emptyRunSummary(buf) inside translateFrame is not an ordinary error message; it is a dated retrospective: the comment records the 2026-11-06 incident of 8 rounds, 1 article-write plus 6 unrelated hot-news calls, zero output, and the user had no clue to determine which tool had failed. So on an empty answer it no longer emits "the tool executed but the model returned no summary," but instead prints the call trace (in collapsed form like hot-news ×4), the round budget, and the last error together, and explicitly discourages "just click retry." This kind of thing cannot be written into nginx configuration; it can only be written in the reverse proxy.

The same idea also exists on the request side. sidecar/chatBody.js:2 explains at the top why this pure function was split out separately:

sidecar/chatBody.js:2

// Pure request-shape translation for /api/chat. Kept out of server.js so the
// contract is unit-testable without starting the HTTP server (server.js has
// top-level listen() + MCP refresh side effects).

buildAgentChatBody does shape conversion: the frontend sends { messages, model, ... }, while agent-httpd wants { message, history }, so it takes the last user message as message, puts the rest into history, appends the task soul and the frontend-computed systemPrompt in order, and always presses TOOL_DISCIPLINE at the very end. The trailing position is deliberate: it sits closest to where the model generates, so it is least diluted by the long context in between. But to be clear—this is a model-behavior-level constraint and cannot replace runtime authorization. Declaration consistency is checked by the startup assertion (computeDrift in consistency.js), which only guarantees that declared tools really are implemented. What is actually callable is constrained jointly by the Sidecar's tool allowlist, token authentication, and handler execution logic; the publish intent check (server.js) is just one of those gates. Mistaking a startup assertion for an authorization mechanism is the easiest trap in this architecture—expanded in the trust-boundary section below. And this discipline itself is incident-driven: sidecar/chatBody.js:8 says that a single tool call failure is enough to make the free-tier model drift into another business domain and burn through the entire 8-round budget.

Splitting it into a pure module that does not import the side effects of server.js is for unit testing—these contracts are the things most likely to be quietly broken during changes.

Layer 3 · Host Sidecar: Why This Deployment Puts It on the Host

What the sidecar does—translating SSE, injecting system prompts, maintaining tool-list drift checks, and spawning child processes to execute tools—half of it requires host privileges. Keeping it in compose would mean the container has to install Node, be able to exec, and be able to write to disk, which would make the "slimming" of layer 1 pointless. So the sidecar service in docker-compose.yml is commented out and instead started by the Makefile on the host machine with nohup node sidecar/launcher.js. This is a trade-off this particular deployment makes to reach host files and spawn child processes—not a universal rule that every agent sidecar must live on the host. With a different capability set, the boundary could be drawn elsewhere.

What most deserves to be singled out here is sidecar/consistency.js. It is not runtime logic but an assertion gate at startup, guarding against "the four lists each drifting on their own." readToolChain reads the four lists out of their respective sources—DEFAULT_ALLOW from the generator script, tool "name" from the .lume bridge, and tool names from the schema file:

sidecar/consistency.js:79

function readToolChain() {
  const gen = fs.readFileSync(GENERATOR_FILE, 'utf8')
  const block = gen.match(/const DEFAULT_ALLOW\s*=\s*\[([\s\S]*?)\]/)
  const allow = [...block[1].matchAll(/['"]([^'"]+)['"]/g)].map((m) => m[1])
  const bridgeSrc = fs.readFileSync(BRIDGE_FILE, 'utf8')
  const bridge = [...bridgeSrc.matchAll(/^tool ['"]([^'"]+)['"]/gm)].map((m) => m[1])
  const schemaNames = JSON.parse(fs.readFileSync(SCHEMA_FILE, 'utf8')).tools.map((t) => t.name)
  return { schemaNames, allow, bridge }
}

Four lists: the schemas shown in the frontend panel, the DEFAULT_ALLOW declaring what should be exposed, what the agent can actually see in the generated .lume bridge, and what is actually implemented in builtin-exec.js. Note that readToolChain reads only the first three (all disk files); the fourth is supplied at runtime—checkToolChain pulls in BUILTIN_NAMES from builtin-exec.js (the set of real implementations registered at module load) before comparing:

function checkToolChain({ implemented } = {}) {
  const disk = readToolChain()
  const impl = [...(implemented || require('./builtin-exec').BUILTIN_NAMES)]
  const problems = computeDrift({ ...disk, implemented: impl })
  return { ok: problems.length === 0, problems,
           stats: { schema: disk.schemaNames.length, allow: disk.allow.length,
                    bridge: disk.bridge.length, implemented: impl.length } }
}

computeDrift computes every pairwise difference, and any drift becomes an explicit startup failure rather than a silently disappearing capability. A failure looks like this (wording translated from computeDrift's Chinese templates):

$ node sidecar/consistency.js
schema=43 allow=25 bridge=25 implemented=43
✗ Toolchain drift:
  DEFAULT_ALLOW references a tool missing from schema: article-write
  sidecar_ro.lume has a duplicate tool name: article-validate

You can see at a glance which list, which tool, and which way it drifted—far easier to triage than the runtime symptom of "some tool doesn't work."

One special case is worth copying down: capabilities must be exposed on both the allow and bridge sides, otherwise the agent cannot distinguish "not exposed" from "does not exist." This is exactly the source of that earlier line "the gateway has no article-write tool mounted"—it was not that the tool was not implemented, but that the agent could not prove it to itself.

The counts deserve a word too, so schema=43 allow=25 bridge=25 implemented=43 does not look like a failed check: computeDrift does not require all four lists to be the same size. It checks set relations: schema and implemented must correspond one-to-one (43=43—everything on the panel has an implementation and vice versa), allow and bridge must match exactly (25=25—declaration and generated artifact do not drift), and allow/bridge must be subsets of schema/implemented. So 25 is the part of the 43 that DEFAULT_ALLOW selects for the agent; the other 18 are registered and implemented but invisible to the agent (used by the frontend panel or internal calls). One more easily confused point: those 25 include one meta-tool, capabilities, which only answers "which tools exist and which are exposed to me" and performs no business action. Hence 24 by business-tool count versus 25 by tool declarations in the bridge. This article consistently uses the bridge total of 25; the "24" in earlier drafts counted business tools only—the two were never the same metric.

The reason this whole set of checks can run on the host rather than in the container is that it needs to read generation scripts, read .lume source files, and read implementation modules—all filesystem actions inside the repository, most natural to do on the host. Doing it in the container would require either mounting a bunch of volumes or stuffing the generation flow into the build phase.

The Host Sidecar Is a New Trust Boundary, Not the End of the Security Boundary

Moving the sidecar out of the container solves a problem of capability ownership: shell access, file writes, and child processes get one well-defined place on the host. It does not, by itself, buy isolation. A host process can reach host resources directly, so its privilege surface is larger than a container's—and this layer therefore needs stricter controls, not fewer:

  • Sidecar token authentication and rotation (implemented): containers can only reach it with X-Sidecar-Token; the token is rotatable, never shipped to the frontend, and the sidecar binds the host loopback 127.0.0.1 by default.
  • Tool allowlist (implemented): DEFAULT_ALLOW / sidecar_ro.lume expose only 25 tools; the other 18 of the 43 implemented tools are invisible to the agent.
  • File-path restrictions (implemented): server.js:126's REAL_FS_ROOTS checks resolved paths; tools can only touch agreed repository-relative paths and do not accept arbitrary absolute paths from callers.
  • Child-process command restrictions (implemented): spawnCapture assembles a fixed command plus arguments, and security.js:54 rejects shell metacharacters rather than letting the model compose a raw command line.
  • Timeouts and resource limits (partial): timeouts and output truncation are implemented—300s on the sidecar side, a 600s http_post ceiling on the lume side, and output truncation via MCP_TEXT_MAX—while CPU / memory resource quotas are not yet implemented.
  • Execution audit (partial — session log only): tool calls and results are recorded in the session log, so "who let the agent act" can be reconstructed later; but the log does not chain caller identity, authorization decisions, argument digests and results together, so it is not yet a full security audit.

Two different guarantees must be kept apart: computeDrift in consistency.js proves capability declarations match implementations (schema / allow / bridge / implemented do not drift); it does not prove that execution authorization is safe. A consistent list only says "what the agent sees is actually implemented." Whether a given caller should be allowed to invoke it, and whether its arguments stay in bounds, is enforced by the runtime controls above. Mistaking a startup assertion for an authorization mechanism is the easiest trap in this kind of architecture. One last boundary note: putting the sidecar on the host is a choice this deployment makes to reach host files and spawn child processes—not a universal claim that every agent sidecar must live there. A host process has a larger privilege surface; the six controls above are governance requirements for this trust boundary and need re-checking as the deployment changes. They do not come for free simply because the sidecar left the container, and what is implemented today should be kept separate from what still needs hardening.

Layer 1 · In-Container C Runtime: Slimmed Down to Just the Binary

The backend container runs the agent-httpd C binary; in compose it only exposes the port, and all external access is bound to 127.0.0.1. It does not recognize OpenAI's SSE dialect (sidecar/agent.js:4), nor is it responsible for shape conversion; dialect matters are all handed to the host sidecar. There is no Node and no Python in the container, because this layer only does what a runtime should do: receive requests, run the agent loop, and emit events in its own {t,d} format.

The same goes for the frontend container. Externally it is the Node service server-entrypoint.mjs; /api/* is forwarded to the host sidecar via host.docker.internal:3000, and /react/* goes through the compose internal network to the backend's :8080. Those fetch('/api/...') calls in frontend/src/api.ts (fetchTasks, createJob, streamJob, etc.) all only recognize relative paths and never know whether the other side is the host or a container—this is an implicit benefit of cutting the boundaries correctly: the frontend is agnostic to topology.

The address conventions of these network paths are worth pinning down, so you don't step on them when reproducing in another environment:

Path Address Notes
Browser → console localhost:18085 frontend container mapped to the host entry
frontend container → sidecar host.docker.internal:3000 compose extra_hosts resolves to host-gateway
backend container (.lume bridge) → sidecar same (SIDECAR_TOOLS_URL, injected at compose :47) same host loopback as frontend
sidecar listening on 127.0.0.1:3000 (server.js:44 default HOST) launcher.js:59 refuses to start on any non-loopback config

There is a hidden premise here that depends on Docker runtime behavior: the sidecar binds only the host loopback 127.0.0.1, yet containers can reach it via host.docker.internal. This topology has only been verified on OrbStack—fetch('http://host.docker.internal:3000/health') from inside the frontend container returns 200 there, because its host-side agent connects back as the host itself, making loopback services reachable. Whether Docker Desktop behaves identically was not verified separately, so no equivalent claim is made here. On native Linux Docker this path breaks: host-gateway only points to the host's NIC IP and cannot reach a port bound to 127.0.0.1. You would then either rebind the sidecar to 0.0.0.0 (exposing an extra interface, requiring your own auth and firewall) or go through a unix socket / SSH tunnel. The "minimal exposure by default" principle for the privileged layer is right, but its portability boundary must be stated.

How the Contracts of Each Layer Come Together

Back to the conclusion at the beginning: the three-layer boundaries are split by privilege requirements, not by language. Looking layer by layer, each layer retains only the capabilities it absolutely must have.

  • The C layer only manages the runtime and its own SSE dialect, and does not touch shape conversion (sidecar/agent.js:4).
  • The sidecar layer is on the host, responsible for everything that requires exec / disk writes / reading repository files, as well as the injection of shape and discipline (sidecar/chatBody.js:2, sidecar/consistency.js:79).
  • The frontend layer only does reverse proxying and static serving, keeping dialect differences outside the container (sidecar/agent.js:6).

The three layers mesh through two contracts: one is the SSE frame format ({t,d} ↔ event: line), and the other is the request body shape of /api/chat ({ messages } ↔ { message, history, system }). Both contracts are each carried by a pure function and can be unit-tested independently of the HTTP service, which is exactly why they could be stably fixed after multiple incidents.

To reproduce this topology, run in order:

make bootstrap
make build
make check

make check will run the toolchain consistency check as well—drift in the four lists will fail directly and print the differences.

Architecture Comparison: resolve-lume vs lume-a2a on Multi-Agent Design

resolve-lume and lume-a2a are both built on lume + lume-core + React, but they solve two opposite sides of Multi-Agent: resolve-lume is a single-node, multi-role "hands-on" executor, while lume-a2a is a cross-node distributed A2A "mouth-only" protocol layer.

Dimension resolve-lume lume-a2a
Form Single node, multi-role (10 souls: planner/evaluator/specialist + code-review/rust-review/weekly-investment/article-write …) Cross-node distributed A2A (default 7 real lume nodes)
Collaboration PSE role chain: Planner decomposes → Specialist researches → Evaluator critiques → ToolAgent executes Inter-node negotiation + delegation: hands work to the executor
Execution boundary sidecar is the hands layer: builtin-tools.json registers 43 tools (including frontend and internal capabilities), of which 25 are exposed to agent-httpd via sidecar_ro.lume—including one capabilities meta-tool, i.e. 24 business tools; real exec / disk-write happens in the sidecar 25 parameterless read-only tools; hands stay on the executor
Orchestration base C binary agent-httpd + sidecar (:3000) node.lume + a2a.lume + negotiate.lume
LLM coupling Live SSE streaming Snapshot-based: the console reads the negotiation result JSON, no live model call
Protocol In-process role messaging (inside the orchestrator) A2A JSON-RPC + /peer/invoke (HMAC-signed) + Agent Card discovery
Compliance Two layers, stated separately: the tool capability contract is checked by the startup assertions of sidecar/consistency.js:79's readToolChain/computeDrift for set relations (implementation aligns with schema, the open list aligns with the bridge, and the open set is a subset of the full implementation set); PSE conclusion grounding has its own evidence gate (claims must be checked against real source/data; incomplete evidence quarantines the draft) Explicitly non-advisory, industry-level only, no security codes

The most essential point: sidecar/business-helpers.js:363's runPseTask pipeline (article-write / pse-review / resume-tailor …) runs inside resolve-lume's sidecar — it is itself a hands-on multi-agent workbench. The lume-a2a fleet treats resolve-lume as peer #7: it only queries the capability catalog resolve-lume exposes and delegates the "hands-on" work back via task.delegate; and the executor's internal tool discipline (sidecar/chatBody.js:8, which records the 2026-11-06 incident) is exactly how this boundary held—stopping the free-tier model from wandering into other business domains. In other words, resolve-lume is the executor whose "hands" lume-a2a borrows, while lume-a2a is the protocol layer that lets independent agents discover, negotiate, and delegate.

Cross-Node Collaboration: Lume A2A

Resolve-Lume handles multi-role orchestration and controlled tool execution inside a single node. Capability discovery, negotiation, and task delegation between independent lume apps belong to Lume A2A: its task.delegate sends work that needs to act back to this host sidecar over the signed peer channel. Together they form a complete path from a single-node agent runtime to a cross-node agent federation.

Further reading: Lume A2A: Distributed Agent Collaboration.

lume Source Evidence: The Lines That Enforce the Split

The layers above are about container boundaries. Here I keep only the one piece of code that actually enforces them. What lets resolve-lume be "borrowed" by lume-a2a as its 7th peer is peer_node.lume, a static node (capabilities come entirely from local files and are orthogonal to the backend container and host sidecar—they work even when those are down), plus the permission split inside /peer/invoke. The file header's privacy discipline, the rl_static_tools() capability list, and the generated sidecar_ro.lume bridge all live in the repository (see the source navigation below); they are no longer pasted here in full.

Names starting with resolve. go to read-only local files, names starting with exec. are forwarded to the host sidecar to actually work, everything else is denied—it won't even "casually call some other tool" (peer_node.lume:278, excerpt; … marks omissions). The lume source below is an excerpt of the real file, with comments and messages translated into English:

post "/peer/invoke", (req) => {
  // … peer.verify checks the signature and parses the body as JSON (source 278-291)
  let tool_name = str(get(parsed.ok, "tool", ""));
  if (len(str_match("^resolve\\.", tool_name)) > 0) {   // read-only, served from local files
    if (tool_name == "resolve.skills") { hit = rl_skills(); }
    else if (tool_name == "resolve.tools") { hit = rl_tools(); }
    ...
  }
  if (len(str_match("^exec\\.", tool_name)) > 0) {       // real side effects, forwarded to the host sidecar
    let args = get(parsed.ok, "arguments", {});
    if (tool_name == "exec.submit") { hit = exec_submit(args); }
    else if (tool_name == "exec.status") { hit = exec_status(args); }
    ...
  }
  return { ok: false, denied: true, error: "This node exposes only read-only resolve.* tools; other tool calls are rejected" };
};

On the other side, lume-tools/sidecar_ro.lume is the tool bridge the agent can actually see—the "agent CAN see" entry among the four lists in consistency.js. It is auto-generated, and all tools share one outbound call sidecar_tool(): the tool name is hard-coded in the handler, so the LLM cannot pass a different name and loop the request back to agent-httpd (:17). The most quotable part of that bridge is actually its comment, which records why the container boundary requires allow_private (the SSRF gate at builtins_http.c:25-26,901 rejects private-range addresses by default):

  // allow_private: the sidecar binds the host loopback 127.0.0.1 (server.js HOST default);
  //                containers reach it via SIDECAR_TOOLS_URL(host.docker.internal), and that
  //                hostname resolves to a private address — lume's SSRF gate rejects private
  //                addresses by default (builtins_http.c:25-26,901), so this flag is required.
  let r = http_post(base, {"headers": hdr, "body": body, "timeout": 600, "max_bytes": 2097152, "allow_private": true});

(Editor's note: the comment "the sidecar binds the host loopback 127.0.0.1" speaks from the host's perspective—the sidecar binds the host loopback, and from inside the container it is reached via host.docker.internal:3000, per the address table earlier. Tool declarations such as article-write are each a single tool "…", …, (p) => sidecar_tool(…) line and are no longer listed one by one.)

Source Code Navigation

  • sidecar/agent.js — frame-by-frame translation from the agent-httpd SSE dialect to OpenAI style, empty-answer retrospective
  • sidecar/chatBody.js — /api/chat request shape conversion, tool call discipline, release intent determination
  • sidecar/consistency.js — drift check for the four tool lists
  • sidecar/builtin-tools.json — tool schemas shown in the frontend panel
  • sidecar/builtin-exec.js — the real implementations of tools and BUILTIN_NAMES
  • deploy/gen-sidecar-tools.mjs — DEFAULT_ALLOW and bridge generation
  • lume-tools/sidecar_ro.lume — the tool bridge visible to the agent
  • frontend/src/api.ts — the entire call surface of the frontend to /api/*
  • frontend/server-entrypoint.mjs — the service the frontend container actually runs externally
  • docker-compose.yml — the backend / frontend services and port bindings

[faq] Q: Why isn't the sidecar placed in compose? A: It needs to exec, write to disk, and read files inside the repository, which are host privileges; that service in docker-compose.yml has been commented out and removed, and the Makefile starts sidecar/launcher.js on the host. Q: What is the difference between agent-httpd's SSE and the format the frontend wants? A: Each frame of agent-httpd has only data: {"t":"delta","d":"..."}, with the type in the JSON's t field; the frontend wants event: <type>\ndata: <json>, which is rewritten by translateFrame in sidecar/agent.js. Q: Which lists does consistency.js check? A: Four—the schemas in builtin-tools.json, the DEFAULT_ALLOW in gen-sidecar-tools.mjs, the bridge declarations in sidecar_ro.lume, and the real implementations in builtin-exec.js. Q: Why must capabilities be exposed to the agent? A: Otherwise the agent cannot distinguish "the tool is not exposed" from "the tool does not exist," and historically it therefore answered "the gateway has no article-write tool mounted." Q: How do you verify the toolchain has not drifted? A: Run make check, or trigger it with node sidecar/consistency.js --check; drift will print the differences and exit with a non-zero code. [/faq]

Comments (0)

    Comments require approval before appearing. Markdown supported.

    ← Back to list
    erishen

    Written by

    erishen

    Senior full-stack engineer focused on AI application engineering & delivery. Author of lume, lume-core and open-source AI engineering tooling.