runcloud 0.1.3 → 0.1.4
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.
|
@@ -7,117 +7,135 @@ import { ApiClient, friendlyApiError } from '../api.js';
|
|
|
7
7
|
import { requireCredentials } from '../config.js';
|
|
8
8
|
export const RUN_CLOUD_SKILL = `---
|
|
9
9
|
name: run-cloud-ios-simulator
|
|
10
|
-
description:
|
|
11
|
-
version: 0.
|
|
10
|
+
description: Use run.cloud SDK and CLI workflows for iOS simulator and Android emulator sessions.
|
|
11
|
+
version: 0.5.0
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
# run.cloud
|
|
14
|
+
# run.cloud Mobile Sessions
|
|
15
15
|
|
|
16
|
-
Use this skill when a user asks an agent to
|
|
16
|
+
Use this skill when a user asks an agent to create, inspect, smoke test, debug, or release an iOS simulator or Android emulator through run.cloud.
|
|
17
17
|
|
|
18
18
|
## Requirements
|
|
19
19
|
|
|
20
|
-
- Read
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
- The account must have run.cloud access and a positive run.cloud balance.
|
|
20
|
+
- Read SDK credentials from \`RUN_CLOUD_API_KEY\`. Never print it, commit it, or write it into a skill file. The SDK uses \`RUN_CLOUD_API_URL\` when set and otherwise defaults to \`https://api.newly.app\`.
|
|
21
|
+
- Authenticate the CLI with either a saved \`runcloud login\` credential or \`RUN_CLOUD_API_KEY\` together with \`RUN_CLOUD_API_URL\`. Do not require both a saved login and an API key.
|
|
22
|
+
- The TypeScript SDK requires Node.js 20 or newer.
|
|
23
|
+
- The account must have run.cloud access, available capacity, and a positive run.cloud balance.
|
|
24
24
|
- App artifacts must match the target platform. iOS sessions need simulator-compatible builds; Android sessions need Android-compatible artifacts such as APKs.
|
|
25
25
|
|
|
26
|
-
## Detect the Existing Sandbox Provider
|
|
27
|
-
|
|
28
|
-
Before changing dependencies or imports, inspect package manifests, lockfiles, source imports, and provider-specific environment variable names. Check for these signals:
|
|
29
|
-
|
|
30
|
-
| Provider | Common package/import signal | run.cloud compatibility entry point |
|
|
31
|
-
| --- | --- | --- |
|
|
32
|
-
| Modal | \`modal\` | \`run_cloud.compat.modal\` |
|
|
33
|
-
| E2B | \`e2b\`, \`@e2b/code-interpreter\` | \`run_cloud.compat.e2b\` |
|
|
34
|
-
| Blaxel | \`blaxel\` | \`run_cloud.compat.blaxel\` |
|
|
35
|
-
| CodeSandbox | \`@codesandbox/sdk\` | \`@run-cloud/sdk/compat/codesandbox\` |
|
|
36
|
-
| Vercel Sandbox | \`@vercel/sandbox\` | \`@run-cloud/sdk/compat/vercel\` |
|
|
37
|
-
| Cloudflare Sandbox | \`@cloudflare/sandbox\` | \`@run-cloud/sdk/compat/cloudflare\` |
|
|
38
|
-
| Fly Machines | \`@flydotio/machines\` | \`@run-cloud/sdk/compat/fly\` |
|
|
39
|
-
| Daytona | \`daytona\` | \`run_cloud.compat.daytona\` |
|
|
40
|
-
|
|
41
|
-
When a provider is detected:
|
|
42
|
-
|
|
43
|
-
1. Preserve the existing provider-shaped API and change only the integration boundary.
|
|
44
|
-
2. Use the matching compatibility entry point only after confirming its package resolves through the project's package manager or configured registry.
|
|
45
|
-
3. Run the existing provider integration tests after the import change. Provider-specific images, networking, regions, and lifecycle options still require explicit validation.
|
|
46
|
-
4. If more than one provider is present, map each call site independently and report the result. Do not choose one globally.
|
|
47
|
-
|
|
48
|
-
When no provider is detected, prefer native \`runcloud\` CLI commands for supported operations. For TypeScript, \`@run-cloud/sdk\` is the native API-key SDK.
|
|
49
|
-
|
|
50
26
|
## TypeScript SDK
|
|
51
27
|
|
|
52
|
-
|
|
28
|
+
Prefer \`@run-cloud/sdk\` for applications, CI, and agent code:
|
|
53
29
|
|
|
54
30
|
\`\`\`bash
|
|
55
31
|
npm install @run-cloud/sdk
|
|
56
32
|
\`\`\`
|
|
57
33
|
|
|
58
|
-
Use
|
|
34
|
+
Use the platform client when the platform is known, and always release metered sessions in \`finally\`:
|
|
59
35
|
|
|
60
36
|
\`\`\`ts
|
|
61
37
|
import { Client } from "@run-cloud/sdk";
|
|
62
38
|
|
|
63
39
|
const cloud = new Client();
|
|
64
|
-
const session = await cloud.
|
|
65
|
-
platform: "android",
|
|
40
|
+
const session = await cloud.ios.create({
|
|
66
41
|
displayName: "Agent smoke",
|
|
42
|
+
labels: { owner: "agent" },
|
|
67
43
|
inactivityTimeout: "60s",
|
|
68
44
|
});
|
|
69
45
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
46
|
+
try {
|
|
47
|
+
await cloud.ios.openUrl(session.id, "https://run.cloud");
|
|
48
|
+
console.log(session.url);
|
|
49
|
+
} finally {
|
|
50
|
+
await cloud.ios.delete(session.id);
|
|
51
|
+
}
|
|
76
52
|
\`\`\`
|
|
77
53
|
|
|
78
|
-
|
|
54
|
+
Use \`cloud.android\` for Android. When the platform is selected at runtime, use \`cloud.simulators\` and pass \`session.platform\` to \`get\`, \`openUrl\`, or \`delete\`.
|
|
79
55
|
|
|
80
|
-
|
|
81
|
-
2. Create a simulator with \`runcloud ios create --install ./build/MyApp.tar.gz --json\`.
|
|
82
|
-
3. Save the returned session id and URL.
|
|
83
|
-
4. Use \`runcloud ios open-url <url> --id <session-id>\` when a URL or deep link must be opened.
|
|
84
|
-
5. Release the session with \`runcloud ios delete <session-id>\`.
|
|
56
|
+
The implemented SDK surface is:
|
|
85
57
|
|
|
86
|
-
|
|
58
|
+
- \`cloud.account()\`;
|
|
59
|
+
- \`cloud.ios\` and \`cloud.android\`: \`create\`, \`list\`, \`get\`, \`openUrl\`, \`delete\`;
|
|
60
|
+
- \`cloud.simulators\`: the same lifecycle with a runtime \`platform\` option;
|
|
61
|
+
- \`cloud.assets\`: \`upload\`, \`list\`, \`delete\`.
|
|
87
62
|
|
|
88
|
-
|
|
63
|
+
Do not invent screenshot, tap, typing, recording, app lifecycle, sandbox, build, or compatibility-adapter methods. Check the installed package types and https://run.cloud/cli/typescript-sdk before using a method not listed here.
|
|
89
64
|
|
|
90
|
-
|
|
91
|
-
2. Create an emulator with \`runcloud android create --install ./build/app-debug.apk --json\`.
|
|
92
|
-
3. Save the returned session id and URL.
|
|
93
|
-
4. Use \`runcloud android open-url <url> --id <session-id>\` when a URL or deep link must be opened.
|
|
94
|
-
5. Release the session with \`runcloud android delete <session-id>\`.
|
|
65
|
+
## CLI Workflow
|
|
95
66
|
|
|
96
|
-
|
|
67
|
+
Use the CLI for interactive terminal work. Authenticate with a saved login:
|
|
97
68
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
69
|
+
\`\`\`bash
|
|
70
|
+
npm install -g runcloud
|
|
71
|
+
runcloud login
|
|
72
|
+
\`\`\`
|
|
73
|
+
|
|
74
|
+
Or authenticate non-interactively with both required environment variables:
|
|
75
|
+
|
|
76
|
+
\`\`\`bash
|
|
77
|
+
export RUN_CLOUD_API_KEY="rc_live_..."
|
|
78
|
+
export RUN_CLOUD_API_URL="https://api.newly.app"
|
|
79
|
+
\`\`\`
|
|
80
|
+
|
|
81
|
+
Then inspect the account:
|
|
82
|
+
|
|
83
|
+
\`\`\`bash
|
|
84
|
+
runcloud account --json
|
|
85
|
+
\`\`\`
|
|
86
|
+
|
|
87
|
+
Create, inspect, open a URL, and release an iOS session:
|
|
88
|
+
|
|
89
|
+
\`\`\`bash
|
|
90
|
+
runcloud ios create --install ./build/MyApp.tar.gz --json
|
|
91
|
+
runcloud ios get "$SESSION_ID" --json
|
|
92
|
+
runcloud ios open-url myapp://settings --id "$SESSION_ID"
|
|
93
|
+
runcloud ios delete "$SESSION_ID" --json
|
|
94
|
+
\`\`\`
|
|
95
|
+
|
|
96
|
+
Use the corresponding \`runcloud android\` commands with an Android artifact for Android emulator sessions.
|
|
97
|
+
|
|
98
|
+
## Runnable SDK Example
|
|
99
|
+
|
|
100
|
+
The maintained example checks account state, creates iOS and Android sessions, opens a URL on each, and releases both sessions:
|
|
101
|
+
|
|
102
|
+
\`\`\`bash
|
|
103
|
+
git clone --depth 1 https://github.com/newly-app/run-cloud-examples.git
|
|
104
|
+
cd run-cloud-examples/sdk-ios-android
|
|
105
|
+
npm install
|
|
106
|
+
npm run demo -- --platform both --open
|
|
107
|
+
\`\`\`
|
|
108
|
+
|
|
109
|
+
Use \`--platform ios\` or \`--platform android\` for one platform. Use \`--json\` for machine-readable output. The example releases sessions on completion, failure, SIGINT, and SIGTERM unless the user explicitly passes \`--keep\`.
|
|
110
|
+
|
|
111
|
+
## Bundled CLI Demos
|
|
112
|
+
|
|
113
|
+
These published demos exercise multi-simulator workflows:
|
|
114
|
+
|
|
115
|
+
\`\`\`bash
|
|
116
|
+
runcloud demo run parallel-simulators --open
|
|
117
|
+
runcloud demo run eight-device-mosaic --open
|
|
118
|
+
runcloud demo run live-camera-relay --open
|
|
119
|
+
\`\`\`
|
|
101
120
|
|
|
102
|
-
|
|
121
|
+
They use the same CLI authentication choices described above and release every session automatically.
|
|
103
122
|
|
|
104
123
|
## Embedded Iframes
|
|
105
124
|
|
|
106
|
-
- Use \`
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
- Iframes post simulator
|
|
110
|
-
-
|
|
125
|
+
- Use \`inactivityTimeout: "60s"\` in the SDK, or \`--inactivity-timeout 60s\` in the CLI, when an embed should auto-close after user inactivity.
|
|
126
|
+
- Omit the option or pass \`null\`/\`none\` when the user needs a metered session without idle auto-close.
|
|
127
|
+
- Treat the returned signed session URL as a secret. Do not publish it in logs.
|
|
128
|
+
- Iframes post \`ios-simulator:status\`, \`ios-simulator:auth-error\`, \`ios-simulator:session-ended\`, and \`ios-simulator:session-restart-requested\` messages to the parent window.
|
|
129
|
+
- Verify \`event.source\` before acting on iframe messages.
|
|
130
|
+
- When \`ios-simulator:session-restart-requested\` arrives, create a fresh session; do not reuse the ended iframe URL.
|
|
111
131
|
|
|
112
132
|
## Rules
|
|
113
133
|
|
|
114
|
-
- Prefer \`--json\` for
|
|
115
|
-
- Detect existing provider usage before proposing SDK changes.
|
|
116
|
-
- Do not install an adapter until its package is resolvable.
|
|
134
|
+
- Prefer the SDK for code and \`--json\` CLI output for shell automation.
|
|
117
135
|
- Always release sessions you create unless the user asks to keep them open.
|
|
118
136
|
- If installation fails, verify that the artifact matches the target platform before attempting code changes.
|
|
119
137
|
- Do not assume a local tunnel is installed on the user's machine.
|
|
120
|
-
- Do not expose simulator tokens in logs or screenshots.
|
|
138
|
+
- Do not expose API keys, CLI tokens, signed simulator URLs, or simulator tokens in logs or screenshots.
|
|
121
139
|
`;
|
|
122
140
|
function client() {
|
|
123
141
|
const creds = requireCredentials();
|
|
@@ -9,8 +9,9 @@ interrupted local process.
|
|
|
9
9
|
## Requirements
|
|
10
10
|
|
|
11
11
|
- Node.js 20 or newer
|
|
12
|
-
- `runcloud` 0.1.3 or newer: `npm install -g runcloud
|
|
13
|
-
-
|
|
12
|
+
- `runcloud` 0.1.3 or newer: `npm install -g runcloud`
|
|
13
|
+
- A simulator account authenticated either with `runcloud login` or with both
|
|
14
|
+
`RUN_CLOUD_API_KEY` and `RUN_CLOUD_API_URL`
|
|
14
15
|
- run.cloud simulator access, capacity, and enough balance for eight sessions
|
|
15
16
|
|
|
16
17
|
The local viewer binds only to `127.0.0.1`. Signed simulator URLs remain in the
|
|
@@ -8,8 +8,9 @@ and sends the real WebRTC video stream to both receiver simulators.
|
|
|
8
8
|
## Requirements
|
|
9
9
|
|
|
10
10
|
- Node.js 20 or newer
|
|
11
|
-
- `runcloud` 0.1.3 or newer: `npm install -g runcloud
|
|
12
|
-
-
|
|
11
|
+
- `runcloud` 0.1.3 or newer: `npm install -g runcloud`
|
|
12
|
+
- A simulator account authenticated either with `runcloud login` or with both
|
|
13
|
+
`RUN_CLOUD_API_KEY` and `RUN_CLOUD_API_URL`
|
|
13
14
|
- run.cloud simulator access, capacity, and enough balance for three sessions
|
|
14
15
|
- A browser with webcam permission
|
|
15
16
|
|
|
@@ -8,13 +8,13 @@ server-side timeout is also set in case the local process is interrupted.
|
|
|
8
8
|
## Requirements
|
|
9
9
|
|
|
10
10
|
- Node.js 20 or newer
|
|
11
|
-
- `runcloud` 0.1.
|
|
12
|
-
-
|
|
11
|
+
- `runcloud` 0.1.3 or newer: `npm install -g runcloud`
|
|
12
|
+
- A simulator account authenticated either with `runcloud login` or with both
|
|
13
|
+
`RUN_CLOUD_API_KEY` and `RUN_CLOUD_API_URL`
|
|
13
14
|
- run.cloud simulator access and enough balance for two or three sessions
|
|
14
15
|
|
|
15
|
-
The demo uses
|
|
16
|
-
|
|
17
|
-
before this demo.
|
|
16
|
+
The demo uses the CLI credential resolution path. It does not require both a
|
|
17
|
+
saved login and an API key.
|
|
18
18
|
|
|
19
19
|
## Run
|
|
20
20
|
|