@multiplayer-app/sandbox 7.0.0 → 7.0.1

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.
package/README.md CHANGED
@@ -21,10 +21,12 @@ for the public worker endpoint. Create one with the control plane's
21
21
  defaults to the machine hostname; set it explicitly when multiple workers could
22
22
  report the same hostname.
23
23
  `SANDBOX_URL` is optional and defaults to
24
- `https://api.sandbox.filingramp.com/v0`; set it explicitly for local or
25
- self-hosted control planes. Its pathname selects the API base: `/v0` uses the
26
- public authenticated worker endpoint, while `/internal/v0` uses the private
27
- tokenless endpoint.
24
+ `https://api.sandbox.filingramp.com/v0/gapi`; set it explicitly for local or
25
+ self-hosted control planes. Its pathname is the sole source of the worker
26
+ socket path `/workers/ws` is appended to it verbatim, so the full base
27
+ (including the `/gapi` segment) must be included: `/v0/gapi` selects the
28
+ public authenticated worker endpoint, while `/internal/v0/gapi` selects the
29
+ private tokenless endpoint.
28
30
 
29
31
  The sandbox worker exposes probes on `SANDBOX_HEALTH_PORT` (default `3000`)
30
32
  under `API_PREFIX` (default `/v0/api`): `GET /v0/api/healthz` is its
@@ -42,23 +44,24 @@ WORKER_TOKEN=<token> sandbox start
42
44
 
43
45
  For a trusted deployment on the same Kubernetes cluster or private Docker
44
46
  Compose network, leave `WORKER_TOKEN` unset and set
45
- `SANDBOX_URL=http://builder-api-service:3000/internal/v0`. This resolves to
46
- `/internal/v0/sapi/workers/ws`, which does not require a token and must not be
47
- exposed by the public ingress. A client URL such as
48
- `https://api.sandbox.filingramp.com/v0` resolves to `/v0/sapi/workers/ws`, which
49
- requires a valid, user-created API key as `WORKER_TOKEN`.
47
+ `SANDBOX_URL=http://builder-gateway-service:3000/internal/v0/gapi`. This
48
+ resolves to `/internal/v0/gapi/workers/ws`, which does not require a token and
49
+ must not be exposed by the public ingress. A client URL such as
50
+ `https://api.sandbox.filingramp.com/v0/gapi` resolves to
51
+ `/v0/gapi/workers/ws`, which requires a valid, user-created API key as
52
+ `WORKER_TOKEN`.
50
53
 
51
54
  The published runtime bundles the repository's internal `builder-types` and
52
55
  `logger` libraries, so installing the CLI does not require those workspace
53
56
  packages to be published separately.
54
57
 
55
58
  The worker ID defaults to the hostname and the control-plane URL defaults to
56
- `https://api.sandbox.filingramp.com/v0`. Both can be overridden with environment
59
+ `https://api.sandbox.filingramp.com/v0/gapi`. Both can be overridden with environment
57
60
  variables or flags:
58
61
 
59
62
  ```sh
60
63
  sandbox start --token <token> --worker-id worker-eu-01 \
61
- --sandbox-url http://localhost:3011/v0 --max-vms 5
64
+ --sandbox-url http://localhost:3011/v0/gapi --max-vms 5
62
65
  ```
63
66
 
64
67
  ## Run as a Docker container
package/dist/cli.js CHANGED
@@ -28,7 +28,7 @@ var import_config5 = require("dotenv/config");
28
28
  var import_commander = require("commander");
29
29
 
30
30
  // package.json
31
- var version = "7.0.0";
31
+ var version = "7.0.1";
32
32
 
33
33
  // src/config.ts
34
34
  var import_os2 = __toESM(require("os"));
@@ -207,22 +207,23 @@ function parseArnList(raw) {
207
207
  const arns = raw.split(",").map((s) => s.trim()).filter(Boolean);
208
208
  return arns.length ? arns : void 0;
209
209
  }
210
- function resolveSandboxEndpoint(rawUrl, explicitSocketPath) {
210
+ function resolveSandboxEndpoint(rawUrl) {
211
211
  const url = new URL(rawUrl);
212
- const basePath = url.pathname.replace(/\/+$/, "") || "/v0";
212
+ const basePath = url.pathname.replace(/\/+$/, "");
213
213
  return {
214
214
  // Socket.IO treats a URL pathname as a namespace, so connect to the origin
215
- // and pass the derived HTTP transport path separately.
215
+ // and pass the derived HTTP transport path separately. SANDBOX_URL's pathname is the
216
+ // sole source of truth for the socket path — it must include whatever base the control
217
+ // plane expects (e.g. "/v0/gapi" or "/internal/v0/gapi"), and "/workers/ws" is appended.
216
218
  sandboxUrl: url.origin,
217
- workerSocketPath: explicitSocketPath ?? `${basePath}/sapi/workers/ws`
219
+ workerSocketPath: `${basePath}/workers/ws`
218
220
  };
219
221
  }
220
222
  function loadWorkerConfigFromEnv(env = process.env) {
221
223
  const workerId = env.WORKER_ID?.trim() || import_os2.default.hostname();
222
224
  const token = env.WORKER_TOKEN?.trim() || void 0;
223
225
  const sandboxEndpoint = resolveSandboxEndpoint(
224
- env.SANDBOX_URL ?? "https://api.sandbox.filingramp.com/v0",
225
- env.WORKER_SOCKET_PATH
226
+ env.SANDBOX_URL ?? "https://api.sandbox.filingramp.com/v0/gapi"
226
227
  );
227
228
  return {
228
229
  workerId,