@wezzard/mcp-relay 0.17.1 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-relay",
3
- "version": "0.17.1",
3
+ "version": "0.19.0",
4
4
  "description": "Runs an agent's code on fresh, isolated VMs, several at once, each run recorded with evidence",
5
5
  "author": {
6
6
  "name": "WeZZard"
package/README.md CHANGED
@@ -304,16 +304,24 @@ installation or platform acceptance is claimed here.
304
304
  ## Durable machines
305
305
 
306
306
  `relay_acquire` takes `machine` in place of `image` to lease a durable machine,
307
- a real Mac that machine-service exposes, such as `Build-Mac-1`. Every other
307
+ a real Mac that machine-service exposes, such as `Mac-A`. Every other
308
308
  tool works on it as on a VM ([docs/durable-machines.md](docs/durable-machines.md)).
309
309
 
310
310
  - The relay finds the instance that owns the machine as `machctl list` does:
311
- the loopback instance, then every `machine-service` registration of the
312
- Consul agent at `CONSUL_HTTP_ADDR` (default `http://127.0.0.1:8500`). A Mac
313
- without its own Consul agent points `CONSUL_HTTP_ADDR` at one, for example
314
- through an SSH tunnel.
311
+ the loopback instance, then every instance that advertises
312
+ `_machine-service._tcp` with Bonjour on the network, so a Mac needs nothing
313
+ else installed. With `MACHINE_SERVICE_DISCOVERY=consul` it asks the Consul
314
+ agent at `CONSUL_HTTP_ADDR` (default `http://127.0.0.1:8500`) instead. Each
315
+ instance found is used only once its `/health` confirms its ID.
315
316
  - Every call carries the lease's `lease_id`, files go as bytes, and the relay
316
317
  stages under the lease's workspace, which machine-service removes at release.
318
+ - When machine-service reports `machine_id`, the relay saves it and can resume
319
+ the same lease after the Mac is renamed or its address changes. Requests keep
320
+ using the name the lease was granted under. Older services keep the existing
321
+ name and origin checks.
322
+ - A durable 404 never proves release. The relay finds the owner again and
323
+ verifies that its machine record no longer names the lease. An unreachable
324
+ owner leaves the lease retained with guest state `unknown`.
317
325
  - Runs take snapshots only while the Mac's cua-driver daemon (`CuaDriver.app`,
318
326
  `com.trycua.driver`) holds Screen Recording, read with
319
327
  `cua-driver permissions status --json` in the lease. machine-service's own
@@ -371,8 +379,9 @@ keeps the VM for a retry after space is freed.
371
379
 
372
380
  - `MCP_RELAY_PROJECT`: the project directory (the plugin passes Claude Code's). Evidence lands under `relay-evidence/<task>/` there. Every host file the relay reads, `relay_stage`'s `workspace` and `files[].local` and `relay_script`'s `localPath`, lies in this folder: a relative path resolves against it, an absolute path must already lie in it, and a path through a symlink is refused.
373
381
  - `MCP_RELAY_SESSION`: an explicit session identity. By default each server process takes a fresh random one; a stable identity lets a restarted server reconcile and reattach the guests of the same identity.
374
- - `MCP_RELAY_URL`: the loopback machine-service origin, default `http://localhost:6240`. Non-loopback servers and redirects are refused; a durable machine's instance on another Mac is reached only when Consul lists it.
375
- - `CONSUL_HTTP_ADDR`: the Consul agent that lists machine-service instances, for durable machines; default `http://127.0.0.1:8500`.
382
+ - `MCP_RELAY_URL`: the loopback machine-service origin, default `http://localhost:6240`. Non-loopback servers and redirects are refused; a durable machine's instance on another Mac is reached only when discovery finds it.
383
+ - `MACHINE_SERVICE_DISCOVERY`: how durable machines' instances are found, `bonjour` (the default) or `consul`, as for machine-service and machctl.
384
+ - `CONSUL_HTTP_ADDR`: the Consul agent that lists machine-service instances, in Consul mode; default `http://127.0.0.1:8500`.
376
385
  - `MCP_RELAY_GUEST_NETWORK`: the network every guest is acquired on, `nat` (the default) or `internet`. With `internet`, machine-service gives a guest that reaches the internet and reaches neither this host nor any private network; an application that hosts agents sets it. The agent cannot choose it: `relay_acquire` takes no network. Any other value stops the server at startup and refuses every acquisition, and a machine-service that cannot give `internet` refuses the acquisition with its own reason, never falling back to `nat`.
377
386
  - `MCP_RELAY_ON_EXIT`: what the end of a session does to its guests, `pause` (the default: renewal pauses and the VMs are kept for an explicit finish or release) or `release` (every guest is released, then the server exits). An application that owns its tasks' machines, such as The Desk, sets `release`. Any other value stops the server at startup.
378
387
  - `MCP_RELAY_CAPACITY_WAIT`: how many seconds `relay_acquire` waits when the host is at capacity, such as at machine-service's limit of two running macOS VMs, asking again every 15 s; default 1800, and 0 for not at all. Any other value stops the server at startup.
@@ -958,7 +958,7 @@
958
958
  "src/config.ts": "3fbc475596ec0a1b6122ea963bf2769420a8a2a0e62fda55e66018fb3a6d53b3",
959
959
  "src/console.ts": "d8258173a24449c2a394289b14983b9575c5ce753ab267d4e13213f3abfcb72d",
960
960
  "src/core.ts": "dd889fda6af982ab47b40b346e7fbc41a213b6d258d3d5fe56cd8c5373221159",
961
- "src/discovery.ts": "80db010052e9a37a00c5f5c1bb525fc95d8026c68ef9cd307eab0e4ec1d48920",
961
+ "src/discovery.ts": "9a46e6ba9808d085b3294ab1d2e4fcf69f9ec86b5af79b758e19beac6bb7ee12",
962
962
  "src/doctor.ts": "8249e9fa78b679e9ef7fd30f617bf07848961346101d3b64c42f779cfb042671",
963
963
  "src/downloads.ts": "4f37b5bb4fac96f9260a3a87c83bacf715b9add5ae9926d3fe0994000c70a8dd",
964
964
  "src/environment.ts": "5770e966e49d78ae069614078c667f94e70074b150f83111049529ff613aa215",
@@ -967,8 +967,9 @@
967
967
  "src/guest/receiver.ts": "92fc8d3bfe95ed56d43cfe5b46eb196034ade5e4e9f58ed202465531458f697d",
968
968
  "src/image-presentation.ts": "64ca29a3444a04606cb783c81ac2d0f3136f9a9ac730ae9074156f0a63256c76",
969
969
  "src/images.ts": "415bfb37966a60ef3e407236295b9aeeb314f7fb33de55a6ada512cff6661908",
970
- "src/machine-service.ts": "9bb169564572304488cf7f33db959186ec2a4f9be9685b84b270cf4cd6f3aee9",
971
- "src/manager.ts": "03d6c94034378f04089d2af9a0a1bdef2cec028a16d5009019c7c397211ab758",
970
+ "src/machine-service.ts": "a6343138b2bb689772310b9798f6cb9d8bc16033f0ba3562039838c7aca1941e",
971
+ "src/manager.ts": "9f989175d07e8629ef8518c90a35db4131d2ea01e96a5de6d287c3d7a7f99ea5",
972
+ "src/mdns.ts": "cbff562d06db1edebb79a467f8fb90eb575647b4eb8efd1e28fb4b9b67a85a96",
972
973
  "src/owner-lock.ts": "a99cbaba67b4aff0e646dc5d5967db4497ba6dbda83fb1838c55f0bf0f6e0367",
973
974
  "src/package.ts": "a52ed791813922e3ace9144706ddde8313a67d8580a3acd54a0799de3ebe44d2",
974
975
  "src/probe.ts": "40a123f725aad7c22fe63707dd2de99646cb1f307d7d660927e8ca2b973e9ce0",
@@ -977,7 +978,7 @@
977
978
  "src/schema.ts": "7f68a85c9593fc2ad1455efd6e757c43f8ed591293fd820f1a08408db17c1912",
978
979
  "src/search-diagnostics.ts": "cea037618c56f075d51155101ad1cc0314bfa67b174bdb070191e0ea5ea04679",
979
980
  "src/search.ts": "8aaf544fcb27e7e018bd976e1ba7d3c70c047aeda3182b3dce91873a901a245e",
980
- "src/server.ts": "bff4c09c29890aa62175ead36d9cfd6f8fa7334d2ee0929b51a0371d38c5df1c",
981
+ "src/server.ts": "ed2475e4834484076ad51f216bacb5aea0f624129401ba9c688a6b0ed651659e",
981
982
  "src/surface.ts": "25681325cb01dfb04524bca8e0e5f3d4b4795d3db814384c7d1e9a8ec831eb16",
982
983
  "src/transfer.ts": "f27d65c0b42f9933e6a7f950f56111b84c644e8739bab44805aebfb54d77e320",
983
984
  "src/transport.ts": "35df20b321f52c4a371f1e29923e957e7c85d58001e2864f0fd13c2c2838945f",
package/dist/doctor.mjs CHANGED
@@ -120,7 +120,7 @@ var MachineService = class {
120
120
  const host = url.hostname.replace(/^\[|\]$/g, "");
121
121
  const loopback = host === "localhost" || host === "::1" || isIP(host) === 4 && host.startsWith("127.");
122
122
  if (!loopback && !options.listed || !["http:", "https:"].includes(url.protocol) || url.username || url.password || url.search || url.hash || url.pathname !== "/") {
123
- throw new TypeError("machine-service baseUrl must be a loopback HTTP(S) origin, or one Consul lists as machine-service, without credentials, path, query or fragment");
123
+ throw new TypeError("machine-service baseUrl must be a loopback HTTP(S) origin, or one discovery found, without credentials, path, query or fragment");
124
124
  }
125
125
  this.baseUrl = url.origin;
126
126
  this.timeoutMs = positive(options.timeoutMs ?? 66e4, "timeoutMs");
@@ -161,7 +161,8 @@ var MachineService = class {
161
161
  }
162
162
  }
163
163
  async get(vm, options = {}) {
164
- return named(await this.request(this.path(vm), void 0, options));
164
+ const path = this.path(vm) + (options.lease_id ? `?${new URLSearchParams({ lease_id: options.lease_id })}` : "");
165
+ return named(await this.request(path, void 0, options));
165
166
  }
166
167
  /**
167
168
  * Cancellation before dispatch prevents allocation. Once dispatched we deliberately
@@ -276,7 +277,7 @@ var MachineService = class {
276
277
  const controller = new AbortController();
277
278
  const abort = () => controller.abort(options.signal?.reason);
278
279
  options.signal?.addEventListener("abort", abort, { once: true });
279
- const expire = () => controller.abort(new MachineServiceError(`machine-service ${path} timed out after ${timeoutMs}ms${stream.idle ? " without a byte" : ""}`));
280
+ const expire = () => controller.abort(Object.assign(new MachineServiceError(`machine-service ${path} timed out after ${timeoutMs}ms${stream.idle ? " without a byte" : ""}`), { code: "ETIMEDOUT" }));
280
281
  let timer = setTimeout(expire, timeoutMs);
281
282
  try {
282
283
  const response = await fetch(`${this.baseUrl}${path}`, {
@@ -1,6 +1,6 @@
1
1
  {
2
- "server.mjs": "7de81a14e4248abfef15cffa78109dfd86a5c84bfdd7ccbacbacebab2954fa80",
2
+ "server.mjs": "e4b503891cf0d2d6b331bf208298cc7261f8be2bcf936275cf8ea9e13cd75b43",
3
3
  "receiver.mjs": "8b5b6fdd6cb789cdc4060e367a155cb42e7cf34187044c899789bf76b7bb0e14",
4
- "doctor.mjs": "f40afe5454bf4367ed50357c6fc20886eae69cbb391085bb853322ea29ab88ae",
4
+ "doctor.mjs": "179feaa8bfa45ebb3a8c9b7a52dd86c008c1b248a1e3c638bf53d64e6e7b991b",
5
5
  "review-data.mjs": "da7b6b35d060e09cfc445df4febda02a1a0c0f23d9b854866aed8d604cbb3993"
6
6
  }