agent-device-x86sim 0.1.1 → 0.1.2
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 +18 -6
- package/dist/cli.js +3 -2
- package/dist/index.js +29 -5
- package/dist/routes-Ctumc6oY.js +777 -0
- package/dist/{start-server-C84E8KRm.js → start-server-C92g1pGb.js} +26 -334
- package/package.json +13 -12
- package/dist/system-DMZAX-z7.js +0 -203
package/README.md
CHANGED
|
@@ -37,12 +37,15 @@ When agent-device runs on the Linux machine, the plugin starts the server and bo
|
|
|
37
37
|
|
|
38
38
|
If an agent-device daemon is running, stop it so that it loads the plugin.
|
|
39
39
|
|
|
40
|
-
3.
|
|
40
|
+
3. Name your session, then connect.
|
|
41
41
|
|
|
42
42
|
```sh
|
|
43
|
+
export AGENT_DEVICE_SESSION=x86sim
|
|
43
44
|
agent-device connect x86sim
|
|
44
45
|
```
|
|
45
46
|
|
|
47
|
+
agent-device asks every command on a provider connection to name its session. Set `AGENT_DEVICE_SESSION` once in each shell, or pass `--session <name>` to each command.
|
|
48
|
+
|
|
46
49
|
Check: the output says `Connected successfully with x86Sim.` and names your phone.
|
|
47
50
|
|
|
48
51
|
4. Open an app.
|
|
@@ -129,6 +132,7 @@ agent-device sends its commands to a WebDriver server that runs next to the simu
|
|
|
129
132
|
|
|
130
133
|
```sh
|
|
131
134
|
agent-device plugins add agent-device-x86sim
|
|
135
|
+
export AGENT_DEVICE_SESSION=x86sim
|
|
132
136
|
agent-device connect x86sim
|
|
133
137
|
```
|
|
134
138
|
|
|
@@ -150,16 +154,22 @@ agent-device sends its commands to a WebDriver server that runs next to the simu
|
|
|
150
154
|
|
|
151
155
|
## Test your own app
|
|
152
156
|
|
|
153
|
-
Install an arm64 iOS simulator build
|
|
157
|
+
Install an arm64 iOS simulator build, then open it by its bundle id. The app can be a `.app` folder or a `.zip` that holds one.
|
|
154
158
|
|
|
155
159
|
```sh
|
|
156
|
-
|
|
157
|
-
./x86sim-0.5.3-x86_64.AppImage x86sim install ./MyApp.app
|
|
158
|
-
# where agent-device runs
|
|
160
|
+
agent-device install com.example.myapp ./MyApp.app.zip
|
|
159
161
|
agent-device open com.example.myapp
|
|
160
162
|
```
|
|
161
163
|
|
|
162
|
-
|
|
164
|
+
This works where agent-device runs, on the Linux machine or another one. The plugin sends the app to the server, and the server installs it on the phone. A `.zip` made on a Mac keeps the app's file modes, so prefer it on Windows.
|
|
165
|
+
|
|
166
|
+
Check: the output says `Installed: com.example.myapp`.
|
|
167
|
+
|
|
168
|
+
To install without agent-device, run x86Sim's own command on the Linux machine and name the phone. Without a name, x86Sim installs on its default phone, which is not the one the launcher creates.
|
|
169
|
+
|
|
170
|
+
```sh
|
|
171
|
+
~/x86sim/x86sim-0.5.3-x86_64.AppImage x86sim install "iPhone 17 Pro" ./MyApp.app
|
|
172
|
+
```
|
|
163
173
|
|
|
164
174
|
## Notes for agents
|
|
165
175
|
|
|
@@ -170,6 +180,7 @@ agent-device open com.example.myapp
|
|
|
170
180
|
- The first `open` on the Linux machine boots the phone and can take up to 6 minutes. Do not run it again while it runs.
|
|
171
181
|
- These operations return `UNSUPPORTED_OPERATION`: `fill`, `back`, `orientation`, the keyboard state, and the clipboard.
|
|
172
182
|
- To enter text, press the field, then use `type`. Press only after a snapshot taken a few seconds after the page opened. A press on a page that has not drawn yet reports `Tapped` but does nothing, and `type` then goes nowhere. Check the result with `snapshot`, which shows the typed text as the field's value.
|
|
183
|
+
- Wait about 4 seconds between pressing a field and `type`. Typed right away, `Rob` sometimes arrives as `ROB` in a field that capitalizes words. `wait text` ignores case, so read the value in `snapshot -i`.
|
|
173
184
|
|
|
174
185
|
## Troubleshooting
|
|
175
186
|
|
|
@@ -183,6 +194,7 @@ agent-device open com.example.myapp
|
|
|
183
194
|
| `snapshot -i` lists only `[application]`, or says `UIKit's accessibility is off` | The hook is not loaded, or accessibility is off | Run `npx agent-device-x86sim serve` again. It stops a phone that lacks the hook and boots it again. |
|
|
184
195
|
| `--provider-app is not supported by x86Sim` | An old plugin sends the bundle id as `--provider-app` | Update the plugin with `agent-device plugins update agent-device-x86sim`, then stop the daemon. |
|
|
185
196
|
| A screenshot shows the screen from before the last `press` | The phone has not drawn the new frame yet | Wait 2 seconds and take the screenshot again. |
|
|
197
|
+
| `A leased remote connection needs its session named` | The shell names no session | Run `export AGENT_DEVICE_SESSION=x86sim`, or pass `--session <name>`. |
|
|
186
198
|
| `connect x86sim` is not a known provider | The daemon started before you installed the plugin | Stop the agent-device daemon and run the command again. |
|
|
187
199
|
|
|
188
200
|
## Limits
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { r as packagedHookPath, t as startServer } from "./start-server-
|
|
3
|
-
import {
|
|
2
|
+
import { r as packagedHookPath, t as startServer } from "./start-server-C92g1pGb.js";
|
|
3
|
+
import { u as discoverTarget } from "./routes-Ctumc6oY.js";
|
|
4
4
|
import { hostname } from "node:os";
|
|
5
5
|
import { parseArgs } from "node:util";
|
|
6
6
|
//#region src/cli/args.ts
|
|
@@ -79,6 +79,7 @@ function readyMessage(endpoint, device) {
|
|
|
79
79
|
`Ready. The server for the phone ${device} answers at ${endpoint}.`,
|
|
80
80
|
"On the machine that runs agent-device, run:",
|
|
81
81
|
" agent-device plugins add agent-device-x86sim",
|
|
82
|
+
" export AGENT_DEVICE_SESSION=x86sim",
|
|
82
83
|
" agent-device connect x86sim",
|
|
83
84
|
`If that is another machine, forward the port first: ssh -N -L ${port}:localhost:${port} <user>@${hostname()}`,
|
|
84
85
|
"Stop the server with Ctrl+C. The phone keeps running."
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as appArchive, f as NotSetUpError, t as APP_UPLOAD_PATH, u as discoverTarget } from "./routes-Ctumc6oY.js";
|
|
2
2
|
//#region src/auto-start.ts
|
|
3
3
|
/**
|
|
4
4
|
* The phone to start a server for, when agent-device runs on the machine that has x86Sim. That
|
|
@@ -19,7 +19,7 @@ async function findAutoTarget(endpoint, env, device, platform = process.platform
|
|
|
19
19
|
throw error;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
const loadStartServer = async (options) => (await import("./start-server-
|
|
22
|
+
const loadStartServer = async (options) => (await import("./start-server-C92g1pGb.js").then((n) => n.n)).startServer(options);
|
|
23
23
|
/** One server for the daemon, started on the first session and closed with the plugin. */
|
|
24
24
|
function createAutoServer(start = loadStartServer) {
|
|
25
25
|
let running;
|
|
@@ -156,6 +156,28 @@ function createConnection(options) {
|
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
158
|
//#endregion
|
|
159
|
+
//#region src/upload-app.ts
|
|
160
|
+
/**
|
|
161
|
+
* `install` from another machine: the app goes to the server, which unpacks it next to x86Sim
|
|
162
|
+
* and answers the path that the engine then installs.
|
|
163
|
+
*/
|
|
164
|
+
function uploadApp(endpoint) {
|
|
165
|
+
return async ({ appPath, signal }) => {
|
|
166
|
+
const url = new URL(APP_UPLOAD_PATH.slice(1), String(endpoint).replace(/\/*$/, "/"));
|
|
167
|
+
const response = await fetch(url, {
|
|
168
|
+
method: "POST",
|
|
169
|
+
headers: { "content-type": "application/zip" },
|
|
170
|
+
body: new Uint8Array(await appArchive(appPath)),
|
|
171
|
+
...signal ? { signal } : {}
|
|
172
|
+
});
|
|
173
|
+
const body = await response.json().catch(() => void 0);
|
|
174
|
+
if (response.status === 404 && body?.value?.error === "unknown command") throw new Error(`The x86Sim server at ${url.origin} takes no app uploads. Update agent-device-x86sim where \`serve\` runs, then start it again.`);
|
|
175
|
+
const staged = body?.value?.appPath;
|
|
176
|
+
if (!response.ok || typeof staged !== "string") throw new Error(`The x86Sim server refused the app: ${body?.value?.message ?? response.statusText}`);
|
|
177
|
+
return { appReference: staged };
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
//#endregion
|
|
159
181
|
//#region src/index.ts
|
|
160
182
|
/**
|
|
161
183
|
* The server answers only the routes behind these operations, so the rest are marked
|
|
@@ -211,10 +233,12 @@ function x86sim(options = {}) {
|
|
|
211
233
|
capabilityOverrides: CAPABILITY_OVERRIDES,
|
|
212
234
|
prepareSession: async ({ base, req }) => {
|
|
213
235
|
const target = await findAutoTarget(options.endpoint, host.env, chosenPhone(req?.flags?.device));
|
|
214
|
-
|
|
236
|
+
const endpoint = target ? await auto.endpoint(target) : base.endpoint;
|
|
237
|
+
return {
|
|
215
238
|
...base,
|
|
216
|
-
endpoint
|
|
217
|
-
|
|
239
|
+
endpoint,
|
|
240
|
+
uploadApp: uploadApp(endpoint)
|
|
241
|
+
};
|
|
218
242
|
}
|
|
219
243
|
},
|
|
220
244
|
dispose: () => auto.close()
|