@wezzard/mcp-relay 0.15.0 → 0.16.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.15.0",
3
+ "version": "0.16.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
@@ -19,10 +19,19 @@ The project was named mcp-vm-relay before v0.12.0. The npm package is now
19
19
  default state directory moved with the name, so finish or release a lease the
20
20
  old relay owns before upgrading.
21
21
 
22
+ From v0.16.0 the relay's backend is machine-service, vm-service under its new
23
+ name. The relay asks for `/machines` paths, which vm-service never served, and
24
+ refuses a service whose `/health` does not answer `machine-service`. A selected
25
+ environment profile must be at `schemaVersion` 2 with `machctlPath`; a profile
26
+ at version 1 or with `vmctlPath` is refused with its fix in the error (DC-27).
27
+ The relay's own names do not change: `MCP_RELAY_*`, `VM_ENVIRONMENT_FILE`,
28
+ `VM_RELAY_*` and the state directories. Release every lease before switching,
29
+ as machine-service's installer requires.
30
+
22
31
  ## How it is built
23
32
 
24
33
  The relay implementation lives in this repository: the manager
25
- (`src/manager.ts`), the vm-service client, the registry with its OS-level lock,
34
+ (`src/manager.ts`), the machine-service client, the registry with its OS-level lock,
26
35
  the guest transfer and transport, the evidence package and its state merge, the
27
36
  selected-environment profile, the console and saved-image contracts, the strict
28
37
  tool contract (`src/schema.ts`), the action dispatch and bounded result
@@ -53,7 +62,7 @@ adds nothing Claude-Code-specific beyond the marketplace packaging and the
53
62
  | `/relay-status` command | `/mcp-relay-status` in pi, `/mcp-relay:status` in Claude Code; it asks the assistant to call `relay_status` |
54
63
  | prompt-composed guest operator | the `vm-relay-operator` agent definition (Claude Code only), limited to the relay's tools and read-only file tools |
55
64
  | typed image blocks in a run result, with pi's `tool_result` hook keeping the error flag | MCP image content blocks in the tool result, with the MCP `isError` flag set beside them |
56
- | session shutdown pauses lease renewal | the same when the server's stdio closes or it is signalled: renewal pauses after one final renewal for the rest of the lease's TTL, the recording detaches, the VM is retained until that TTL for an explicit `relay_finish` or `relay_release`, and the vm-service TTL is the backstop |
65
+ | session shutdown pauses lease renewal | the same when the server's stdio closes or it is signalled: renewal pauses after one final renewal for the rest of the lease's TTL, the recording detaches, the VM is retained until that TTL for an explicit `relay_finish` or `relay_release`, and the machine-service TTL is the backstop |
57
66
  | the settled agent pauses renewal | none: MCP has no such hook, so the instructions and each run tool's description say "finish or release before you return" |
58
67
 
59
68
  ## Install
@@ -106,7 +115,7 @@ without a Claude Code plugin or pi package wrapper.
106
115
 
107
116
  Node 22+, Python 3 with `fcntl` for the registry lock, and for VM execution an
108
117
  Apple-silicon Mac with Tart, a running
109
- [vm-service](https://github.com/WeZZard/vm-service) and prepared guest images.
118
+ [machine-service](https://github.com/WeZZard/vm-service) (formerly vm-service) and prepared guest images.
110
119
  Check readiness with `node dist/doctor.mjs`. It does not acquire a VM or
111
120
  establish guest UI readiness. Staging and runs assume no software in the guest
112
121
  but Node.js, which runs the relay's own guest code; `relay_stage` refuses an
@@ -117,7 +126,7 @@ gap. Snapshots need cua-driver with capture permission; on Linux, native X11
117
126
  and `serve --no-overlay`. `relay_script` runs JavaScript with the guest's
118
127
  Node.js, TypeScript with `tsx` and Python with `python3`, each from the guest's
119
128
  `PATH`; the relay installs none of them, nor the software a script drives, such
120
- as cua-driver, Playwright or a browser. Console viewing needs the vm-service guest-sharing backend and its
129
+ as cua-driver, Playwright or a browser. Console viewing needs the machine-service guest-sharing backend and its
121
130
  guest preparation; see `docs/console.md` here.
122
131
 
123
132
  ## The tools
@@ -149,7 +158,7 @@ automatic: see "Runs" below.
149
158
  | `relay_console_resolve` | Resolve console status | `console-resolve` | Resolve non-secret console status for the guest's lease and environment. |
150
159
  | `relay_console_open` | Open console viewing | `console-open` | Open explicitly user-requested viewing on the service host, with `console_id`, `attempt_id`, `userRequested: true`, `reason` and `expected`. |
151
160
  | `relay_console_cancel` | Cancel console viewing | `console-cancel` | Cancel the identified viewing attempt without releasing the VM. |
152
- | `relay_status` | Show relay status | (unchanged) | Every guest this session holds, by name, each with its lease: backend binding, guest state, renewal state, console observation, last error, staging state and evidence path; plus `maxGuests`, the project directory, the VM service origin and the selected environment. `active` is false when no guest's lease is being renewed. |
161
+ | `relay_status` | Show relay status | (unchanged) | Every guest this session holds, by name, each with its lease: backend binding, guest state, renewal state, console observation, last error, staging state and evidence path; plus `maxGuests`, the project directory, the machine-service origin and the selected environment. `active` is false when no guest's lease is being renewed. |
153
162
 
154
163
  `readOnlyHint`/`idempotentHint` are true for `relay_search`, `relay_probe`,
155
164
  `relay_acquisition_capabilities`, `relay_console_resolve`, `relay_image` and
@@ -198,10 +207,10 @@ tarball it checked.
198
207
  - An operation failure retains the VM so the agent can inspect, repair and submit a new operation. Failed and uncertain operations are never automatically replayed.
199
208
  - Use `finish` to deliver evidence and release, or `release` to abandon explicitly. A declared output that was never produced is recorded as incomplete (`incompleteExtractions`) rather than failing `finish`. A failed delivery retains the VM; a release failure retains ownership until destruction is verified.
200
209
  - When the session ends (the client closes the server's standard input, a write to its standard output fails, it is signalled with SIGTERM, SIGINT or SIGHUP, or the process that started it goes away), `MCP_RELAY_ON_EXIT` says what happens to the guests. With `release`, the relay releases every guest the session holds through its own release path, keeping the evidence the host can still pull, then exits; an operation already in flight completes first, all within the shutdown grace period, after which a guest still held is released directly in one bounded attempt. A guest whose release fails keeps its record and stops renewing, so its lease ends within its last 15-minute window. With `pause`, the default, the relay renews each guest's lease once for the rest of its TTL, then renewal pauses and the recording detaches; no VM is destroyed and is retained until its TTL for an explicit finish or release. A `finish` or `release` already in flight completes first, for up to the shutdown grace period; after that the operation is cancelled and renewal pauses without it. The backend TTL and grace period handle abandoned leases. Status reports the last confirmed expiration time.
201
- - While the session is live, the relay tracks the lease's own deadline (its start plus `ttlHours`) and renews vm-service only 15 minutes ahead at a time, never past that deadline, and stops renewing at it. A client that crashes without ending its session therefore leaves its VM leased for at most about 15 minutes, plus the backend's grace period, rather than its whole TTL.
210
+ - While the session is live, the relay tracks the lease's own deadline (its start plus `ttlHours`) and renews machine-service only 15 minutes ahead at a time, never past that deadline, and stops renewing at it. A client that crashes without ending its session therefore leaves its VM leased for at most about 15 minutes, plus the backend's grace period, rather than its whole TTL.
202
211
  - A restarted server with the same `MCP_RELAY_SESSION` reconciles each guest's durable ownership and reattaches its recording session without replaying prior work; every guest keeps its name. A session state written by a relay before several guests is restored as one guest named from its task. Context compaction does not reset VM state; `probe` reports the owned state without relying on earlier messages.
203
212
  - A run tool's `timeoutMs` defaults to 120,000 ms and accepts integers up to 3,600,000 ms. It bounds command execution, not the snapshot delay or the lease lifetime. A timeout reports confirmed termination or uncertainty and keeps the VM available.
204
- - A shell `relay_script` with `diagnostic: true` records diagnosis or repair without screenshots, for explicitly requested diagnosis when capture is unavailable. It runs through vm-service as `/bin/sh -c <script>`, a script file read on the host first: before staging in the guest's default directory, after staging in the recording workspace. Only a shell script may be diagnostic, because no receiver or Node.js is involved. It cannot join a snapshot group and is not visual verification.
213
+ - A shell `relay_script` with `diagnostic: true` records diagnosis or repair without screenshots, for explicitly requested diagnosis when capture is unavailable. It runs through machine-service as `/bin/sh -c <script>`, a script file read on the host first: before staging in the guest's default directory, after staging in the recording workspace. Only a shell script may be diagnostic, because no receiver or Node.js is involved. It cannot join a snapshot group and is not visual verification.
205
214
  - After diagnosing damaged recording state, `relay_stage` with `resetRecording: true` archives the old recording and starts a new recording session in the same VM. An existing receiver lock refuses the reset until its operation is reconciled. Prior evidence paths remain in the owned status.
206
215
 
207
216
  ## Runs
@@ -295,17 +304,18 @@ installation or platform acceptance is claimed here.
295
304
 
296
305
  ## Selected environments
297
306
 
298
- Set `VM_ENVIRONMENT_FILE` to a profile that binds a loopback vm-service
299
- endpoint, an image repository, a Tart store and separate service, image and
307
+ Set `VM_ENVIRONMENT_FILE` to a profile, at `schemaVersion` 2 with
308
+ `machctlPath`, that binds a loopback machine-service endpoint, an image repository, a Tart store and separate service, image and
300
309
  relay state directories together. The profile is validated before use, is
301
310
  authoritative over the individual `MCP_RELAY_*` variables, and an invalid
302
311
  selection fails rather than falling back. Leases are bound to their backend and
303
312
  store: an owned lease restored under a different environment fails before any
304
313
  backend operation, and destruction is verified with the selected Tart binary
305
314
  and `TART_HOME`. `docs/selected-environments.md` documents the schema. The
306
- bundle the profile exports to subprocesses is the canonical one vm-service
307
- defines, so its relay entries keep the `VM_RELAY_STATE_DIR` and
308
- `VM_RELAY_URL` names and the three runtimes agree; this server reads its own
315
+ bundle the profile exports to subprocesses is the canonical one machine-service
316
+ defines, with `MACHCTL` and the `MACHINE_SERVICE_*` names, so its relay entries
317
+ keep the `VM_RELAY_STATE_DIR` and `VM_RELAY_URL` names and the three runtimes
318
+ agree; this server reads its own
309
319
  settings from the profile.
310
320
 
311
321
  ## Evidence and cleanup
@@ -327,7 +337,7 @@ destroying the VM; a failed delivery removes only the derived files it created
327
337
  and retains the VM for a corrected attempt. Cleanup checks the read-only host
328
338
  Tart inventory (the selected one, when an environment is selected) before
329
339
  claiming destruction. Leases default to 4 hours, renewed 15 minutes at a
330
- time up to that TTL; the vm-service reaper is the final backstop for process death.
340
+ time up to that TTL; the machine-service reaper is the final backstop for process death.
331
341
 
332
342
  Relay evidence has no size limit (owner decision PS-D12): screenshots are
333
343
  delivered as captured, never scaled, compressed, deduplicated or budgeted, and
@@ -342,10 +352,10 @@ keeps the VM for a retry after space is freed.
342
352
 
343
353
  - `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.
344
354
  - `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.
345
- - `MCP_RELAY_URL`: the loopback vm-service origin, default `http://localhost:6240`. Non-loopback servers, redirects and physical targets are refused.
346
- - `MCP_RELAY_GUEST_NETWORK`: the network every guest is acquired on, `nat` (the default) or `internet`. With `internet`, vm-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 vm-service that cannot give `internet` refuses the acquisition with its own reason, never falling back to `nat`.
355
+ - `MCP_RELAY_URL`: the loopback machine-service origin, default `http://localhost:6240`. Non-loopback servers, redirects and physical targets are refused.
356
+ - `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`.
347
357
  - `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.
348
- - `MCP_RELAY_CAPACITY_WAIT`: how many seconds `relay_acquire` waits when the host is at capacity, such as at vm-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.
358
+ - `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.
349
359
  - `MCP_RELAY_MAX_GUESTS`: the most guests one session holds at once, a positive integer, default 4. Any other value stops the server at startup.
350
360
  - `MCP_RELAY_STATE_DIR`: host state, otherwise `$XDG_STATE_HOME/mcp-relay` or `~/.local/state/mcp-relay`, one subdirectory per session, with one `guests/<guest>/` folder per guest holding its ownership record and owner lock.
351
361
  - `MCP_RELAY_REGISTRY`: an explicit task registry file; otherwise an existing compatible `~/AGENTS.md` VM table, or a private managed `registry.md` in the state directory.
@@ -364,9 +374,12 @@ npm run setup:dev -- /absolute/path/to/built/relay-driver
364
374
  npm run check # build, typecheck, tests
365
375
  ```
366
376
 
367
- Three tests need a sibling checkout beside this repository and skip with a
368
- message when it is absent: the console fixture regeneration and the
369
- environment parity test need `../vm-service`, and the shared catalog text
377
+ Three tests need something outside this repository and skip with a message
378
+ when it is absent: the console fixture regeneration needs a historical
379
+ `../vm-service` checkout with the Python backend (or
380
+ `VM_SERVICE_PYTHON_BACKEND`); the environment parity test needs
381
+ machine-service's `machctl` (`MACHCTL`, `PATH`, or a release build in
382
+ `../machine-service/rust`) and `../pilot-images`; and the shared catalog text
370
383
  corpus needs `../pilot-images`. The JPEG and WebP presentation fixtures in
371
384
  `tests/fixtures/` were encoded once from the test's spatial PNG with a codec
372
385
  outside this repository and are committed, because the core carries none.
@@ -379,7 +392,7 @@ npm run test:e2e
379
392
 
380
393
  This runs `claude --print` with the plugin loaded from this checkout
381
394
  (`--plugin-dir`), the model limited to the relay's tools, and the server pointed
382
- at a loopback stand-in for vm-service (`tests/e2e/fixture-service.ts`), which
395
+ at a loopback stand-in for machine-service (`tests/e2e/fixture-service.ts`), which
383
396
  keeps leases as records, runs the relay's own Node and transfer commands
384
397
  locally, and fakes the desktop capture driver. Four cases run, each a separate
385
398
  headless session: the status call (which also proves the server is pointed at
@@ -412,7 +425,7 @@ separate, explicit step.
412
425
 
413
426
  Pushing the tag triggers
414
427
  [`.github/workflows/release.yml`](.github/workflows/release.yml), which
415
- rebuilds `vmctl`, checks the working build against a fresh one, and publishes
428
+ rebuilds `machctl`, checks the working build against a fresh one, and publishes
416
429
  to npm using [trusted publishing](https://docs.npmjs.com/trusted-publishers)
417
430
  (OIDC — no `NPM_TOKEN` secret involved), then creates the matching GitHub
418
431
  release.
@@ -35,5 +35,5 @@ watch.
35
35
  Call relay_finish or relay_release explicitly for every guest before you
36
36
  return; the session ending never finishes a guest. Report the verified package path, the
37
37
  delivery result, the snapshot completeness and the execution outcome as
38
- separate facts. Do not claim human review. Do not use vm-service or
38
+ separate facts. Do not claim human review. Do not use machine-service or
39
39
  relay-driver directly.
@@ -956,30 +956,30 @@
956
956
  "src/archive.ts": "469ca411558db5696c8790d8a7132108d6705d4316c5a31a149f7472ddbef0ec",
957
957
  "src/config.ts": "3fbc475596ec0a1b6122ea963bf2769420a8a2a0e62fda55e66018fb3a6d53b3",
958
958
  "src/console.ts": "d8258173a24449c2a394289b14983b9575c5ce753ab267d4e13213f3abfcb72d",
959
- "src/core.ts": "ea656be559f2a82cc76ab95a4c0f142df4d524fab35276d95aaa099ae537d38b",
960
- "src/doctor.ts": "7f509d7fd6c927a14e85110ad156efa879d9fa75e4e5f4af02b7f651cf66a8ab",
959
+ "src/core.ts": "dd889fda6af982ab47b40b346e7fbc41a213b6d258d3d5fe56cd8c5373221159",
960
+ "src/doctor.ts": "8249e9fa78b679e9ef7fd30f617bf07848961346101d3b64c42f779cfb042671",
961
961
  "src/downloads.ts": "4f37b5bb4fac96f9260a3a87c83bacf715b9add5ae9926d3fe0994000c70a8dd",
962
- "src/environment.ts": "04bc2a82eb56c1b0d77dabc9db4b0af9331f18c14398e7370e31a0081914f019",
962
+ "src/environment.ts": "5770e966e49d78ae069614078c667f94e70074b150f83111049529ff613aa215",
963
963
  "src/evidence-merge.ts": "2f2759e28e70595ef9284fec85e1d6082bf25e815d04f0a36a253c24bfb75110",
964
964
  "src/guest/image-evidence.ts": "9c5daaed5b33b9912021a91fd79a2e6d5be42c75d37761772a3bd2645d20a55e",
965
965
  "src/guest/receiver.ts": "92fc8d3bfe95ed56d43cfe5b46eb196034ade5e4e9f58ed202465531458f697d",
966
966
  "src/image-presentation.ts": "64ca29a3444a04606cb783c81ac2d0f3136f9a9ac730ae9074156f0a63256c76",
967
967
  "src/images.ts": "734a30ba34cd80ef0b5c3791232f13b170b06d6d74c4b843d39566d2e09136d0",
968
- "src/manager.ts": "7e24a1eb66753698e6909406ef0a3dd1cef61ec096dc8301978f86214df976d5",
968
+ "src/machine-service.ts": "777fac0552e2aa63910b6e224c787cf0b2696e7652eab0a734c7c772de3eddf3",
969
+ "src/manager.ts": "440c06f3cd42b5f8031e0dca43088225175ca64a956c85e88890e39b8b3ea291",
969
970
  "src/owner-lock.ts": "a99cbaba67b4aff0e646dc5d5967db4497ba6dbda83fb1838c55f0bf0f6e0367",
970
971
  "src/package.ts": "a52ed791813922e3ace9144706ddde8313a67d8580a3acd54a0799de3ebe44d2",
971
972
  "src/probe.ts": "40a123f725aad7c22fe63707dd2de99646cb1f307d7d660927e8ca2b973e9ce0",
972
973
  "src/registry.ts": "87478f1ceef0f06df9b28c064a817383ff153bdadd70e6d58b4a7ed464f66146",
973
974
  "src/review-data.ts": "2e873eb23612fd4502d84e65322006345f4e97bb679109b23dc4d26683200c19",
974
- "src/schema.ts": "0141b2befc75fafa1bbe9914b34eab374a1204ce34f44af19f2100153805baf8",
975
+ "src/schema.ts": "110d65d59a2ad3bcd3a35de188f68804dcada9c92702630aaf9de029ba77b5a5",
975
976
  "src/search-diagnostics.ts": "cea037618c56f075d51155101ad1cc0314bfa67b174bdb070191e0ea5ea04679",
976
977
  "src/search.ts": "8aaf544fcb27e7e018bd976e1ba7d3c70c047aeda3182b3dce91873a901a245e",
977
- "src/server.ts": "c3256d27248140a1072a924796ba9b7f0edbbe9b5c72bcdeea02a46734aaf5cd",
978
+ "src/server.ts": "bff4c09c29890aa62175ead36d9cfd6f8fa7334d2ee0929b51a0371d38c5df1c",
978
979
  "src/surface.ts": "f7772fbafa613aaeba05e47d2def4975fb0ce75d1af067bde968f0e95775f81a",
979
- "src/transfer.ts": "009dfb72ebd41a5642ec02a48ab7b678bed75e5db8859acc15a45e7f0bd43462",
980
- "src/transport.ts": "08609fcf56ef9b60b867f7f86783c198b622f72e2b02f2562c5f1506ee1dc0bd",
980
+ "src/transfer.ts": "f27d65c0b42f9933e6a7f950f56111b84c644e8739bab44805aebfb54d77e320",
981
+ "src/transport.ts": "35df20b321f52c4a371f1e29923e957e7c85d58001e2864f0fd13c2c2838945f",
981
982
  "src/typebox.ts": "7f071fbc67548c7d3701272dabe88a217812e12e41dfad76974ff08169fa1a7e",
982
- "src/util.ts": "88993ec29376fbaf5c19fd23153b19c35fef99be1a906c59428cf48554c3b8da",
983
- "src/vm-service.ts": "f2a6bfa910484f42aa264dbe02012379c82b093a71645b33e8a8ccd968f4634d"
983
+ "src/util.ts": "88993ec29376fbaf5c19fd23153b19c35fef99be1a906c59428cf48554c3b8da"
984
984
  }
985
985
  }
package/dist/doctor.mjs CHANGED
@@ -45,14 +45,14 @@ async function command(argv, options = {}) {
45
45
  });
46
46
  }
47
47
 
48
- // src/vm-service.ts
48
+ // src/machine-service.ts
49
49
  import { isIP } from "node:net";
50
- var VmServiceError = class extends Error {
50
+ var MachineServiceError = class extends Error {
51
51
  constructor(message, status, responseBody, options) {
52
52
  super(message, options);
53
53
  this.status = status;
54
54
  this.responseBody = responseBody;
55
- this.name = "VmServiceError";
55
+ this.name = "MachineServiceError";
56
56
  }
57
57
  status;
58
58
  responseBody;
@@ -60,7 +60,7 @@ var VmServiceError = class extends Error {
60
60
  capacity = false;
61
61
  };
62
62
  function capacityRefusal(error) {
63
- if (!(error instanceof VmServiceError) || error.status !== 409 || !error.responseBody) return false;
63
+ if (!(error instanceof MachineServiceError) || error.status !== 409 || !error.responseBody) return false;
64
64
  let body;
65
65
  try {
66
66
  body = JSON.parse(error.responseBody);
@@ -71,9 +71,14 @@ function capacityRefusal(error) {
71
71
  const { error: reason, outcome } = body;
72
72
  return typeof reason === "string" && reason.startsWith("macOS VM limit reached") && outcome !== "uncertain";
73
73
  }
74
- var AcquireIndeterminateError = class extends VmServiceError {
74
+ var SERVICE_NAME = "machine-service";
75
+ function expectMachineService(health, origin) {
76
+ if (health.service === SERVICE_NAME) return;
77
+ throw new Error(`The service at ${origin} answers as ${JSON.stringify(health.service ?? null)}, not ${SERVICE_NAME}. This relay speaks only machine-service's /machines API: install machine-service, which replaced vm-service.`);
78
+ }
79
+ var AcquireIndeterminateError = class extends MachineServiceError {
75
80
  constructor(purpose, cause) {
76
- super(`Acquisition outcome unknown for purpose '${purpose}'; reconcile GET /vms before retrying or ending the enclosure`, void 0, void 0, { cause });
81
+ super(`Acquisition outcome unknown for purpose '${purpose}'; reconcile GET /machines before retrying or ending the enclosure`, void 0, void 0, { cause });
77
82
  this.purpose = purpose;
78
83
  this.name = "AcquireIndeterminateError";
79
84
  }
@@ -90,7 +95,7 @@ function isLease(value) {
90
95
  if (!record(value)) return false;
91
96
  return ["vm", "purpose", "image"].every((k) => typeof value[k] === "string" && value[k] !== "") && ["macos", "linux"].includes(String(value.image_kind)) && ["pending", "provisioning", "running", "releasing"].includes(String(value.state)) && ["created_at", "ttl_expires_at"].every((k) => typeof value[k] === "number" && Number.isFinite(value[k])) && ["cpu", "memory_mb", "disk_gb", "grace_until"].every((k) => value[k] === null || typeof value[k] === "number") && ["env", "ip"].every((k) => value[k] === null || typeof value[k] === "string") && typeof value.warned === "boolean";
92
97
  }
93
- var VmService = class {
98
+ var MachineService = class {
94
99
  baseUrl;
95
100
  environment;
96
101
  timeoutMs;
@@ -104,7 +109,7 @@ var VmService = class {
104
109
  const host = url.hostname.replace(/^\[|\]$/g, "");
105
110
  const loopback = host === "localhost" || host === "::1" || isIP(host) === 4 && host.startsWith("127.");
106
111
  if (!loopback || !["http:", "https:"].includes(url.protocol) || url.username || url.password || url.search || url.hash || url.pathname !== "/") {
107
- throw new TypeError("vm-service baseUrl must be a loopback HTTP(S) origin without credentials, path, query or fragment");
112
+ throw new TypeError("machine-service baseUrl must be a loopback HTTP(S) origin without credentials, path, query or fragment");
108
113
  }
109
114
  this.baseUrl = url.origin;
110
115
  this.timeoutMs = positive(options.timeoutMs ?? 66e4, "timeoutMs");
@@ -115,7 +120,7 @@ var VmService = class {
115
120
  return this.request("/health", void 0, options);
116
121
  }
117
122
  list(options = {}) {
118
- return this.request("/vms", void 0, options);
123
+ return this.request("/machines", void 0, options);
119
124
  }
120
125
  images(options = {}) {
121
126
  return this.request("/images", void 0, options);
@@ -139,7 +144,7 @@ var VmService = class {
139
144
  try {
140
145
  return await this.request(path, body, options);
141
146
  } catch (error) {
142
- throw new VmServiceError(`Console API unavailable or request outcome unknown${error instanceof VmServiceError && error.status ? ` (HTTP ${error.status})` : ""}; resolve before another open`, error instanceof VmServiceError ? error.status : void 0);
147
+ throw new MachineServiceError(`Console API unavailable or request outcome unknown${error instanceof MachineServiceError && error.status ? ` (HTTP ${error.status})` : ""}; resolve before another open`, error instanceof MachineServiceError ? error.status : void 0);
143
148
  }
144
149
  }
145
150
  get(vm, options = {}) {
@@ -158,12 +163,12 @@ var VmService = class {
158
163
  const timeoutMs = positive(options.timeoutMs ?? this.acquireTimeoutMs, "timeoutMs");
159
164
  try {
160
165
  const lease = await this.request("/acquire", body, { timeoutMs });
161
- if (!isLease(lease)) throw new VmServiceError("Invalid vm-service acquire response");
166
+ if (!isLease(lease)) throw new MachineServiceError("Invalid machine-service acquire response");
162
167
  return lease;
163
168
  } catch (error) {
164
- const safeError = body.vnc ? new VmServiceError(`VNC acquisition refused or outcome unknown${error instanceof VmServiceError && error.status ? ` (HTTP ${error.status})` : ""}; inspect capabilities and reconcile ownership`, error instanceof VmServiceError ? error.status : void 0) : error;
165
- if (safeError instanceof VmServiceError) safeError.capacity = capacityRefusal(error);
166
- if (error instanceof VmServiceError && error.status !== void 0 && error.status >= 400 && error.status < 500) throw safeError;
169
+ const safeError = body.vnc ? new MachineServiceError(`VNC acquisition refused or outcome unknown${error instanceof MachineServiceError && error.status ? ` (HTTP ${error.status})` : ""}; inspect capabilities and reconcile ownership`, error instanceof MachineServiceError ? error.status : void 0) : error;
170
+ if (safeError instanceof MachineServiceError) safeError.capacity = capacityRefusal(error);
171
+ if (error instanceof MachineServiceError && error.status !== void 0 && error.status >= 400 && error.status < 500) throw safeError;
167
172
  throw new AcquireIndeterminateError(body.purpose, safeError);
168
173
  }
169
174
  }
@@ -184,7 +189,7 @@ var VmService = class {
184
189
  }
185
190
  path(vm, action) {
186
191
  if (!/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(vm)) throw new TypeError("Invalid VM name");
187
- return `/vms/${encodeURIComponent(vm)}${action ? `/${action}` : ""}`;
192
+ return `/machines/${encodeURIComponent(vm)}${action ? `/${action}` : ""}`;
188
193
  }
189
194
  async request(path, body, options) {
190
195
  options.signal?.throwIfAborted();
@@ -192,7 +197,7 @@ var VmService = class {
192
197
  const controller = new AbortController();
193
198
  const abort = () => controller.abort(options.signal?.reason);
194
199
  options.signal?.addEventListener("abort", abort, { once: true });
195
- const timer = setTimeout(() => controller.abort(new VmServiceError(`vm-service ${path} timed out after ${timeoutMs}ms`)), timeoutMs);
200
+ const timer = setTimeout(() => controller.abort(new MachineServiceError(`machine-service ${path} timed out after ${timeoutMs}ms`)), timeoutMs);
196
201
  try {
197
202
  const response = await fetch(`${this.baseUrl}${path}`, {
198
203
  method: body === void 0 ? "GET" : "POST",
@@ -226,17 +231,17 @@ var VmService = class {
226
231
  }
227
232
  }
228
233
  const text = Buffer.concat(chunks).toString("utf8");
229
- if (!response.ok) throw new VmServiceError(`vm-service ${path}: HTTP ${response.status}: ${text}${truncated ? " [truncated]" : ""}`, response.status, text);
230
- if (truncated) throw new VmServiceError(`vm-service ${path}: response exceeds ${bound} bytes`);
234
+ if (!response.ok) throw new MachineServiceError(`machine-service ${path}: HTTP ${response.status}: ${text}${truncated ? " [truncated]" : ""}`, response.status, text);
235
+ if (truncated) throw new MachineServiceError(`machine-service ${path}: response exceeds ${bound} bytes`);
231
236
  try {
232
237
  return JSON.parse(text);
233
238
  } catch (cause) {
234
- throw new VmServiceError(`vm-service ${path}: invalid JSON response`, void 0, void 0, { cause });
239
+ throw new MachineServiceError(`machine-service ${path}: invalid JSON response`, void 0, void 0, { cause });
235
240
  }
236
241
  } catch (cause) {
237
242
  if (controller.signal.aborted) throw controller.signal.reason;
238
- if (cause instanceof VmServiceError) throw cause;
239
- throw new VmServiceError(`vm-service ${path}: request failed`, void 0, void 0, { cause });
243
+ if (cause instanceof MachineServiceError) throw cause;
244
+ throw new MachineServiceError(`machine-service ${path}: request failed`, void 0, void 0, { cause });
240
245
  } finally {
241
246
  clearTimeout(timer);
242
247
  options.signal?.removeEventListener("abort", abort);
@@ -260,8 +265,9 @@ import { createHash as createHash2 } from "node:crypto";
260
265
  import { dirname, isAbsolute, join, relative, resolve } from "node:path";
261
266
  import { homedir } from "node:os";
262
267
  import { isIP as isIP2 } from "node:net";
263
- var paths = ["imageRepository", "tartHome", "serviceStateDir", "imageStateDir", "relayStateDir", "vmctlPath", "tartPath"];
268
+ var paths = ["imageRepository", "tartHome", "serviceStateDir", "imageStateDir", "relayStateDir", "machctlPath", "tartPath"];
264
269
  var mutable = ["tartHome", "serviceStateDir", "imageStateDir", "relayStateDir"];
270
+ var LEGACY_PROFILE = "Environment profile is from before the machine-service rename, which reads only schemaVersion 2 with machctlPath: a profile at schemaVersion 1 or with vmctlPath is refused. Rename vmctlPath to machctlPath, naming the machctl executable, and set schemaVersion to 2.";
265
271
  function canonicalPath(value) {
266
272
  if (typeof value !== "string" || !isAbsolute(value) || !value.trim() || /[\x00-\x1f\x7f\uD800-\uDFFF]/u.test(value)) throw new Error("Environment paths must be absolute and contain no control characters");
267
273
  let ancestor = resolve(value);
@@ -322,19 +328,20 @@ function loadEnvironment(path, env = process.env, home = env.HOME ?? homedir())
322
328
  } else if (text[i] === "{" || text[i] === "[") depth++;
323
329
  else if (text[i] === "}" || text[i] === "]") depth--;
324
330
  }
331
+ if (raw && typeof raw === "object" && !Array.isArray(raw) && (raw.schemaVersion === 1 || Object.hasOwn(raw, "vmctlPath"))) throw new Error(LEGACY_PROFILE);
325
332
  const fields = ["schemaVersion", "id", "vmServiceUrl", ...paths].sort();
326
333
  if (!raw || typeof raw !== "object" || Array.isArray(raw) || JSON.stringify(Object.keys(raw).sort()) !== JSON.stringify(fields)) throw new Error("Environment profile has missing or unknown fields");
327
334
  const p = raw;
328
- if (p.schemaVersion !== 1 || typeof p.id !== "string" || !/^[a-z0-9][a-z0-9-]{0,47}$/.test(p.id)) throw new Error("Invalid environment schemaVersion or id");
329
- const profile = { schemaVersion: 1, id: p.id, vmServiceUrl: endpoint(p.vmServiceUrl) };
335
+ if (p.schemaVersion !== 2 || typeof p.id !== "string" || !/^[a-z0-9][a-z0-9-]{0,47}$/.test(p.id)) throw new Error("Invalid environment schemaVersion or id");
336
+ const profile = { schemaVersion: 2, id: p.id, vmServiceUrl: endpoint(p.vmServiceUrl) };
330
337
  for (const key of paths) profile[key] = canonicalPath(p[key]);
331
338
  if (!statSync(profile.imageRepository).isDirectory() || !statSync(join(profile.imageRepository, "images")).isDirectory()) throw new Error("Selected imageRepository must contain images/");
332
- for (const key of ["vmctlPath", "tartPath"]) {
339
+ for (const key of ["machctlPath", "tartPath"]) {
333
340
  if (!statSync(profile[key]).isFile()) throw new Error(`${key} must be a regular executable file`);
334
341
  accessSync(profile[key], constants.X_OK);
335
342
  }
336
343
  const state = env.XDG_STATE_HOME ? canonicalPath(env.XDG_STATE_HOME) : join(canonicalPath(home), ".local/state");
337
- const names = ["vm-service", "pilot-images", "mcp-relay", "mcp-vm-relay"];
344
+ const names = ["machine-service", "vm-service", "pilot-images", "mcp-relay", "mcp-vm-relay"];
338
345
  const defaults = [join(canonicalPath(home), ".tart"), ...names.map((n) => join(state, n)), ...names.map((n) => join(canonicalPath(home), ".local/state", n))].map(canonicalPath);
339
346
  for (const key of mutable) {
340
347
  const value = profile[key];
@@ -373,13 +380,13 @@ function environmentVariables(selected) {
373
380
  VM_ENVIRONMENT_FINGERPRINT: selected.identity.fingerprint,
374
381
  PILOT_REPO: p.imageRepository,
375
382
  TART_HOME: p.tartHome,
376
- VM_SERVICE_STATE: p.serviceStateDir,
383
+ MACHINE_SERVICE_STATE: p.serviceStateDir,
377
384
  PILOT_IMAGES_STATE_DIR: p.imageStateDir,
378
385
  VM_RELAY_STATE_DIR: p.relayStateDir,
379
386
  VM_RELAY_URL: p.vmServiceUrl,
380
- VM_SERVICE_HOST: url.hostname.replace(/^\[|\]$/g, ""),
381
- VM_SERVICE_PORT: String(Number(p.vmServiceUrl.match(/:([0-9]+)$/)[1])),
382
- VMCTL: p.vmctlPath,
387
+ MACHINE_SERVICE_HOST: url.hostname.replace(/^\[|\]$/g, ""),
388
+ MACHINE_SERVICE_PORT: String(Number(p.vmServiceUrl.match(/:([0-9]+)$/)[1])),
389
+ MACHCTL: p.machctlPath,
383
390
  TART: p.tartPath
384
391
  };
385
392
  }
@@ -744,7 +751,7 @@ async function installationReport(options = {}) {
744
751
  return process.versions.node;
745
752
  });
746
753
  await check("host", async () => {
747
- if (process.platform !== "darwin" || process.arch !== "arm64") throw Error("The supported local Tart/vm-service backend requires an Apple-silicon Mac. Ubuntu is a guest, not a substitute host.");
754
+ if (process.platform !== "darwin" || process.arch !== "arm64") throw Error("The supported local Tart/machine-service backend requires an Apple-silicon Mac. Ubuntu is a guest, not a substitute host.");
748
755
  return `${process.platform}/${process.arch}`;
749
756
  });
750
757
  await check("python", async () => {
@@ -777,15 +784,16 @@ async function installationReport(options = {}) {
777
784
  if (r.code !== 0 || !Array.isArray(JSON.parse(r.stdout))) throw Error("Install Tart and ensure tart list --format json works; required for independent destruction verification.");
778
785
  return "Read-only local inventory available";
779
786
  });
780
- await check("vm-service", async () => {
781
- const vm = options.vm ?? new VmService({ baseUrl: environment?.profile.vmServiceUrl ?? process.env.MCP_RELAY_URL, environment });
787
+ await check("machine-service", async () => {
788
+ const vm = options.vm ?? new MachineService({ baseUrl: environment?.profile.vmServiceUrl ?? process.env.MCP_RELAY_URL, environment });
782
789
  const health = await vm.health({ timeoutMs: 5e3 });
783
790
  if (!health.ok) throw Error("Service health check failed");
784
- if (environment && !matchesEnvironment(health.environment, environment)) throw Error("VM service environment identity mismatch");
791
+ expectMachineService(health, vm.baseUrl);
792
+ if (environment && !matchesEnvironment(health.environment, environment)) throw Error("machine-service environment identity mismatch");
785
793
  const images = await vm.images({ timeoutMs: 5e3 });
786
794
  await vm.list({ timeoutMs: 5e3 });
787
795
  const available = Object.entries(images.images).filter(([, v]) => v.base_available).map(([k]) => k);
788
- if (!available.length) throw Error("vm-service is running but has no available golden images. Provision a supported image in the backend.");
796
+ if (!available.length) throw Error("machine-service is running but has no available golden images. Provision a supported image in the backend.");
789
797
  return `HTTP API reachable; available images: ${available.join(", ")}. This inventory does not prove guest readiness. Use relay probe scope=guest for executable checks; capture and browser behavior require separate checks. Staging alone is not readiness.`;
790
798
  });
791
799
  return { formatVersion: 1, ready: checks.every((c) => c.ok), environment: environment?.identity, stateDirectory: environment?.profile.relayStateDir ?? relayStateRoot(), checks, note: "Read-only host/API prerequisite check. No VM acquired, input sent, screenshot captured or permissions changed. Claude Code (or another MCP client) must be installed separately." };
@@ -1,6 +1,6 @@
1
1
  {
2
- "server.mjs": "94d0e19263eb7202808929768f0e85ecbbad361dec51b91732422d4e75708e33",
2
+ "server.mjs": "59774785e2e9d3e930f7e96fa4b93843a557509137338e76ae9c0a5e93228db1",
3
3
  "receiver.mjs": "8b5b6fdd6cb789cdc4060e367a155cb42e7cf34187044c899789bf76b7bb0e14",
4
- "doctor.mjs": "32bcfbcf318ab72f81be6fa1d2106b7556e7978ed61bf0da0c79bc9f5da360d2",
4
+ "doctor.mjs": "63003135f4ffae0abbf962e46b6ef3840a2f9c83c46aff3b0b294e498a0d7e32",
5
5
  "review-data.mjs": "da7b6b35d060e09cfc445df4febda02a1a0c0f23d9b854866aed8d604cbb3993"
6
6
  }
package/dist/server.mjs CHANGED
@@ -17197,8 +17197,9 @@ import { createHash } from "node:crypto";
17197
17197
  import { dirname, isAbsolute, join, relative, resolve } from "node:path";
17198
17198
  import { homedir } from "node:os";
17199
17199
  import { isIP } from "node:net";
17200
- var paths = ["imageRepository", "tartHome", "serviceStateDir", "imageStateDir", "relayStateDir", "vmctlPath", "tartPath"];
17200
+ var paths = ["imageRepository", "tartHome", "serviceStateDir", "imageStateDir", "relayStateDir", "machctlPath", "tartPath"];
17201
17201
  var mutable = ["tartHome", "serviceStateDir", "imageStateDir", "relayStateDir"];
17202
+ var LEGACY_PROFILE = "Environment profile is from before the machine-service rename, which reads only schemaVersion 2 with machctlPath: a profile at schemaVersion 1 or with vmctlPath is refused. Rename vmctlPath to machctlPath, naming the machctl executable, and set schemaVersion to 2.";
17202
17203
  function canonicalPath(value) {
17203
17204
  if (typeof value !== "string" || !isAbsolute(value) || !value.trim() || /[\x00-\x1f\x7f\uD800-\uDFFF]/u.test(value)) throw new Error("Environment paths must be absolute and contain no control characters");
17204
17205
  let ancestor = resolve(value);
@@ -17259,19 +17260,20 @@ function loadEnvironment(path, env = process.env, home = env.HOME ?? homedir())
17259
17260
  } else if (text4[i] === "{" || text4[i] === "[") depth++;
17260
17261
  else if (text4[i] === "}" || text4[i] === "]") depth--;
17261
17262
  }
17263
+ if (raw && typeof raw === "object" && !Array.isArray(raw) && (raw.schemaVersion === 1 || Object.hasOwn(raw, "vmctlPath"))) throw new Error(LEGACY_PROFILE);
17262
17264
  const fields = ["schemaVersion", "id", "vmServiceUrl", ...paths].sort();
17263
17265
  if (!raw || typeof raw !== "object" || Array.isArray(raw) || JSON.stringify(Object.keys(raw).sort()) !== JSON.stringify(fields)) throw new Error("Environment profile has missing or unknown fields");
17264
17266
  const p = raw;
17265
- if (p.schemaVersion !== 1 || typeof p.id !== "string" || !/^[a-z0-9][a-z0-9-]{0,47}$/.test(p.id)) throw new Error("Invalid environment schemaVersion or id");
17266
- const profile = { schemaVersion: 1, id: p.id, vmServiceUrl: endpoint(p.vmServiceUrl) };
17267
+ if (p.schemaVersion !== 2 || typeof p.id !== "string" || !/^[a-z0-9][a-z0-9-]{0,47}$/.test(p.id)) throw new Error("Invalid environment schemaVersion or id");
17268
+ const profile = { schemaVersion: 2, id: p.id, vmServiceUrl: endpoint(p.vmServiceUrl) };
17267
17269
  for (const key of paths) profile[key] = canonicalPath(p[key]);
17268
17270
  if (!statSync(profile.imageRepository).isDirectory() || !statSync(join(profile.imageRepository, "images")).isDirectory()) throw new Error("Selected imageRepository must contain images/");
17269
- for (const key of ["vmctlPath", "tartPath"]) {
17271
+ for (const key of ["machctlPath", "tartPath"]) {
17270
17272
  if (!statSync(profile[key]).isFile()) throw new Error(`${key} must be a regular executable file`);
17271
17273
  accessSync(profile[key], constants.X_OK);
17272
17274
  }
17273
17275
  const state = env.XDG_STATE_HOME ? canonicalPath(env.XDG_STATE_HOME) : join(canonicalPath(home), ".local/state");
17274
- const names = ["vm-service", "pilot-images", "mcp-relay", "mcp-vm-relay"];
17276
+ const names = ["machine-service", "vm-service", "pilot-images", "mcp-relay", "mcp-vm-relay"];
17275
17277
  const defaults = [join(canonicalPath(home), ".tart"), ...names.map((n) => join(state, n)), ...names.map((n) => join(canonicalPath(home), ".local/state", n))].map(canonicalPath);
17276
17278
  for (const key of mutable) {
17277
17279
  const value = profile[key];
@@ -17310,13 +17312,13 @@ function environmentVariables(selected) {
17310
17312
  VM_ENVIRONMENT_FINGERPRINT: selected.identity.fingerprint,
17311
17313
  PILOT_REPO: p.imageRepository,
17312
17314
  TART_HOME: p.tartHome,
17313
- VM_SERVICE_STATE: p.serviceStateDir,
17315
+ MACHINE_SERVICE_STATE: p.serviceStateDir,
17314
17316
  PILOT_IMAGES_STATE_DIR: p.imageStateDir,
17315
17317
  VM_RELAY_STATE_DIR: p.relayStateDir,
17316
17318
  VM_RELAY_URL: p.vmServiceUrl,
17317
- VM_SERVICE_HOST: url.hostname.replace(/^\[|\]$/g, ""),
17318
- VM_SERVICE_PORT: String(Number(p.vmServiceUrl.match(/:([0-9]+)$/)[1])),
17319
- VMCTL: p.vmctlPath,
17319
+ MACHINE_SERVICE_HOST: url.hostname.replace(/^\[|\]$/g, ""),
17320
+ MACHINE_SERVICE_PORT: String(Number(p.vmServiceUrl.match(/:([0-9]+)$/)[1])),
17321
+ MACHCTL: p.machctlPath,
17320
17322
  TART: p.tartPath
17321
17323
  };
17322
17324
  }
@@ -17744,14 +17746,14 @@ var Session = class {
17744
17746
  // node_modules/@wezzard/relay-driver-host-sdk/dist/src/index.js
17745
17747
  init_evidence_package();
17746
17748
 
17747
- // src/vm-service.ts
17749
+ // src/machine-service.ts
17748
17750
  import { isIP as isIP2 } from "node:net";
17749
- var VmServiceError = class extends Error {
17751
+ var MachineServiceError = class extends Error {
17750
17752
  constructor(message3, status, responseBody, options) {
17751
17753
  super(message3, options);
17752
17754
  this.status = status;
17753
17755
  this.responseBody = responseBody;
17754
- this.name = "VmServiceError";
17756
+ this.name = "MachineServiceError";
17755
17757
  }
17756
17758
  status;
17757
17759
  responseBody;
@@ -17759,7 +17761,7 @@ var VmServiceError = class extends Error {
17759
17761
  capacity = false;
17760
17762
  };
17761
17763
  function capacityRefusal(error2) {
17762
- if (!(error2 instanceof VmServiceError) || error2.status !== 409 || !error2.responseBody) return false;
17764
+ if (!(error2 instanceof MachineServiceError) || error2.status !== 409 || !error2.responseBody) return false;
17763
17765
  let body;
17764
17766
  try {
17765
17767
  body = JSON.parse(error2.responseBody);
@@ -17770,9 +17772,14 @@ function capacityRefusal(error2) {
17770
17772
  const { error: reason2, outcome } = body;
17771
17773
  return typeof reason2 === "string" && reason2.startsWith("macOS VM limit reached") && outcome !== "uncertain";
17772
17774
  }
17773
- var AcquireIndeterminateError = class extends VmServiceError {
17775
+ var SERVICE_NAME = "machine-service";
17776
+ function expectMachineService(health, origin) {
17777
+ if (health.service === SERVICE_NAME) return;
17778
+ throw new Error(`The service at ${origin} answers as ${JSON.stringify(health.service ?? null)}, not ${SERVICE_NAME}. This relay speaks only machine-service's /machines API: install machine-service, which replaced vm-service.`);
17779
+ }
17780
+ var AcquireIndeterminateError = class extends MachineServiceError {
17774
17781
  constructor(purpose, cause) {
17775
- super(`Acquisition outcome unknown for purpose '${purpose}'; reconcile GET /vms before retrying or ending the enclosure`, void 0, void 0, { cause });
17782
+ super(`Acquisition outcome unknown for purpose '${purpose}'; reconcile GET /machines before retrying or ending the enclosure`, void 0, void 0, { cause });
17776
17783
  this.purpose = purpose;
17777
17784
  this.name = "AcquireIndeterminateError";
17778
17785
  }
@@ -17789,7 +17796,7 @@ function isLease(value) {
17789
17796
  if (!record2(value)) return false;
17790
17797
  return ["vm", "purpose", "image"].every((k) => typeof value[k] === "string" && value[k] !== "") && ["macos", "linux"].includes(String(value.image_kind)) && ["pending", "provisioning", "running", "releasing"].includes(String(value.state)) && ["created_at", "ttl_expires_at"].every((k) => typeof value[k] === "number" && Number.isFinite(value[k])) && ["cpu", "memory_mb", "disk_gb", "grace_until"].every((k) => value[k] === null || typeof value[k] === "number") && ["env", "ip"].every((k) => value[k] === null || typeof value[k] === "string") && typeof value.warned === "boolean";
17791
17798
  }
17792
- var VmService = class {
17799
+ var MachineService = class {
17793
17800
  baseUrl;
17794
17801
  environment;
17795
17802
  timeoutMs;
@@ -17803,7 +17810,7 @@ var VmService = class {
17803
17810
  const host = url.hostname.replace(/^\[|\]$/g, "");
17804
17811
  const loopback = host === "localhost" || host === "::1" || isIP2(host) === 4 && host.startsWith("127.");
17805
17812
  if (!loopback || !["http:", "https:"].includes(url.protocol) || url.username || url.password || url.search || url.hash || url.pathname !== "/") {
17806
- throw new TypeError("vm-service baseUrl must be a loopback HTTP(S) origin without credentials, path, query or fragment");
17813
+ throw new TypeError("machine-service baseUrl must be a loopback HTTP(S) origin without credentials, path, query or fragment");
17807
17814
  }
17808
17815
  this.baseUrl = url.origin;
17809
17816
  this.timeoutMs = positive(options.timeoutMs ?? 66e4, "timeoutMs");
@@ -17814,7 +17821,7 @@ var VmService = class {
17814
17821
  return this.request("/health", void 0, options);
17815
17822
  }
17816
17823
  list(options = {}) {
17817
- return this.request("/vms", void 0, options);
17824
+ return this.request("/machines", void 0, options);
17818
17825
  }
17819
17826
  images(options = {}) {
17820
17827
  return this.request("/images", void 0, options);
@@ -17838,7 +17845,7 @@ var VmService = class {
17838
17845
  try {
17839
17846
  return await this.request(path, body, options);
17840
17847
  } catch (error2) {
17841
- throw new VmServiceError(`Console API unavailable or request outcome unknown${error2 instanceof VmServiceError && error2.status ? ` (HTTP ${error2.status})` : ""}; resolve before another open`, error2 instanceof VmServiceError ? error2.status : void 0);
17848
+ throw new MachineServiceError(`Console API unavailable or request outcome unknown${error2 instanceof MachineServiceError && error2.status ? ` (HTTP ${error2.status})` : ""}; resolve before another open`, error2 instanceof MachineServiceError ? error2.status : void 0);
17842
17849
  }
17843
17850
  }
17844
17851
  get(vm, options = {}) {
@@ -17857,12 +17864,12 @@ var VmService = class {
17857
17864
  const timeoutMs2 = positive(options.timeoutMs ?? this.acquireTimeoutMs, "timeoutMs");
17858
17865
  try {
17859
17866
  const lease = await this.request("/acquire", body, { timeoutMs: timeoutMs2 });
17860
- if (!isLease(lease)) throw new VmServiceError("Invalid vm-service acquire response");
17867
+ if (!isLease(lease)) throw new MachineServiceError("Invalid machine-service acquire response");
17861
17868
  return lease;
17862
17869
  } catch (error2) {
17863
- const safeError = body.vnc ? new VmServiceError(`VNC acquisition refused or outcome unknown${error2 instanceof VmServiceError && error2.status ? ` (HTTP ${error2.status})` : ""}; inspect capabilities and reconcile ownership`, error2 instanceof VmServiceError ? error2.status : void 0) : error2;
17864
- if (safeError instanceof VmServiceError) safeError.capacity = capacityRefusal(error2);
17865
- if (error2 instanceof VmServiceError && error2.status !== void 0 && error2.status >= 400 && error2.status < 500) throw safeError;
17870
+ const safeError = body.vnc ? new MachineServiceError(`VNC acquisition refused or outcome unknown${error2 instanceof MachineServiceError && error2.status ? ` (HTTP ${error2.status})` : ""}; inspect capabilities and reconcile ownership`, error2 instanceof MachineServiceError ? error2.status : void 0) : error2;
17871
+ if (safeError instanceof MachineServiceError) safeError.capacity = capacityRefusal(error2);
17872
+ if (error2 instanceof MachineServiceError && error2.status !== void 0 && error2.status >= 400 && error2.status < 500) throw safeError;
17866
17873
  throw new AcquireIndeterminateError(body.purpose, safeError);
17867
17874
  }
17868
17875
  }
@@ -17883,7 +17890,7 @@ var VmService = class {
17883
17890
  }
17884
17891
  path(vm, action) {
17885
17892
  if (!/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(vm)) throw new TypeError("Invalid VM name");
17886
- return `/vms/${encodeURIComponent(vm)}${action ? `/${action}` : ""}`;
17893
+ return `/machines/${encodeURIComponent(vm)}${action ? `/${action}` : ""}`;
17887
17894
  }
17888
17895
  async request(path, body, options) {
17889
17896
  options.signal?.throwIfAborted();
@@ -17891,7 +17898,7 @@ var VmService = class {
17891
17898
  const controller = new AbortController();
17892
17899
  const abort = () => controller.abort(options.signal?.reason);
17893
17900
  options.signal?.addEventListener("abort", abort, { once: true });
17894
- const timer = setTimeout(() => controller.abort(new VmServiceError(`vm-service ${path} timed out after ${timeoutMs2}ms`)), timeoutMs2);
17901
+ const timer = setTimeout(() => controller.abort(new MachineServiceError(`machine-service ${path} timed out after ${timeoutMs2}ms`)), timeoutMs2);
17895
17902
  try {
17896
17903
  const response = await fetch(`${this.baseUrl}${path}`, {
17897
17904
  method: body === void 0 ? "GET" : "POST",
@@ -17925,17 +17932,17 @@ var VmService = class {
17925
17932
  }
17926
17933
  }
17927
17934
  const text4 = Buffer.concat(chunks).toString("utf8");
17928
- if (!response.ok) throw new VmServiceError(`vm-service ${path}: HTTP ${response.status}: ${text4}${truncated ? " [truncated]" : ""}`, response.status, text4);
17929
- if (truncated) throw new VmServiceError(`vm-service ${path}: response exceeds ${bound} bytes`);
17935
+ if (!response.ok) throw new MachineServiceError(`machine-service ${path}: HTTP ${response.status}: ${text4}${truncated ? " [truncated]" : ""}`, response.status, text4);
17936
+ if (truncated) throw new MachineServiceError(`machine-service ${path}: response exceeds ${bound} bytes`);
17930
17937
  try {
17931
17938
  return JSON.parse(text4);
17932
17939
  } catch (cause) {
17933
- throw new VmServiceError(`vm-service ${path}: invalid JSON response`, void 0, void 0, { cause });
17940
+ throw new MachineServiceError(`machine-service ${path}: invalid JSON response`, void 0, void 0, { cause });
17934
17941
  }
17935
17942
  } catch (cause) {
17936
17943
  if (controller.signal.aborted) throw controller.signal.reason;
17937
- if (cause instanceof VmServiceError) throw cause;
17938
- throw new VmServiceError(`vm-service ${path}: request failed`, void 0, void 0, { cause });
17944
+ if (cause instanceof MachineServiceError) throw cause;
17945
+ throw new MachineServiceError(`machine-service ${path}: request failed`, void 0, void 0, { cause });
17939
17946
  } finally {
17940
17947
  clearTimeout(timer);
17941
17948
  options.signal?.removeEventListener("abort", abort);
@@ -28770,7 +28777,7 @@ var RelayManager = class {
28770
28777
  this.capacityWaitMs = options.capacityWaitMs ?? capacityWait() * 1e3;
28771
28778
  this.capacityRetryMs = options.capacityRetryMs ?? CAPACITY_RETRY_MS;
28772
28779
  if (!Number.isFinite(this.capacityWaitMs) || this.capacityWaitMs < 0 || !Number.isFinite(this.capacityRetryMs) || this.capacityRetryMs <= 0) throw new Error("capacityWaitMs must be nonnegative and capacityRetryMs positive");
28773
- this.vm = options.vm ?? new VmService({ baseUrl: this.environment?.profile.vmServiceUrl ?? process.env.MCP_RELAY_URL, environment: this.environment });
28780
+ this.vm = options.vm ?? new MachineService({ baseUrl: this.environment?.profile.vmServiceUrl ?? process.env.MCP_RELAY_URL, environment: this.environment });
28774
28781
  this.registry = options.registry ?? new Registry(this.environment ? { managedRoot: this.environment.profile.relayStateDir } : {});
28775
28782
  this.root = join13(this.environment?.profile.relayStateDir ?? options.stateRoot ?? relayStateRoot(), hash(options.sessionId).slice(0, 32));
28776
28783
  this.channel = {
@@ -28940,7 +28947,8 @@ var RelayManager = class {
28940
28947
  if (!this.environment) return;
28941
28948
  if (new URL(this.vm.baseUrl).origin !== new URL(this.environment.profile.vmServiceUrl).origin) throw new Error("Injected backend endpoint does not match selected environment");
28942
28949
  const health = await this.vm.health({ timeoutMs: 5e3 });
28943
- if (!health.ok || !matchesEnvironment(health.environment, this.environment)) throw new Error("VM service environment identity mismatch; no lease operation was performed");
28950
+ expectMachineService(health, this.vm.baseUrl);
28951
+ if (!health.ok || !matchesEnvironment(health.environment, this.environment)) throw new Error("machine-service environment identity mismatch; no lease operation was performed");
28944
28952
  }
28945
28953
  async unlock() {
28946
28954
  if (this.ownerLock) {
@@ -28999,7 +29007,7 @@ var RelayManager = class {
28999
29007
  async readAcquisitionCapabilities(signal) {
29000
29008
  signal?.throwIfAborted();
29001
29009
  await this.assertBackend();
29002
- if (!this.vm.acquisitionCapabilities) throw new Error("Backend lacks acquisition-capabilities; upgrade vm-service for VNC");
29010
+ if (!this.vm.acquisitionCapabilities) throw new Error("Backend lacks acquisition-capabilities; upgrade machine-service for VNC");
29003
29011
  return acquisitionCapabilities(await this.vm.acquisitionCapabilities({ signal, timeoutMs: 1e4 }));
29004
29012
  }
29005
29013
  acquisitionCapabilities(signal) {
@@ -29298,7 +29306,7 @@ var Guest = class {
29298
29306
  await this.m.assertBackend();
29299
29307
  e.backend ??= this.m.binding();
29300
29308
  if (!e.lease) {
29301
- const matches = Object.values((await this.m.vm.list({ timeoutMs: 1e4 })).vms).filter((v) => v.purpose === e.purpose);
29309
+ const matches = Object.values((await this.m.vm.list({ timeoutMs: 1e4 })).machines).filter((v) => v.purpose === e.purpose);
29302
29310
  if (matches.length !== 1) throw new Error(`Cannot reconcile acquisition for ${e.purpose}; ownership retained, never automatically reacquire`);
29303
29311
  e.lease = matches[0];
29304
29312
  e.acquisitionInFlight = false;
@@ -29321,7 +29329,7 @@ var Guest = class {
29321
29329
  await this.save();
29322
29330
  } catch (error2) {
29323
29331
  e.guestState = "unknown";
29324
- if (error2 instanceof VmServiceError && error2.status === 404 && await this.destroyed(e.lease.vm)) {
29332
+ if (error2 instanceof MachineServiceError && error2.status === 404 && await this.destroyed(e.lease.vm)) {
29325
29333
  await this.m.registry.remove(e.row);
29326
29334
  await jsonFile(`${e.hostRoot}.lifecycle.json`, { purpose: e.purpose, vm: e.lease.vm, released: true, reason: "backend lease absent and destruction verified", finishedAt: (/* @__PURE__ */ new Date()).toISOString() });
29327
29335
  this.enclosure = void 0;
@@ -29385,7 +29393,7 @@ var Guest = class {
29385
29393
  }
29386
29394
  async resolveConsole(signal) {
29387
29395
  const e = await this.consoleOwner(signal);
29388
- if (!this.m.vm.consoleResolve) throw new Error("Backend lacks console API; upgrade vm-service");
29396
+ if (!this.m.vm.consoleResolve) throw new Error("Backend lacks console API; upgrade machine-service");
29389
29397
  let observation;
29390
29398
  try {
29391
29399
  observation = consoleStatus(await this.m.vm.consoleResolve(e.lease.vm, { lease_id: e.lease.lease_id }, { signal, timeoutMs: 1e4 }));
@@ -29412,7 +29420,7 @@ var Guest = class {
29412
29420
  if (!e.lease.console?.console_id) throw new Error("This lease has no acquired console; automatic VNC retrofit is forbidden");
29413
29421
  if (resolved.console_id !== input.console_id) throw new Error("Console instance identity mismatch");
29414
29422
  const method = operation === "open" ? this.m.vm.consoleOpen : this.m.vm.consoleCancel;
29415
- if (!method) throw new Error("Backend lacks console API; upgrade vm-service");
29423
+ if (!method) throw new Error("Backend lacks console API; upgrade machine-service");
29416
29424
  if (operation === "open") {
29417
29425
  if (resolved.viewer_location !== "service-host") throw new Error("Only a viewer on the declared service host is supported; no remote-client viewer fallback");
29418
29426
  if (e.lease.state !== "running" || !Number.isFinite(e.lease.ttl_expires_at) || e.lease.ttl_expires_at <= Date.now() / 1e3) throw new Error("Console lease is not running or has expired");
@@ -29460,8 +29468,8 @@ var Guest = class {
29460
29468
  }
29461
29469
  /**
29462
29470
  * The acquisition, in this guest's own order. Its ownership intent is
29463
- * persisted and registered before vm-service is asked. A refusal before
29464
- * that, or vm-service's own refusal, leaves the session without the guest;
29471
+ * persisted and registered before machine-service is asked. A refusal before
29472
+ * that, or machine-service's own refusal, leaves the session without the guest;
29465
29473
  * any other failure keeps the guest's record for reconciliation.
29466
29474
  */
29467
29475
  async acquire(input, network, signal) {
@@ -29484,7 +29492,7 @@ var Guest = class {
29484
29492
  const stamp = startedAt.slice(0, 19).replace(/[T:]/g, "-") + "-Z";
29485
29493
  const project = this.m.options.project, environment = this.m.environment;
29486
29494
  const hostRoot = join13(this.m.options.outputRoot ?? resolve9(project, "relay-evidence"), purpose);
29487
- const row = { machine: environment ? `${environment.profile.vmServiceUrl} (${environment.profile.id}; ${purpose})` : `127.0.0.1 (vm-service ${purpose})`, os: input.image, taskName: purpose, agent: `mcp-relay ${this.m.options.sessionId}`, project: resolve9(project), startDate: stamp };
29495
+ const row = { machine: environment ? `${environment.profile.vmServiceUrl} (${environment.profile.id}; ${purpose})` : `127.0.0.1 (machine-service ${purpose})`, os: input.image, taskName: purpose, agent: `mcp-relay ${this.m.options.sessionId}`, project: resolve9(project), startDate: stamp };
29488
29496
  const e = this.enclosure = { backend: this.m.binding(), purpose, task: input.task, image: input.image, project, startedAt, guestRoot: `/var/tmp/${stamp}-mcp-relay-${purpose}`, hostRoot, ttlHours, extractions: input.extractions, fullWorkspace: input.fullWorkspace ?? false, row, staged: false };
29489
29497
  let refused = false;
29490
29498
  try {
@@ -29514,11 +29522,11 @@ var Guest = class {
29514
29522
  break;
29515
29523
  } catch (error2) {
29516
29524
  if (signal?.aborted && error2 === signal.reason) e.acquisitionInFlight = false;
29517
- else if (error2 instanceof VmServiceError && error2.status !== void 0 && error2.status >= 400 && error2.status < 500) {
29525
+ else if (error2 instanceof MachineServiceError && error2.status !== void 0 && error2.status >= 400 && error2.status < 500) {
29518
29526
  e.acquisitionInFlight = false;
29519
29527
  refused = true;
29520
29528
  }
29521
- if (!refused || !(error2 instanceof VmServiceError && error2.capacity) || this.m.capacityWaitMs <= 0) throw error2;
29529
+ if (!refused || !(error2 instanceof MachineServiceError && error2.capacity) || this.m.capacityWaitMs <= 0) throw error2;
29522
29530
  firstRefusal ??= asked;
29523
29531
  await this.waitForCapacity(e, error2, firstRefusal, signal);
29524
29532
  refused = false;
@@ -29552,7 +29560,7 @@ Guest ${this.name} keeps this acquisition's ownership record: name it to reconci
29552
29560
  /**
29553
29561
  * The host is at capacity: wait one retry interval, or what is left of
29554
29562
  * MCP_RELAY_CAPACITY_WAIT, before the acquisition is asked again. Refuses
29555
- * with vm-service's reason and the time waited once the wait has run out,
29563
+ * with machine-service's reason and the time waited once the wait has run out,
29556
29564
  * or when the call is cancelled or the session ends (DC-22).
29557
29565
  */
29558
29566
  async waitForCapacity(e, refusal, since, signal) {
@@ -29578,16 +29586,16 @@ Guest ${this.name} keeps this acquisition's ownership record: name it to reconci
29578
29586
  if (stop.aborted) throw new Error(`${signal?.aborted ? String(signal.reason) : "The relay session ended"} while the acquisition waited ${seconds(Date.now() - since)} s for capacity (${refusal.message}), so nothing was acquired`, { cause: refusal });
29579
29587
  }
29580
29588
  /**
29581
- * A refused acquisition acquired nothing: once vm-service lists no VM for
29589
+ * A refused acquisition acquired nothing: once machine-service lists no VM for
29582
29590
  * its purpose, its registry row goes and the guest leaves the session.
29583
29591
  * False when that cannot be established, so the record stays.
29584
29592
  */
29585
29593
  async withdraw(error2) {
29586
29594
  const e = this.enclosure;
29587
29595
  try {
29588
- if (Object.values((await this.m.vm.list({ timeoutMs: 1e4 })).vms).some((lease) => lease.purpose === e.purpose)) return false;
29596
+ if (Object.values((await this.m.vm.list({ timeoutMs: 1e4 })).machines).some((lease) => lease.purpose === e.purpose)) return false;
29589
29597
  await this.m.registry.remove(e.row);
29590
- await jsonFile(`${e.hostRoot}.lifecycle.json`, { purpose: e.purpose, released: false, acquired: false, reason: "vm-service refused the acquisition", error: String(error2), finishedAt: (/* @__PURE__ */ new Date()).toISOString() });
29598
+ await jsonFile(`${e.hostRoot}.lifecycle.json`, { purpose: e.purpose, released: false, acquired: false, reason: "machine-service refused the acquisition", error: String(error2), finishedAt: (/* @__PURE__ */ new Date()).toISOString() });
29591
29599
  this.enclosure = void 0;
29592
29600
  await this.save();
29593
29601
  await this.m.forget(this);
@@ -29722,7 +29730,7 @@ VM state: ${JSON.stringify(this.status())}`, { cause: error2 });
29722
29730
  this.transport = new VmTransport(transfer, e.guestRoot, join13(e.hostRoot, "host"), e.cuaDriver);
29723
29731
  this.transport.capture = e.capture !== false;
29724
29732
  relay.useTransport(() => this.transport);
29725
- this.session = await relay.start({ taskId: e.purpose, target: `vm-service:${e.lease.vm}` });
29733
+ this.session = await relay.start({ taskId: e.purpose, target: `machine-service:${e.lease.vm}` });
29726
29734
  e.sessionId = this.session.sessionId;
29727
29735
  e.staged = true;
29728
29736
  await this.save();
@@ -29784,7 +29792,7 @@ VM state: ${JSON.stringify(this.status())}`, { cause: error2 });
29784
29792
  const e = this.current();
29785
29793
  const timeoutMs2 = input.timeoutMs ?? 12e4;
29786
29794
  if (!Number.isSafeInteger(timeoutMs2) || timeoutMs2 < 1 || timeoutMs2 > 36e5) throw new Error("timeoutMs must be an integer from 1 to 3600000");
29787
- if (input.diagnostic && input.language !== "shell") throw new Error("Only a shell script may be diagnostic, because a diagnostic run goes through vm-service without the receiver");
29795
+ if (input.diagnostic && input.language !== "shell") throw new Error("Only a shell script may be diagnostic, because a diagnostic run goes through machine-service without the receiver");
29788
29796
  if (e.delivered) throw new Error("Evidence already sealed; release this VM explicitly");
29789
29797
  if (input.diagnostic) return this.diagnostic(input, timeoutMs2, signal);
29790
29798
  if (e.pendingReset) throw new Error("Recording reset is pending; retry stage to reconcile it, or use a shell relay_script with diagnostic: true");
@@ -29859,7 +29867,7 @@ VM state: ${JSON.stringify(this.status())}`, { cause: error2 });
29859
29867
  const lease = await this.m.vm.get(e.lease.vm, options);
29860
29868
  if (lease.purpose !== e.purpose) throw Object.assign(new Error("Lease ownership identity changed."), { code: "unauthorized-reference" });
29861
29869
  } catch (error2) {
29862
- if (error2 instanceof VmServiceError && error2.status === 404) throw Object.assign(new Error("Saved image guest is no longer available."), { code: "stale-reference" });
29870
+ if (error2 instanceof MachineServiceError && error2.status === 404) throw Object.assign(new Error("Saved image guest is no longer available."), { code: "stale-reference" });
29863
29871
  throw error2;
29864
29872
  }
29865
29873
  }
@@ -30247,7 +30255,7 @@ VM state: ${JSON.stringify(this.status())}`, { cause: error2 });
30247
30255
  if (!e.released) {
30248
30256
  if (!e.lease) {
30249
30257
  const list = await this.m.vm.list({ timeoutMs: 1e4 });
30250
- const matches = Object.values(list.vms).filter((lease) => lease.purpose === e.purpose);
30258
+ const matches = Object.values(list.machines).filter((lease) => lease.purpose === e.purpose);
30251
30259
  if (matches.length > 1) throw new Error("Ambiguous acquisition; refusing to remove ownership record");
30252
30260
  if (!matches.length && e.acquisitionInFlight) throw new Error(`Acquire outcome still indeterminate for ${e.purpose}; ownership record retained at ${this.dir}. Reconcile before retrying; never blindly acquire again.`);
30253
30261
  e.lease = matches[0];
@@ -30259,7 +30267,7 @@ VM state: ${JSON.stringify(this.status())}`, { cause: error2 });
30259
30267
  for (let attempt = 0; attempt < attempts; attempt++) {
30260
30268
  try {
30261
30269
  const response = await this.m.vm.release(e.lease.vm, { reason: reason2 }, { timeoutMs: timeoutMs2 });
30262
- if (!response.released) throw new Error("vm-service did not confirm destruction");
30270
+ if (!response.released) throw new Error("machine-service did not confirm destruction");
30263
30271
  released = true;
30264
30272
  break;
30265
30273
  } catch (error2) {
@@ -30268,7 +30276,7 @@ VM state: ${JSON.stringify(this.status())}`, { cause: error2 });
30268
30276
  try {
30269
30277
  await this.m.vm.get(e.lease.vm, { timeoutMs: 5e3 });
30270
30278
  } catch (getError) {
30271
- if (getError instanceof VmServiceError && getError.status === 404) {
30279
+ if (getError instanceof MachineServiceError && getError.status === 404) {
30272
30280
  released = true;
30273
30281
  break;
30274
30282
  }
@@ -30277,7 +30285,7 @@ VM state: ${JSON.stringify(this.status())}`, { cause: error2 });
30277
30285
  }
30278
30286
  }
30279
30287
  if (!released) throw new Error("Lease release unconfirmed");
30280
- if (!await this.destroyed(e.lease.vm)) throw new Error(`vm-service relinquished ${e.lease.vm}, but Tart still lists it. Destruction is unverified; ownership retained. See docs/verification.md dependency limitation.`);
30288
+ if (!await this.destroyed(e.lease.vm)) throw new Error(`machine-service relinquished ${e.lease.vm}, but Tart still lists it. Destruction is unverified; ownership retained. See docs/verification.md dependency limitation.`);
30281
30289
  }
30282
30290
  e.released = true;
30283
30291
  await this.save().catch(() => {
@@ -30425,7 +30433,7 @@ function validateRelayInput(value) {
30425
30433
  if (!Check2(relayContract, value)) throw new Error("Invalid relay input: action is required; a call that acts on a guest names it with guest, the name relay_acquire answered; console-open requires nonblank reason. Supply only the fields for the selected action.");
30426
30434
  if (value.action === "probe" && value.scope === "guest" && value.guest === void 0) throw new Error('Invalid relay input: relay_probe with scope "guest" names the guest to probe with guest, the name relay_acquire answered.');
30427
30435
  if (value.action === "run") {
30428
- if (value.diagnostic && value.language !== "shell") throw new Error("Invalid relay input: only a shell script may be diagnostic, because a diagnostic run goes through vm-service without the receiver.");
30436
+ if (value.diagnostic && value.language !== "shell") throw new Error("Invalid relay input: only a shell script may be diagnostic, because a diagnostic run goes through machine-service without the receiver.");
30429
30437
  if (value.diagnostic && value.snapshots?.group) throw new Error("Diagnostic scripts cannot join snapshot groups.");
30430
30438
  const given = value.inline ? value.code : value.localPath, other = value.inline ? value.localPath : value.code;
30431
30439
  if (given === void 0 || other !== void 0) throw new Error(value.inline ? "Invalid relay input: relay_script with inline: true takes the script as code, and no localPath." : "Invalid relay input: relay_script with inline: false takes the script file as localPath, and no code.");
@@ -30628,7 +30636,7 @@ async function relayCall(host, raw, options = {}) {
30628
30636
 
30629
30637
  // src/server.ts
30630
30638
  var SERVER_NAME = "relay";
30631
- var SERVER_VERSION = true ? "0.15.0" : JSON.parse(readFileSync(fileURLToPath(new URL("../package.json", import.meta.url)), "utf8")).version;
30639
+ var SERVER_VERSION = true ? "0.16.0" : JSON.parse(readFileSync(fileURLToPath(new URL("../package.json", import.meta.url)), "utf8")).version;
30632
30640
  var STATUS_TOOL = "relay_status";
30633
30641
  var PLUGIN_TOOL_PREFIX = "mcp__plugin_mcp-relay_relay__";
30634
30642
  var message2 = (error2) => error2 instanceof Error ? error2.message : String(error2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wezzard/mcp-relay",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "type": "module",
5
5
  "description": "MCP server and Claude Code plugin. Runs an agent's code on fresh, isolated VMs, several at once, each run recorded with evidence",
6
6
  "license": "MIT",
package/pi-mcp.json CHANGED
@@ -1 +1 @@
1
- {"mcpServers":{"relay":{"command":"npx","args":["-y","@wezzard/mcp-relay@0.15.0"],"lifecycle":"lazy-keep-alive","requestTimeoutMs":3900000,"directTools":true,"toolPrefix":"none"}}}
1
+ {"mcpServers":{"relay":{"command":"npx","args":["-y","@wezzard/mcp-relay@0.16.0"],"lifecycle":"lazy-keep-alive","requestTimeoutMs":3900000,"directTools":true,"toolPrefix":"none"}}}