runcloud 0.2.243 → 0.2.244

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.
@@ -12,6 +12,25 @@ import { formatRunCloudCredits, readRunCloudCredits, RunCloudCreditsError } from
12
12
  export const IOS_SIMULATOR_CAPABILITIES = ['HealthKit', 'HomeKit', 'WidgetKit', 'SpeechSynthesis', 'Contacts', 'Calendars', 'AppleAccount'];
13
13
  export const IOS_PLATFORM_VERSIONS = ['26.5'];
14
14
  export const IOS_DEVICE_NAMES = ['iPhone 17e', 'iPad (A16)'];
15
+ export const RUN_CLOUD_CODEC_HELP = 'viewer stream codec: auto (default, recommended) uses run.cloud\'s H.264 streaming protocol; '
16
+ + 'mjpeg is a fallback only for clients that cannot decode H.264 (on Android it is PNG screenshots at about 1.5 fps); '
17
+ + 'webrtc is experimental';
18
+ export const MJPEG_CODEC_WARNINGS = {
19
+ android: {
20
+ code: 'android_mjpeg_low_fps',
21
+ message: 'codec mjpeg on Android sends PNG screenshots at about 1.5 fps, not video; on a busy host the viewer can show "Connecting…" between frames. Use codec auto (H.264, the default) unless the client cannot decode H.264.',
22
+ },
23
+ ios: {
24
+ code: 'mjpeg_fallback_codec',
25
+ message: 'codec mjpeg is a fallback with higher latency than codec auto (H.264, the default). Use it only when the client cannot decode H.264.',
26
+ },
27
+ };
28
+ export function createWarnings(session, platform, codec) {
29
+ if (Array.isArray(session.warnings)) {
30
+ return session.warnings.filter((warning) => typeof warning === 'object' && warning !== null && typeof warning.message === 'string');
31
+ }
32
+ return codec?.trim().toLowerCase() === 'mjpeg' ? [MJPEG_CODEC_WARNINGS[platform]] : [];
33
+ }
15
34
  export function runCloudIosOptions(opts) {
16
35
  const capabilities = [...new Set(opts.capability ?? [])];
17
36
  if (!capabilities.length && !opts.platformVersion && !opts.deviceName)
@@ -961,16 +980,26 @@ async function createSimulatorSession(platform, opts) {
961
980
  const STATE_WAIT_DEADLINE_MS = 10 * 60_000;
962
981
  const STATE_LONG_POLL_MS = 60_000;
963
982
  const STATE_POLL_INTERVAL_MS = 500;
964
- function printCreatedSession(session, opts) {
965
- const restore = session.stateRestore;
966
- if (opts.json || !restore || typeof restore !== 'object') {
967
- print(session, opts);
983
+ function printCreatedSession(session, opts, platform) {
984
+ const warnings = createWarnings(session, platform, opts.codec);
985
+ if (opts.json) {
986
+ print(warnings.length > 0 && !Array.isArray(session.warnings) ? { ...session, warnings } : session, opts);
968
987
  return;
969
988
  }
970
- print({ ...session, stateRestore: `${restore.status}${restore.code ? ` (${restore.code})` : ''}` }, opts);
971
- if (restore.status !== 'restored') {
972
- console.error(`warning: saved state ${restore.stateId ?? ''} was not restored; the session started from a clean device`);
989
+ const rest = { ...session };
990
+ delete rest.warnings;
991
+ const restore = session.stateRestore;
992
+ if (!restore || typeof restore !== 'object') {
993
+ print(rest, opts);
994
+ }
995
+ else {
996
+ print({ ...rest, stateRestore: `${restore.status}${restore.code ? ` (${restore.code})` : ''}` }, opts);
997
+ if (restore.status !== 'restored') {
998
+ console.error(`warning: saved state ${restore.stateId ?? ''} was not restored; the session started from a clean device`);
999
+ }
973
1000
  }
1001
+ for (const warning of warnings)
1002
+ console.error(`warning: ${warning.message}`);
974
1003
  }
975
1004
  function sleep(ms) {
976
1005
  return new Promise((resolveSleep) => setTimeout(resolveSleep, ms));
@@ -1317,7 +1346,7 @@ function registerSimulatorCommands(program, platform) {
1317
1346
  .option('--install-asset <name-or-id>', 'previously uploaded asset to install', (v, p) => [...p, v], [])
1318
1347
  .option('--inactivity-timeout <duration>', 'auto-close idle timeout, e.g. 60s, 3m, or none')
1319
1348
  .option('--hard-timeout <duration>', 'maximum lifetime, e.g. 10m or 1h')
1320
- .option('--codec <auto|mjpeg|webrtc>', 'force the simulator viewer stream codec', 'auto')
1349
+ .option('--codec <auto|mjpeg|webrtc>', RUN_CLOUD_CODEC_HELP, 'auto')
1321
1350
  .option('--rm', 'release the session when this command exits', false)
1322
1351
  .option('--json', 'output JSON', false)
1323
1352
  .addOption(new Option('--dev-host <host>', 'dev-only: target a specific simulator fleet host').hideHelp());
@@ -1361,7 +1390,7 @@ function registerSimulatorCommands(program, platform) {
1361
1390
  createCommand
1362
1391
  .option('--restore-state <state-id>', 'start from a saved state (see delete --save-state); falls back to a clean device')
1363
1392
  .action((opts) => action(async () => {
1364
- printCreatedSession(await createSimulatorSession(platform, opts), opts);
1393
+ printCreatedSession(await createSimulatorSession(platform, opts), opts, platform);
1365
1394
  }, opts));
1366
1395
  simulator
1367
1396
  .command('list')
@@ -2156,7 +2185,7 @@ export function registerRunCloud(program) {
2156
2185
  .option('--label <key=value>', 'session tag; repeatable', (value, previous) => [...previous, value], [])
2157
2186
  .option('--inactivity-timeout <duration>', 'idle timeout such as 60s, 3m, or none')
2158
2187
  .option('--hard-timeout <duration>', 'maximum lifetime such as 10m or 1h')
2159
- .option('--codec <auto|mjpeg|webrtc>', 'viewer codec', 'auto')
2188
+ .option('--codec <auto|mjpeg|webrtc>', RUN_CLOUD_CODEC_HELP, 'auto')
2160
2189
  .option('--json', 'output JSON', false)
2161
2190
  .action((opts) => action(async () => {
2162
2191
  if (Boolean(opts.asset) === Boolean(opts.build)) {
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = '0.2.243';
1
+ export const CLI_VERSION = '0.2.244';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runcloud",
3
- "version": "0.2.243",
3
+ "version": "0.2.244",
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
Binary file