@lynx-js/devtool-connector 0.16.3 → 0.16.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @lynx-js/devtool-connector
2
2
 
3
+ ## 0.16.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Refresh cached ref coordinates after unannotated screenshots change the host coordinate mode, preserving node identities and invalidating stale coordinates when capture fails.
8
+
9
+ ## 0.16.4
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependency `dprint` to `^0.63.0`.
14
+
3
15
  ## 0.16.3
4
16
 
5
17
  ### Patch Changes
package/dist/2.js CHANGED
@@ -1659,7 +1659,7 @@ const DAEMON_SHUTDOWN_PATH = `${DAEMON_WS_PATH}/shutdown`;
1659
1659
  const DAEMON_INSPECTOR_PATH = `${DAEMON_WS_PATH}/inspector`;
1660
1660
  const DAEMON_COMMAND_PATH_PREFIX = "/command/";
1661
1661
  var package_namespaceObject = {
1662
- rE: "0.16.3"
1662
+ rE: "0.16.5"
1663
1663
  };
1664
1664
  const CONNECTOR_VERSION = package_namespaceObject.rE;
1665
1665
  const node_modules_semver = __webpack_require__("../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/index.js");
package/dist/f.js CHANGED
@@ -5390,6 +5390,9 @@ class ActionCore {
5390
5390
  "Use `agent-lynx take-screenshot --fullscreen` for an unannotated fullscreen image."
5391
5391
  ]
5392
5392
  });
5393
+ const snapshotKey = this.#key(clientId, sessionId);
5394
+ const cached = this.#snapshots.get(snapshotKey);
5395
+ for (const key of this.#snapshots.keys())if (key.startsWith(`${clientId}:`)) this.#snapshots.delete(key);
5393
5396
  try {
5394
5397
  const capturedFrame = await captureScreenshotFrame(ctx.connector, clientId, sessionId, {
5395
5398
  fullscreen,
@@ -5429,6 +5432,42 @@ class ActionCore {
5429
5432
  viewport,
5430
5433
  refs
5431
5434
  });
5435
+ } else if (cached) {
5436
+ const { viewport, refs } = await buildSnapshotStructure(ctx.connector, clientId, sessionId, signal);
5437
+ const byNode = new Map(refs.map((ref)=>[
5438
+ ref.nodeId,
5439
+ ref
5440
+ ]));
5441
+ const byBackend = new Map(refs.filter((ref)=>void 0 !== ref.backendNodeId).map((ref)=>[
5442
+ ref.backendNodeId,
5443
+ ref
5444
+ ]));
5445
+ const updated = cached.refs.flatMap((ref)=>{
5446
+ const live = (void 0 === ref.backendNodeId ? void 0 : byBackend.get(ref.backendNodeId)) ?? byNode.get(ref.nodeId);
5447
+ if (!live || !sameSnapshotNode(ref, live)) return [];
5448
+ const refreshed = {
5449
+ ...ref,
5450
+ ...live,
5451
+ ref: ref.ref,
5452
+ text: ref.text,
5453
+ attributes: ref.attributes,
5454
+ flags: {
5455
+ ...ref.flags,
5456
+ visible: ref.flags.visible && live.flags.visible,
5457
+ offscreen: live.flags.offscreen
5458
+ }
5459
+ };
5460
+ if (void 0 === ref.parentRef) delete refreshed.parentRef;
5461
+ else refreshed.parentRef = ref.parentRef;
5462
+ return [
5463
+ refreshed
5464
+ ];
5465
+ });
5466
+ this.#snapshots.set(snapshotKey, {
5467
+ createdAt: Date.now(),
5468
+ viewport,
5469
+ refs: updated
5470
+ });
5432
5471
  }
5433
5472
  let annotated;
5434
5473
  if (snapshot?.viewport && frameBounds) try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/devtool-connector",
3
- "version": "0.16.3",
3
+ "version": "0.16.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lynx-community/skills.git",
@@ -59,7 +59,7 @@
59
59
  "@types/ws": "^8.18.2",
60
60
  "@yume-chan/adb-server-node-tcp": "3.0.0-beta.4",
61
61
  "@yume-chan/stream-extra": "3.0.0-beta.4",
62
- "dprint": "^0.62.0",
62
+ "dprint": "^0.63.0",
63
63
  "jpeg-js": "^0.4.4",
64
64
  "obug": "^2.2.1",
65
65
  "plist": "^5.0.0",
@@ -74,7 +74,7 @@
74
74
  "license": "Apache-2.0",
75
75
  "scripts": {
76
76
  "build": "rslib build",
77
- "test": "node --test --test-concurrency=1 'test/**/*.test.ts'",
77
+ "test": "node --test --test-concurrency=1 \"test/**/*.test.ts\"",
78
78
  "test:e2e": "node --test --test-concurrency=1 'e2e/**/*.test.ts'",
79
79
  "test:e2e:public": "node --test --test-concurrency=1 'e2e/public/**/*.test.ts'",
80
80
  "format:check": "dprint check --config dprint.jsonc",