rnxsim 0.1.457 → 0.1.459

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.
Files changed (61) hide show
  1. package/cli/bridge-flow-runner.ts +13 -10
  2. package/cli/commands/inspect/actions.ts +20 -127
  3. package/cli/commands/inspect/core.ts +4 -19
  4. package/cli/commands/inspect/keyboard.ts +1 -0
  5. package/cli/commands/inspect/resolve-target.ts +3 -1
  6. package/cli/commands/inspect.ts +2 -0
  7. package/detox/index.ts +12 -1
  8. package/dist-lib/agent-daemon-client.cjs +1 -1
  9. package/dist-lib/agent-events.cjs +1 -1
  10. package/dist-lib/agent-identity.cjs +1 -1
  11. package/dist-lib/agent-sessions.cjs +1 -1
  12. package/dist-lib/attached-projects.cjs +1 -1
  13. package/dist-lib/auth/shared-session.cjs +1 -1
  14. package/dist-lib/backend-origin.cjs +1 -1
  15. package/dist-lib/beta.cjs +1 -1
  16. package/dist-lib/beta.mjs +1 -1
  17. package/dist-lib/bridge-constants.cjs +1 -1
  18. package/dist-lib/bridge-contract-input.cjs +24 -3
  19. package/dist-lib/bridge-contract-input.mjs +22 -2
  20. package/dist-lib/bridge-contract.cjs +1 -1
  21. package/dist-lib/bridge-contract.mjs +1 -1
  22. package/dist-lib/capture-contract.cjs +1 -1
  23. package/dist-lib/capture-contract.mjs +1 -1
  24. package/dist-lib/cli-constants.cjs +1 -1
  25. package/dist-lib/cloud-contract.cjs +1 -1
  26. package/dist-lib/cloud-contract.mjs +1 -1
  27. package/dist-lib/cloud.cjs +1 -1
  28. package/dist-lib/cloud.mjs +1 -1
  29. package/dist-lib/config.cjs +1 -1
  30. package/dist-lib/detox/index.cjs +15 -2
  31. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  32. package/dist-lib/home-paths.cjs +1 -1
  33. package/dist-lib/host/bridge-host.cjs +1 -1
  34. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  35. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  36. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  37. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  38. package/dist-lib/host/websocket-proxy.cjs +1 -1
  39. package/dist-lib/index.cjs +26 -72
  40. package/dist-lib/jump-to-source-babel.cjs +1 -1
  41. package/dist-lib/jump-to-source-native.cjs +1 -1
  42. package/dist-lib/menu.cjs +1 -1
  43. package/dist-lib/menu.mjs +1 -1
  44. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  45. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  46. package/dist-lib/metro-production-bundle.cjs +1 -1
  47. package/dist-lib/metro-production-bundle.mjs +1 -1
  48. package/dist-lib/metro.cjs +1 -1
  49. package/dist-lib/profiles.cjs +1 -1
  50. package/dist-lib/public-brand.cjs +1 -1
  51. package/dist-lib/react-native-host-modules.cjs +1 -1
  52. package/dist-lib/react-native-host-modules.mjs +1 -1
  53. package/dist-lib/render-mode.cjs +1 -1
  54. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  55. package/dist-lib/sdk.cjs +26 -72
  56. package/dist-lib/sdk.mjs +26 -72
  57. package/dist-lib/skills.cjs +788 -160
  58. package/dist-lib/vite.cjs +1 -1
  59. package/package.json +1 -1
  60. package/src/bridge-contract-input.ts +22 -2
  61. package/src/sim-client.ts +14 -2
package/dist-lib/sdk.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.457 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.459 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  var __defProp = Object.defineProperty;
3
3
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -1253,11 +1253,12 @@ async function resolveTargetCoords(bridge, target) {
1253
1253
  if (!isSimSemanticTree(semanticNodes) || typeof x !== "number" || !Number.isFinite(x) || typeof y !== "number" || !Number.isFinite(y)) {
1254
1254
  throw new Error("resolve returned an invalid result");
1255
1255
  }
1256
- const semanticMatch = semanticNodes[0];
1256
+ const semanticMatch = semanticNodes[1];
1257
1257
  if (!semanticMatch) throw new Error("resolve returned an invalid result");
1258
1258
  return {
1259
1259
  x,
1260
1260
  y,
1261
+ nodeId: semanticMatch.nodeId,
1261
1262
  testID: semanticMatch.testID ?? null,
1262
1263
  text: semanticMatch.text ?? (target.mode === "text" ? target.value : semanticMatch.label),
1263
1264
  type: semanticMatch.type
@@ -1469,34 +1470,6 @@ function offscreenPayload(cx, cy, screen) {
1469
1470
  }
1470
1471
  return { offscreen: true, screen };
1471
1472
  }
1472
- function geometryContains(geometry, x, y) {
1473
- return x >= geometry.x && y >= geometry.y && x <= geometry.x + geometry.width && y <= geometry.y + geometry.height;
1474
- }
1475
- function hitTestSemanticTree(nodes, x, y, ancestors = []) {
1476
- for (let index = nodes.length - 1; index >= 0; index--) {
1477
- const node = nodes[index];
1478
- if (!node || !geometryContains(node.geometry, x, y)) continue;
1479
- const childHit = node.children?.length ? hitTestSemanticTree(node.children, x, y, [...ancestors, node]) : null;
1480
- return childHit ?? { node, ancestors };
1481
- }
1482
- return null;
1483
- }
1484
- function nodeMatchesRequested(node, requested) {
1485
- if (typeof requested.nodeId === "number" && node.nodeId === requested.nodeId) {
1486
- return true;
1487
- }
1488
- if (requested.testID && node.testID === requested.testID) return true;
1489
- if (requested.id && node.testID === requested.id) return true;
1490
- return false;
1491
- }
1492
- function coveringNodeSummary(node) {
1493
- return {
1494
- nodeId: node.nodeId,
1495
- testID: node.testID ?? null,
1496
- text: node.text ?? node.label ?? null,
1497
- type: node.type
1498
- };
1499
- }
1500
1473
  var DEFAULT_AGENT_TIMING = {
1501
1474
  initialWaitMs: 3e3,
1502
1475
  deadlineMs: 5e3,
@@ -1523,9 +1496,10 @@ function isTapSuccess(result) {
1523
1496
  return true;
1524
1497
  }
1525
1498
  function tapTargetFromPayload(payload, textFallback) {
1499
+ const id = payload.target?.id ?? payload.match?.id ?? payload.node?.id;
1526
1500
  return {
1527
1501
  nodeId: payload.target?.nodeId ?? payload.match?.nodeId ?? payload.node?.nodeId ?? null,
1528
- id: payload.target?.id ?? payload.match?.id ?? payload.node?.id ?? null,
1502
+ id: typeof id === "string" ? id : null,
1529
1503
  testID: payload.target?.testID ?? payload.match?.testID ?? payload.node?.testID ?? null,
1530
1504
  text: payload.target?.text ?? payload.target?.accessibilityLabel ?? payload.match?.text ?? payload.match?.accessibilityLabel ?? payload.node?.text ?? textFallback ?? null,
1531
1505
  type: payload.target?.type ?? payload.match?.type ?? payload.node?.type ?? null
@@ -1583,36 +1557,17 @@ async function tapResolvedTarget(bridge, args) {
1583
1557
  } else {
1584
1558
  lastOffscreenAt = null;
1585
1559
  const requestedTarget = tapTargetFromPayload(payload, args.textFallback);
1586
- const { tree } = await inspectTree(bridge, 50);
1587
- let moved = false;
1588
- if (Array.isArray(tree) && tree.length > 0) {
1589
- const hit = hitTestSemanticTree(tree, payload.cx, payload.cy);
1590
- const matched = hit !== null && (nodeMatchesRequested(hit.node, requestedTarget) || hit.ancestors.some(
1591
- (ancestor) => nodeMatchesRequested(ancestor, requestedTarget)
1592
- ));
1593
- const blocks = hit !== null && (hit.node.type === "text" || hit.node.pressable === true || hit.ancestors.some((ancestor) => ancestor.pressable === true));
1594
- if (hit && !matched && blocks) {
1595
- moved = subtreeMatchesRequested(hit.node, requestedTarget);
1596
- lastResult = {
1597
- hit: false,
1598
- reason: moved ? "target-moved" : "target-covered",
1599
- requestedTarget,
1600
- coordinateTarget: coveringNodeSummary(hit.node)
1601
- };
1602
- if (!moved)
1603
- return { payload, result: lastResult, attempts, failure: "missed" };
1604
- }
1605
- }
1606
- if (!moved) {
1607
- const result = await tapCoordinates(
1608
- bridge,
1609
- payload.cx,
1610
- payload.cy,
1611
- requestedTarget
1612
- );
1613
- lastResult = result;
1614
- if (isTapSuccess(result)) return { payload, result, attempts };
1560
+ const result = await tapCoordinates(
1561
+ bridge,
1562
+ payload.cx,
1563
+ payload.cy,
1564
+ requestedTarget
1565
+ );
1566
+ lastResult = result;
1567
+ if (result?.requestedTargetMatched === false) {
1568
+ return { payload, result, attempts, failure: "missed" };
1615
1569
  }
1570
+ if (isTapSuccess(result)) return { payload, result, attempts };
1616
1571
  }
1617
1572
  }
1618
1573
  const remaining = deadline - Date.now();
@@ -1641,13 +1596,6 @@ async function tapResolvedTarget(bridge, args) {
1641
1596
  failure: lastPayload && typeof lastPayload.cx === "number" ? "missed" : "not-found"
1642
1597
  };
1643
1598
  }
1644
- function subtreeMatchesRequested(node, requested) {
1645
- for (const child of node.children ?? []) {
1646
- if (nodeMatchesRequested(child, requested) || subtreeMatchesRequested(child, requested))
1647
- return true;
1648
- }
1649
- return false;
1650
- }
1651
1599
  async function tapCoordinates(bridge, x, y, target) {
1652
1600
  return bridge.send({
1653
1601
  type: "tap",
@@ -1668,7 +1616,7 @@ function payloadFromResolved(resolved, match, extra = {}) {
1668
1616
  type: match.type ?? null
1669
1617
  },
1670
1618
  target: {
1671
- nodeId: match.nodeId ?? null,
1619
+ nodeId: resolved.nodeId ?? match.nodeId ?? null,
1672
1620
  id: resolved.testID ?? match.testID ?? null,
1673
1621
  testID: resolved.testID ?? match.testID ?? null,
1674
1622
  text: resolved.text ?? match.text ?? null,
@@ -1800,7 +1748,7 @@ async function tapBest(bridge, query, opts = {}) {
1800
1748
  ...payloadFromResolved(byId, byId),
1801
1749
  strategy: "testid",
1802
1750
  node: {
1803
- nodeId: null,
1751
+ nodeId: byId.nodeId ?? null,
1804
1752
  id: byId.testID ?? query,
1805
1753
  testID: byId.testID ?? query,
1806
1754
  type: byId.type ?? null,
@@ -1814,7 +1762,7 @@ async function tapBest(bridge, query, opts = {}) {
1814
1762
  ...payloadFromResolved(byText, byText),
1815
1763
  strategy: "text",
1816
1764
  node: {
1817
- nodeId: null,
1765
+ nodeId: byText.nodeId ?? null,
1818
1766
  id: byText.testID ?? null,
1819
1767
  testID: byText.testID ?? null,
1820
1768
  type: byText.type ?? null,
@@ -2133,11 +2081,16 @@ var SimClient = class {
2133
2081
  const { text, ...textOpts } = target;
2134
2082
  return this.throwUnlessTapped(await tapByText(this, text, textOpts), text);
2135
2083
  }
2136
- if ("testID" in target && typeof target.testID === "string") {
2084
+ if ("testID" in target && typeof target.testID === "string" && typeof target.nodeId !== "number") {
2137
2085
  return this.throwUnlessTapped(await tapById(this, target.testID), target.testID);
2138
2086
  }
2139
2087
  const coords = this.coordsForTapTarget(target);
2140
- const result = await this.send({ type: "tap", x: coords.x, y: coords.y });
2088
+ const result = await this.send({
2089
+ type: "tap",
2090
+ x: coords.x,
2091
+ y: coords.y,
2092
+ ..."nodeId" in target && typeof target.nodeId === "number" ? { target: { nodeId: target.nodeId } } : {}
2093
+ });
2141
2094
  if (!isTapSuccess(result)) {
2142
2095
  throw new SimTapError(
2143
2096
  `tap at ${coords.x},${coords.y} missed: ${JSON.stringify(result)}`
@@ -2200,6 +2153,7 @@ var SimClient = class {
2200
2153
  x: target.x,
2201
2154
  y: target.y,
2202
2155
  target: {
2156
+ nodeId: target.nodeId,
2203
2157
  testID: target.testID ?? void 0,
2204
2158
  text: target.text ?? void 0,
2205
2159
  type: target.type ?? void 0