runcloud 0.2.239 → 0.2.241

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.
@@ -76,7 +76,7 @@ export async function pollImageRegistration(api, ref, opts = {}) {
76
76
  for (;;) {
77
77
  const data = await api.get('/run-cloud/images');
78
78
  const items = (data?.items ?? []);
79
- const row = items.find((item) => item.ref === ref || item.name === ref);
79
+ const row = items.find((item) => (opts.id ? item.id === opts.id : item.name === ref));
80
80
  if (row)
81
81
  opts.onState?.(row.state);
82
82
  if (row && TERMINAL_STATES.has(row.state))
@@ -107,6 +107,7 @@ export function registerImage(program) {
107
107
  const status = opts.json ? undefined : new StatusLine();
108
108
  status?.update(`Building ${opts.ref}`);
109
109
  const finalRow = await pollImageRegistration(api, opts.ref, {
110
+ id: typeof created?.id === 'string' ? created.id : undefined,
110
111
  timeoutMs: opts.timeout * 1000,
111
112
  onState: (state) => status?.update(state === 'building' ? `Building ${opts.ref}` : `${opts.ref} is ${state}`),
112
113
  });
@@ -157,6 +157,18 @@ function parseMemoryLimitMb(value) {
157
157
  }
158
158
  return n;
159
159
  }
160
+ function parseCpuLimitCores(value) {
161
+ const n = Number(value);
162
+ if (!Number.isFinite(n) || n <= 0 || n > 32) {
163
+ throw new InvalidArgumentError('--cpu-limit must be a number of cores above 0 and at most 32, e.g. 2');
164
+ }
165
+ return n;
166
+ }
167
+ function assertCpuLimit(cpuLimit, cpu) {
168
+ if (cpuLimit !== undefined && cpu !== undefined && cpuLimit < cpu) {
169
+ throw new Error(`--cpu-limit (${cpuLimit}) must not be below --cpu (${cpu})`);
170
+ }
171
+ }
160
172
  function assertMemoryLimit(memoryLimit, memory) {
161
173
  if (memoryLimit !== undefined && memory !== undefined && memoryLimit < memory) {
162
174
  throw new Error(`--memory-limit (${memoryLimit} MiB) must not be below --memory (${memory} MiB)`);
@@ -387,6 +399,7 @@ export function registerSandbox(program) {
387
399
  .option('--name <name>', 'human-readable name; with --expose, the hostname prefix <name>-box.run.cloud')
388
400
  .option('--org <id>', 'billing and ownership organization')
389
401
  .option('--cpu <cores>', 'fractional vCPU allocation, e.g. 0.5', parseCpuCores)
402
+ .option('--cpu-limit <cores>', 'CPU the sandbox may burst to above --cpu when its host has room; CPU above --cpu is billed as burst', parseCpuLimitCores)
390
403
  .option('--memory <mb>', 'memory allocation in MiB', parseMemoryMb)
391
404
  .option('--memory-limit <mb>', 'memory the sandbox may use above --memory when its host has room, in MiB; memory above --memory is billed as used', parseMemoryLimitMb)
392
405
  .option('--disk <gb>', 'root disk capacity in GiB', parseDiskGb)
@@ -428,6 +441,9 @@ export function registerSandbox(program) {
428
441
  assertMemoryLimit(opts.memoryLimit, memory);
429
442
  if (opts.memoryLimit !== undefined)
430
443
  body.memoryLimit = opts.memoryLimit;
444
+ assertCpuLimit(opts.cpuLimit, cpu);
445
+ if (opts.cpuLimit !== undefined)
446
+ body.cpuLimit = opts.cpuLimit;
431
447
  if (opts.disk !== undefined)
432
448
  body.disk = opts.disk;
433
449
  const persistent = exposed || opts.persistent || opts.idlePause === 0;
@@ -848,6 +864,7 @@ export function registerSandbox(program) {
848
864
  .option('--name <name>', 'human-readable name for the new sandbox')
849
865
  .option('--size <size>', 'size preset for the restored sandbox')
850
866
  .option('--cpu <cores>', 'CPU cores, including fractional values', parseCpuCores)
867
+ .option('--cpu-limit <cores>', 'CPU the fork may burst to above its CPU when its host has room; CPU above it is billed as burst', parseCpuLimitCores)
851
868
  .option('--memory <mb>', 'memory in MiB', parseMemoryMb)
852
869
  .option('--memory-limit <mb>', 'memory the fork may use above its memory when its host has room, in MiB; memory above it is billed as used', parseMemoryLimitMb)
853
870
  .option('--disk <gb>', 'root disk capacity in GiB (may only grow)', parseDiskGb)
@@ -868,6 +885,9 @@ export function registerSandbox(program) {
868
885
  assertMemoryLimit(opts.memoryLimit, opts.memory);
869
886
  if (opts.memoryLimit !== undefined)
870
887
  body.memoryLimit = opts.memoryLimit;
888
+ assertCpuLimit(opts.cpuLimit, opts.cpu);
889
+ if (opts.cpuLimit !== undefined)
890
+ body.cpuLimit = opts.cpuLimit;
871
891
  if (opts.disk !== undefined)
872
892
  body.disk = opts.disk;
873
893
  if (opts.region)
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = '0.2.239';
1
+ export const CLI_VERSION = '0.2.241';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runcloud",
3
- "version": "0.2.239",
3
+ "version": "0.2.241",
4
4
  "description": "Create and control run.cloud remote mobile simulators and cloud sandboxes",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
Binary file
@@ -238,6 +238,36 @@ runcloud ios tunnel-status --json
238
238
  Do not expose an unauthenticated third-party tunnel. If the sidecar is
239
239
  unavailable, report that requirement instead of guessing a public URL.
240
240
 
241
+ ## Stream Codec and Browsers
242
+
243
+ Keep the default codec, `auto`. It selects the run.cloud streaming protocol:
244
+ low-latency H.264 over MoQ, with H.264 over HTTP as the fallback. Do not set
245
+ `--codec mjpeg` unless the client cannot decode H.264. MJPEG is a fallback
246
+ only. On Android it sends PNG screenshots at approximately 1.5 fps. It does not
247
+ turn off MoQ; codec and transport are separate choices.
248
+
249
+ To see or check the device, use `screenshot`, `accessibility-tree`, or
250
+ `recording`. These do not need a browser.
251
+
252
+ To watch a session in an automated browser, open the signed session URL as
253
+ the page itself. This works in installed Chrome, also headless. Do not build
254
+ an automated page that embeds viewers in iframes, especially in headless
255
+ Chrome:
256
+
257
+ - Chrome can stop painting a cross-origin iframe that is hidden or off-screen,
258
+ for example with `display: none`. Do not wait for a live status to show it.
259
+ - A `first_frame` report or live status does not prove that a picture is
260
+ visible. A hidden iframe can decode H.264 and report both. Check a screenshot.
261
+ - A localStorage `SecurityError` in a viewer iframe does not by itself stop the
262
+ video. Look for another cause.
263
+ - Check H.264 support with `VideoDecoder.isConfigSupported`, not by browser
264
+ name. `VideoDecoder` can exist without the codec, and builds differ.
265
+ - Playwright's bundled Chromium does not play the `auto` stream reliably. Use
266
+ installed Chrome (Playwright `channel: 'chrome'`).
267
+
268
+ If you must embed viewers, use installed Chrome in a visible window, keep each
269
+ iframe visible, and serve the page from an `http://` or `https://` origin.
270
+
241
271
  ## Embed a Session
242
272
 
243
273
  - Use `RemoteControl` from `@run-cloud/ui` with the signed session URL.
Binary file