shellway 0.8.9 → 0.8.10
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/package.json +1 -1
- package/shellway.js +15 -3
package/package.json
CHANGED
package/shellway.js
CHANGED
|
@@ -10,7 +10,7 @@ import { readFile, writeFile, appendFile, readdir, stat, lstat, mkdir, rename, c
|
|
|
10
10
|
import { createServer as netServer, connect as netConnect } from 'node:net';
|
|
11
11
|
import { randomBytes, timingSafeEqual, createHash } from 'node:crypto';
|
|
12
12
|
|
|
13
|
-
const AGENT_VERSION = '0.8.
|
|
13
|
+
const AGENT_VERSION = '0.8.10'; // keep equal to agent/package.json
|
|
14
14
|
if (Number(process.versions.node.split('.')[0]) < 22) {
|
|
15
15
|
console.error(`Shellway needs Node.js 22 or newer (you have ${process.versions.node}). Get it at https://nodejs.org`);
|
|
16
16
|
process.exit(1);
|
|
@@ -1349,8 +1349,17 @@ async function refPoint(s, ref, text) {
|
|
|
1349
1349
|
for (const e of __all(sel)) { const r = e.getBoundingClientRect(); if (r.width < 1 || r.height < 1) continue;
|
|
1350
1350
|
const l = (e.getAttribute('aria-label') || e.innerText || e.value || e.getAttribute('placeholder') || e.getAttribute('title') || hostLabel(e) || '').replace(/\\s+/g, ' ').trim().toLowerCase();
|
|
1351
1351
|
if (l === want) return e; if (!partial && l && l.includes(want)) partial = e; } return partial; })()`;
|
|
1352
|
-
|
|
1353
|
-
|
|
1352
|
+
// 0.8.10 (owner's live test 29 Nov): on pages with CSS "scroll-behavior: smooth" the scroll was still moving when the
|
|
1353
|
+
// position was measured, so a click on an item below the fold landed on the old spot and did nothing (the Check line
|
|
1354
|
+
// showed NO CHANGE). Scroll instantly, then measure again a moment later and use the item's final position.
|
|
1355
|
+
const r0 = await evalJs(s, `(() => { ${DEEP_JS} const e = ${pick}; if (!e) return null; window.__swPick = e; e.scrollIntoView({ block: 'center', inline: 'center', behavior: 'instant' }); return true; })()`);
|
|
1356
|
+
let r = null;
|
|
1357
|
+
if (r0) {
|
|
1358
|
+
await sleep(120);
|
|
1359
|
+
r = await evalJs(s, `(() => { const e = window.__swPick; if (!e || !e.isConnected) return null; let b = e.getBoundingClientRect();
|
|
1360
|
+
if (b.bottom < 0 || b.top > innerHeight || b.right < 0 || b.left > innerWidth) { e.scrollIntoView({ block: 'center', inline: 'center', behavior: 'instant' }); b = e.getBoundingClientRect(); }
|
|
1361
|
+
const tag = e.tagName.toLowerCase(); return { x: b.left + b.width / 2, y: b.top + b.height / 2, tag, type: (e.getAttribute('type') || '').toLowerCase() }; })()`);
|
|
1362
|
+
}
|
|
1354
1363
|
if (!r) throw new Error(ref !== undefined && ref !== null && ref !== '' ? `Item [${ref}] was not found: the page has changed. Call browser_read again for fresh numbers.` : `No clickable item with the text "${text}" was found. Call browser_read to see what is on the page.`);
|
|
1355
1364
|
return r;
|
|
1356
1365
|
}
|
|
@@ -1442,6 +1451,9 @@ function proofText(b, a, what) {
|
|
|
1442
1451
|
const noisy = b.noise > 0;
|
|
1443
1452
|
if (upd > 0) ch.push(`${upd} update${upd > 1 ? 's' : ''} inside the page${noisy ? ` (the page also changes by itself: ${b.noise} in 0.3 s before the ${what}, so this alone proves nothing)` : ''}`);
|
|
1444
1453
|
const real = ch.length > (upd > 0 && noisy ? 1 : 0);
|
|
1454
|
+
// 0.8.10 (owner's live test on claude.ai): a missed click still caused a few page updates (hover effects), and the
|
|
1455
|
+
// Check said "had an effect". Updates alone are now reported as a weak sign, not as proof.
|
|
1456
|
+
if (real && upd > 0 && ch.length === 1) return `Check: only a small change after the ${what}: ${upd} update${upd > 1 ? 's' : ''} inside the page, same address and title${b.ref ? ', the item looks the same' : ''}. That can be a hover effect rather than the ${what} itself: if you expected a new page, a dialog or a changed item, confirm with browser_read before relying on it.`;
|
|
1445
1457
|
return real ? `Check: the ${what} had an effect: ${ch.join('; ')}.`
|
|
1446
1458
|
: `Check: NO CHANGE DETECTED after the ${what}${upd > 0 ? ` (only ${ch.join('; ')})` : ''}: same page, same address and title${b.ref ? ', the item looks the same' : ''}. It may not have worked, or it changed something this check cannot see (a download, a canvas, another tab or window). Confirm with browser_read or browser_screenshot before relying on it.`;
|
|
1447
1459
|
}
|