@e2e-dev/mobile 0.12.4-nightly-20261022080215 → 0.12.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.
package/README.md CHANGED
@@ -39,7 +39,7 @@ export default {
39
39
  workers: 1,
40
40
  agents: {
41
41
  default: {
42
- model: gateway('openai/gpt-5.6-luna'),
42
+ model: gateway('openai/gpt-6-luna-fast'),
43
43
  tools: mobileTools(iphone, pixel),
44
44
  },
45
45
  },
package/dist/.build.json CHANGED
@@ -1 +1 @@
1
- {"version":"0.12.4-nightly-20261022080215"}
1
+ {"version":"0.12.4"}
package/dist/locate.js CHANGED
@@ -10,6 +10,13 @@ import { compileSelector } from './selector.js';
10
10
  /** Resolves one expression to the nodes it currently matches; `platform` is the one agent-device selectors match for. */
11
11
  export function resolveExpression(expression, index, platform) {
12
12
  switch (expression.kind) {
13
+ case 'union': {
14
+ const matches = new Set([
15
+ ...resolveExpression(expression.left, index, platform),
16
+ ...resolveExpression(expression.right, index, platform),
17
+ ]);
18
+ return index.filter((entry) => matches.has(entry));
19
+ }
13
20
  case 'query': {
14
21
  const candidates = expression.scope === undefined ? index : descendantsOf(resolveExpression(expression.scope, index, platform), index);
15
22
  const full = candidates.filter((entry) => matchesQuery(entry, expression.query, false));
package/dist/surface.d.ts CHANGED
@@ -113,8 +113,10 @@ export declare class AgentDeviceSurface {
113
113
  /**
114
114
  * The screen's logical size as last learned from a snapshot with geometry
115
115
  * or from the device itself, so a snapshot without geometry (an empty
116
- * screen before any app is open, a sparse tree) still reports the viewport
117
- * every observation must carry.
116
+ * screen before any app is open, a sparse tree) or with an app drawn
117
+ * smaller than the screen still reports the viewport every observation
118
+ * must carry. A rotation replaces it; any other size needs the device's
119
+ * screen to agree, see `viewportFor`.
118
120
  */
119
121
  private knownViewport;
120
122
  constructor(options: MobileOptions, createClient: ClientFactory);
@@ -277,13 +279,27 @@ export declare class AgentDeviceSurface {
277
279
  * reason instead, so a wait that ends on an unreadable screen says so.
278
280
  */
279
281
  private locateSnapshot;
282
+ /**
283
+ * Projects a snapshot and learns its viewport when it is plainly the
284
+ * screen's: the first one the session reads, the one it knows, or that one
285
+ * rotated. A tree of any other size may be an app drawn smaller than the
286
+ * screen (behind Notification Center, iOS shrinks it to a third), so an
287
+ * observation's `viewportFor` checks it against the device before it
288
+ * replaces the known one.
289
+ */
280
290
  private project;
281
291
  /**
282
- * The viewport of a snapshot: its own geometry, else the last one this
283
- * session learned, else the device's logical screen size read off one
284
- * screenshot. A device whose size cannot be learned fails the observation:
285
- * the harness measures every rect and point against the viewport, so an
286
- * invented one would misplace every tap.
292
+ * The viewport of a snapshot: its own geometry when that is the screen,
293
+ * else the last one this session learned, else the device's logical screen
294
+ * size read off one screenshot. A tree whose size is neither the known one
295
+ * nor that one rotated replaces it only when the screenshot's size, in
296
+ * either orientation, agrees: a screenshot reports the portrait size even
297
+ * in landscape, so it confirms a size but cannot pick the orientation. Only
298
+ * a simulator's screenshot reports a logical size; on a real device the
299
+ * tree's size is taken as it comes. A device whose size cannot be learned
300
+ * at all fails the observation: the harness
301
+ * measures every rect and point against the viewport, so an invented one
302
+ * would misplace every tap.
287
303
  */
288
304
  private viewportFor;
289
305
  /** The device's logical screen size as its screenshot reports it; undefined when it reports none. */
package/dist/surface.js CHANGED
@@ -93,6 +93,11 @@ function isTruncated(raw) {
93
93
  * the action are acted on at once.
94
94
  */
95
95
  const DEFAULT_TRANSITION_MS = 500;
96
+ /** Whether two viewports are one screen, in the same orientation or rotated; rects from the tree carry fractions. */
97
+ function sameScreen(a, b) {
98
+ const near = (x, y) => Math.abs(x - y) < 1;
99
+ return (near(a.width, b.width) && near(a.height, b.height)) || (near(a.width, b.height) && near(a.height, b.width));
100
+ }
96
101
  /** The centre of a rect in logical pixels. */
97
102
  function centreOf(rect) {
98
103
  return { x: rect.x + rect.width / 2, y: rect.y + rect.height / 2 };
@@ -248,8 +253,10 @@ export class AgentDeviceSurface {
248
253
  /**
249
254
  * The screen's logical size as last learned from a snapshot with geometry
250
255
  * or from the device itself, so a snapshot without geometry (an empty
251
- * screen before any app is open, a sparse tree) still reports the viewport
252
- * every observation must carry.
256
+ * screen before any app is open, a sparse tree) or with an app drawn
257
+ * smaller than the screen still reports the viewport every observation
258
+ * must carry. A rotation replaces it; any other size needs the device's
259
+ * screen to agree, see `viewportFor`.
253
260
  */
254
261
  knownViewport;
255
262
  constructor(options, createClient) {
@@ -754,6 +761,14 @@ export class AgentDeviceSurface {
754
761
  return undefined;
755
762
  }
756
763
  }
764
+ /**
765
+ * Projects a snapshot and learns its viewport when it is plainly the
766
+ * screen's: the first one the session reads, the one it knows, or that one
767
+ * rotated. A tree of any other size may be an app drawn smaller than the
768
+ * screen (behind Notification Center, iOS shrinks it to a third), so an
769
+ * observation's `viewportFor` checks it against the device before it
770
+ * replaces the known one.
771
+ */
757
772
  project(raw) {
758
773
  const projected = projectSnapshot(raw.nodes ?? [], {
759
774
  mintId: () => {
@@ -763,21 +778,38 @@ export class AgentDeviceSurface {
763
778
  viewport: raw.viewport,
764
779
  });
765
780
  this.latestIndex = projected.index;
766
- if (projected.viewport !== undefined)
767
- this.knownViewport = projected.viewport;
781
+ const read = projected.viewport;
782
+ if (read !== undefined && (this.knownViewport === undefined || sameScreen(read, this.knownViewport)))
783
+ this.knownViewport = read;
768
784
  return projected;
769
785
  }
770
786
  /**
771
- * The viewport of a snapshot: its own geometry, else the last one this
772
- * session learned, else the device's logical screen size read off one
773
- * screenshot. A device whose size cannot be learned fails the observation:
774
- * the harness measures every rect and point against the viewport, so an
775
- * invented one would misplace every tap.
787
+ * The viewport of a snapshot: its own geometry when that is the screen,
788
+ * else the last one this session learned, else the device's logical screen
789
+ * size read off one screenshot. A tree whose size is neither the known one
790
+ * nor that one rotated replaces it only when the screenshot's size, in
791
+ * either orientation, agrees: a screenshot reports the portrait size even
792
+ * in landscape, so it confirms a size but cannot pick the orientation. Only
793
+ * a simulator's screenshot reports a logical size; on a real device the
794
+ * tree's size is taken as it comes. A device whose size cannot be learned
795
+ * at all fails the observation: the harness
796
+ * measures every rect and point against the viewport, so an invented one
797
+ * would misplace every tap.
776
798
  */
777
799
  async viewportFor(projected, signal) {
778
- const known = projected.viewport ?? this.knownViewport;
779
- if (known !== undefined)
780
- return known;
800
+ const read = projected.viewport;
801
+ const known = this.knownViewport;
802
+ if (known !== undefined) {
803
+ if (read === undefined)
804
+ return known;
805
+ if (!sameScreen(read, known)) {
806
+ const probed = await this.probeViewport(signal);
807
+ if (probed !== undefined && !sameScreen(read, probed))
808
+ return known;
809
+ }
810
+ this.knownViewport = read;
811
+ return read;
812
+ }
781
813
  const probed = await this.probeViewport(signal);
782
814
  if (probed === undefined) {
783
815
  throw new EngineError('ENGINE_FAILURE', 'the device reported no screen geometry: the snapshot has no bounds and the screenshot no logical size, so the viewport is unknown', { retryable: false });
@@ -831,7 +863,7 @@ export class AgentDeviceSurface {
831
863
  */
832
864
  traceScreen(raw, projected) {
833
865
  const sink = this.screenSink;
834
- const viewport = projected.viewport ?? this.knownViewport;
866
+ const viewport = this.knownViewport;
835
867
  if (sink === undefined || viewport === undefined)
836
868
  return;
837
869
  const location = screenLocation(raw.appBundleId ?? raw.appName ?? this.appIdentity, screenTitle(projected));
@@ -1314,7 +1346,7 @@ export class AgentDeviceSurface {
1314
1346
  };
1315
1347
  const projected = this.project(await this.snapshotOrEmpty(operation, false));
1316
1348
  const data = await this.rawScreenshot(signal);
1317
- const masked = redactSecure(data, projected, projected.viewport ?? this.knownViewport);
1349
+ const masked = redactSecure(data, projected, this.knownViewport);
1318
1350
  if (masked === undefined) {
1319
1351
  throw new EngineError('ENGINE_FAILURE', 'a secure field on screen could not be masked; screenshot withheld', {
1320
1352
  retryable: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e2e-dev/mobile",
3
- "version": "0.12.4-nightly-20261022080215",
3
+ "version": "0.12.4",
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.21.3-nightly-20261022080215"
60
+ "e2e": ">=0.15.0 <1"
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-nightly-20261022080215",
71
+ "e2e": "0.21.3",
72
72
  "typescript": "7.0.2",
73
73
  "vitest": "5.0.1"
74
74
  },