@capagents/forgeqe 3.2.0 → 3.2.2
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/HOW_TO_USE.md +33 -9
- package/dist/docs-site/docs/area-api/index.html +1 -1
- package/dist/docs-site/docs/area-mobile/index.html +28 -8
- package/dist/docs-site/docs/area-quality/index.html +10 -0
- package/dist/docs-site/docs/get-started/index.html +12 -8
- package/dist/docs-site/docs/mobile/index.html +19 -7
- package/dist/docs-site/docs/search.js +1 -1
- package/dist/docs-site/docs/web-app/index.html +2 -1
- package/dist/forgeqe.js +1895 -1884
- package/dist/web/assets/{3d-force-graph-Bhmgjf_7.js → 3d-force-graph-CTC0tr_c.js} +1 -1
- package/dist/web/assets/Agent-wRS-AWzy.js +8 -0
- package/dist/web/assets/{AgentWork-D0MS10up.js → AgentWork-GXWfoD_Z.js} +2 -2
- package/dist/web/assets/ApiTests-BH_mbOVX.js +10 -0
- package/dist/web/assets/Browse-B5RXYaB5.js +1 -0
- package/dist/web/assets/Chat-CVF0hHdk.js +3 -0
- package/dist/web/assets/{CommandPalette-rY8rp79k.js → CommandPalette-BipNmH6a.js} +1 -1
- package/dist/web/assets/Compare-FHtKxtLJ.js +1 -0
- package/dist/web/assets/Cost-BDwt86M-.js +1 -0
- package/dist/web/assets/{Data-CFyxbwPS.js → Data-Ctg96el3.js} +4 -4
- package/dist/web/assets/Desktop-B2k0qH7c.js +1 -0
- package/dist/web/assets/DesktopReview-CE65JglI.js +2 -0
- package/dist/web/assets/DeviceScreen-CoArZGyY.js +1 -0
- package/dist/web/assets/{Evidence-BlTkmzfE.js → Evidence-D_90W10z.js} +1 -1
- package/dist/web/assets/{Explore-DyGqAEff.js → Explore-CD7Mq4il.js} +2 -2
- package/dist/web/assets/{Features-BjPR9gCe.js → Features-CLHC2bGL.js} +1 -1
- package/dist/web/assets/Flags-FpR9O_13.js +2 -0
- package/dist/web/assets/Flaky-Bzt9VcYv.js +1 -0
- package/dist/web/assets/Impact-BC8w7uQ5.js +3 -0
- package/dist/web/assets/Jobs-DeBncFIN.js +5 -0
- package/dist/web/assets/KindPage-CJcRnrTe.js +6 -0
- package/dist/web/assets/LiveDevice-BP47IrPa.js +1 -0
- package/dist/web/assets/Migration-BaVfcEYa.js +8 -0
- package/dist/web/assets/Mobile-CLoZlBuq.js +1 -0
- package/dist/web/assets/Observability-CaRIhlKg.js +1 -0
- package/dist/web/assets/PageAgent-C_oSStNT.js +1 -0
- package/dist/web/assets/Product-BdY0j-z8.js +12 -0
- package/dist/web/assets/{Production-C8eGcwCi.js → Production-BhDff1v6.js} +1 -1
- package/dist/web/assets/Quality-EATW3zGE.js +1 -0
- package/dist/web/assets/{Readiness-BWlbiTeu.js → Readiness-D4nY3Nr1.js} +1 -1
- package/dist/web/assets/Record-CIf6M72U.js +1 -0
- package/dist/web/assets/Regression-DhNAgDgD.js +5 -0
- package/dist/web/assets/{RelationGraph-CzR_Hs8A.js → RelationGraph-UXFyQOKO.js} +1 -1
- package/dist/web/assets/Reports-D4-y2w-2.js +2 -0
- package/dist/web/assets/Response-CpHrRtzJ.js +9 -0
- package/dist/web/assets/Responsive-DljiUZXJ.js +3 -0
- package/dist/web/assets/{RunDiff-COaxhvKm.js → RunDiff-DjUiMBsq.js} +1 -1
- package/dist/web/assets/Runs-DC0tJWvX.js +2 -0
- package/dist/web/assets/Settings-CD1RbHXf.js +21 -0
- package/dist/web/assets/{Steps-CN4n8U1I.js → Steps-DG1WYfYK.js} +3 -3
- package/dist/web/assets/{TestCases-BEfJFp5h.js → TestCases-BfZzshUI.js} +1 -1
- package/dist/web/assets/TestData-BoyXYHtp.js +2 -0
- package/dist/web/assets/{TestDebt-DIYhbhjh.js → TestDebt-CX1XT-CA.js} +1 -1
- package/dist/web/assets/TestManagement-BTdMN3Bl.js +4 -0
- package/dist/web/assets/WhatsNew-ZorWOqDL.js +1 -0
- package/dist/web/assets/agents-DPabR9dS.js +1 -0
- package/dist/web/assets/{coverage-DCtiu73T.js → coverage-xSRsKFL6.js} +1 -1
- package/dist/web/assets/dataParts-CeMHTXLx.js +3 -0
- package/dist/web/assets/desktopAppPath-BVJxel_D.js +1 -0
- package/dist/web/assets/{diff-DEgLgw6R.js → diff-BXu8cULX.js} +1 -1
- package/dist/web/assets/{highlight-DSLpJ_Dq.js → highlight-Cd5aQvev.js} +1 -1
- package/dist/web/assets/index-CgpH1pj9.css +2 -0
- package/dist/web/assets/index-F95avSUY.js +64 -0
- package/dist/web/assets/input-BmJ7dt1C.js +1 -0
- package/dist/web/assets/pageBack-BNLSF2VR.js +3 -0
- package/dist/web/assets/palette-BS9ixqiJ.js +1 -0
- package/dist/web/assets/{paletteCommands-fwv5XVOS.js → paletteCommands-DferMQDH.js} +1 -1
- package/dist/web/assets/{parts-CkI14hIv.js → parts-69Ei7EPi.js} +1 -1
- package/dist/web/assets/productParts-PERPm-xD.js +1 -0
- package/dist/web/assets/{qualityParts-8KI3JCY8.js → qualityParts-BRZOCiQs.js} +1 -1
- package/dist/web/assets/{recordTest-kf2ykEQF.js → recordTest-DVJCNI0y.js} +1 -1
- package/dist/web/assets/{stepper-CQSK6KS0.js → stepper-t0O_8eQo.js} +1 -1
- package/dist/web/index.html +6 -6
- package/docs/MOBILE.md +22 -7
- package/docs/WEB_APP.md +2 -1
- package/docs/user-guide.html +51 -17
- package/forgeqe.example.yaml +1 -0
- package/package.json +1 -1
- package/py/forgeqe_engine/copilot_gateway.py +88 -10
- package/py/forgeqe_engine/persona.py +197 -10
- package/py/forgeqe_engine/service.py +2 -2
- package/py/forgeqe_mobile/a11y.py +322 -0
- package/py/forgeqe_mobile/appium_driver.py +16 -0
- package/py/forgeqe_mobile/live.py +225 -0
- package/py/forgeqe_mobile/service.py +102 -4
- package/dist/web/assets/Agent-Dx4aOB_h.js +0 -8
- package/dist/web/assets/ApiTests-DUoEh0nX.js +0 -10
- package/dist/web/assets/Browse-BGgyLuL3.js +0 -1
- package/dist/web/assets/Chat-CEHUI2ty.js +0 -3
- package/dist/web/assets/Compare-B_NCvogR.js +0 -1
- package/dist/web/assets/Cost-sm-6tWRQ.js +0 -1
- package/dist/web/assets/Desktop-A_D4LTis.js +0 -1
- package/dist/web/assets/DesktopReview-CM7xmpHS.js +0 -2
- package/dist/web/assets/Flags-C_DneXS9.js +0 -2
- package/dist/web/assets/Flaky-l5ugC_ER.js +0 -1
- package/dist/web/assets/Impact-7TXQHcsW.js +0 -3
- package/dist/web/assets/Jobs-xRLNI-8l.js +0 -5
- package/dist/web/assets/KindPage-BZu1Zo4S.js +0 -6
- package/dist/web/assets/Migration-DKsyDwDO.js +0 -8
- package/dist/web/assets/Observability-CVwKJ-fI.js +0 -1
- package/dist/web/assets/PageAgent-C1X5ot6v.js +0 -1
- package/dist/web/assets/Product-iHqLyIhD.js +0 -12
- package/dist/web/assets/Quality-BVsN6u0E.js +0 -1
- package/dist/web/assets/Record-C7qgNFqs.js +0 -1
- package/dist/web/assets/Regression-ChleHlqe.js +0 -5
- package/dist/web/assets/Reports-CIcKyoHH.js +0 -2
- package/dist/web/assets/Response-D2ZeO8uW.js +0 -9
- package/dist/web/assets/Responsive-DCfw-Oz3.js +0 -3
- package/dist/web/assets/Runs-3qx2qf56.js +0 -2
- package/dist/web/assets/Settings-DG2k3Lno.js +0 -21
- package/dist/web/assets/TestData-SO2qqaAF.js +0 -2
- package/dist/web/assets/TestManagement-D7q6G3YN.js +0 -4
- package/dist/web/assets/WhatsNew-DqBLhhgk.js +0 -1
- package/dist/web/assets/agents-BUWN-VJv.js +0 -1
- package/dist/web/assets/dataParts-BdmBLsU9.js +0 -3
- package/dist/web/assets/index-DAteDsgB.css +0 -2
- package/dist/web/assets/index-RJ1kEHuo.js +0 -64
- package/dist/web/assets/input-Be3YOEK2.js +0 -1
- package/dist/web/assets/logLevel-Dq8s6DZz.js +0 -3
- package/dist/web/assets/palette-Dcoz5crU.js +0 -1
- package/dist/web/assets/productParts-BOUMBM_H.js +0 -1
package/docs/user-guide.html
CHANGED
|
@@ -484,11 +484,11 @@ browser, desktop and mobile agents. No other model is needed.</p>
|
|
|
484
484
|
<ol>
|
|
485
485
|
<li>Open <strong>Settings › Models</strong>.</li>
|
|
486
486
|
<li>Under <strong>Sign-ins</strong>, on the <strong>GitHub Copilot</strong> row, press <strong>Sign in</strong>.</li>
|
|
487
|
-
<li>Sign in to GitHub in the browser tab that opens
|
|
487
|
+
<li>Sign in to GitHub in the browser tab that opens. ForgeQE then uses <code>auto</code>: Copilot picks the model for each request.</li>
|
|
488
488
|
</ol>
|
|
489
489
|
<p><strong>Terminal</strong></p>
|
|
490
490
|
<pre><code class="language-bash">forgeqe setup # the browser engine and what Copilot needs
|
|
491
|
-
forgeqe auth login copilot # opens GitHub in your browser to sign in
|
|
491
|
+
forgeqe auth login copilot # opens GitHub in your browser to sign in; ForgeQE then uses auto
|
|
492
492
|
forgeqe doctor # checks the setup, the sign-in and each model
|
|
493
493
|
</code></pre>
|
|
494
494
|
<p><strong>Making a request.</strong> Type what you want in plain words and send it:</p>
|
|
@@ -716,9 +716,10 @@ personal account and add the <strong>Copilot Requests</strong> permission, then
|
|
|
716
716
|
what it got (<code>github_pat_11AB…Wz9Q (93 characters)</code>) and keeps the token in your system's credential store. Classic
|
|
717
717
|
tokens (<code>ghp_</code>) do not work with Copilot.</li>
|
|
718
718
|
</ul>
|
|
719
|
-
<p>Either way, ForgeQE checks the sign-in by asking Copilot for your seat's models.
|
|
720
|
-
|
|
721
|
-
default model
|
|
719
|
+
<p>Either way, ForgeQE checks the sign-in by asking Copilot for your seat's models. It asks nothing more: the Copilot
|
|
720
|
+
profile gets <code>auto</code>, so Copilot picks the model for each request and a model that stops working on your seat is left
|
|
721
|
+
for another, and it becomes the default model (models your seat has but has not turned on are named, with the settings
|
|
722
|
+
page). To use one model instead, pick it on <strong>Settings › Models</strong> or with <code>forgeqe models --copilot --add <model></code>. The first time, Copilot's runtime is downloaded from GitHub and checked against GitHub's checksums.</p>
|
|
722
723
|
<p><strong>Web app</strong></p>
|
|
723
724
|
<ol>
|
|
724
725
|
<li>Open <strong>Settings › Models</strong>.</li>
|
|
@@ -728,7 +729,7 @@ default model. The first time, Copilot's runtime is downloaded from GitHub and c
|
|
|
728
729
|
<li>Pick the model. The row then says who is signed in and with which model.</li>
|
|
729
730
|
</ol>
|
|
730
731
|
<p><strong>Terminal</strong></p>
|
|
731
|
-
<pre><code class="language-bash">forgeqe auth login copilot # sign in
|
|
732
|
+
<pre><code class="language-bash">forgeqe auth login copilot # sign in; ForgeQE then uses auto
|
|
732
733
|
forgeqe auth # the Copilot line shows the sign-in
|
|
733
734
|
</code></pre>
|
|
734
735
|
<p><strong>GitHub Enterprise Cloud</strong> (a <code>ghe.com</code> address, with data residency). In the web app press <strong>Enterprise</strong>; in the
|
|
@@ -756,7 +757,7 @@ keeps the authorization until you revoke <strong>GitHub Copilot CLI</strong> at
|
|
|
756
757
|
<tr><th>Field</th><th>What it is</th></tr>
|
|
757
758
|
</thead>
|
|
758
759
|
<tbody>
|
|
759
|
-
<tr><td><code>model</code></td><td><code>auto</code> (
|
|
760
|
+
<tr><td><code>model</code></td><td><code>auto</code> (what the sign-in writes, without asking), or a Copilot model as Copilot names it (<code>gpt-4.1</code>, <code>claude-sonnet-4.6</code>) that takes screenshots. With <code>auto</code>, Copilot picks the model for each request, and the browser's screenshot steps go to your seat's cheapest model that takes images. The sign-in lists your seat's models and which of them take images.</td></tr>
|
|
760
761
|
<tr><td><code>engine_model</code></td><td>Optional. Another Copilot model for the browser and the desktop agent.</td></tr>
|
|
761
762
|
<tr><td><code>reasoning_effort</code></td><td>Optional. How hard a reasoning model thinks: <code>low</code>, <code>medium</code>, <code>high</code>, <code>xhigh</code> or <code>max</code>. Sent only to a model your seat says takes one; unset, the model's default.</td></tr>
|
|
762
763
|
<tr><td><code>api_key_env</code></td><td>Optional. A variable that must hold the GitHub token for this profile. Without it, ForgeQE uses <code>COPILOT_GITHUB_TOKEN</code>, then a token <code>forgeqe auth login copilot</code> saved, then the browser sign-in.</td></tr>
|
|
@@ -773,7 +774,10 @@ refused, a rate limit or a used-up allowance never moves to another model. <code
|
|
|
773
774
|
what Copilot answered and which model took over.</p>
|
|
774
775
|
<p><strong>Copilot's versions.</strong> ForgeQE pins GitHub's Copilot SDK and the Copilot runtime it runs, so a GitHub release never
|
|
775
776
|
changes your setup by itself; a newer ForgeQE brings newer ones (<code>forgeqe update</code>, then <code>forgeqe setup</code>). <code>forgeqe doctor</code>
|
|
776
|
-
shows the versions in use.
|
|
777
|
+
shows the versions in use. A newer version is downloaded from GitHub the first time it is needed; when that download
|
|
778
|
+
fails (a company network or proxy that blocks GitHub's downloads), ForgeQE keeps using the Copilot already on your
|
|
779
|
+
computer, for the sign-in and for chats and runs, and says so. To get the newer one, allow <code>github.com</code> and
|
|
780
|
+
<code>release-assets.githubusercontent.com</code>, or set <code>FORGEQE_GITHUB_MIRROR</code> to your company's GitHub mirror. If GitHub ever stops accepting them, the chat or run says so and asks you to update ForgeQE,
|
|
777
781
|
rather than trying another model.</p>
|
|
778
782
|
<p><strong>Behind a company proxy.</strong> ForgeQE reaches Copilot over plain HTTPS. Copilot can use WebSockets for some models, which
|
|
779
783
|
many company proxies break, leaving requests unanswered; ForgeQE turns them off, as each request is a new Copilot
|
|
@@ -5601,6 +5605,14 @@ forgeqe mobile replay mobile-tests/ --junit results.xml # every workflow i
|
|
|
5601
5605
|
forgeqe mobile maestro .maestro/ # your team's Maestro flows, checked first
|
|
5602
5606
|
forgeqe mobile flow workflow.yaml > login.flow.yaml # a workflow as a Maestro flow, to keep
|
|
5603
5607
|
</code></pre>
|
|
5608
|
+
<p><strong>Accessibility of each screen.</strong> A replay or an explore on Appium checks each new screen it reaches (once per
|
|
5609
|
+
screen, at most 40) and writes <code>accessibility.json</code> in the run's folder, in the same shape as a browser run's: controls a
|
|
5610
|
+
screen reader has no name for (WCAG 4.1.2), images it stops on with no description (1.1.1), fields with no label, hint or
|
|
5611
|
+
placeholder (1.3.1), touch targets under 24 by 24 dp or pt (2.5.8; under Android's 48 dp or iOS's 44 pt as a minor
|
|
5612
|
+
finding), and several controls announced by one name. On iOS 17 or later with Xcode 15 it also runs Apple's own audit
|
|
5613
|
+
(contrast, hit regions, element descriptions, Dynamic Type, clipped text, traits). Android's sizes are judged from the
|
|
5614
|
+
screen's density. <code>mobile.accessibility: false</code> turns it off (<strong>Settings › Mobile</strong>). These are automated checks of what
|
|
5615
|
+
the screen's controls say, not a person with TalkBack or VoiceOver; Maestro runs are not checked.</p>
|
|
5604
5616
|
<p><strong>Secrets.</strong> <code>{{secret:NAME}}</code> reads only <code>mobile.secrets</code> (and the environment's secrets). A flow kept with <code>forgeqe mobile flow</code> reads each secret as <code>${MAESTRO_<NAME>}</code>, never its value, so set <code>MAESTRO_<NAME></code> when you run it outside ForgeQE. A workflow that types a secret not listed there is refused.</p>
|
|
5605
5617
|
<p><strong>Team Maestro flows</strong> run only with UI commands: scripts, JavaScript in <code>${…}</code>, Maestro's AI commands and file writes are refused. Details: <a href="#doc-docs-mobile-forgeqe-mobile-android-and-ios-apps">docs/MOBILE.md</a>.</p>
|
|
5606
5618
|
<h5>On TestMu AI (formerly LambdaTest)</h5>
|
|
@@ -5679,15 +5691,27 @@ by the ForgeQE team (it needs a Mac with a simulator).</p>
|
|
|
5679
5691
|
<tr><th>Task</th><th>Web app</th><th>Terminal</th></tr>
|
|
5680
5692
|
</thead>
|
|
5681
5693
|
<tbody>
|
|
5682
|
-
<tr><td>Set up Appium on this computer</td><td><strong>Settings › Set up</strong></td><td><code>forgeqe mobile setup</code></td></tr>
|
|
5683
|
-
<tr><td>Devices and drivers</td><td><strong>Settings › Mobile</strong
|
|
5684
|
-
<tr><td>Record your own steps</td><td><strong>Record › Mobile app</strong
|
|
5685
|
-
<tr><td>Review and replay a recording</td><td>the recording's review</td><td><code>forgeqe mobile replay</code></td></tr>
|
|
5686
|
-
<tr><td>Explore a goal with the model</td><td>in a chat</td><td><code>forgeqe mobile explore</code></td></tr>
|
|
5687
|
-
<tr><td>Run your team's Maestro flows</td><td>in a chat</td><td><code>forgeqe mobile maestro</code></td></tr>
|
|
5688
|
-
<tr><td>Upload a build to TestMu AI</td><td>in a chat</td><td><code>forgeqe mobile upload</code></td></tr>
|
|
5694
|
+
<tr><td>Set up Appium on this computer</td><td><strong>Mobile apps › Devices and apps</strong>, or <strong>Settings › Set up</strong></td><td><code>forgeqe mobile setup</code></td></tr>
|
|
5695
|
+
<tr><td>Devices and drivers</td><td><strong>Settings › Mobile</strong> (listed on <strong>Mobile apps › Devices and apps</strong>)</td><td><code>forgeqe.yaml</code>, <code>forgeqe mobile devices</code></td></tr>
|
|
5696
|
+
<tr><td>Record your own steps</td><td><strong>Record › Mobile app</strong> (or <strong>Record by hand</strong> on <strong>Mobile apps › Workflows</strong>)</td><td>not available</td></tr>
|
|
5697
|
+
<tr><td>Review and replay a recording</td><td>the recording's review, or <strong>Mobile apps › Workflows</strong> (Appium or Maestro)</td><td><code>forgeqe mobile replay</code></td></tr>
|
|
5698
|
+
<tr><td>Explore a goal with the model</td><td><strong>Mobile apps › Workflows › Explore a goal</strong>, or in a chat</td><td><code>forgeqe mobile explore</code></td></tr>
|
|
5699
|
+
<tr><td>Run your team's Maestro flows</td><td><strong>Mobile apps › Maestro flows</strong> (from <code>.maestro/</code>), or in a chat</td><td><code>forgeqe mobile maestro</code></td></tr>
|
|
5700
|
+
<tr><td>Upload a build to TestMu AI</td><td><strong>Mobile apps › Devices and apps › Upload a build</strong>, or in a chat</td><td><code>forgeqe mobile upload</code></td></tr>
|
|
5701
|
+
<tr><td>Watch the device while a run works</td><td><strong>Mobile apps</strong> (above its tabs), and a chat's device pane</td><td>not available</td></tr>
|
|
5689
5702
|
</tbody>
|
|
5690
5703
|
</table></div>
|
|
5704
|
+
<p><strong>Mobile apps</strong> (<code>#/mobile</code>) is MobilePilot's page. Its <strong>Agent</strong> tab is where you ask it; <strong>Workflows</strong>, <strong>Maestro
|
|
5705
|
+
flows</strong>, <strong>Runs</strong> and <strong>Devices and apps</strong> are its work. While a run is at work, from the page or from a chat, the
|
|
5706
|
+
device is shown above the tabs: its screen about once a second, the step just done and the next one, and for a device on
|
|
5707
|
+
TestMu or BrowserStack a link to the cloud's own live view.</p>
|
|
5708
|
+
</div>
|
|
5709
|
+
<section class="doc sub" id="doc-docs-mobile-watching-the-device"><h5>Watching the device</h5><div class="prose"><p>The engine keeps the device's latest screen while a run works (<code>live/</code> in the run's folder: one picture, the step, and
|
|
5710
|
+
when; removed when the run ends). Appium runs, on this computer or a device cloud, use Appium's own screenshot. Maestro
|
|
5711
|
+
on this computer is read with <code>adb exec-out screencap</code> (Android) or <code>xcrun simctl io … screenshot</code> (an iOS simulator).
|
|
5712
|
+
Maestro on TestMu (HyperExecute) gives ForgeQE no pictures: watch it on TestMu. A typed value is never shown, only a
|
|
5713
|
+
secret's name or a length, and nothing of it reaches the model. A chat that runs a mobile tool docks the device on its
|
|
5714
|
+
right for the rest of the chat; below 1100px wide, <strong>Show the device</strong> opens it over the chat.</p>
|
|
5691
5715
|
<p><strong>Setting up.</strong> For an emulator or phone on this computer, ForgeQE installs Appium and its drivers once (see
|
|
5692
5716
|
<a href="#doc-docs-mobile-appium-on-this-computer">Appium on this computer</a>). A device cloud needs none of it.</p>
|
|
5693
5717
|
<p><strong>Web app</strong></p>
|
|
@@ -5724,7 +5748,7 @@ desktop one. At a terminal, ask the same in <code>forgeqe start</code>, or run:<
|
|
|
5724
5748
|
<pre><code class="language-bash">forgeqe mobile explore "Sign in as the courier and accept the first delivery" --app courier
|
|
5725
5749
|
forgeqe mobile maestro .maestro/ # the team's flows
|
|
5726
5750
|
</code></pre>
|
|
5727
|
-
</div>
|
|
5751
|
+
</div></section>
|
|
5728
5752
|
</section>
|
|
5729
5753
|
<section class="doc" id="doc-docs-mobile-apps-and-settings">
|
|
5730
5754
|
<h4>Apps and settings</h4>
|
|
@@ -9911,7 +9935,7 @@ projects; for other frameworks add <code>--agent</code>, or run the listed files
|
|
|
9911
9935
|
<div class="fact"><span class="mono">Ask it</span><ul class="asks"><li>Turn the last run's API calls into tests</li><li>Test the API in openapi.yaml</li><li>Write API scenario tests for the order lifecycle</li><li>Import our Postman collection and send its calls</li><li>Add these cURL calls to the shop API</li><li>Heal the API contracts from the latest run</li></ul></div>
|
|
9912
9936
|
<div class="fact"><span class="mono">What it needs</span><ul class="needs"><li><span class="need opt">Optional</span><span>The coding agent, Quill: a live model profile (or code.model), and what forgeqe setup installs for it</span></li></ul></div>
|
|
9913
9937
|
<div class="fact"><span class="mono">Limits</span><ul class="plainlist"><li>Calls that change data run only when the user allows them, on a test environment, never production; healing never replays them.</li><li>A contract that fails can be a real defect: healing proposes a new version, and a person decides.</li></ul></div>
|
|
9914
|
-
<div class="fact"><span class="mono">Tools</span><p class="tools"><code>api_contracts</code> <code>run_api_contracts</code> <code>heal_api_contracts</code> <code>api_scenarios</code> <code>run_api_scenarios</code> <code>write_api_tests</code> <code>api_find_calls</code> <code>api_new_set</code> <code>api_add_calls</code> <code>api_delete_set</code> <code>api_import_collection</code></p></div>
|
|
9938
|
+
<div class="fact"><span class="mono">Tools</span><p class="tools"><code>api_contracts</code> <code>run_api_contracts</code> <code>heal_api_contracts</code> <code>api_scenarios</code> <code>run_api_scenarios</code> <code>write_api_tests</code> <code>api_find_calls</code> <code>api_new_set</code> <code>api_add_calls</code> <code>api_rename_folder</code> <code>api_move_calls</code> <code>api_delete_set</code> <code>api_import_collection</code></p></div>
|
|
9915
9939
|
</div>
|
|
9916
9940
|
<div class="detail"><span class="mono">In detail</span>
|
|
9917
9941
|
<section class="doc" id="doc-how_to_use-api-and-contract-tests">
|
|
@@ -10389,11 +10413,18 @@ built-in checks) and standard; left on the project's, quality.accessibility deci
|
|
|
10389
10413
|
<p><strong>Terminal</strong></p>
|
|
10390
10414
|
<pre><code class="language-bash">forgeqe a11y "find running shoes and add a pair to the basket" --persona blind,keyboard-only --url https://shop.test
|
|
10391
10415
|
forgeqe a11y "check out" --persona blind --engine ibm --standard wcag22aa --best-practice # this session's rule checks
|
|
10416
|
+
forgeqe a11y "check out" --persona blind,keyboard-only --device iphone-15 # every persona on a phone
|
|
10392
10417
|
forgeqe a11y personas # the personas: built in, and the project's own
|
|
10393
10418
|
</code></pre>
|
|
10394
10419
|
<p><code>--engine</code> (axe, ibm, basic), <code>--standard</code> (wcag2a, wcag21aa, wcag22aa, wcag21aaa, section508, en301549,
|
|
10395
10420
|
best-practice) and <code>--best-practice</code> choose the session's automated rule checks over <code>quality.accessibility</code>; a value off
|
|
10396
10421
|
its list is refused before anything runs. The report and the Results tab say which were used.</p>
|
|
10422
|
+
<p><code>--device</code> (on the page: <strong>on</strong>, beside the standard) runs every persona on a phone or tablet of the Responsive page's
|
|
10423
|
+
list: its CSS size, pixel ratio, touch and user agent are emulated in ForgeQE's Chromium, so a site lays out as it does
|
|
10424
|
+
there (a page with no viewport meta tag is shown shrunk, as on a real phone). <code>desktop</code> is the browser's own window for
|
|
10425
|
+
every persona; with no device named, each persona uses its own (the three phone personas are on phones, the rest on
|
|
10426
|
+
desktop). A persona file may set <code>input: touch</code>, <code>text_scale</code> (1 to 3) and <code>device</code>. This is emulation in Chromium, not
|
|
10427
|
+
Safari or a real phone: confirm what matters on real devices.</p>
|
|
10397
10428
|
<p><strong>How each persona uses the page.</strong> Each persona is one browser run. The agent works the way the person does:</p>
|
|
10398
10429
|
<div class="tbl"><table>
|
|
10399
10430
|
<thead>
|
|
@@ -10408,6 +10439,9 @@ its list is refused before anything runs. The report and the Results tab say whi
|
|
|
10408
10439
|
<tr><td><code>reduced-motion</code></td><td>The browser asks for reduced motion.</td></tr>
|
|
10409
10440
|
<tr><td><code>deaf</code></td><td>Captions, transcripts, sound-only information.</td></tr>
|
|
10410
10441
|
<tr><td><code>high-contrast</code></td><td>Forced colours (a high contrast theme).</td></tr>
|
|
10442
|
+
<tr><td><code>mobile-screen-reader</code></td><td>VoiceOver or TalkBack on an iPhone 15: no screenshots and no keyboard. It swipes right and left through the page item by item (<code>swipe_next</code>, <code>swipe_previous</code>), hears each item's role, name and state, and double taps to activate (<code>double_tap</code>, a touch where the item is).</td></tr>
|
|
10443
|
+
<tr><td><code>large-text</code></td><td>A Pixel 8 with the system's text at 200%: text sized in rem or em grows, text sized in px does not. Touch only.</td></tr>
|
|
10444
|
+
<tr><td><code>touch-tremor</code></td><td>A Galaxy S23, one finger, a hand tremor: small or close targets, gestures with no simple alternative, time limits.</td></tr>
|
|
10411
10445
|
</tbody>
|
|
10412
10446
|
</table></div>
|
|
10413
10447
|
<p><strong>The report.</strong> For each persona, <code>.forgeqe/reports/accessibility/<time>-<goal>/accessibility.md</code> says whether they reached the goal, each barrier with its severity (critical: stops them; serious; moderate; minor) and WCAG success criterion, and the automated WCAG rule checks of the pages they visited. The run folders keep the evidence: steps, screenshots, video when on. A run as a persona uses no page memory, site rulebook or skills, since those hold how to click through the site.</p>
|
package/forgeqe.example.yaml
CHANGED
|
@@ -66,6 +66,7 @@ environments:
|
|
|
66
66
|
# hyperexecute: ./hyperexecute # TestMu's program, for Maestro on its devices
|
|
67
67
|
# secrets: [COURIER_PASSWORD] # the only environment variables {{secret:…}} may read
|
|
68
68
|
# heal: true
|
|
69
|
+
# accessibility: true # check each new screen of a replay or explore: names, fields, target size (Apple's audit on iOS 17+)
|
|
69
70
|
# headless: false # true: Appium starts emulators (a device's avd) and iOS simulators without a window
|
|
70
71
|
|
|
71
72
|
# Desktop apps: the apps themselves are in env.yaml (kind: desktop). See docs/DESKTOP.md.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capagents/forgeqe",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "ForgeQE: a browser agent CLI that runs goals and test cases in local Chrome or Chromium, or BrowserStack and TestMu AI/LambdaTest when configured, and turns passing runs into tests in your repo",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
|
@@ -430,15 +430,14 @@ def websockets_on(env: Optional[Dict[str, str]] = None) -> bool:
|
|
|
430
430
|
return str((os.environ if env is None else env).get(WEBSOCKETS_ENV, "")).strip().lower() in ("1", "true", "yes", "on")
|
|
431
431
|
|
|
432
432
|
|
|
433
|
-
def capi_options(websockets: bool) -> Optional[Any]:
|
|
434
|
-
"""
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
return CapiSessionOptions(enable_web_socket_responses=False)
|
|
433
|
+
def capi_options(websockets: bool) -> Optional[Dict[str, Any]]:
|
|
434
|
+
"""
|
|
435
|
+
The session's Copilot API options: plain HTTPS for the Responses API unless WebSockets are wanted. create_session
|
|
436
|
+
takes these as the SDK's CapiSessionOptions TypedDict (copilot.client), a plain dict, never the data class of the
|
|
437
|
+
same name in copilot.generated.rpc, which it cannot read (2026-11-24: "argument of type 'CapiSessionOptions' is not
|
|
438
|
+
iterable" on every request).
|
|
439
|
+
"""
|
|
440
|
+
return None if websockets else {"enable_web_socket_responses": False}
|
|
442
441
|
|
|
443
442
|
|
|
444
443
|
def pinned_versions() -> str:
|
|
@@ -470,6 +469,80 @@ def outdated_error(message: str) -> "GatewayError":
|
|
|
470
469
|
)
|
|
471
470
|
|
|
472
471
|
|
|
472
|
+
# A runtime version as Copilot's releases name them (1.0.105, 1.0.64-1).
|
|
473
|
+
_RUNTIME_VERSION = re.compile(r"^[0-9]{1,4}\.[0-9]{1,4}\.[0-9]{1,6}(?:-[0-9]{1,4})?$")
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
def _version_key(v: str) -> Tuple[int, ...]:
|
|
477
|
+
return tuple(int(p) for p in re.split(r"[.-]", v))
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
def cached_runtimes(root: Any, platform: str, wrapper: str) -> List[Tuple[str, str]]:
|
|
481
|
+
"""
|
|
482
|
+
The Copilot runtimes the SDK already keeps on this computer (<root>/<version>/prebuilds/<platform>/), newest first,
|
|
483
|
+
as (version, wrapper path): a folder of a version's shape, no link on the way, the wrapper and runtime.node both
|
|
484
|
+
regular, non-empty files.
|
|
485
|
+
"""
|
|
486
|
+
out: List[Tuple[str, str]] = []
|
|
487
|
+
try:
|
|
488
|
+
names = os.listdir(root)
|
|
489
|
+
except OSError:
|
|
490
|
+
return out
|
|
491
|
+
for name in names:
|
|
492
|
+
if not _RUNTIME_VERSION.match(name):
|
|
493
|
+
continue
|
|
494
|
+
pair = os.path.join(root, name, "prebuilds", platform)
|
|
495
|
+
try:
|
|
496
|
+
if any(os.path.islink(p) for p in (os.path.join(root, name), os.path.join(root, name, "prebuilds"), pair)):
|
|
497
|
+
continue
|
|
498
|
+
files = [os.path.join(pair, wrapper), os.path.join(pair, "runtime.node")]
|
|
499
|
+
if all(os.path.isfile(f) and not os.path.islink(f) and os.path.getsize(f) > 0 for f in files):
|
|
500
|
+
out.append((name, files[0]))
|
|
501
|
+
except OSError:
|
|
502
|
+
continue
|
|
503
|
+
out.sort(key=lambda vp: _version_key(vp[0]), reverse=True)
|
|
504
|
+
return out
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
def runtime_fallback(env: Optional[Dict[str, str]] = None) -> Optional[Dict[str, str]]:
|
|
508
|
+
"""
|
|
509
|
+
Makes sure the SDK has a runtime before it starts. The pinned one is used when it is here or can be downloaded;
|
|
510
|
+
when it cannot be downloaded (a company network that blocks GitHub's downloads), the newest runtime the SDK already
|
|
511
|
+
keeps on this computer runs instead, through the SDK's own COPILOT_CLI_PATH. Returns {"pinned", "used", "reason"}
|
|
512
|
+
when it fell back, None otherwise; raises with a clear reason when there is nothing to fall back to. A
|
|
513
|
+
COPILOT_CLI_PATH the person set is left alone.
|
|
514
|
+
"""
|
|
515
|
+
env = os.environ if env is None else env
|
|
516
|
+
if env.get("COPILOT_CLI_PATH"):
|
|
517
|
+
return None
|
|
518
|
+
try:
|
|
519
|
+
from copilot._cli_download import ensure_runtime_wrapper, get_cache_dir
|
|
520
|
+
from copilot._cli_version import CLI_VERSION, get_runtime_platform
|
|
521
|
+
except ImportError:
|
|
522
|
+
return None
|
|
523
|
+
try:
|
|
524
|
+
ensure_runtime_wrapper()
|
|
525
|
+
return None
|
|
526
|
+
except Exception as e: # The download failed: anything else here is no better reason to stop.
|
|
527
|
+
reason = " ".join(str(e).split())[:300]
|
|
528
|
+
try:
|
|
529
|
+
platform = get_runtime_platform()
|
|
530
|
+
root = str(get_cache_dir(None))
|
|
531
|
+
except Exception:
|
|
532
|
+
raise RuntimeError(f"Copilot's runtime {CLI_VERSION} could not be downloaded: {reason}") from e
|
|
533
|
+
wrapper = "copilot-runtime.exe" if sys.platform == "win32" else "copilot-runtime"
|
|
534
|
+
older = [(v, p) for v, p in cached_runtimes(root, platform, wrapper) if v != CLI_VERSION]
|
|
535
|
+
if not older:
|
|
536
|
+
raise RuntimeError(
|
|
537
|
+
f"Copilot's runtime {CLI_VERSION} could not be downloaded, and no earlier one is on this computer: {reason}. "
|
|
538
|
+
"A company network that blocks GitHub's downloads does this: ask IT to allow github.com and "
|
|
539
|
+
"release-assets.githubusercontent.com, or set FORGEQE_GITHUB_MIRROR to your company's GitHub mirror."
|
|
540
|
+
) from e
|
|
541
|
+
version, path = older[0]
|
|
542
|
+
env["COPILOT_CLI_PATH"] = path
|
|
543
|
+
return {"pinned": str(CLI_VERSION), "used": version, "reason": reason}
|
|
544
|
+
|
|
545
|
+
|
|
473
546
|
def client_options(token: Optional[str], home: str, workdir: str) -> Dict[str, Any]:
|
|
474
547
|
"""With a token, that token only; without one, the signed-in user, as the Copilot SDK recommends on a user's machine."""
|
|
475
548
|
auth: Dict[str, Any] = {"github_token": token, "use_logged_in_user": False} if token else {"use_logged_in_user": True}
|
|
@@ -490,6 +563,10 @@ class Copilot:
|
|
|
490
563
|
if not self.websockets:
|
|
491
564
|
# The runtime the SDK starts reads this too, for every request it makes (the model list included).
|
|
492
565
|
os.environ[SDK_NO_WEBSOCKETS_ENV] = "1"
|
|
566
|
+
# Before the client: it looks for (and downloads) its runtime as it is made.
|
|
567
|
+
self.runtime = runtime_fallback()
|
|
568
|
+
if self.runtime:
|
|
569
|
+
gateway_log("gateway", f"runtime {self.runtime['pinned']} could not be downloaded: running {self.runtime['used']} from this computer ({self.runtime['reason']})")
|
|
493
570
|
self.client = CopilotClient(**client_options(token, home, self.workdir))
|
|
494
571
|
self.health = ModelHealth()
|
|
495
572
|
self._seat: List[Dict[str, Any]] = []
|
|
@@ -1212,7 +1289,8 @@ async def serve(out: TextIO, copilot: Any = None) -> int:
|
|
|
1212
1289
|
server = await asyncio.start_server(lambda r, w: handle(r, w, copilot, key), host="127.0.0.1", port=0, limit=64 * 1024)
|
|
1213
1290
|
port = server.sockets[0].getsockname()[1]
|
|
1214
1291
|
gateway_log("gateway", f"listening on 127.0.0.1:{port}")
|
|
1215
|
-
|
|
1292
|
+
runtime = getattr(copilot, "runtime", None)
|
|
1293
|
+
out.write(json.dumps({"port": port, "login": getattr(copilot, "login", ""), **({"runtime": runtime} if runtime else {})}) + "\n")
|
|
1216
1294
|
out.flush()
|
|
1217
1295
|
loop = asyncio.get_running_loop()
|
|
1218
1296
|
# Stop when ForgeQE closes stdin (or exits).
|
|
@@ -8,6 +8,10 @@ that changes the browser or the agent's actions comes from fixed lists, never fr
|
|
|
8
8
|
page's markup (find_elements).
|
|
9
9
|
- input "keyboard": the mouse actions (click, input, select_dropdown, upload, scripts) are taken away; the agent moves
|
|
10
10
|
with press_key and types with type_text into the focused field.
|
|
11
|
+
- input "touch": a touchscreen, no keyboard (no press_key). With a screen reader (VoiceOver, TalkBack) the agent moves
|
|
12
|
+
a reading cursor with swipe_next and swipe_previous and activates what it is on with double_tap, never a tap by sight.
|
|
13
|
+
- device: a phone or tablet of ForgeQE's list (src/responsive/devices.ts): its size, pixel ratio, touch and user agent;
|
|
14
|
+
text_scale: the system's larger text, as the browser's default font size.
|
|
11
15
|
- vision, zoom and media: Chrome's own emulation (a colour vision deficiency or blur, a zoomed page, reduced motion,
|
|
12
16
|
forced colours), applied to each page before the agent's step.
|
|
13
17
|
|
|
@@ -15,6 +19,7 @@ This is not functional testing: whether the feature works is not judged, only wh
|
|
|
15
19
|
operate and understand it. Each barrier is recorded with record_accessibility_issue into persona-findings.json.
|
|
16
20
|
"""
|
|
17
21
|
|
|
22
|
+
import asyncio
|
|
18
23
|
import json
|
|
19
24
|
import logging
|
|
20
25
|
import re
|
|
@@ -28,7 +33,9 @@ from .prompts import text as prompt_text
|
|
|
28
33
|
logger = logging.getLogger(__name__)
|
|
29
34
|
|
|
30
35
|
PERCEPTIONS = ("sight", "screen_reader")
|
|
31
|
-
INPUTS = ("any", "keyboard")
|
|
36
|
+
INPUTS = ("any", "keyboard", "touch")
|
|
37
|
+
# A device's user agent: ForgeQE's own fixed strings (src/responsive/devices.ts userAgentOf), checked to be plain text.
|
|
38
|
+
UA = re.compile(r"[A-Za-z0-9 ()/;:._,+-]{1,300}")
|
|
32
39
|
# Chrome's Emulation.setEmulatedVisionDeficiency types, by the persona's name for them.
|
|
33
40
|
VISION = {
|
|
34
41
|
"none": "none",
|
|
@@ -106,6 +113,21 @@ You have no mouse. You MUST move with press_key (Tab, Shift+Tab, the arrow keys,
|
|
|
106
113
|
""".strip()
|
|
107
114
|
|
|
108
115
|
|
|
116
|
+
TOUCH_READER_MESSAGE = """
|
|
117
|
+
## You use a screen reader on a touchscreen
|
|
118
|
+
You use VoiceOver or TalkBack on a phone or tablet. You have no keyboard and you do not tap by sight.
|
|
119
|
+
- You MUST move with swipe_next and swipe_previous: each moves the screen reader's cursor to the next or previous item in reading order and says it, as a swipe right or left does.
|
|
120
|
+
- You MUST activate the item under the cursor with double_tap, and type into a field with type_text after double_tap has put focus in it.
|
|
121
|
+
- An item you cannot reach by swiping, an item announced with no name, a control that does nothing on double_tap, and a dialog or new content that the cursor does not move into are barriers.
|
|
122
|
+
""".strip()
|
|
123
|
+
|
|
124
|
+
TOUCH_MESSAGE = """
|
|
125
|
+
## You use a touchscreen
|
|
126
|
+
You have no keyboard and no mouse: you tap, and you type on the on-screen keyboard.
|
|
127
|
+
- Targets that are small or close together, actions that need a precise gesture (drag, swipe, pinch) with no simple alternative, and content that appears only on hover are barriers.
|
|
128
|
+
""".strip()
|
|
129
|
+
|
|
130
|
+
|
|
109
131
|
def parse_persona(raw: Any) -> Optional[Dict[str, Any]]:
|
|
110
132
|
"""The persona of the run request, with each setting from its fixed list; None for no persona."""
|
|
111
133
|
if not isinstance(raw, dict):
|
|
@@ -127,11 +149,54 @@ def parse_persona(raw: Any) -> Optional[Dict[str, Any]]:
|
|
|
127
149
|
"zoom": min(4.0, max(1.0, zoom)),
|
|
128
150
|
"media": list(dict.fromkeys(media)),
|
|
129
151
|
"watch_for": watch,
|
|
152
|
+
"text_scale": _number(raw.get("text_scale"), 1.0, 1.0, 3.0),
|
|
153
|
+
"device": parse_device(raw.get("device")),
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def _number(v: Any, default: float, low: float, high: float) -> float:
|
|
158
|
+
try:
|
|
159
|
+
n = float(v if v not in (None, "") else default)
|
|
160
|
+
except (TypeError, ValueError):
|
|
161
|
+
return default
|
|
162
|
+
return min(high, max(low, n)) if n == n else default
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def parse_device(raw: Any) -> Optional[Dict[str, Any]]:
|
|
166
|
+
"""A phone or tablet to emulate, each value in range and the user agent plain text; None for the browser's own."""
|
|
167
|
+
if not isinstance(raw, dict):
|
|
168
|
+
return None
|
|
169
|
+
try:
|
|
170
|
+
width, height = int(raw.get("width")), int(raw.get("height"))
|
|
171
|
+
except (TypeError, ValueError):
|
|
172
|
+
return None
|
|
173
|
+
if not (240 <= width <= 3000 and 240 <= height <= 3000):
|
|
174
|
+
return None
|
|
175
|
+
ua = str(raw.get("ua") or "")
|
|
176
|
+
return {
|
|
177
|
+
"id": re.sub(r"[^a-z0-9-]", "", str(raw.get("id") or "").lower())[:40],
|
|
178
|
+
"label": " ".join(str(raw.get("label") or "").split())[:60],
|
|
179
|
+
"width": width,
|
|
180
|
+
"height": height,
|
|
181
|
+
"scale": _number(raw.get("scale"), 1.0, 1.0, 4.0),
|
|
182
|
+
"mobile": raw.get("mobile") is True,
|
|
183
|
+
"ua": ua if UA.fullmatch(ua) else "",
|
|
130
184
|
}
|
|
131
185
|
|
|
132
186
|
|
|
133
187
|
def keyboard_only(persona: Dict[str, Any]) -> bool:
|
|
134
|
-
|
|
188
|
+
"""Moves with keys: a keyboard user, and a screen reader user who is not on a touchscreen."""
|
|
189
|
+
return persona["input"] == "keyboard" or (persona["perception"] == "screen_reader" and persona["input"] != "touch")
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def touch_reader(persona: Dict[str, Any]) -> bool:
|
|
193
|
+
"""A screen reader on a touchscreen (VoiceOver, TalkBack): swipes and double taps, never a tap by sight."""
|
|
194
|
+
return persona["perception"] == "screen_reader" and persona["input"] == "touch"
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def no_pointer(persona: Dict[str, Any]) -> bool:
|
|
198
|
+
"""Has no mouse or tap by sight: the pointer actions are taken away."""
|
|
199
|
+
return keyboard_only(persona) or touch_reader(persona)
|
|
135
200
|
|
|
136
201
|
|
|
137
202
|
def uses_vision(persona: Dict[str, Any]) -> bool:
|
|
@@ -146,6 +211,11 @@ def system_message(persona: Dict[str, Any]) -> str:
|
|
|
146
211
|
setting = []
|
|
147
212
|
if persona["zoom"] > 1:
|
|
148
213
|
setting.append(f"The page is zoomed to {round(persona['zoom'] * 100)}%, as this person zooms it. Text that is cut off or overlaps, and content that needs scrolling sideways, are barriers.")
|
|
214
|
+
if persona.get("device"):
|
|
215
|
+
d = persona["device"]
|
|
216
|
+
setting.append(f"You use {d['label'] or 'a handheld device'}: the page is shown at its size ({d['width']}×{d['height']} CSS pixels){', with touch' if d['mobile'] else ''}. Content that does not fit, needs scrolling sideways, or is hidden behind fixed bars is a barrier.")
|
|
217
|
+
if persona.get("text_scale", 1) > 1:
|
|
218
|
+
setting.append(f"Your system's text size is {round(persona['text_scale'] * 100)}%. Text that does not grow, is cut off, or overlaps is a barrier.")
|
|
149
219
|
if persona["vision"] != "none":
|
|
150
220
|
setting.append(f"The screenshots show the page as this person sees it ({persona['vision'].replace('_', ' ')}). Information that you can tell only by colour, and text that you cannot read, are barriers.")
|
|
151
221
|
for m in persona["media"]:
|
|
@@ -163,9 +233,13 @@ def system_message(persona: Dict[str, Any]) -> str:
|
|
|
163
233
|
who += ["", "Barriers that this person meets often (look for them, but record only what you meet):", *[f"- {w}" for w in persona["watch_for"]]]
|
|
164
234
|
parts = [prompt_text("browser-persona", PERSONA_SYSTEM_MESSAGE)]
|
|
165
235
|
if persona["perception"] == "screen_reader":
|
|
166
|
-
parts.append(SCREEN_READER_MESSAGE)
|
|
167
|
-
if
|
|
236
|
+
parts.append(SCREEN_READER_MESSAGE.replace("what press_key announces", "what swipe_next and double_tap announce") if touch_reader(persona) else SCREEN_READER_MESSAGE)
|
|
237
|
+
if touch_reader(persona):
|
|
238
|
+
parts.append(TOUCH_READER_MESSAGE)
|
|
239
|
+
elif keyboard_only(persona):
|
|
168
240
|
parts.append(KEYBOARD_MESSAGE)
|
|
241
|
+
elif persona["input"] == "touch":
|
|
242
|
+
parts.append(TOUCH_MESSAGE)
|
|
169
243
|
parts.append("\n".join(who))
|
|
170
244
|
return "\n\n".join(parts)
|
|
171
245
|
|
|
@@ -186,7 +260,9 @@ async def _cdp(browser_session: BrowserSession):
|
|
|
186
260
|
|
|
187
261
|
async def apply_emulation(browser_session: BrowserSession, persona: Dict[str, Any], viewport: Optional[List[int]], applied: Dict[str, Any]) -> None:
|
|
188
262
|
"""Vision, zoom and media of the persona on the page in focus: vision and media once per tab, zoom whenever it is gone."""
|
|
189
|
-
|
|
263
|
+
device = persona.get("device")
|
|
264
|
+
scale = persona.get("text_scale", 1)
|
|
265
|
+
if persona["vision"] == "none" and persona["zoom"] <= 1 and not persona["media"] and not device and scale <= 1:
|
|
190
266
|
return
|
|
191
267
|
try:
|
|
192
268
|
cdp = await _cdp(browser_session)
|
|
@@ -201,8 +277,26 @@ async def apply_emulation(browser_session: BrowserSession, persona: Dict[str, An
|
|
|
201
277
|
await send.Emulation.setEmulatedVisionDeficiency(params={"type": VISION[persona["vision"]]}, session_id=sid)
|
|
202
278
|
if persona["media"]:
|
|
203
279
|
await send.Emulation.setEmulatedMedia(params={"features": [{"name": MEDIA[m][0], "value": MEDIA[m][1]} for m in persona["media"]]}, session_id=sid)
|
|
280
|
+
if device and device["mobile"]:
|
|
281
|
+
await send.Emulation.setTouchEmulationEnabled(params={"enabled": True, "maxTouchPoints": 5}, session_id=sid)
|
|
282
|
+
if device and device["ua"]:
|
|
283
|
+
await send.Emulation.setUserAgentOverride(params={"userAgent": device["ua"]}, session_id=sid)
|
|
284
|
+
if scale > 1:
|
|
285
|
+
# The system's larger text, as the browser's default font size: text sized in rem or em grows, px does not.
|
|
286
|
+
await send.Page.setFontSizes(params={"fontSizes": {"standard": round(16 * scale), "fixed": round(13 * scale)}}, session_id=sid)
|
|
204
287
|
applied[sid] = True
|
|
205
|
-
if
|
|
288
|
+
if device:
|
|
289
|
+
# The device's size, at the persona's zoom; the browser library resets the viewport when a tab gains focus, so it is
|
|
290
|
+
# checked before every step and applied again once it is gone.
|
|
291
|
+
z = persona["zoom"]
|
|
292
|
+
width = max(240, round(device["width"] / z))
|
|
293
|
+
# screen.width, not innerWidth: a page with no viewport meta lays out wider (980px) on a phone, as it should.
|
|
294
|
+
now = ((await send.Runtime.evaluate(params={"expression": "screen.width", "returnByValue": True}, session_id=sid)).get("result") or {}).get("value")
|
|
295
|
+
if now != width:
|
|
296
|
+
await send.Emulation.setDeviceMetricsOverride(
|
|
297
|
+
params={"screenWidth": width, "screenHeight": max(240, round(device["height"] / z)), "width": width, "height": max(240, round(device["height"] / z)), "deviceScaleFactor": device["scale"] * z, "mobile": device["mobile"]}, session_id=sid
|
|
298
|
+
)
|
|
299
|
+
elif persona["zoom"] > 1:
|
|
206
300
|
# Zooming a page is a smaller viewport in CSS pixels at a larger scale: the page reflows as it does at that zoom.
|
|
207
301
|
w, h = (viewport or [1280, 800])[:2]
|
|
208
302
|
z = persona["zoom"]
|
|
@@ -263,7 +357,14 @@ def announce(node: Dict[str, Any]) -> str:
|
|
|
263
357
|
return " ".join(b for b in bits if b)
|
|
264
358
|
|
|
265
359
|
|
|
266
|
-
def
|
|
360
|
+
def reading_items(nodes: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
|
|
361
|
+
"""What a touch screen reader's swipes move through, in reading order: each item as it is said, and its DOM node."""
|
|
362
|
+
items: List[Dict[str, Any]] = []
|
|
363
|
+
render_tree(nodes, "page", items)
|
|
364
|
+
return items
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
def render_tree(nodes: List[Dict[str, Any]], view: str, items: Optional[List[Dict[str, Any]]] = None) -> str:
|
|
267
368
|
"""The accessibility tree as a screen reader user hears it: the whole page, or one of its rotor lists."""
|
|
268
369
|
by_id = {str(n.get("nodeId")): n for n in nodes if isinstance(n, dict)}
|
|
269
370
|
lines: List[str] = []
|
|
@@ -285,7 +386,9 @@ def render_tree(nodes: List[Dict[str, Any]], view: str) -> str:
|
|
|
285
386
|
if role in ("generic", "none", "presentation", "RootWebArea", "group", "LabelText", "paragraph", "Section") and not _ax_value(n.get("name")):
|
|
286
387
|
return False
|
|
287
388
|
if role == "StaticText":
|
|
288
|
-
#
|
|
389
|
+
# Empty or blank text is not said; text inside a named element is already in that element's name.
|
|
390
|
+
if not _ax_value(n.get("name")).strip():
|
|
391
|
+
return False
|
|
289
392
|
parent = by_id.get(str(n.get("parentId")))
|
|
290
393
|
return not (parent and _ax_value(parent.get("name")) and _ax_value(parent.get("role")) in INTERACTIVE | {"heading", "image", "img"})
|
|
291
394
|
return True
|
|
@@ -299,6 +402,10 @@ def render_tree(nodes: List[Dict[str, Any]], view: str) -> str:
|
|
|
299
402
|
role = _ax_value(n.get("role"))
|
|
300
403
|
line = f"text {' '.join(_ax_value(n.get('name')).split())[:200]!r}" if role == "StaticText" else announce(n)
|
|
301
404
|
lines.append((" " * min(depth, 8) if view == "page" else "") + line)
|
|
405
|
+
# A swipe stops on what VoiceOver and TalkBack stop on: not the page itself, a landmark, or an unnamed legend.
|
|
406
|
+
if items is not None and role not in LANDMARKS and role not in ("RootWebArea", "Legend"):
|
|
407
|
+
backend = n.get("backendDOMNodeId")
|
|
408
|
+
items.append({"line": line, "backend": backend if isinstance(backend, int) else None})
|
|
302
409
|
for c in n.get("childIds") or []:
|
|
303
410
|
walk(str(c), depth + (1 if shown else 0))
|
|
304
411
|
|
|
@@ -412,12 +519,92 @@ def register_persona_tools(tools: Any, persona: Dict[str, Any], findings: List[D
|
|
|
412
519
|
said = f"Pressed {'Shift+' if shift else ''}{name}. {focus_line(f, sighted)}"
|
|
413
520
|
return ActionResult(extracted_content=said, long_term_memory=said)
|
|
414
521
|
|
|
415
|
-
|
|
522
|
+
if touch_reader(persona):
|
|
523
|
+
cursor: Dict[str, Any] = {"url": "", "at": -1, "line": "", "backend": None}
|
|
524
|
+
|
|
525
|
+
async def _items(browser_session: BrowserSession) -> List[Dict[str, Any]]:
|
|
526
|
+
cdp = await _cdp(browser_session)
|
|
527
|
+
try:
|
|
528
|
+
await cdp.cdp_client.send.Accessibility.enable(session_id=cdp.session_id)
|
|
529
|
+
except Exception:
|
|
530
|
+
pass
|
|
531
|
+
tree = await cdp.cdp_client.send.Accessibility.getFullAXTree(params={}, session_id=cdp.session_id)
|
|
532
|
+
return reading_items(tree.get("nodes") or [])
|
|
533
|
+
|
|
534
|
+
async def _place(browser_session: BrowserSession, items: List[Dict[str, Any]]) -> int:
|
|
535
|
+
"""Where the cursor is now: on its item again after the page changed, at the start of a new page."""
|
|
536
|
+
url = ""
|
|
537
|
+
try:
|
|
538
|
+
url = str(await browser_session.get_current_page_url() or "")
|
|
539
|
+
except Exception:
|
|
540
|
+
pass
|
|
541
|
+
if url != cursor["url"]:
|
|
542
|
+
cursor.update({"url": url, "at": -1, "line": "", "backend": None})
|
|
543
|
+
return -1
|
|
544
|
+
for i, it in enumerate(items):
|
|
545
|
+
if cursor["backend"] is not None and it["backend"] == cursor["backend"] and it["line"] == cursor["line"]:
|
|
546
|
+
return i
|
|
547
|
+
return min(cursor["at"], len(items) - 1)
|
|
548
|
+
|
|
549
|
+
async def _swipe(step: int, browser_session: BrowserSession) -> ActionResult:
|
|
550
|
+
try:
|
|
551
|
+
items = await _items(browser_session)
|
|
552
|
+
at = await _place(browser_session, items) + step
|
|
553
|
+
except Exception as ex:
|
|
554
|
+
return ActionResult(error=f"The screen reader could not read the page: {ex}")
|
|
555
|
+
if not items:
|
|
556
|
+
return ActionResult(extracted_content="The screen reader announces nothing on this page.")
|
|
557
|
+
if at < 0 or at >= len(items):
|
|
558
|
+
return ActionResult(extracted_content="Start of the page: nothing before this." if at < 0 else "End of the page: nothing after this.")
|
|
559
|
+
cursor.update({"at": at, "line": items[at]["line"], "backend": items[at]["backend"]})
|
|
560
|
+
said = f"{'Swiped right' if step > 0 else 'Swiped left'}. {items[at]['line']}"
|
|
561
|
+
return ActionResult(extracted_content=said, long_term_memory=said)
|
|
562
|
+
|
|
563
|
+
@tools.action("Swipe right with the screen reader: move to the next item in reading order and hear it.")
|
|
564
|
+
async def swipe_next(browser_session: BrowserSession) -> ActionResult:
|
|
565
|
+
return await _swipe(1, browser_session)
|
|
566
|
+
|
|
567
|
+
@tools.action("Swipe left with the screen reader: move to the previous item in reading order and hear it.")
|
|
568
|
+
async def swipe_previous(browser_session: BrowserSession) -> ActionResult:
|
|
569
|
+
return await _swipe(-1, browser_session)
|
|
570
|
+
|
|
571
|
+
@tools.action("Double tap with the screen reader: activate the item the cursor is on (follow a link, press a button, put focus in a field).")
|
|
572
|
+
async def double_tap(browser_session: BrowserSession) -> ActionResult:
|
|
573
|
+
if cursor["backend"] is None:
|
|
574
|
+
return ActionResult(error="The cursor is on nothing that can be activated: move to an item with swipe_next first.")
|
|
575
|
+
try:
|
|
576
|
+
cdp = await _cdp(browser_session)
|
|
577
|
+
send, sid = cdp.cdp_client.send, cdp.session_id
|
|
578
|
+
await send.DOM.getDocument(params={"depth": 0}, session_id=sid)
|
|
579
|
+
await send.DOM.scrollIntoViewIfNeeded(params={"backendNodeId": cursor["backend"]}, session_id=sid)
|
|
580
|
+
box = ((await send.DOM.getBoxModel(params={"backendNodeId": cursor["backend"]}, session_id=sid)) or {}).get("model") or {}
|
|
581
|
+
quad = box.get("content") or box.get("border") or []
|
|
582
|
+
if len(quad) < 8:
|
|
583
|
+
return ActionResult(error=f"{cursor['line']} has no place on the screen: double tap does nothing on it.")
|
|
584
|
+
x, y = sum(quad[0::2]) / 4, sum(quad[1::2]) / 4
|
|
585
|
+
# A screen reader's double tap activates the item where it is, as a finger's tap there does: a touch, in the
|
|
586
|
+
# page's layout pixels (the input layer maps them onto a page a phone shows scaled). Without touch, a click.
|
|
587
|
+
try:
|
|
588
|
+
await send.Input.dispatchTouchEvent(params={"type": "touchStart", "touchPoints": [{"x": x, "y": y}]}, session_id=sid)
|
|
589
|
+
await send.Input.dispatchTouchEvent(params={"type": "touchEnd", "touchPoints": []}, session_id=sid)
|
|
590
|
+
except Exception:
|
|
591
|
+
for kind in ("mousePressed", "mouseReleased"):
|
|
592
|
+
await send.Input.dispatchMouseEvent(params={"type": kind, "x": x, "y": y, "button": "left", "clickCount": 1}, session_id=sid)
|
|
593
|
+
await asyncio.sleep(0.3)
|
|
594
|
+
f = await focused(browser_session)
|
|
595
|
+
except Exception as ex:
|
|
596
|
+
return ActionResult(error=f"Double tap did not reach {cursor['line']}: {ex}")
|
|
597
|
+
said = f"Double tapped {cursor['line']}. {focus_line(f, False)}"
|
|
598
|
+
return ActionResult(extracted_content=said, long_term_memory=said)
|
|
599
|
+
|
|
600
|
+
if touch_reader(persona) or keyboard_only(persona):
|
|
601
|
+
|
|
602
|
+
@tools.action("Type text into the field that has focus, as on the on-screen or a real keyboard. Put focus in the field first (press_key, or double_tap on a touchscreen).")
|
|
416
603
|
async def type_text(text: str, browser_session: BrowserSession) -> ActionResult:
|
|
417
604
|
try:
|
|
418
605
|
f = await focused(browser_session)
|
|
419
606
|
if f.get("none"):
|
|
420
|
-
return ActionResult(error="Nothing has focus:
|
|
607
|
+
return ActionResult(error="Nothing has focus: put focus in the field first.")
|
|
421
608
|
cdp = await _cdp(browser_session)
|
|
422
609
|
await cdp.cdp_client.send.Input.insertText(params={"text": str(text or "")}, session_id=cdp.session_id)
|
|
423
610
|
f = await focused(browser_session)
|