@e2e-dev/mobile 0.12.4 → 0.12.5-nightly-20261026030534

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/dist/.build.json CHANGED
@@ -1 +1 @@
1
- {"version":"0.12.4"}
1
+ {"version":"0.12.5-nightly-20261026030534"}
package/dist/options.d.ts CHANGED
@@ -38,8 +38,9 @@ export interface MobileOptions {
38
38
  * is a pool: the engine declares one worker per entry and worker slot `n`
39
39
  * drives the `n`th, so `workers` at or above the pool size runs the target's
40
40
  * files across every device at once. Omitted, the pool is every booted device
41
- * of the platform at `prepare`, as many as the run has slots; with none
42
- * booted, agent-device boots one. A `DeviceProvider` leases hosted devices
41
+ * of the platform at `prepare` that no other agent-device session holds, as
42
+ * many as the run has slots; with none booted, agent-device boots one, and
43
+ * with every booted one held, `prepare` fails. A `DeviceProvider` leases hosted devices
43
44
  * instead: one per worker slot at `prepare`, each driven through the daemon
44
45
  * and client configuration the lease names. A replacement worker resumes a
45
46
  * healthy agent-device session on the same lease. Forced worker shutdown
package/dist/pool.d.ts CHANGED
@@ -2,8 +2,9 @@
2
2
  * The devices one target drives: one simulator or emulator per worker slot,
3
3
  * each under its own agent-device session. A named `device` is a pool of one
4
4
  * and a list a pool of many; with no `device` the pool is every booted device
5
- * of the platform, discovered in `prepare`; a `DeviceProvider` leases one
6
- * hosted device per slot instead. Each is a `DeviceSource`; `prepare` binds
5
+ * of the platform no other agent-device session holds, discovered in
6
+ * `prepare`; a `DeviceProvider` leases one hosted device per slot instead.
7
+ * Each is a `DeviceSource`; `prepare` binds
7
8
  * one `SlotBinding` per slot from it, warms each once per run before any
8
9
  * worker exists, and hands the bindings to the workers through the run's
9
10
  * environment. The worker that owns a slot then resumes its session in
package/dist/pool.js CHANGED
@@ -2,8 +2,9 @@
2
2
  * The devices one target drives: one simulator or emulator per worker slot,
3
3
  * each under its own agent-device session. A named `device` is a pool of one
4
4
  * and a list a pool of many; with no `device` the pool is every booted device
5
- * of the platform, discovered in `prepare`; a `DeviceProvider` leases one
6
- * hosted device per slot instead. Each is a `DeviceSource`; `prepare` binds
5
+ * of the platform no other agent-device session holds, discovered in
6
+ * `prepare`; a `DeviceProvider` leases one hosted device per slot instead.
7
+ * Each is a `DeviceSource`; `prepare` binds
7
8
  * one `SlotBinding` per slot from it, warms each once per run before any
8
9
  * worker exists, and hands the bindings to the workers through the run's
9
10
  * environment. The worker that owns a slot then resumes its session in
@@ -60,7 +61,11 @@ class ConfiguredDevices {
60
61
  return this.fallback.slice(0, Math.min(info.slots, this.size));
61
62
  }
62
63
  }
63
- /** Every booted device of the platform, as many as the run has slots; with none booted, one slot the daemon fills. */
64
+ /**
65
+ * Every booted device of the platform no other agent-device session holds, as
66
+ * many as the run has slots; with none booted, one slot the daemon fills. A
67
+ * device held by one of this target's own slot sessions stays in the pool.
68
+ */
64
69
  class BootedDevices {
65
70
  platform;
66
71
  createClient;
@@ -72,15 +77,22 @@ class BootedDevices {
72
77
  }
73
78
  async bind(info) {
74
79
  const booted = await this.inventory(info.targetName, info.signal);
75
- const chosen = booted.slice(0, info.slots);
80
+ const own = new Set(Array.from({ length: info.slots }, (_, slot) => this.session(info.targetName, slot)));
81
+ const held = booted.filter((device) => device.claimedBy !== undefined && !own.has(device.claimedBy));
82
+ const chosen = booted.filter((device) => !held.includes(device)).slice(0, info.slots);
83
+ const heldBy = held.map((device) => `${device.name} by session "${device.claimedBy}"`).join(', ');
84
+ if (chosen.length === 0 && held.length > 0) {
85
+ throw new EngineError('ENGINE_FAILURE', `every booted ${this.platform} device is held by another agent-device session (${heldBy}); boot another one, close a holding session, or name the device in the target's \`device\` option`, { retryable: false });
86
+ }
76
87
  if (chosen.length === 0) {
77
88
  info.log(`no booted ${this.platform} device; agent-device boots one`);
78
89
  return [{}];
79
90
  }
80
- info.log(`${booted.length} booted ${this.platform} device(s); driving ${chosen.length}: ${chosen.map((device) => device.name).join(', ')}`);
91
+ const skipped = held.length === 0 ? '' : `, skipping ${held.length} held by another agent-device session (${heldBy})`;
92
+ info.log(`${booted.length} booted ${this.platform} device(s)${skipped}; driving ${chosen.length}: ${chosen.map((device) => device.name).join(', ')}`);
81
93
  return chosen.map((device) => ({ deviceId: device.id }));
82
94
  }
83
- /** Every booted device of the platform, by stable id and name, in agent-device's inventory order. */
95
+ /** Every booted device of the platform, by stable id and name, with the session holding it, in agent-device's inventory order. */
84
96
  async inventory(targetName, signal) {
85
97
  const client = this.createClient(this.session(targetName, 0));
86
98
  const inventory = await runCommand('devices', () => client.devices.list({ platform: this.platform }), signal);
@@ -92,7 +104,14 @@ class BootedDevices {
92
104
  device.booted === true &&
93
105
  device.platform === this.platform &&
94
106
  typeof device.id === 'string')
95
- .map((device) => ({ id: device.id, name: typeof device.name === 'string' ? device.name : device.id }));
107
+ .map((device) => {
108
+ const session = device.claimedBy?.session;
109
+ return obj({
110
+ id: device.id,
111
+ name: typeof device.name === 'string' ? device.name : device.id,
112
+ claimedBy: typeof session === 'string' ? session : undefined,
113
+ });
114
+ });
96
115
  }
97
116
  }
98
117
  export class DevicePool {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e2e-dev/mobile",
3
- "version": "0.12.4",
3
+ "version": "0.12.5-nightly-20261026030534",
4
4
  "description": "Mobile engine (iOS and Android) for e2e agentic end-to-end testing, built on agent-device",
5
5
  "keywords": [
6
6
  "e2e",
@@ -57,7 +57,7 @@
57
57
  },
58
58
  "peerDependencies": {
59
59
  "ai": "^7.0.0",
60
- "e2e": ">=0.15.0 <1"
60
+ "e2e": "0.21.4-nightly-20261026030534"
61
61
  },
62
62
  "peerDependenciesMeta": {
63
63
  "ai": {
@@ -68,7 +68,7 @@
68
68
  "@types/node": "26.6.2",
69
69
  "@types/pngjs": "6.0.5",
70
70
  "ai": "7.0.107",
71
- "e2e": "0.21.3",
71
+ "e2e": "0.21.4-nightly-20261026030534",
72
72
  "typescript": "7.0.2",
73
73
  "vitest": "5.0.1"
74
74
  },