@riddledc/riddle-proof 0.7.161 → 0.7.162

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.
@@ -5738,106 +5738,79 @@ async function executeSetupAction(action, ordinal, viewport) {
5738
5738
  const durationMs = setupNumber(action.duration_ms ?? action.durationMs, 0);
5739
5739
  const pointerType = String(action.pointer_type || action.pointerType || "mouse").trim().toLowerCase();
5740
5740
  if (pointerType === "touch" || pointerType === "pen") {
5741
- const localStart = {
5742
- x: coordinate(fromX, box.width),
5743
- y: coordinate(fromY, box.height),
5744
- };
5745
- const localEnd = {
5746
- x: coordinate(toX, box.width),
5747
- y: coordinate(toY, box.height),
5748
- };
5749
- await target.evaluate(async (element, payload) => {
5750
- const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
5751
- const rect = element.getBoundingClientRect();
5752
- const pointerId = payload.pointerType === "touch" ? 11 : 12;
5753
- const capturedPointers = new Set();
5754
- const originalOwnSetPointerCapture = Object.getOwnPropertyDescriptor(element, "setPointerCapture");
5755
- const originalOwnReleasePointerCapture = Object.getOwnPropertyDescriptor(element, "releasePointerCapture");
5756
- const originalOwnHasPointerCapture = Object.getOwnPropertyDescriptor(element, "hasPointerCapture");
5757
- const originalSetPointerCapture = typeof element.setPointerCapture === "function" ? element.setPointerCapture.bind(element) : undefined;
5758
- const originalReleasePointerCapture = typeof element.releasePointerCapture === "function" ? element.releasePointerCapture.bind(element) : undefined;
5759
- const originalHasPointerCapture = typeof element.hasPointerCapture === "function" ? element.hasPointerCapture.bind(element) : undefined;
5760
- const restorePointerCapture = () => {
5761
- if (originalOwnSetPointerCapture) Object.defineProperty(element, "setPointerCapture", originalOwnSetPointerCapture);
5762
- else delete (element as any).setPointerCapture;
5763
- if (originalOwnReleasePointerCapture) Object.defineProperty(element, "releasePointerCapture", originalOwnReleasePointerCapture);
5764
- else delete (element as any).releasePointerCapture;
5765
- if (originalOwnHasPointerCapture) Object.defineProperty(element, "hasPointerCapture", originalOwnHasPointerCapture);
5766
- else delete (element as any).hasPointerCapture;
5767
- };
5768
- Object.defineProperty(element, "setPointerCapture", {
5769
- configurable: true,
5770
- value: (activePointerId) => {
5771
- capturedPointers.add(activePointerId);
5772
- try {
5773
- return originalSetPointerCapture?.(activePointerId);
5774
- } catch {
5775
- return undefined;
5776
- }
5777
- },
5778
- });
5779
- Object.defineProperty(element, "releasePointerCapture", {
5780
- configurable: true,
5781
- value: (activePointerId) => {
5782
- capturedPointers.delete(activePointerId);
5783
- try {
5784
- return originalReleasePointerCapture?.(activePointerId);
5785
- } catch {
5786
- return undefined;
5787
- }
5788
- },
5789
- });
5790
- Object.defineProperty(element, "hasPointerCapture", {
5791
- configurable: true,
5792
- value: (activePointerId) => {
5793
- if (capturedPointers.has(activePointerId)) return true;
5794
- try {
5795
- return Boolean(originalHasPointerCapture?.(activePointerId));
5796
- } catch {
5797
- return false;
5798
- }
5799
- },
5800
- });
5801
- const point = (progress) => ({
5802
- clientX: rect.left + payload.start.x + (payload.end.x - payload.start.x) * progress,
5803
- clientY: rect.top + payload.start.y + (payload.end.y - payload.start.y) * progress,
5804
- });
5805
- const dispatch = (type, progress) => {
5806
- const coords = point(progress);
5807
- element.dispatchEvent(new PointerEvent(type, {
5808
- bubbles: true,
5809
- cancelable: true,
5810
- composed: true,
5811
- pointerId,
5812
- pointerType: payload.pointerType,
5813
- isPrimary: true,
5814
- buttons: type === "pointerup" ? 0 : 1,
5815
- button: type === "pointerup" ? 0 : 0,
5816
- clientX: coords.clientX,
5817
- clientY: coords.clientY,
5818
- }));
5819
- };
5820
- try {
5821
- dispatch("pointerover", 0);
5822
- dispatch("pointerenter", 0);
5823
- dispatch("pointerdown", 0);
5824
- for (let step = 1; step <= payload.steps; step += 1) {
5825
- dispatch("pointermove", step / payload.steps);
5826
- if (payload.durationMs && payload.steps > 1) await wait(payload.durationMs / payload.steps);
5741
+ const client = await page.context().newCDPSession(page);
5742
+ try {
5743
+ if (pointerType === "touch") {
5744
+ const touchPoint = (x, y) => ({
5745
+ x,
5746
+ y,
5747
+ radiusX: 1,
5748
+ radiusY: 1,
5749
+ force: 1,
5750
+ id: 11,
5751
+ });
5752
+ await client.send("Input.dispatchTouchEvent", {
5753
+ type: "touchStart",
5754
+ touchPoints: [touchPoint(start.x, start.y)],
5755
+ });
5756
+ for (let step = 1; step <= steps; step += 1) {
5757
+ const progress = step / steps;
5758
+ await client.send("Input.dispatchTouchEvent", {
5759
+ type: "touchMove",
5760
+ touchPoints: [
5761
+ touchPoint(
5762
+ start.x + (end.x - start.x) * progress,
5763
+ start.y + (end.y - start.y) * progress,
5764
+ ),
5765
+ ],
5766
+ });
5767
+ if (durationMs && steps > 1) await page.waitForTimeout(durationMs / steps);
5768
+ }
5769
+ await client.send("Input.dispatchTouchEvent", {
5770
+ type: "touchEnd",
5771
+ touchPoints: [],
5772
+ });
5773
+ } else {
5774
+ await client.send("Input.dispatchMouseEvent", {
5775
+ type: "mouseMoved",
5776
+ x: start.x,
5777
+ y: start.y,
5778
+ pointerType: "pen",
5779
+ });
5780
+ await client.send("Input.dispatchMouseEvent", {
5781
+ type: "mousePressed",
5782
+ x: start.x,
5783
+ y: start.y,
5784
+ button: "left",
5785
+ buttons: 1,
5786
+ clickCount: 1,
5787
+ pointerType: "pen",
5788
+ });
5789
+ for (let step = 1; step <= steps; step += 1) {
5790
+ const progress = step / steps;
5791
+ await client.send("Input.dispatchMouseEvent", {
5792
+ type: "mouseMoved",
5793
+ x: start.x + (end.x - start.x) * progress,
5794
+ y: start.y + (end.y - start.y) * progress,
5795
+ button: "left",
5796
+ buttons: 1,
5797
+ pointerType: "pen",
5798
+ });
5799
+ if (durationMs && steps > 1) await page.waitForTimeout(durationMs / steps);
5827
5800
  }
5828
- dispatch("pointerup", 1);
5829
- dispatch("pointerout", 1);
5830
- dispatch("pointerleave", 1);
5831
- } finally {
5832
- restorePointerCapture();
5801
+ await client.send("Input.dispatchMouseEvent", {
5802
+ type: "mouseReleased",
5803
+ x: end.x,
5804
+ y: end.y,
5805
+ button: "left",
5806
+ buttons: 0,
5807
+ clickCount: 1,
5808
+ pointerType: "pen",
5809
+ });
5833
5810
  }
5834
- }, {
5835
- pointerType,
5836
- start: localStart,
5837
- end: localEnd,
5838
- steps,
5839
- durationMs,
5840
- });
5811
+ } finally {
5812
+ await client.detach().catch(() => {});
5813
+ }
5841
5814
  } else {
5842
5815
  await page.mouse.move(start.x, start.y);
5843
5816
  await page.mouse.down();
@@ -5870,7 +5843,7 @@ async function executeSetupAction(action, ordinal, viewport) {
5870
5843
  to_x: toX,
5871
5844
  to_y: toY,
5872
5845
  pointer_type: pointerType,
5873
- pointer_capture_polyfill: pointerType === "touch" || pointerType === "pen" ? true : undefined,
5846
+ input_dispatch: pointerType === "touch" || pointerType === "pen" ? "cdp" : "playwright_mouse",
5874
5847
  steps,
5875
5848
  duration_ms: durationMs || undefined,
5876
5849
  };
package/dist/cli.cjs CHANGED
@@ -12679,106 +12679,79 @@ async function executeSetupAction(action, ordinal, viewport) {
12679
12679
  const durationMs = setupNumber(action.duration_ms ?? action.durationMs, 0);
12680
12680
  const pointerType = String(action.pointer_type || action.pointerType || "mouse").trim().toLowerCase();
12681
12681
  if (pointerType === "touch" || pointerType === "pen") {
12682
- const localStart = {
12683
- x: coordinate(fromX, box.width),
12684
- y: coordinate(fromY, box.height),
12685
- };
12686
- const localEnd = {
12687
- x: coordinate(toX, box.width),
12688
- y: coordinate(toY, box.height),
12689
- };
12690
- await target.evaluate(async (element, payload) => {
12691
- const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
12692
- const rect = element.getBoundingClientRect();
12693
- const pointerId = payload.pointerType === "touch" ? 11 : 12;
12694
- const capturedPointers = new Set();
12695
- const originalOwnSetPointerCapture = Object.getOwnPropertyDescriptor(element, "setPointerCapture");
12696
- const originalOwnReleasePointerCapture = Object.getOwnPropertyDescriptor(element, "releasePointerCapture");
12697
- const originalOwnHasPointerCapture = Object.getOwnPropertyDescriptor(element, "hasPointerCapture");
12698
- const originalSetPointerCapture = typeof element.setPointerCapture === "function" ? element.setPointerCapture.bind(element) : undefined;
12699
- const originalReleasePointerCapture = typeof element.releasePointerCapture === "function" ? element.releasePointerCapture.bind(element) : undefined;
12700
- const originalHasPointerCapture = typeof element.hasPointerCapture === "function" ? element.hasPointerCapture.bind(element) : undefined;
12701
- const restorePointerCapture = () => {
12702
- if (originalOwnSetPointerCapture) Object.defineProperty(element, "setPointerCapture", originalOwnSetPointerCapture);
12703
- else delete (element as any).setPointerCapture;
12704
- if (originalOwnReleasePointerCapture) Object.defineProperty(element, "releasePointerCapture", originalOwnReleasePointerCapture);
12705
- else delete (element as any).releasePointerCapture;
12706
- if (originalOwnHasPointerCapture) Object.defineProperty(element, "hasPointerCapture", originalOwnHasPointerCapture);
12707
- else delete (element as any).hasPointerCapture;
12708
- };
12709
- Object.defineProperty(element, "setPointerCapture", {
12710
- configurable: true,
12711
- value: (activePointerId) => {
12712
- capturedPointers.add(activePointerId);
12713
- try {
12714
- return originalSetPointerCapture?.(activePointerId);
12715
- } catch {
12716
- return undefined;
12717
- }
12718
- },
12719
- });
12720
- Object.defineProperty(element, "releasePointerCapture", {
12721
- configurable: true,
12722
- value: (activePointerId) => {
12723
- capturedPointers.delete(activePointerId);
12724
- try {
12725
- return originalReleasePointerCapture?.(activePointerId);
12726
- } catch {
12727
- return undefined;
12728
- }
12729
- },
12730
- });
12731
- Object.defineProperty(element, "hasPointerCapture", {
12732
- configurable: true,
12733
- value: (activePointerId) => {
12734
- if (capturedPointers.has(activePointerId)) return true;
12735
- try {
12736
- return Boolean(originalHasPointerCapture?.(activePointerId));
12737
- } catch {
12738
- return false;
12739
- }
12740
- },
12741
- });
12742
- const point = (progress) => ({
12743
- clientX: rect.left + payload.start.x + (payload.end.x - payload.start.x) * progress,
12744
- clientY: rect.top + payload.start.y + (payload.end.y - payload.start.y) * progress,
12745
- });
12746
- const dispatch = (type, progress) => {
12747
- const coords = point(progress);
12748
- element.dispatchEvent(new PointerEvent(type, {
12749
- bubbles: true,
12750
- cancelable: true,
12751
- composed: true,
12752
- pointerId,
12753
- pointerType: payload.pointerType,
12754
- isPrimary: true,
12755
- buttons: type === "pointerup" ? 0 : 1,
12756
- button: type === "pointerup" ? 0 : 0,
12757
- clientX: coords.clientX,
12758
- clientY: coords.clientY,
12759
- }));
12760
- };
12761
- try {
12762
- dispatch("pointerover", 0);
12763
- dispatch("pointerenter", 0);
12764
- dispatch("pointerdown", 0);
12765
- for (let step = 1; step <= payload.steps; step += 1) {
12766
- dispatch("pointermove", step / payload.steps);
12767
- if (payload.durationMs && payload.steps > 1) await wait(payload.durationMs / payload.steps);
12682
+ const client = await page.context().newCDPSession(page);
12683
+ try {
12684
+ if (pointerType === "touch") {
12685
+ const touchPoint = (x, y) => ({
12686
+ x,
12687
+ y,
12688
+ radiusX: 1,
12689
+ radiusY: 1,
12690
+ force: 1,
12691
+ id: 11,
12692
+ });
12693
+ await client.send("Input.dispatchTouchEvent", {
12694
+ type: "touchStart",
12695
+ touchPoints: [touchPoint(start.x, start.y)],
12696
+ });
12697
+ for (let step = 1; step <= steps; step += 1) {
12698
+ const progress = step / steps;
12699
+ await client.send("Input.dispatchTouchEvent", {
12700
+ type: "touchMove",
12701
+ touchPoints: [
12702
+ touchPoint(
12703
+ start.x + (end.x - start.x) * progress,
12704
+ start.y + (end.y - start.y) * progress,
12705
+ ),
12706
+ ],
12707
+ });
12708
+ if (durationMs && steps > 1) await page.waitForTimeout(durationMs / steps);
12709
+ }
12710
+ await client.send("Input.dispatchTouchEvent", {
12711
+ type: "touchEnd",
12712
+ touchPoints: [],
12713
+ });
12714
+ } else {
12715
+ await client.send("Input.dispatchMouseEvent", {
12716
+ type: "mouseMoved",
12717
+ x: start.x,
12718
+ y: start.y,
12719
+ pointerType: "pen",
12720
+ });
12721
+ await client.send("Input.dispatchMouseEvent", {
12722
+ type: "mousePressed",
12723
+ x: start.x,
12724
+ y: start.y,
12725
+ button: "left",
12726
+ buttons: 1,
12727
+ clickCount: 1,
12728
+ pointerType: "pen",
12729
+ });
12730
+ for (let step = 1; step <= steps; step += 1) {
12731
+ const progress = step / steps;
12732
+ await client.send("Input.dispatchMouseEvent", {
12733
+ type: "mouseMoved",
12734
+ x: start.x + (end.x - start.x) * progress,
12735
+ y: start.y + (end.y - start.y) * progress,
12736
+ button: "left",
12737
+ buttons: 1,
12738
+ pointerType: "pen",
12739
+ });
12740
+ if (durationMs && steps > 1) await page.waitForTimeout(durationMs / steps);
12768
12741
  }
12769
- dispatch("pointerup", 1);
12770
- dispatch("pointerout", 1);
12771
- dispatch("pointerleave", 1);
12772
- } finally {
12773
- restorePointerCapture();
12742
+ await client.send("Input.dispatchMouseEvent", {
12743
+ type: "mouseReleased",
12744
+ x: end.x,
12745
+ y: end.y,
12746
+ button: "left",
12747
+ buttons: 0,
12748
+ clickCount: 1,
12749
+ pointerType: "pen",
12750
+ });
12774
12751
  }
12775
- }, {
12776
- pointerType,
12777
- start: localStart,
12778
- end: localEnd,
12779
- steps,
12780
- durationMs,
12781
- });
12752
+ } finally {
12753
+ await client.detach().catch(() => {});
12754
+ }
12782
12755
  } else {
12783
12756
  await page.mouse.move(start.x, start.y);
12784
12757
  await page.mouse.down();
@@ -12811,7 +12784,7 @@ async function executeSetupAction(action, ordinal, viewport) {
12811
12784
  to_x: toX,
12812
12785
  to_y: toY,
12813
12786
  pointer_type: pointerType,
12814
- pointer_capture_polyfill: pointerType === "touch" || pointerType === "pen" ? true : undefined,
12787
+ input_dispatch: pointerType === "touch" || pointerType === "pen" ? "cdp" : "playwright_mouse",
12815
12788
  steps,
12816
12789
  duration_ms: durationMs || undefined,
12817
12790
  };
package/dist/cli.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  profileStatusExitCode,
14
14
  resolveRiddleProofProfileTargetUrl,
15
15
  resolveRiddleProofProfileTimeoutSec
16
- } from "./chunk-ZE2U5EML.js";
16
+ } from "./chunk-ZLNPYVMJ.js";
17
17
  import {
18
18
  createRiddleApiClient,
19
19
  isTerminalRiddleJobStatus,
package/dist/index.cjs CHANGED
@@ -14471,106 +14471,79 @@ async function executeSetupAction(action, ordinal, viewport) {
14471
14471
  const durationMs = setupNumber(action.duration_ms ?? action.durationMs, 0);
14472
14472
  const pointerType = String(action.pointer_type || action.pointerType || "mouse").trim().toLowerCase();
14473
14473
  if (pointerType === "touch" || pointerType === "pen") {
14474
- const localStart = {
14475
- x: coordinate(fromX, box.width),
14476
- y: coordinate(fromY, box.height),
14477
- };
14478
- const localEnd = {
14479
- x: coordinate(toX, box.width),
14480
- y: coordinate(toY, box.height),
14481
- };
14482
- await target.evaluate(async (element, payload) => {
14483
- const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
14484
- const rect = element.getBoundingClientRect();
14485
- const pointerId = payload.pointerType === "touch" ? 11 : 12;
14486
- const capturedPointers = new Set();
14487
- const originalOwnSetPointerCapture = Object.getOwnPropertyDescriptor(element, "setPointerCapture");
14488
- const originalOwnReleasePointerCapture = Object.getOwnPropertyDescriptor(element, "releasePointerCapture");
14489
- const originalOwnHasPointerCapture = Object.getOwnPropertyDescriptor(element, "hasPointerCapture");
14490
- const originalSetPointerCapture = typeof element.setPointerCapture === "function" ? element.setPointerCapture.bind(element) : undefined;
14491
- const originalReleasePointerCapture = typeof element.releasePointerCapture === "function" ? element.releasePointerCapture.bind(element) : undefined;
14492
- const originalHasPointerCapture = typeof element.hasPointerCapture === "function" ? element.hasPointerCapture.bind(element) : undefined;
14493
- const restorePointerCapture = () => {
14494
- if (originalOwnSetPointerCapture) Object.defineProperty(element, "setPointerCapture", originalOwnSetPointerCapture);
14495
- else delete (element as any).setPointerCapture;
14496
- if (originalOwnReleasePointerCapture) Object.defineProperty(element, "releasePointerCapture", originalOwnReleasePointerCapture);
14497
- else delete (element as any).releasePointerCapture;
14498
- if (originalOwnHasPointerCapture) Object.defineProperty(element, "hasPointerCapture", originalOwnHasPointerCapture);
14499
- else delete (element as any).hasPointerCapture;
14500
- };
14501
- Object.defineProperty(element, "setPointerCapture", {
14502
- configurable: true,
14503
- value: (activePointerId) => {
14504
- capturedPointers.add(activePointerId);
14505
- try {
14506
- return originalSetPointerCapture?.(activePointerId);
14507
- } catch {
14508
- return undefined;
14509
- }
14510
- },
14511
- });
14512
- Object.defineProperty(element, "releasePointerCapture", {
14513
- configurable: true,
14514
- value: (activePointerId) => {
14515
- capturedPointers.delete(activePointerId);
14516
- try {
14517
- return originalReleasePointerCapture?.(activePointerId);
14518
- } catch {
14519
- return undefined;
14520
- }
14521
- },
14522
- });
14523
- Object.defineProperty(element, "hasPointerCapture", {
14524
- configurable: true,
14525
- value: (activePointerId) => {
14526
- if (capturedPointers.has(activePointerId)) return true;
14527
- try {
14528
- return Boolean(originalHasPointerCapture?.(activePointerId));
14529
- } catch {
14530
- return false;
14531
- }
14532
- },
14533
- });
14534
- const point = (progress) => ({
14535
- clientX: rect.left + payload.start.x + (payload.end.x - payload.start.x) * progress,
14536
- clientY: rect.top + payload.start.y + (payload.end.y - payload.start.y) * progress,
14537
- });
14538
- const dispatch = (type, progress) => {
14539
- const coords = point(progress);
14540
- element.dispatchEvent(new PointerEvent(type, {
14541
- bubbles: true,
14542
- cancelable: true,
14543
- composed: true,
14544
- pointerId,
14545
- pointerType: payload.pointerType,
14546
- isPrimary: true,
14547
- buttons: type === "pointerup" ? 0 : 1,
14548
- button: type === "pointerup" ? 0 : 0,
14549
- clientX: coords.clientX,
14550
- clientY: coords.clientY,
14551
- }));
14552
- };
14553
- try {
14554
- dispatch("pointerover", 0);
14555
- dispatch("pointerenter", 0);
14556
- dispatch("pointerdown", 0);
14557
- for (let step = 1; step <= payload.steps; step += 1) {
14558
- dispatch("pointermove", step / payload.steps);
14559
- if (payload.durationMs && payload.steps > 1) await wait(payload.durationMs / payload.steps);
14474
+ const client = await page.context().newCDPSession(page);
14475
+ try {
14476
+ if (pointerType === "touch") {
14477
+ const touchPoint = (x, y) => ({
14478
+ x,
14479
+ y,
14480
+ radiusX: 1,
14481
+ radiusY: 1,
14482
+ force: 1,
14483
+ id: 11,
14484
+ });
14485
+ await client.send("Input.dispatchTouchEvent", {
14486
+ type: "touchStart",
14487
+ touchPoints: [touchPoint(start.x, start.y)],
14488
+ });
14489
+ for (let step = 1; step <= steps; step += 1) {
14490
+ const progress = step / steps;
14491
+ await client.send("Input.dispatchTouchEvent", {
14492
+ type: "touchMove",
14493
+ touchPoints: [
14494
+ touchPoint(
14495
+ start.x + (end.x - start.x) * progress,
14496
+ start.y + (end.y - start.y) * progress,
14497
+ ),
14498
+ ],
14499
+ });
14500
+ if (durationMs && steps > 1) await page.waitForTimeout(durationMs / steps);
14501
+ }
14502
+ await client.send("Input.dispatchTouchEvent", {
14503
+ type: "touchEnd",
14504
+ touchPoints: [],
14505
+ });
14506
+ } else {
14507
+ await client.send("Input.dispatchMouseEvent", {
14508
+ type: "mouseMoved",
14509
+ x: start.x,
14510
+ y: start.y,
14511
+ pointerType: "pen",
14512
+ });
14513
+ await client.send("Input.dispatchMouseEvent", {
14514
+ type: "mousePressed",
14515
+ x: start.x,
14516
+ y: start.y,
14517
+ button: "left",
14518
+ buttons: 1,
14519
+ clickCount: 1,
14520
+ pointerType: "pen",
14521
+ });
14522
+ for (let step = 1; step <= steps; step += 1) {
14523
+ const progress = step / steps;
14524
+ await client.send("Input.dispatchMouseEvent", {
14525
+ type: "mouseMoved",
14526
+ x: start.x + (end.x - start.x) * progress,
14527
+ y: start.y + (end.y - start.y) * progress,
14528
+ button: "left",
14529
+ buttons: 1,
14530
+ pointerType: "pen",
14531
+ });
14532
+ if (durationMs && steps > 1) await page.waitForTimeout(durationMs / steps);
14560
14533
  }
14561
- dispatch("pointerup", 1);
14562
- dispatch("pointerout", 1);
14563
- dispatch("pointerleave", 1);
14564
- } finally {
14565
- restorePointerCapture();
14534
+ await client.send("Input.dispatchMouseEvent", {
14535
+ type: "mouseReleased",
14536
+ x: end.x,
14537
+ y: end.y,
14538
+ button: "left",
14539
+ buttons: 0,
14540
+ clickCount: 1,
14541
+ pointerType: "pen",
14542
+ });
14566
14543
  }
14567
- }, {
14568
- pointerType,
14569
- start: localStart,
14570
- end: localEnd,
14571
- steps,
14572
- durationMs,
14573
- });
14544
+ } finally {
14545
+ await client.detach().catch(() => {});
14546
+ }
14574
14547
  } else {
14575
14548
  await page.mouse.move(start.x, start.y);
14576
14549
  await page.mouse.down();
@@ -14603,7 +14576,7 @@ async function executeSetupAction(action, ordinal, viewport) {
14603
14576
  to_x: toX,
14604
14577
  to_y: toY,
14605
14578
  pointer_type: pointerType,
14606
- pointer_capture_polyfill: pointerType === "touch" || pointerType === "pen" ? true : undefined,
14579
+ input_dispatch: pointerType === "touch" || pointerType === "pen" ? "cdp" : "playwright_mouse",
14607
14580
  steps,
14608
14581
  duration_ms: durationMs || undefined,
14609
14582
  };
package/dist/index.js CHANGED
@@ -62,7 +62,7 @@ import {
62
62
  resolveRiddleProofProfileTimeoutSec,
63
63
  slugifyRiddleProofProfileName,
64
64
  summarizeRiddleProofProfileResult
65
- } from "./chunk-ZE2U5EML.js";
65
+ } from "./chunk-ZLNPYVMJ.js";
66
66
  import {
67
67
  DEFAULT_RIDDLE_API_BASE_URL,
68
68
  DEFAULT_RIDDLE_API_KEY_FILE,
package/dist/profile.cjs CHANGED
@@ -5785,106 +5785,79 @@ async function executeSetupAction(action, ordinal, viewport) {
5785
5785
  const durationMs = setupNumber(action.duration_ms ?? action.durationMs, 0);
5786
5786
  const pointerType = String(action.pointer_type || action.pointerType || "mouse").trim().toLowerCase();
5787
5787
  if (pointerType === "touch" || pointerType === "pen") {
5788
- const localStart = {
5789
- x: coordinate(fromX, box.width),
5790
- y: coordinate(fromY, box.height),
5791
- };
5792
- const localEnd = {
5793
- x: coordinate(toX, box.width),
5794
- y: coordinate(toY, box.height),
5795
- };
5796
- await target.evaluate(async (element, payload) => {
5797
- const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
5798
- const rect = element.getBoundingClientRect();
5799
- const pointerId = payload.pointerType === "touch" ? 11 : 12;
5800
- const capturedPointers = new Set();
5801
- const originalOwnSetPointerCapture = Object.getOwnPropertyDescriptor(element, "setPointerCapture");
5802
- const originalOwnReleasePointerCapture = Object.getOwnPropertyDescriptor(element, "releasePointerCapture");
5803
- const originalOwnHasPointerCapture = Object.getOwnPropertyDescriptor(element, "hasPointerCapture");
5804
- const originalSetPointerCapture = typeof element.setPointerCapture === "function" ? element.setPointerCapture.bind(element) : undefined;
5805
- const originalReleasePointerCapture = typeof element.releasePointerCapture === "function" ? element.releasePointerCapture.bind(element) : undefined;
5806
- const originalHasPointerCapture = typeof element.hasPointerCapture === "function" ? element.hasPointerCapture.bind(element) : undefined;
5807
- const restorePointerCapture = () => {
5808
- if (originalOwnSetPointerCapture) Object.defineProperty(element, "setPointerCapture", originalOwnSetPointerCapture);
5809
- else delete (element as any).setPointerCapture;
5810
- if (originalOwnReleasePointerCapture) Object.defineProperty(element, "releasePointerCapture", originalOwnReleasePointerCapture);
5811
- else delete (element as any).releasePointerCapture;
5812
- if (originalOwnHasPointerCapture) Object.defineProperty(element, "hasPointerCapture", originalOwnHasPointerCapture);
5813
- else delete (element as any).hasPointerCapture;
5814
- };
5815
- Object.defineProperty(element, "setPointerCapture", {
5816
- configurable: true,
5817
- value: (activePointerId) => {
5818
- capturedPointers.add(activePointerId);
5819
- try {
5820
- return originalSetPointerCapture?.(activePointerId);
5821
- } catch {
5822
- return undefined;
5823
- }
5824
- },
5825
- });
5826
- Object.defineProperty(element, "releasePointerCapture", {
5827
- configurable: true,
5828
- value: (activePointerId) => {
5829
- capturedPointers.delete(activePointerId);
5830
- try {
5831
- return originalReleasePointerCapture?.(activePointerId);
5832
- } catch {
5833
- return undefined;
5834
- }
5835
- },
5836
- });
5837
- Object.defineProperty(element, "hasPointerCapture", {
5838
- configurable: true,
5839
- value: (activePointerId) => {
5840
- if (capturedPointers.has(activePointerId)) return true;
5841
- try {
5842
- return Boolean(originalHasPointerCapture?.(activePointerId));
5843
- } catch {
5844
- return false;
5845
- }
5846
- },
5847
- });
5848
- const point = (progress) => ({
5849
- clientX: rect.left + payload.start.x + (payload.end.x - payload.start.x) * progress,
5850
- clientY: rect.top + payload.start.y + (payload.end.y - payload.start.y) * progress,
5851
- });
5852
- const dispatch = (type, progress) => {
5853
- const coords = point(progress);
5854
- element.dispatchEvent(new PointerEvent(type, {
5855
- bubbles: true,
5856
- cancelable: true,
5857
- composed: true,
5858
- pointerId,
5859
- pointerType: payload.pointerType,
5860
- isPrimary: true,
5861
- buttons: type === "pointerup" ? 0 : 1,
5862
- button: type === "pointerup" ? 0 : 0,
5863
- clientX: coords.clientX,
5864
- clientY: coords.clientY,
5865
- }));
5866
- };
5867
- try {
5868
- dispatch("pointerover", 0);
5869
- dispatch("pointerenter", 0);
5870
- dispatch("pointerdown", 0);
5871
- for (let step = 1; step <= payload.steps; step += 1) {
5872
- dispatch("pointermove", step / payload.steps);
5873
- if (payload.durationMs && payload.steps > 1) await wait(payload.durationMs / payload.steps);
5788
+ const client = await page.context().newCDPSession(page);
5789
+ try {
5790
+ if (pointerType === "touch") {
5791
+ const touchPoint = (x, y) => ({
5792
+ x,
5793
+ y,
5794
+ radiusX: 1,
5795
+ radiusY: 1,
5796
+ force: 1,
5797
+ id: 11,
5798
+ });
5799
+ await client.send("Input.dispatchTouchEvent", {
5800
+ type: "touchStart",
5801
+ touchPoints: [touchPoint(start.x, start.y)],
5802
+ });
5803
+ for (let step = 1; step <= steps; step += 1) {
5804
+ const progress = step / steps;
5805
+ await client.send("Input.dispatchTouchEvent", {
5806
+ type: "touchMove",
5807
+ touchPoints: [
5808
+ touchPoint(
5809
+ start.x + (end.x - start.x) * progress,
5810
+ start.y + (end.y - start.y) * progress,
5811
+ ),
5812
+ ],
5813
+ });
5814
+ if (durationMs && steps > 1) await page.waitForTimeout(durationMs / steps);
5815
+ }
5816
+ await client.send("Input.dispatchTouchEvent", {
5817
+ type: "touchEnd",
5818
+ touchPoints: [],
5819
+ });
5820
+ } else {
5821
+ await client.send("Input.dispatchMouseEvent", {
5822
+ type: "mouseMoved",
5823
+ x: start.x,
5824
+ y: start.y,
5825
+ pointerType: "pen",
5826
+ });
5827
+ await client.send("Input.dispatchMouseEvent", {
5828
+ type: "mousePressed",
5829
+ x: start.x,
5830
+ y: start.y,
5831
+ button: "left",
5832
+ buttons: 1,
5833
+ clickCount: 1,
5834
+ pointerType: "pen",
5835
+ });
5836
+ for (let step = 1; step <= steps; step += 1) {
5837
+ const progress = step / steps;
5838
+ await client.send("Input.dispatchMouseEvent", {
5839
+ type: "mouseMoved",
5840
+ x: start.x + (end.x - start.x) * progress,
5841
+ y: start.y + (end.y - start.y) * progress,
5842
+ button: "left",
5843
+ buttons: 1,
5844
+ pointerType: "pen",
5845
+ });
5846
+ if (durationMs && steps > 1) await page.waitForTimeout(durationMs / steps);
5874
5847
  }
5875
- dispatch("pointerup", 1);
5876
- dispatch("pointerout", 1);
5877
- dispatch("pointerleave", 1);
5878
- } finally {
5879
- restorePointerCapture();
5848
+ await client.send("Input.dispatchMouseEvent", {
5849
+ type: "mouseReleased",
5850
+ x: end.x,
5851
+ y: end.y,
5852
+ button: "left",
5853
+ buttons: 0,
5854
+ clickCount: 1,
5855
+ pointerType: "pen",
5856
+ });
5880
5857
  }
5881
- }, {
5882
- pointerType,
5883
- start: localStart,
5884
- end: localEnd,
5885
- steps,
5886
- durationMs,
5887
- });
5858
+ } finally {
5859
+ await client.detach().catch(() => {});
5860
+ }
5888
5861
  } else {
5889
5862
  await page.mouse.move(start.x, start.y);
5890
5863
  await page.mouse.down();
@@ -5917,7 +5890,7 @@ async function executeSetupAction(action, ordinal, viewport) {
5917
5890
  to_x: toX,
5918
5891
  to_y: toY,
5919
5892
  pointer_type: pointerType,
5920
- pointer_capture_polyfill: pointerType === "touch" || pointerType === "pen" ? true : undefined,
5893
+ input_dispatch: pointerType === "touch" || pointerType === "pen" ? "cdp" : "playwright_mouse",
5921
5894
  steps,
5922
5895
  duration_ms: durationMs || undefined,
5923
5896
  };
package/dist/profile.js CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  resolveRiddleProofProfileTimeoutSec,
24
24
  slugifyRiddleProofProfileName,
25
25
  summarizeRiddleProofProfileResult
26
- } from "./chunk-ZE2U5EML.js";
26
+ } from "./chunk-ZLNPYVMJ.js";
27
27
  export {
28
28
  RIDDLE_PROOF_PROFILE_CHECK_TYPES,
29
29
  RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
@@ -292,7 +292,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
292
292
  blocking?: boolean;
293
293
  details?: Record<string, unknown>;
294
294
  ok: boolean;
295
- action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
295
+ action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
296
296
  state_path: string;
297
297
  stage: any;
298
298
  summary: string;
@@ -382,7 +382,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
382
382
  continueWithStage?: WorkflowStage | null;
383
383
  blocking?: boolean;
384
384
  details?: Record<string, unknown>;
385
- action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
385
+ action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
386
386
  state_path: string;
387
387
  stage: any;
388
388
  checkpoint: string;
@@ -659,7 +659,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
659
659
  error?: undefined;
660
660
  } | {
661
661
  ok: boolean;
662
- action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
662
+ action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
663
663
  state_path: string;
664
664
  stage: any;
665
665
  summary: string;
@@ -292,7 +292,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
292
292
  blocking?: boolean;
293
293
  details?: Record<string, unknown>;
294
294
  ok: boolean;
295
- action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
295
+ action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
296
296
  state_path: string;
297
297
  stage: any;
298
298
  summary: string;
@@ -382,7 +382,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
382
382
  continueWithStage?: WorkflowStage | null;
383
383
  blocking?: boolean;
384
384
  details?: Record<string, unknown>;
385
- action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
385
+ action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
386
386
  state_path: string;
387
387
  stage: any;
388
388
  checkpoint: string;
@@ -659,7 +659,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
659
659
  error?: undefined;
660
660
  } | {
661
661
  ok: boolean;
662
- action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
662
+ action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
663
663
  state_path: string;
664
664
  stage: any;
665
665
  summary: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riddledc/riddle-proof",
3
- "version": "0.7.161",
3
+ "version": "0.7.162",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",