runcloud 0.2.244 → 0.2.247
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.
|
@@ -135,9 +135,13 @@ async function addCommand(group, preset, opts) {
|
|
|
135
135
|
const existing = existsSync(credentialsConfigPath()) ? readFileSync(credentialsConfigPath(), 'utf8') : null;
|
|
136
136
|
const next = addEntry(existing, group, entry);
|
|
137
137
|
const config = parseCredentialsConfig(next);
|
|
138
|
-
const
|
|
138
|
+
const entries = config.groups.find((g) => g.name === group)?.entries ?? [];
|
|
139
|
+
const added = entries.at(-1);
|
|
139
140
|
if (!added)
|
|
140
141
|
throw new Error(`could not add an entry to group "${group}"`);
|
|
142
|
+
if (entries.slice(0, -1).some((e) => JSON.stringify(e) === JSON.stringify(added))) {
|
|
143
|
+
throw new Error(`group "${group}" already has this entry`);
|
|
144
|
+
}
|
|
141
145
|
if (added.kind === 'preset') {
|
|
142
146
|
if (added.preset !== 'claude') {
|
|
143
147
|
const message = await checkPresetReady(added.preset, added.options, defaultRunCommand);
|
|
@@ -156,7 +160,7 @@ async function addCommand(group, preset, opts) {
|
|
|
156
160
|
return;
|
|
157
161
|
}
|
|
158
162
|
if (added.kind === 'preset' && added.preset === 'claude') {
|
|
159
|
-
await storeClaudeToken(await obtainClaudeToken(opts.paste === true), defaultRunCommand);
|
|
163
|
+
await storeClaudeToken(await obtainClaudeToken(group, opts.paste === true), defaultRunCommand);
|
|
160
164
|
}
|
|
161
165
|
writeCredentialsConfig(next);
|
|
162
166
|
const results = await pushAndSave(config, { groups: [group] });
|
|
@@ -165,7 +169,7 @@ async function addCommand(group, preset, opts) {
|
|
|
165
169
|
if (results.some((r) => r.outcome === 'failed' || r.outcome === 'not-adopted'))
|
|
166
170
|
process.exitCode = 1;
|
|
167
171
|
}
|
|
168
|
-
async function obtainClaudeToken(paste) {
|
|
172
|
+
async function obtainClaudeToken(group, paste) {
|
|
169
173
|
if (!paste && process.stdin.isTTY) {
|
|
170
174
|
console.log('Running `claude setup-token`. Finish the sign-in it opens; the token it prints is stored for you.');
|
|
171
175
|
const token = await runClaudeSetupToken();
|
|
@@ -173,7 +177,11 @@ async function obtainClaudeToken(paste) {
|
|
|
173
177
|
return token;
|
|
174
178
|
console.log('Could not read a token from `claude setup-token`.');
|
|
175
179
|
}
|
|
176
|
-
|
|
180
|
+
const token = (await promptHidden('Paste the output of `claude setup-token`: ')).trim();
|
|
181
|
+
if (token)
|
|
182
|
+
return token;
|
|
183
|
+
throw new Error('No Claude token received. Run this in a terminal so runcloud can run `claude setup-token` for you, ' +
|
|
184
|
+
`or pipe a token you already have: printf '%s' "$TOKEN" | runcloud credentials add ${group} claude --paste --yes`);
|
|
177
185
|
}
|
|
178
186
|
async function deleteRemote(org, group, names) {
|
|
179
187
|
const api = engineApi();
|
|
@@ -10,8 +10,8 @@ import { requireCredentials } from '../config.js';
|
|
|
10
10
|
import { recordSimulatorAudio } from './run-cloud-audio.js';
|
|
11
11
|
import { formatRunCloudCredits, readRunCloudCredits, RunCloudCreditsError } from './run-cloud-credits.js';
|
|
12
12
|
export const IOS_SIMULATOR_CAPABILITIES = ['HealthKit', 'HomeKit', 'WidgetKit', 'SpeechSynthesis', 'Contacts', 'Calendars', 'AppleAccount'];
|
|
13
|
-
export const IOS_PLATFORM_VERSIONS = ['26.5'];
|
|
14
|
-
export const IOS_DEVICE_NAMES = ['iPhone 17e', 'iPad (A16)'];
|
|
13
|
+
export const IOS_PLATFORM_VERSIONS = ['26.5', '27.2'];
|
|
14
|
+
export const IOS_DEVICE_NAMES = ['iPhone 17e', 'iPad (A16)', 'iPhone Duo'];
|
|
15
15
|
export const RUN_CLOUD_CODEC_HELP = 'viewer stream codec: auto (default, recommended) uses run.cloud\'s H.264 streaming protocol; '
|
|
16
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
17
|
+ 'webrtc is experimental';
|
|
@@ -114,6 +114,8 @@ function normalizedAccessibilityErrorCode(value) {
|
|
|
114
114
|
? value
|
|
115
115
|
: 'accessibility_unavailable';
|
|
116
116
|
}
|
|
117
|
+
const FOLD_POSES = ['closed', 'book', 'open', 'keyboard', 'tent'];
|
|
118
|
+
const HINGE_DEGREES = { min: 0, max: 180 };
|
|
117
119
|
const DEFAULT_ACCESSIBILITY_TIMEOUT_MS = 20_000;
|
|
118
120
|
const INTERACTION_RESPONSE_MARGIN_MS = 250;
|
|
119
121
|
const REQUEST_ID_PATTERN = /^[A-Za-z0-9._:-]{1,128}$/;
|
|
@@ -263,6 +265,11 @@ function renderDebugOption(raw) {
|
|
|
263
265
|
}
|
|
264
266
|
throw new Error(`Unknown render debug option: ${raw}. Choose one of: ${SIMULATOR_RENDER_DEBUG_OPTIONS.join(', ')}.`);
|
|
265
267
|
}
|
|
268
|
+
function foldPose(raw) {
|
|
269
|
+
if (FOLD_POSES.includes(raw))
|
|
270
|
+
return raw;
|
|
271
|
+
throw new Error(`Unknown fold pose: ${raw}. Choose one of: ${FOLD_POSES.join(', ')}.`);
|
|
272
|
+
}
|
|
266
273
|
function booleanArgument(raw, name) {
|
|
267
274
|
if (raw === 'true')
|
|
268
275
|
return true;
|
|
@@ -1673,6 +1680,19 @@ function registerSimulatorCommands(program, platform) {
|
|
|
1673
1680
|
option: renderDebugOption(rawOption),
|
|
1674
1681
|
enabled: booleanArgument(rawEnabled, 'enabled'),
|
|
1675
1682
|
}, opts), opts));
|
|
1683
|
+
addInteractionOptions(simulator
|
|
1684
|
+
.command('hinge')
|
|
1685
|
+
.description(`Set the hinge angle of a foldable device such as iPhone Duo in ${article} ${label} session (other devices return unsupported_action)`)
|
|
1686
|
+
.argument('<id>', 'session id')
|
|
1687
|
+
.argument('<degrees>', `hinge angle from ${HINGE_DEGREES.min} (closed) to ${HINGE_DEGREES.max} (flat open)`)).action((id, degrees, opts) => action(() => runSimulatorInteraction(platform, id, {
|
|
1688
|
+
action: 'setHinge',
|
|
1689
|
+
degrees: finiteInRange(degrees, 'degrees', HINGE_DEGREES.min, HINGE_DEGREES.max),
|
|
1690
|
+
}, opts), opts));
|
|
1691
|
+
addInteractionOptions(simulator
|
|
1692
|
+
.command('pose')
|
|
1693
|
+
.description(`Put a foldable device such as iPhone Duo into a named pose in ${article} ${label} session (other devices return unsupported_action)`)
|
|
1694
|
+
.argument('<id>', 'session id')
|
|
1695
|
+
.argument('<pose>', 'closed (0°), book (130°), open (180°, flat), keyboard (laptop pose, about 110°), or tent (about 75°, cover screen out)')).action((id, rawPose, opts) => action(() => runSimulatorInteraction(platform, id, { action: 'setPose', pose: foldPose(rawPose) }, opts), opts));
|
|
1676
1696
|
simulator
|
|
1677
1697
|
.command('accessibility-tree')
|
|
1678
1698
|
.alias('accessibility')
|
package/dist/commands/sandbox.js
CHANGED
|
@@ -403,6 +403,7 @@ export function registerSandbox(program) {
|
|
|
403
403
|
.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)
|
|
404
404
|
.option('--memory <mb>', 'memory allocation in MiB', parseMemoryMb)
|
|
405
405
|
.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)
|
|
406
|
+
.option('--hardware-acceleration', 'run on a host with a GPU, with the hardware-accelerated image (OpenGL and Vulkan); must be enabled for the account; not with --image')
|
|
406
407
|
.option('--disk <gb>', 'root disk capacity in GiB', parseDiskGb)
|
|
407
408
|
.option('--idle-pause <seconds>', 'pause after inactivity; 0 keeps it running', parseIdlePauseSeconds)
|
|
408
409
|
.option('--timeout <seconds>', 'maximum sandbox lifetime; defaults to 300, or 0 for persistent sandboxes', parseTimeoutSeconds)
|
|
@@ -425,9 +426,12 @@ export function registerSandbox(program) {
|
|
|
425
426
|
if ((exposed || opts.persistent) && opts.idlePause !== undefined && opts.idlePause !== 0) {
|
|
426
427
|
throw new Error('--persistent and --expose keep the sandbox running; drop the non-zero --idle-pause');
|
|
427
428
|
}
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
}
|
|
429
|
+
if (opts.hardwareAcceleration && opts.image !== undefined) {
|
|
430
|
+
throw new Error('--hardware-acceleration boots the hardware-accelerated image; drop --image');
|
|
431
|
+
}
|
|
432
|
+
const body = opts.hardwareAcceleration
|
|
433
|
+
? { hardwareAcceleration: true }
|
|
434
|
+
: { image: opts.image ?? 'runcloud/agent-base' };
|
|
431
435
|
if (opts.name)
|
|
432
436
|
body.name = opts.name;
|
|
433
437
|
if (opts.region)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { chmodSync, closeSync, existsSync, mkdirSync, openSync, realpathSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { homedir } from 'node:os';
|
|
3
|
-
import { dirname, join } from 'node:path';
|
|
1
|
+
import { chmodSync, closeSync, existsSync, lstatSync, mkdirSync, openSync, realpathSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { homedir, tmpdir } from 'node:os';
|
|
3
|
+
import { basename, delimiter, dirname, isAbsolute, join, sep } from 'node:path';
|
|
4
4
|
import { credentialsHome, loadCredentials, loadStoredCredentials } from '../config.js';
|
|
5
5
|
import { liveLockHolder } from './lockFile.js';
|
|
6
6
|
import { shellQuote } from './tokenStore.js';
|
|
@@ -27,8 +27,69 @@ function scriptArgument() {
|
|
|
27
27
|
return [];
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
+
function realpathOrNull(path) {
|
|
31
|
+
try {
|
|
32
|
+
return realpathSync(path);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export function temporaryRoots() {
|
|
39
|
+
const roots = ['/tmp', '/private/tmp', '/var/folders', '/private/var/folders', '/run/user', tmpdir()];
|
|
40
|
+
if (process.env.XDG_RUNTIME_DIR)
|
|
41
|
+
roots.push(process.env.XDG_RUNTIME_DIR);
|
|
42
|
+
for (const root of [...roots]) {
|
|
43
|
+
const real = realpathOrNull(root);
|
|
44
|
+
if (real)
|
|
45
|
+
roots.push(real);
|
|
46
|
+
}
|
|
47
|
+
return roots;
|
|
48
|
+
}
|
|
49
|
+
function isSymlink(path) {
|
|
50
|
+
try {
|
|
51
|
+
return lstatSync(path).isSymbolicLink();
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function isUnder(path, roots) {
|
|
58
|
+
const real = realpathOrNull(path) ?? path;
|
|
59
|
+
return roots.some((root) => real === root || real.startsWith(root.endsWith(sep) ? root : root + sep) || path.startsWith(root + sep));
|
|
60
|
+
}
|
|
61
|
+
export function stableExecPath(execPath = process.execPath, pathEnv = process.env.PATH ?? '', tempRoots = temporaryRoots()) {
|
|
62
|
+
const real = realpathOrNull(execPath);
|
|
63
|
+
if (!real)
|
|
64
|
+
return execPath;
|
|
65
|
+
for (const entry of pathEnv.split(delimiter)) {
|
|
66
|
+
if (!entry || !isAbsolute(entry))
|
|
67
|
+
continue;
|
|
68
|
+
const candidate = join(entry, basename(execPath));
|
|
69
|
+
if (isUnder(candidate, tempRoots) || isUnder(entry, tempRoots))
|
|
70
|
+
continue;
|
|
71
|
+
if (!isSymlink(candidate))
|
|
72
|
+
continue;
|
|
73
|
+
if (realpathOrNull(candidate) === real)
|
|
74
|
+
return candidate;
|
|
75
|
+
}
|
|
76
|
+
return execPath;
|
|
77
|
+
}
|
|
78
|
+
export function persistentPath(pathEnv, tempRoots = temporaryRoots()) {
|
|
79
|
+
const seen = new Set();
|
|
80
|
+
const kept = [];
|
|
81
|
+
for (const entry of pathEnv.split(delimiter)) {
|
|
82
|
+
if (!entry || seen.has(entry))
|
|
83
|
+
continue;
|
|
84
|
+
seen.add(entry);
|
|
85
|
+
if (!isAbsolute(entry) || !existsSync(entry) || isUnder(entry, tempRoots))
|
|
86
|
+
continue;
|
|
87
|
+
kept.push(entry);
|
|
88
|
+
}
|
|
89
|
+
return kept.join(delimiter);
|
|
90
|
+
}
|
|
30
91
|
export function agentProgram() {
|
|
31
|
-
return [
|
|
92
|
+
return [stableExecPath(), ...scriptArgument(), 'credentials', 'sync', '--log-only'];
|
|
32
93
|
}
|
|
33
94
|
const xml = (text) => text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
34
95
|
export function renderLaunchdPlist(o) {
|
|
@@ -116,7 +177,7 @@ export async function installAgent(run, platform = process.platform, home = home
|
|
|
116
177
|
const path = unitPath(platform, home);
|
|
117
178
|
const options = {
|
|
118
179
|
program: agentProgram(),
|
|
119
|
-
path: process.env.PATH ?? '',
|
|
180
|
+
path: persistentPath(process.env.PATH ?? ''),
|
|
120
181
|
...(process.env.RUN_CLOUD_HOME && { runCloudHome: process.env.RUN_CLOUD_HOME }),
|
|
121
182
|
logPath: agentLogPath(),
|
|
122
183
|
};
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CLI_VERSION = '0.2.
|
|
1
|
+
export const CLI_VERSION = '0.2.247';
|
package/package.json
CHANGED
|
Binary file
|
package/runcloud-0.2.244.tgz
DELETED
|
Binary file
|