@capagents/forgeqe 3.1.9 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/HOW_TO_USE.md +43 -4
  2. package/THIRD_PARTY_NOTICES.md +2 -1
  3. package/dist/docs-site/docs/area-api/index.html +1 -1
  4. package/dist/docs-site/docs/area-mobile/index.html +28 -8
  5. package/dist/docs-site/docs/area-quality/index.html +27 -3
  6. package/dist/docs-site/docs/area-setup/index.html +1 -1
  7. package/dist/docs-site/docs/get-started/index.html +4 -1
  8. package/dist/docs-site/docs/mobile/index.html +19 -7
  9. package/dist/docs-site/docs/search.js +1 -1
  10. package/dist/docs-site/docs/web-app/index.html +2 -1
  11. package/dist/forgeqe.js +1931 -1917
  12. package/dist/template.html +12 -12
  13. package/dist/vendor/ibm-ace.js +2 -0
  14. package/dist/web/assets/{3d-force-graph-CGHQthr3.js → 3d-force-graph-ByL874l5.js} +1 -1
  15. package/dist/web/assets/Agent-Drs4mcil.js +8 -0
  16. package/dist/web/assets/{AgentWork-DEZVZTuJ.js → AgentWork-DLcCZTgu.js} +1 -1
  17. package/dist/web/assets/ApiTests-BcrTspwJ.js +10 -0
  18. package/dist/web/assets/Browse-D9eaDrZT.js +1 -0
  19. package/dist/web/assets/Chat-CMNf9-ys.js +3 -0
  20. package/dist/web/assets/{CommandPalette-sokhT5PA.js → CommandPalette-Bcf1Muan.js} +1 -1
  21. package/dist/web/assets/Compare-V5xKnwGO.js +1 -0
  22. package/dist/web/assets/Cost-DC3DYthD.js +1 -0
  23. package/dist/web/assets/Data-DzrP-MdL.js +6 -0
  24. package/dist/web/assets/Desktop-DjTq9eAr.js +1 -0
  25. package/dist/web/assets/DesktopReview-Buecn3n5.js +2 -0
  26. package/dist/web/assets/DeviceScreen-CoArZGyY.js +1 -0
  27. package/dist/web/assets/Evidence-D6VvlFNK.js +1 -0
  28. package/dist/web/assets/Explore-YkonRPmA.js +2 -0
  29. package/dist/web/assets/Features-BKB4iSRj.js +1 -0
  30. package/dist/web/assets/Flags-4GGW38Xu.js +2 -0
  31. package/dist/web/assets/Flaky-BRcLjYrP.js +1 -0
  32. package/dist/web/assets/Impact-CvuahLDQ.js +3 -0
  33. package/dist/web/assets/Jobs-DBCw8Z8I.js +5 -0
  34. package/dist/web/assets/KindPage-Ige-qO2t.js +6 -0
  35. package/dist/web/assets/LiveDevice-DI7Bq6ag.js +1 -0
  36. package/dist/web/assets/Migration-CEwXGs4c.js +8 -0
  37. package/dist/web/assets/Mobile-BqyFTBeG.js +1 -0
  38. package/dist/web/assets/Observability-B2Y1pHpD.js +1 -0
  39. package/dist/web/assets/PageAgent-BRhWi7LL.js +1 -0
  40. package/dist/web/assets/Product-CXIbmmMF.js +12 -0
  41. package/dist/web/assets/Production-BOy7ew7l.js +1 -0
  42. package/dist/web/assets/Quality-Dtcq2AWE.js +1 -0
  43. package/dist/web/assets/Readiness-B53Drc7i.js +1 -0
  44. package/dist/web/assets/Record-BuCIDb1d.js +1 -0
  45. package/dist/web/assets/Regression-BpPXCQIv.js +5 -0
  46. package/dist/web/assets/{RelationGraph-CeBfmWYf.js → RelationGraph-UXFyQOKO.js} +1 -1
  47. package/dist/web/assets/Reports-CWCa9uof.js +2 -0
  48. package/dist/web/assets/Response-C6EmnnQz.js +9 -0
  49. package/dist/web/assets/Responsive-Bl6i7kB3.js +3 -0
  50. package/dist/web/assets/{RunDiff-T4e0xs_5.js → RunDiff-CWf9Bkmu.js} +1 -1
  51. package/dist/web/assets/Runs-C0tfrB_j.js +2 -0
  52. package/dist/web/assets/Settings-tgCcBEwu.js +21 -0
  53. package/dist/web/assets/Steps-xASPoq1N.js +3 -0
  54. package/dist/web/assets/TestCases-Cm4KwWIP.js +1 -0
  55. package/dist/web/assets/TestData-DMV5S00V.js +2 -0
  56. package/dist/web/assets/{TestDebt-WuBkOmz5.js → TestDebt-D54mt0ZT.js} +1 -1
  57. package/dist/web/assets/TestManagement-DBFlK8Xe.js +4 -0
  58. package/dist/web/assets/WhatsNew-Dp-zP-jw.js +1 -0
  59. package/dist/web/assets/agents-DPabR9dS.js +1 -0
  60. package/dist/web/assets/coverage-xSRsKFL6.js +5 -0
  61. package/dist/web/assets/dataParts-BPff7ClX.js +3 -0
  62. package/dist/web/assets/desktopAppPath-BVJxel_D.js +1 -0
  63. package/dist/web/assets/{diff-CZ0iWWGv.js → diff-BXu8cULX.js} +1 -1
  64. package/dist/web/assets/families-CrnKBjis.js +1 -0
  65. package/dist/web/assets/{highlight-CGRzYrMa.js → highlight-DCCKhwHj.js} +1 -1
  66. package/dist/web/assets/index-BsAaOk_G.js +64 -0
  67. package/dist/web/assets/index-CgpH1pj9.css +2 -0
  68. package/dist/web/assets/input-BmJ7dt1C.js +1 -0
  69. package/dist/web/assets/pageBack-BNLSF2VR.js +3 -0
  70. package/dist/web/assets/palette-BS9ixqiJ.js +1 -0
  71. package/dist/web/assets/{paletteCommands-DU0boMQR.js → paletteCommands-C3knXWbA.js} +1 -1
  72. package/dist/web/assets/{parts-CTmOGb8E.js → parts-69Ei7EPi.js} +1 -1
  73. package/dist/web/assets/productParts-CrAb3-j0.js +1 -0
  74. package/dist/web/assets/qualityParts-BQTnBwPs.js +1 -0
  75. package/dist/web/assets/{recordTest-H42EwQYC.js → recordTest-DVJCNI0y.js} +1 -1
  76. package/dist/web/assets/{route-Mq0QZuqV.js → route-D8G-pTdk.js} +1 -1
  77. package/dist/web/assets/{stepper-ceEfHcbV.js → stepper-t0O_8eQo.js} +1 -1
  78. package/dist/web/index.html +7 -7
  79. package/docs/MOBILE.md +22 -7
  80. package/docs/WEB_APP.md +2 -1
  81. package/docs/user-guide.html +40 -5
  82. package/forgeqe.example.yaml +3 -1
  83. package/package.json +2 -1
  84. package/prompts/browser-persona.md +1 -1
  85. package/py/forgeqe_engine/copilot_gateway.py +80 -1
  86. package/py/forgeqe_engine/diagnostics.py +119 -2
  87. package/py/forgeqe_engine/persona.py +200 -12
  88. package/py/forgeqe_engine/service.py +6 -3
  89. package/py/forgeqe_mobile/a11y.py +322 -0
  90. package/py/forgeqe_mobile/appium_driver.py +16 -0
  91. package/py/forgeqe_mobile/live.py +225 -0
  92. package/py/forgeqe_mobile/service.py +102 -4
  93. package/dist/web/assets/Agent-lzvUoYv1.js +0 -8
  94. package/dist/web/assets/ApiTests-k9bR9dXo.js +0 -10
  95. package/dist/web/assets/Browse-4bm1SVvY.js +0 -1
  96. package/dist/web/assets/Chat-CbyylnvP.js +0 -3
  97. package/dist/web/assets/Compare-ChWSXkvf.js +0 -1
  98. package/dist/web/assets/Cost-DlZnyY_C.js +0 -1
  99. package/dist/web/assets/Data-CElI9cSA.js +0 -6
  100. package/dist/web/assets/Desktop-YtONOq0M.js +0 -1
  101. package/dist/web/assets/DesktopReview-CldegMwj.js +0 -2
  102. package/dist/web/assets/Evidence-B9wlQQy6.js +0 -1
  103. package/dist/web/assets/Explore-Cp3eqrm2.js +0 -2
  104. package/dist/web/assets/Features-ySmycsYI.js +0 -1
  105. package/dist/web/assets/Flags-CnjZtCU3.js +0 -2
  106. package/dist/web/assets/Flaky-D7VtH51H.js +0 -1
  107. package/dist/web/assets/Impact-Dx1cn9WD.js +0 -3
  108. package/dist/web/assets/Jobs-BwfvwxGd.js +0 -5
  109. package/dist/web/assets/KindPage-BHGa8zq7.js +0 -6
  110. package/dist/web/assets/Migration-f-gLkpSC.js +0 -4
  111. package/dist/web/assets/Observability-CibZbiOA.js +0 -1
  112. package/dist/web/assets/PageAgent-UTRXl1j4.js +0 -1
  113. package/dist/web/assets/Product-LJxwGFzs.js +0 -12
  114. package/dist/web/assets/Production-DXwaHzaa.js +0 -1
  115. package/dist/web/assets/Quality-Di4cF4nd.js +0 -1
  116. package/dist/web/assets/Readiness-Bu1OXgnc.js +0 -1
  117. package/dist/web/assets/Record-olwaN1G1.js +0 -1
  118. package/dist/web/assets/Regression-DBu-34b_.js +0 -5
  119. package/dist/web/assets/Reports-hoagfsmM.js +0 -2
  120. package/dist/web/assets/Response-CJSq1qN7.js +0 -9
  121. package/dist/web/assets/Responsive-DYhEQEpT.js +0 -3
  122. package/dist/web/assets/Runs-CcG9BELK.js +0 -2
  123. package/dist/web/assets/Settings-lWl74aQY.js +0 -21
  124. package/dist/web/assets/Steps-BefTJLTB.js +0 -3
  125. package/dist/web/assets/TestCases-CyzfvT_X.js +0 -1
  126. package/dist/web/assets/TestData-DSusRbgZ.js +0 -2
  127. package/dist/web/assets/TestManagement-HwkjrA4a.js +0 -4
  128. package/dist/web/assets/WhatsNew-B-w1pGj6.js +0 -1
  129. package/dist/web/assets/agents-BUWN-VJv.js +0 -1
  130. package/dist/web/assets/coverage-CWE1aatw.js +0 -5
  131. package/dist/web/assets/dataParts-ClIBv7-8.js +0 -3
  132. package/dist/web/assets/families-CfIM4f2s.js +0 -1
  133. package/dist/web/assets/index-Cg0SmlXN.js +0 -64
  134. package/dist/web/assets/index-tPgJ7dv2.css +0 -2
  135. package/dist/web/assets/input-1RVqxCVH.js +0 -1
  136. package/dist/web/assets/logLevel-CFPS8IkY.js +0 -3
  137. package/dist/web/assets/palette-5nApQc76.js +0 -1
  138. package/dist/web/assets/productParts-CL2E8Uaf.js +0 -1
  139. package/dist/web/assets/qualityParts-CnlpML55.js +0 -1
@@ -1 +1 @@
1
- import{O as e}from"./route-Mq0QZuqV.js";import{t}from"./jsx-runtime-LKYXHABd.js";import{A as n}from"./input-1RVqxCVH.js";var r=t();function i({steps:t,at:i,reached:a,onGo:o,label:s=`Steps`}){return(0,r.jsx)(`nav`,{"aria-label":s,children:(0,r.jsx)(`ol`,{className:`m-0 flex list-none items-center gap-2 p-0`,children:t.map((s,c)=>{let l=c<=a,u=c===i,d=c<a&&!u;return(0,r.jsxs)(`li`,{className:n(`flex items-center gap-2`,c<t.length-1&&`flex-1`),children:[(0,r.jsxs)(`button`,{type:`button`,disabled:!l,"aria-current":u?`step`:void 0,onClick:()=>o(c),"aria-label":s.name,"data-tip":s.tip,className:n(`inline-flex min-h-8 flex-none items-center gap-2 rounded-[8px] border-0 bg-transparent px-1 text-[13px] whitespace-nowrap`,l&&!u?`cursor-pointer hover:bg-surface-strong`:``),children:[(0,r.jsx)(`span`,{"aria-hidden":`true`,className:n(`inline-flex size-6 flex-none items-center justify-center rounded-full text-[13px] font-semibold tabular-nums`,d?`bg-pass text-white`:u?`bg-accent text-accent-ink`:`border border-line bg-bg text-muted`),children:d?(0,r.jsx)(e,{size:13,strokeWidth:3}):c+1}),(0,r.jsx)(`span`,{className:n(u?`font-medium text-ink`:l?`text-ink-2`:`text-muted`,!u&&`hidden @xl:inline`),children:s.name})]}),c<t.length-1&&(0,r.jsx)(`span`,{"aria-hidden":`true`,className:`h-0.5 min-w-4 flex-1 overflow-hidden rounded-full bg-line @xl:min-w-8`,children:(0,r.jsx)(`span`,{className:n(`block h-full rounded-full bg-pass transition-[width] duration-250 ease-out`,c<a?`w-full`:`w-0`)})})]},s.name)})})})}export{i as t};
1
+ import{O as e}from"./route-D8G-pTdk.js";import{t}from"./jsx-runtime-LKYXHABd.js";import{A as n}from"./input-BmJ7dt1C.js";var r=t();function i({steps:t,at:i,reached:a,onGo:o,label:s=`Steps`}){return(0,r.jsx)(`nav`,{"aria-label":s,children:(0,r.jsx)(`ol`,{className:`m-0 flex list-none items-center gap-2 p-0`,children:t.map((s,c)=>{let l=c<=a,u=c===i,d=c<a&&!u;return(0,r.jsxs)(`li`,{className:n(`flex items-center gap-2`,c<t.length-1&&`flex-1`),children:[(0,r.jsxs)(`button`,{type:`button`,disabled:!l,"aria-current":u?`step`:void 0,onClick:()=>o(c),"aria-label":s.name,"data-tip":s.tip,className:n(`inline-flex min-h-8 flex-none items-center gap-2 rounded-[8px] border-0 bg-transparent px-1 text-[13px] whitespace-nowrap`,l&&!u?`cursor-pointer hover:bg-surface-strong`:``),children:[(0,r.jsx)(`span`,{"aria-hidden":`true`,className:n(`inline-flex size-6 flex-none items-center justify-center rounded-full text-[13px] font-semibold tabular-nums`,d?`bg-pass text-white`:u?`bg-accent text-accent-ink`:`border border-line bg-bg text-muted`),children:d?(0,r.jsx)(e,{size:13,strokeWidth:3}):c+1}),(0,r.jsx)(`span`,{className:n(u?`font-medium text-ink`:l?`text-ink-2`:`text-muted`,!u&&`hidden @xl:inline`),children:s.name})]}),c<t.length-1&&(0,r.jsx)(`span`,{"aria-hidden":`true`,className:`h-0.5 min-w-4 flex-1 overflow-hidden rounded-full bg-line @xl:min-w-8`,children:(0,r.jsx)(`span`,{className:n(`block h-full rounded-full bg-pass transition-[width] duration-250 ease-out`,c<a?`w-full`:`w-0`)})})]},s.name)})})})}export{i as t};
@@ -7,15 +7,15 @@
7
7
  <!-- Light and dark both: before the app has set its mode, the page is the computer's (src/index.css, :root). -->
8
8
  <meta name="color-scheme" content="light dark" />
9
9
  <title>ForgeQE</title>
10
- <script type="module" crossorigin src="/assets/index-Cg0SmlXN.js"></script>
10
+ <script type="module" crossorigin src="/assets/index-BsAaOk_G.js"></script>
11
11
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-XKyaHtl9.js">
12
- <link rel="modulepreload" crossorigin href="/assets/route-Mq0QZuqV.js">
13
- <link rel="modulepreload" crossorigin href="/assets/agents-BUWN-VJv.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/route-D8G-pTdk.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/agents-DPabR9dS.js">
14
14
  <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-LKYXHABd.js">
15
- <link rel="modulepreload" crossorigin href="/assets/input-1RVqxCVH.js">
16
- <link rel="modulepreload" crossorigin href="/assets/logLevel-CFPS8IkY.js">
17
- <link rel="modulepreload" crossorigin href="/assets/palette-5nApQc76.js">
18
- <link rel="stylesheet" crossorigin href="/assets/index-tPgJ7dv2.css">
15
+ <link rel="modulepreload" crossorigin href="/assets/input-BmJ7dt1C.js">
16
+ <link rel="modulepreload" crossorigin href="/assets/pageBack-BNLSF2VR.js">
17
+ <link rel="modulepreload" crossorigin href="/assets/palette-BS9ixqiJ.js">
18
+ <link rel="stylesheet" crossorigin href="/assets/index-CgpH1pj9.css">
19
19
  </head>
20
20
  <body>
21
21
  <div id="root"></div>
package/docs/MOBILE.md CHANGED
@@ -21,13 +21,28 @@ What the web app and the terminal each offer:
21
21
 
22
22
  | Task | Web app | Terminal |
23
23
  |---|---|---|
24
- | Set up Appium on this computer | **Settings › Set up** | `forgeqe mobile setup` |
25
- | Devices and drivers | **Settings › Mobile** | `forgeqe.yaml`, `forgeqe mobile devices` |
26
- | Record your own steps | **Record › Mobile app** | not available |
27
- | Review and replay a recording | the recording's review | `forgeqe mobile replay` |
28
- | Explore a goal with the model | in a chat | `forgeqe mobile explore` |
29
- | Run your team's Maestro flows | in a chat | `forgeqe mobile maestro` |
30
- | Upload a build to TestMu AI | in a chat | `forgeqe mobile upload` |
24
+ | Set up Appium on this computer | **Mobile apps › Devices and apps**, or **Settings › Set up** | `forgeqe mobile setup` |
25
+ | Devices and drivers | **Settings › Mobile** (listed on **Mobile apps › Devices and apps**) | `forgeqe.yaml`, `forgeqe mobile devices` |
26
+ | Record your own steps | **Record › Mobile app** (or **Record by hand** on **Mobile apps › Workflows**) | not available |
27
+ | Review and replay a recording | the recording's review, or **Mobile apps › Workflows** (Appium or Maestro) | `forgeqe mobile replay` |
28
+ | Explore a goal with the model | **Mobile apps › Workflows › Explore a goal**, or in a chat | `forgeqe mobile explore` |
29
+ | Run your team's Maestro flows | **Mobile apps › Maestro flows** (from `.maestro/`), or in a chat | `forgeqe mobile maestro` |
30
+ | Upload a build to TestMu AI | **Mobile apps › Devices and apps › Upload a build**, or in a chat | `forgeqe mobile upload` |
31
+ | Watch the device while a run works | **Mobile apps** (above its tabs), and a chat's device pane | not available |
32
+
33
+ **Mobile apps** (`#/mobile`) is MobilePilot's page. Its **Agent** tab is where you ask it; **Workflows**, **Maestro
34
+ flows**, **Runs** and **Devices and apps** are its work. While a run is at work, from the page or from a chat, the
35
+ 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
36
+ TestMu or BrowserStack a link to the cloud's own live view.
37
+
38
+ ### Watching the device
39
+
40
+ The engine keeps the device's latest screen while a run works (`live/` in the run's folder: one picture, the step, and
41
+ when; removed when the run ends). Appium runs, on this computer or a device cloud, use Appium's own screenshot. Maestro
42
+ on this computer is read with `adb exec-out screencap` (Android) or `xcrun simctl io … screenshot` (an iOS simulator).
43
+ Maestro on TestMu (HyperExecute) gives ForgeQE no pictures: watch it on TestMu. A typed value is never shown, only a
44
+ 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
45
+ right for the rest of the chat; below 1100px wide, **Show the device** opens it over the chat.
31
46
 
32
47
  **Setting up.** For an emulator or phone on this computer, ForgeQE installs Appium and its drivers once (see
33
48
  [Appium on this computer](#appium-on-this-computer)). A device cloud needs none of it.
package/docs/WEB_APP.md CHANGED
@@ -187,7 +187,7 @@ repository, databases, test environments and systems it reaches), its instructio
187
187
  changed in Prompts) and its recent runs. A request sent from there goes to Atlas with the agent's
188
188
  name before it, so it is handed on.
189
189
 
190
- An agent whose work has a page of its own opens on that page, on its first tab, **Agent**: DeskPilot on Desktop apps,
190
+ An agent whose work has a page of its own opens on that page, on its first tab, **Agent**: DeskPilot on Desktop apps, MobilePilot on Mobile apps,
191
191
  Rover on Exploratory, Quill on Record, Librarian on Knowledge, Mender on Regression, Mover and the Tosca assistant on
192
192
  Migration, Prism on Responsive, Link on API tests and Miner on Data. The page's other tabs hold its work. Agents that
193
193
  only plan, review or help another have no card: they are listed under **Works with** on the agent they help (Pathfinder,
@@ -275,6 +275,7 @@ can say.
275
275
  | **Test cases** | One story's test cases in your test case system: pick the system (Azure DevOps, Jira, TestRail, Zephyr Scale, qTest), type the **Story** and press **Open**. **Linked cases** says which are older than the story's last change, **Acceptance criteria** which cases cover each criterion, and **Proposed changes** lists the changes to existing cases that ForgeQE's agent proposed when it saved cases in a chat: tick them and press **Apply** (nothing is written before). **Recent changes** lists what ForgeQE changed. See [Where cases come from](../HOW_TO_USE.md#where-cases-come-from). At a terminal: ask in `forgeqe start`. |
276
276
  | **Exploratory** | Rover's page. **Agent**: plan charters or explore a journey. **Sessions**: every exploratory session and what it found. At a terminal: `forgeqe explore <story>`. |
277
277
  | **Desktop apps** | DeskPilot's page. **Agent**: automate a task in a Windows app. **Workflows**, **Runs** (with heals to accept), and **Machine and apps**. At a terminal: `forgeqe desktop`. |
278
+ | **Mobile apps** | MobilePilot's page. **Agent**: automate a task in an Android or iOS app. **Workflows** (replay on Appium or Maestro), **Maestro flows** (your team's, from `.maestro/`), **Runs** (with heals to accept) and **Devices and apps** (Appium, Maestro, the devices, the apps, upload a build). The device a run works on is shown live above the tabs. At a terminal: `forgeqe mobile`. |
278
279
  | **Migration** | Every migration, Tosca conversions included, with their numbers. **Agent**: plan one in words. **New** plans one in four steps (source, target, instructions, review); starting needs the plan's id typed. A migration's page follows the job: its stages, every file, the tests with **Fix**, source and target side by side, and the activity. See [Migrating a test suite](../HOW_TO_USE.md#migrating-a-test-suite) and [Converting Tosca tests](../HOW_TO_USE.md#converting-tosca-tests). At a terminal: `forgeqe migrate`, `forgeqe tosca`. |
279
280
  | **BASAL** | A business question played by ForgeQE's agents as the people it affects: **Agent**, **Tests**, **Personas** and **Findings**. See [BASAL.md](BASAL.md). At a terminal: `forgeqe basal`. |
280
281
  | **Mask** (business personas) | Mask's page (Quality Engineering, or Agents › All agents), in three tabs: **Agent** (describe a person and Mask drafts the persona), **Personas** (every persona any agent can act as or test for, with **New persona**, **Edit**, or **Copy to edit** for a built-in one, and **Export** and **Import** to share them between projects) and **Tools and conversations**. See [Business personas](../HOW_TO_USE.md#business-personas). At a terminal: `forgeqe persona`. |
@@ -773,7 +773,10 @@ refused, a rate limit or a used-up allowance never moves to another model. <code
773
773
  what Copilot answered and which model took over.</p>
774
774
  <p><strong>Copilot's versions.</strong> ForgeQE pins GitHub's Copilot SDK and the Copilot runtime it runs, so a GitHub release never
775
775
  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. If GitHub ever stops accepting them, the chat or run says so and asks you to update ForgeQE,
776
+ shows the versions in use. A newer version is downloaded from GitHub the first time it is needed; when that download
777
+ fails (a company network or proxy that blocks GitHub's downloads), ForgeQE keeps using the Copilot already on your
778
+ computer, for the sign-in and for chats and runs, and says so. To get the newer one, allow <code>github.com</code> and
779
+ <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
780
  rather than trying another model.</p>
778
781
  <p><strong>Behind a company proxy.</strong> ForgeQE reaches Copilot over plain HTTPS. Copilot can use WebSockets for some models, which
779
782
  many company proxies break, leaving requests unanswered; ForgeQE turns them off, as each request is a new Copilot
@@ -3623,7 +3626,7 @@ Signing in stays <code>/auth</code> and <code>forgeqe login</code>; <code>forgeq
3623
3626
  <tr><td><code>forgeqe pr-tests [pr] [--base BRANCH] [--run] [--post]</code></td><td>The tests a pull request can break; <code>--run</code> makes it a CI gate (see <a href="#doc-how_to_use-tests-for-a-pull-request">Tests for a pull request</a>)</td></tr>
3624
3627
  <tr><td><code>forgeqe impact &lt;repo&gt; &lt;base&gt; &lt;head&gt; | &lt;repo&gt; --pr LINK [--gate] [--post] [--json] [--quick]</code></td><td>What a change in a product repository reaches, and whether it is ready; <code>--gate</code> exits 1 when it is blocked</td></tr>
3625
3628
  <tr><td><code>forgeqe report &lt;file|folder&gt;... [--title T] [--out DIR]</code>, <code>forgeqe report setup [--repo DIR]</code></td><td>report.html from JUnit XML or TRX run outside ForgeQE (see <a href="#doc-how_to_use-reports-for-tests-run-outside-forgeqe">Reports for tests run outside ForgeQE</a>)</td></tr>
3626
- <tr><td><code>forgeqe a11y &quot;&lt;goal&gt;&quot; --persona a,b [--url URL]</code>, <code>forgeqe a11y personas</code></td><td>Accessibility testing as personas (see <a href="#doc-how_to_use-accessibility-testing-with-personas">Accessibility testing with personas</a>)</td></tr>
3629
+ <tr><td><code>forgeqe a11y &quot;&lt;goal&gt;&quot; --persona a,b [--url URL] [--engine E] [--standard S] [--best-practice]</code>, <code>forgeqe a11y personas</code></td><td>Accessibility testing as personas (see <a href="#doc-how_to_use-accessibility-testing-with-personas">Accessibility testing with personas</a>)</td></tr>
3627
3630
  <tr><td><code>forgeqe persona [list] | show | create | export | import</code></td><td>Business personas (see <a href="#doc-how_to_use-business-personas">Business personas</a>)</td></tr>
3628
3631
  <tr><td><code>forgeqe flags list [--env NAME]</code>, <code>forgeqe flags run &lt;pack&gt; &lt;flag=v1,v2&gt; --env NAME</code></td><td>A regression pack once per feature-flag combination (see <a href="#doc-how_to_use-feature-flag-matrix">Feature-flag matrix</a>)</td></tr>
3629
3632
  <tr><td><code>forgeqe defects [--folder DIR]</code>, <code>forgeqe defects predict [--repo DIR] [--base REF] [--head REF]</code></td><td>Defect trends, and where a change is likely to cause defects</td></tr>
@@ -5601,6 +5604,14 @@ forgeqe mobile replay mobile-tests/ --junit results.xml # every workflow i
5601
5604
  forgeqe mobile maestro .maestro/ # your team's Maestro flows, checked first
5602
5605
  forgeqe mobile flow workflow.yaml &gt; login.flow.yaml # a workflow as a Maestro flow, to keep
5603
5606
  </code></pre>
5607
+ <p><strong>Accessibility of each screen.</strong> A replay or an explore on Appium checks each new screen it reaches (once per
5608
+ 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
5609
+ 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
5610
+ 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
5611
+ finding), and several controls announced by one name. On iOS 17 or later with Xcode 15 it also runs Apple's own audit
5612
+ (contrast, hit regions, element descriptions, Dynamic Type, clipped text, traits). Android's sizes are judged from the
5613
+ screen's density. <code>mobile.accessibility: false</code> turns it off (<strong>Settings › Mobile</strong>). These are automated checks of what
5614
+ the screen's controls say, not a person with TalkBack or VoiceOver; Maestro runs are not checked.</p>
5604
5615
  <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_&lt;NAME&gt;}</code>, never its value, so set <code>MAESTRO_&lt;NAME&gt;</code> when you run it outside ForgeQE. A workflow that types a secret not listed there is refused.</p>
5605
5616
  <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
5617
  <h5>On TestMu AI (formerly LambdaTest)</h5>
@@ -9911,7 +9922,7 @@ projects; for other frameworks add <code>--agent</code>, or run the listed files
9911
9922
  <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
9923
  <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
9924
  <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>
9925
+ <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
9926
  </div>
9916
9927
  <div class="detail"><span class="mono">In detail</span>
9917
9928
  <section class="doc" id="doc-how_to_use-api-and-contract-tests">
@@ -10311,6 +10322,7 @@ in <strong>Settings › Settings as text</strong>.</li>
10311
10322
  accessibility:
10312
10323
  standard: wcag21aa # wcag2a, wcag21aa (default), wcag22aa, wcag21aaa, section508, en301549, best-practice
10313
10324
  best_practice: false # also the best-practice rules
10325
+ engine: axe # axe (axe-core, default), ibm (IBM Equal Access), basic (ForgeQE's own checks)
10314
10326
  budgets:
10315
10327
  accessibility: # most violations per page by impact; unset impacts have no limit (or: accessibility: true for 0 critical, 0 serious)
10316
10328
  critical: 0
@@ -10324,6 +10336,13 @@ in <strong>Settings › Settings as text</strong>.</li>
10324
10336
  pages: # by path prefix; the longest match wins
10325
10337
  /search: { lcp_ms: 4000 }
10326
10338
  </code></pre>
10339
+ <p><strong>Rule engine.</strong> <code>engine: ibm</code> checks each page with IBM Equal Access (accessibility-checker-engine, shipped with
10340
+ ForgeQE) instead of axe-core: the standard picks its ruleset (WCAG 2.0, 2.1 or 2.2 at A or AA; Section 508 as WCAG 2.0
10341
+ AA; EN 301 549 as WCAG 2.1 AA; best practice as IBM's own ruleset with its recommendations). IBM's rules stop at AA, so a
10342
+ <code>wcag21aaa</code> standard is checked at AA with it and the run says so. Impact comes from IBM's toolkit level (1 critical,
10343
+ 2 serious, 3 moderate, 4 minor; a recommendation is minor), and rule ids are IBM's (<code>img_alt_valid</code>), so budgets'
10344
+ <code>rules</code> and <code>ignore</code> name IBM's ids when it is the engine. The two engines find different things: run both on a page
10345
+ that matters. The engine runs inside a function on the page, so a page's own <code>window.ace</code> (the Ace editor) is left alone.</p>
10327
10346
  <p><strong>Over time.</strong> Every run adds each page's violations and timings to <code>.forgeqe/reports/quality-history.json</code> (keep it between CI runs as a cache). Ask &quot;did accessibility regress?&quot; or &quot;is checkout getting slower?&quot;. The trends show each page's violations over the last runs, the rules that newly fail or were fixed since the previous run, and each timing against its usual value (the median of the last 10 runs; slower or faster only beyond noise).</p>
10328
10347
  <p><strong>Web app</strong></p>
10329
10348
  <ol>
@@ -10373,13 +10392,26 @@ forgeqe quality trends shop.test # per page over time; exits 1 when a page go
10373
10392
  <p><strong>Web app</strong></p>
10374
10393
  <ol>
10375
10394
  <li>Open <strong>Accessibility</strong> (Quality Engineering › Specialised testing), on its <strong>Agent</strong> tab.</li>
10376
- <li>Say what the person should try to do, and who tries it (&quot;act as a blind person and use the website to find accessibility issues&quot;, &quot;can a keyboard-only user check out?&quot;).</li>
10377
- <li>Agree to the plan the agent shows. Each session's result is on the <strong>Results</strong> tab, and the personas on the <strong>Personas</strong> tab.</li>
10395
+ <li>Say what the person should try to do, and who tries it (&quot;act as a blind person and use the website to find accessibility issues&quot;, &quot;can a keyboard-only user check out?&quot;).
10396
+ Under the persona chips, <strong>Checked with</strong> picks this session's rule engine (axe-core, IBM Equal Access or the
10397
+ built-in checks) and standard; left on the project's, quality.accessibility decides.</li>
10398
+ <li>Agree to the plan the agent shows, which says the rule checks it will use. Each session's result is on the <strong>Results</strong> tab, and the personas on the <strong>Personas</strong> tab.</li>
10378
10399
  </ol>
10379
10400
  <p><strong>Terminal</strong></p>
10380
10401
  <pre><code class="language-bash">forgeqe a11y &quot;find running shoes and add a pair to the basket&quot; --persona blind,keyboard-only --url https://shop.test
10402
+ forgeqe a11y &quot;check out&quot; --persona blind --engine ibm --standard wcag22aa --best-practice # this session's rule checks
10403
+ forgeqe a11y &quot;check out&quot; --persona blind,keyboard-only --device iphone-15 # every persona on a phone
10381
10404
  forgeqe a11y personas # the personas: built in, and the project's own
10382
10405
  </code></pre>
10406
+ <p><code>--engine</code> (axe, ibm, basic), <code>--standard</code> (wcag2a, wcag21aa, wcag22aa, wcag21aaa, section508, en301549,
10407
+ best-practice) and <code>--best-practice</code> choose the session's automated rule checks over <code>quality.accessibility</code>; a value off
10408
+ its list is refused before anything runs. The report and the Results tab say which were used.</p>
10409
+ <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
10410
+ list: its CSS size, pixel ratio, touch and user agent are emulated in ForgeQE's Chromium, so a site lays out as it does
10411
+ 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
10412
+ every persona; with no device named, each persona uses its own (the three phone personas are on phones, the rest on
10413
+ 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
10414
+ Safari or a real phone: confirm what matters on real devices.</p>
10383
10415
  <p><strong>How each persona uses the page.</strong> Each persona is one browser run. The agent works the way the person does:</p>
10384
10416
  <div class="tbl"><table>
10385
10417
  <thead>
@@ -10394,6 +10426,9 @@ forgeqe a11y personas # the personas: built in, and the project's
10394
10426
  <tr><td><code>reduced-motion</code></td><td>The browser asks for reduced motion.</td></tr>
10395
10427
  <tr><td><code>deaf</code></td><td>Captions, transcripts, sound-only information.</td></tr>
10396
10428
  <tr><td><code>high-contrast</code></td><td>Forced colours (a high contrast theme).</td></tr>
10429
+ <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>
10430
+ <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>
10431
+ <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>
10397
10432
  </tbody>
10398
10433
  </table></div>
10399
10434
  <p><strong>The report.</strong> For each persona, <code>.forgeqe/reports/accessibility/&lt;time&gt;-&lt;goal&gt;/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>
@@ -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.
@@ -610,11 +611,12 @@ suite:
610
611
  # top_k: 5
611
612
  # timeout_seconds: 20
612
613
 
613
- # Accessibility (axe-core, WCAG) and performance (Core Web Vitals) of every page a run visits. Without budgets they
614
+ # Accessibility (axe-core or IBM Equal Access, WCAG) and performance (Core Web Vitals) of every page a run visits. Without budgets they
614
615
  # are reported and tracked over time; a run fails on them only when a budget below is exceeded.
615
616
  # quality:
616
617
  # accessibility:
617
618
  # standard: wcag21aa # wcag2a, wcag21aa, wcag22aa, wcag21aaa, section508, en301549, best-practice
619
+ # engine: axe # axe (axe-core), ibm (IBM Equal Access: up to AA, no AAA rules), basic (ForgeQE's own)
618
620
  # ask_before_run: true # false: a persona session runs its browser runs without asking first
619
621
  # visual: # each page compared with its approved screenshot (.forgeqe/visual-baselines)
620
622
  # mask: [".clock", "#ad-slot"] # hidden before capture
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capagents/forgeqe",
3
- "version": "3.1.9",
3
+ "version": "3.2.1",
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": {
@@ -94,6 +94,7 @@
94
94
  "@types/pngjs": "^6.0.5",
95
95
  "@types/react": "^19.3.0",
96
96
  "@vscode/tree-sitter-wasm": "0.3.1",
97
+ "accessibility-checker-engine": "4.0.34",
97
98
  "axe-core": "4.14.0",
98
99
  "fast-xml-parser": "^5.11.1",
99
100
  "neo4j-driver": "6.2.0",
@@ -11,4 +11,4 @@ This run is accessibility testing, not functional testing. You act as the person
11
11
  - You MUST set `wcag` to the WCAG success criterion the barrier fails, such as 1.1.1 or 2.4.7, when one applies.
12
12
  - You MUST set `severity`: critical when it stops the person from reaching the goal, serious when they get past it only with a lot of effort or help, moderate when it slows or confuses them, minor for an annoyance.
13
13
  - When a barrier stops you, you MUST NOT go around it in a way this person could not, such as a mouse click for a keyboard user. Record it, then try another way this person has, such as another link or the browser's back.
14
- - You MUST finish with done. Start the text with "Goal reached: yes", "Goal reached: partly", or "Goal reached: no", then say in a few sentences how it went for this person. Use success=true when you reached the goal and success=false when a barrier stopped you.
14
+ - You MUST finish with done. Start the text with "Goal reached: yes", "Goal reached: partly", or "Goal reached: no", then say in a few sentences how it went for this person. Use success=true when you reached the goal and success=false when a barrier stopped you. You MUST call done in a step of its own, with no other action: a done that follows another action in the same step, such as record_accessibility_issue, is not carried out. Record the last barrier, then call done in the next step.
@@ -470,6 +470,80 @@ def outdated_error(message: str) -> "GatewayError":
470
470
  )
471
471
 
472
472
 
473
+ # A runtime version as Copilot's releases name them (1.0.105, 1.0.64-1).
474
+ _RUNTIME_VERSION = re.compile(r"^[0-9]{1,4}\.[0-9]{1,4}\.[0-9]{1,6}(?:-[0-9]{1,4})?$")
475
+
476
+
477
+ def _version_key(v: str) -> Tuple[int, ...]:
478
+ return tuple(int(p) for p in re.split(r"[.-]", v))
479
+
480
+
481
+ def cached_runtimes(root: Any, platform: str, wrapper: str) -> List[Tuple[str, str]]:
482
+ """
483
+ The Copilot runtimes the SDK already keeps on this computer (<root>/<version>/prebuilds/<platform>/), newest first,
484
+ as (version, wrapper path): a folder of a version's shape, no link on the way, the wrapper and runtime.node both
485
+ regular, non-empty files.
486
+ """
487
+ out: List[Tuple[str, str]] = []
488
+ try:
489
+ names = os.listdir(root)
490
+ except OSError:
491
+ return out
492
+ for name in names:
493
+ if not _RUNTIME_VERSION.match(name):
494
+ continue
495
+ pair = os.path.join(root, name, "prebuilds", platform)
496
+ try:
497
+ if any(os.path.islink(p) for p in (os.path.join(root, name), os.path.join(root, name, "prebuilds"), pair)):
498
+ continue
499
+ files = [os.path.join(pair, wrapper), os.path.join(pair, "runtime.node")]
500
+ if all(os.path.isfile(f) and not os.path.islink(f) and os.path.getsize(f) > 0 for f in files):
501
+ out.append((name, files[0]))
502
+ except OSError:
503
+ continue
504
+ out.sort(key=lambda vp: _version_key(vp[0]), reverse=True)
505
+ return out
506
+
507
+
508
+ def runtime_fallback(env: Optional[Dict[str, str]] = None) -> Optional[Dict[str, str]]:
509
+ """
510
+ Makes sure the SDK has a runtime before it starts. The pinned one is used when it is here or can be downloaded;
511
+ when it cannot be downloaded (a company network that blocks GitHub's downloads), the newest runtime the SDK already
512
+ keeps on this computer runs instead, through the SDK's own COPILOT_CLI_PATH. Returns {"pinned", "used", "reason"}
513
+ when it fell back, None otherwise; raises with a clear reason when there is nothing to fall back to. A
514
+ COPILOT_CLI_PATH the person set is left alone.
515
+ """
516
+ env = os.environ if env is None else env
517
+ if env.get("COPILOT_CLI_PATH"):
518
+ return None
519
+ try:
520
+ from copilot._cli_download import ensure_runtime_wrapper, get_cache_dir
521
+ from copilot._cli_version import CLI_VERSION, get_runtime_platform
522
+ except ImportError:
523
+ return None
524
+ try:
525
+ ensure_runtime_wrapper()
526
+ return None
527
+ except Exception as e: # The download failed: anything else here is no better reason to stop.
528
+ reason = " ".join(str(e).split())[:300]
529
+ try:
530
+ platform = get_runtime_platform()
531
+ root = str(get_cache_dir(None))
532
+ except Exception:
533
+ raise RuntimeError(f"Copilot's runtime {CLI_VERSION} could not be downloaded: {reason}") from e
534
+ wrapper = "copilot-runtime.exe" if sys.platform == "win32" else "copilot-runtime"
535
+ older = [(v, p) for v, p in cached_runtimes(root, platform, wrapper) if v != CLI_VERSION]
536
+ if not older:
537
+ raise RuntimeError(
538
+ f"Copilot's runtime {CLI_VERSION} could not be downloaded, and no earlier one is on this computer: {reason}. "
539
+ "A company network that blocks GitHub's downloads does this: ask IT to allow github.com and "
540
+ "release-assets.githubusercontent.com, or set FORGEQE_GITHUB_MIRROR to your company's GitHub mirror."
541
+ ) from e
542
+ version, path = older[0]
543
+ env["COPILOT_CLI_PATH"] = path
544
+ return {"pinned": str(CLI_VERSION), "used": version, "reason": reason}
545
+
546
+
473
547
  def client_options(token: Optional[str], home: str, workdir: str) -> Dict[str, Any]:
474
548
  """With a token, that token only; without one, the signed-in user, as the Copilot SDK recommends on a user's machine."""
475
549
  auth: Dict[str, Any] = {"github_token": token, "use_logged_in_user": False} if token else {"use_logged_in_user": True}
@@ -490,6 +564,10 @@ class Copilot:
490
564
  if not self.websockets:
491
565
  # The runtime the SDK starts reads this too, for every request it makes (the model list included).
492
566
  os.environ[SDK_NO_WEBSOCKETS_ENV] = "1"
567
+ # Before the client: it looks for (and downloads) its runtime as it is made.
568
+ self.runtime = runtime_fallback()
569
+ if self.runtime:
570
+ gateway_log("gateway", f"runtime {self.runtime['pinned']} could not be downloaded: running {self.runtime['used']} from this computer ({self.runtime['reason']})")
493
571
  self.client = CopilotClient(**client_options(token, home, self.workdir))
494
572
  self.health = ModelHealth()
495
573
  self._seat: List[Dict[str, Any]] = []
@@ -1212,7 +1290,8 @@ async def serve(out: TextIO, copilot: Any = None) -> int:
1212
1290
  server = await asyncio.start_server(lambda r, w: handle(r, w, copilot, key), host="127.0.0.1", port=0, limit=64 * 1024)
1213
1291
  port = server.sockets[0].getsockname()[1]
1214
1292
  gateway_log("gateway", f"listening on 127.0.0.1:{port}")
1215
- out.write(json.dumps({"port": port, "login": getattr(copilot, "login", "")}) + "\n")
1293
+ runtime = getattr(copilot, "runtime", None)
1294
+ out.write(json.dumps({"port": port, "login": getattr(copilot, "login", ""), **({"runtime": runtime} if runtime else {})}) + "\n")
1216
1295
  out.flush()
1217
1296
  loop = asyncio.get_running_loop()
1218
1297
  # Stop when ForgeQE closes stdin (or exits).
@@ -203,6 +203,74 @@ AXE_RUN = r"""axe.run(document, {runOnly: {type: 'tag', values: %s}, resultTypes
203
203
  examples: v.nodes.slice(0, 5).map((n) => ({html: (n.html || '').slice(0, 160), target: (n.target || []).join(' '), text: (n.failureSummary || '').slice(0, 300)}))}))
204
204
  }))"""
205
205
 
206
+ # IBM Equal Access (accessibility-checker-engine's ace.js): the engine's source is evaluated inside a function, so its
207
+ # top-level `var ace` stays local: nothing is put on the page's window (a page's own `window.ace`, such as the Ace code
208
+ # editor, is left alone) and the page cannot hand ForgeQE a checker of its own. The rules kept are the ruleset's at the
209
+ # levels asked for (recommendations only when asked); results are made plain here, each rule with up to five elements.
210
+ IBM_RUN = r"""(async ({ruleset, levels, recommendations}) => {
211
+ const ace = (function () {
212
+ /*IBM_ENGINE_SOURCE*/
213
+ ;return ace })();
214
+ const checker = new ace.Checker();
215
+ const guide = checker.getGuidelines().find((g) => g.id === ruleset);
216
+ if (!guide) return {error: 'no ruleset ' + ruleset};
217
+ const rules = {};
218
+ for (const cp of guide.checkpoints || []) {
219
+ const sc = /^\d+\.\d+\.\d+$/.test(cp.num || '');
220
+ if (sc ? !levels.includes(cp.wcagLevel) : !recommendations) continue;
221
+ for (const r of cp.rules || []) {
222
+ if (r.level !== 'VIOLATION' && !(recommendations && r.level === 'RECOMMENDATION')) continue;
223
+ const x = rules[r.id] || (rules[r.id] = {criteria: [], level: '', policy: r.level, toolkit: String(r.toolkitLevel || '')});
224
+ if (r.level === 'VIOLATION') x.policy = 'VIOLATION';
225
+ if (sc && !x.criteria.includes(cp.num)) x.criteria.push(cp.num);
226
+ if (sc && (!x.level || cp.wcagLevel.length < x.level.length)) x.level = cp.wcagLevel;
227
+ }
228
+ }
229
+ const report = await checker.check(document, [ruleset]);
230
+ const by = {};
231
+ for (const r of report.results || []) {
232
+ if (!rules[r.ruleId] || !Array.isArray(r.value) || r.value[0] === 'INFORMATION') continue;
233
+ const e = by[r.ruleId] || (by[r.ruleId] = {fail: [], open: 0, pass: 0});
234
+ if (r.value[1] === 'PASS') e.pass++;
235
+ else if (r.value[1] === 'FAIL') e.fail.push(r);
236
+ else if (r.value[1] === 'POTENTIAL' || r.value[1] === 'MANUAL') e.open++;
237
+ }
238
+ const ids = Object.keys(by);
239
+ return {
240
+ passed: ids.filter((id) => by[id].pass && !by[id].fail.length),
241
+ incomplete: ids.filter((id) => by[id].open && !by[id].fail.length),
242
+ violations: ids.filter((id) => by[id].fail.length).map((id) => ({id, policy: rules[id].policy, toolkit: rules[id].toolkit,
243
+ criteria: rules[id].criteria, level: rules[id].level, count: by[id].fail.length, help: String(by[id].fail[0].message || '').slice(0, 300),
244
+ examples: by[id].fail.slice(0, 5).map((n) => ({html: String(n.snippet || '').slice(0, 160), target: String((n.path || {}).dom || ''), text: String(n.message || '').slice(0, 300)}))}))
245
+ };
246
+ })(%s)"""
247
+
248
+ IBM_RULESETS = ("WCAG_2_0", "WCAG_2_1", "WCAG_2_2", "IBM_Accessibility")
249
+ IBM_HELP = "https://able.ibm.com/rules/archives/latest/doc/en-US/{}.html"
250
+ IBM_RULE = re.compile(r"^[A-Za-z0-9_]{1,80}$")
251
+ IBM_SC = re.compile(r"^\d\.\d{1,2}\.\d{1,2}$")
252
+ # A violation's impact from IBM's toolkit level (1: the most essential); a recommendation is minor.
253
+ IBM_IMPACT = {"1": "critical", "2": "serious", "3": "moderate", "4": "minor"}
254
+
255
+
256
+ def ibm_issue(v: Dict[str, Any]) -> Optional[Dict[str, Any]]:
257
+ """One IBM rule's failures in accessibility.json's shape (as axe's), read as data; None for one not of its shape."""
258
+ rule = str(v.get("id") or "")
259
+ if not IBM_RULE.fullmatch(rule):
260
+ return None
261
+ criteria = [c for c in (v.get("criteria") or []) if isinstance(c, str) and IBM_SC.fullmatch(c)][:6]
262
+ level = str(v.get("level") or "")
263
+ impact = "minor" if v.get("policy") != "VIOLATION" else IBM_IMPACT.get(str(v.get("toolkit") or ""), "moderate")
264
+ examples = [
265
+ {"html": str(e.get("html") or "")[:160], "target": str(e.get("target") or "")[:300], "text": str(e.get("text") or "")[:300]}
266
+ for e in (v.get("examples") or [])[:5]
267
+ if isinstance(e, dict)
268
+ ]
269
+ return {"rule": rule, "wcag": ", ".join(criteria), "level": level if level in ("A", "AA", "AAA") else "", "impact": impact,
270
+ "help": " ".join(str(v.get("help") or "").split())[:300], "helpUrl": IBM_HELP.format(rule),
271
+ "count": max(0, int(v.get("count") or 0)), "examples": examples}
272
+
273
+
206
274
  WCAG_SC = re.compile(r"^wcag(\d)(\d)(\d{1,2})$")
207
275
  WCAG_LEVEL = re.compile(r"^wcag2\d?(a{1,3})$")
208
276
 
@@ -277,7 +345,7 @@ def box_for(browser_state: Any, index: Any) -> Optional[Dict[str, float]]:
277
345
 
278
346
 
279
347
  class Diagnostics:
280
- def __init__(self, *, accessibility: bool = True, network: bool = True, axe: Optional[Dict[str, Any]] = None, vitals: bool = True, visual: Optional[Dict[str, Any]] = None, keep_headers: Optional[List[str]] = None) -> None:
348
+ def __init__(self, *, accessibility: bool = True, network: bool = True, axe: Optional[Dict[str, Any]] = None, vitals: bool = True, visual: Optional[Dict[str, Any]] = None, keep_headers: Optional[List[str]] = None, ibm: Optional[Dict[str, Any]] = None) -> None:
281
349
  self.accessibility = accessibility
282
350
  # axe-core: {"script": path to axe.min.js, "tags": ["wcag2a", "wcag2aa"]}; without it, the built-in checks.
283
351
  self.axe_tags: List[str] = [str(t) for t in ((axe or {}).get("tags") or ["wcag2a", "wcag2aa"])]
@@ -287,12 +355,27 @@ class Diagnostics:
287
355
  self._axe_source = Path(str(axe["script"])).read_text(encoding="utf-8")
288
356
  except OSError:
289
357
  logger.warning("axe-core not found at %s: using the built-in accessibility checks", axe.get("script"))
358
+ # IBM Equal Access: {"script": path to ace.js, "ruleset": "WCAG_2_1", "levels": ["A", "AA"], "recommendations":
359
+ # bool, "version": "4.0.34"}; it takes the place of axe-core when given and found.
360
+ self._ibm_source: Optional[str] = None
361
+ self.ibm: Dict[str, Any] = {}
362
+ if ibm and ibm.get("script"):
363
+ try:
364
+ self._ibm_source = Path(str(ibm["script"])).read_text(encoding="utf-8")
365
+ self.ibm = {
366
+ "ruleset": str(ibm.get("ruleset") or "WCAG_2_1") if str(ibm.get("ruleset") or "") in IBM_RULESETS else "WCAG_2_1",
367
+ "levels": [x for x in (ibm.get("levels") or ["A", "AA"]) if x in ("A", "AA")] or ["A", "AA"],
368
+ "recommendations": ibm.get("recommendations") is True,
369
+ "version": re.sub(r"[^0-9.]", "", str(ibm.get("version") or ""))[:20],
370
+ }
371
+ except OSError:
372
+ logger.warning("IBM Equal Access not found at %s: using %s", ibm.get("script"), "axe-core" if self._axe_source else "the built-in accessibility checks")
290
373
  self.vitals = vitals
291
374
  self.perf: Dict[str, Dict[str, Any]] = {}
292
375
  # {"mask": [selectors], "pages": {"/path": [selectors]}, "full_page": bool}; None: no visual captures.
293
376
  self.visual: Optional[Dict[str, Any]] = visual
294
377
  self.shots: Dict[str, Dict[str, Any]] = {}
295
- self.timeout = CHECK_TIMEOUT * (3 if self._axe_source else 1)
378
+ self.timeout = CHECK_TIMEOUT * (3 if self._axe_source or self._ibm_source else 1)
296
379
  self.network: Optional[NetworkCapture] = NetworkCapture(keep_headers) if network else None
297
380
  self._net_handlers: Dict[str, Any] = {}
298
381
  self.events: List[Dict[str, Any]] = []
@@ -589,6 +672,21 @@ class Diagnostics:
589
672
  logger.debug("axe-core did not run", exc_info=True)
590
673
  return None
591
674
 
675
+ async def _ibm(self, session: Any) -> Optional[Dict[str, Any]]:
676
+ """IBM Equal Access's results for the page, or None when it could not run (axe-core or the built-in checks run instead)."""
677
+ if not self._ibm_source:
678
+ return None
679
+ try:
680
+ # The arguments first, then the engine's source in its place: the source has % signs of its own.
681
+ args = {"ruleset": self.ibm["ruleset"], "levels": self.ibm["levels"], "recommendations": self.ibm["recommendations"]}
682
+ expr = (IBM_RUN % json.dumps(args)).replace("/*IBM_ENGINE_SOURCE*/", self._ibm_source, 1)
683
+ r = await session.cdp_client.send.Runtime.evaluate(params={"expression": expr, "returnByValue": True, "awaitPromise": True}, session_id=session.session_id)
684
+ value = ((r or {}).get("result") or {}).get("value")
685
+ return value if isinstance(value, dict) and isinstance(value.get("violations"), list) else None
686
+ except Exception:
687
+ logger.debug("IBM Equal Access did not run", exc_info=True)
688
+ return None
689
+
592
690
  async def _check_page(self, browser: Any, session: Any) -> None:
593
691
  try:
594
692
  url = str(await browser.get_current_page_url() or "")
@@ -599,6 +697,25 @@ class Diagnostics:
599
697
  return
600
698
  send = session.cdp_client.send
601
699
  order = {"critical": 0, "serious": 1, "moderate": 2, "minor": 3}
700
+ ibm = await self._ibm(session)
701
+ if ibm is not None:
702
+ title = ""
703
+ try:
704
+ title = str(await self._eval(session, "document.title") or "")
705
+ except Exception:
706
+ pass
707
+ found = [i for i in (ibm_issue(v) for v in ibm["violations"] if isinstance(v, dict)) if i]
708
+ plain = lambda xs: [x for x in (xs or []) if isinstance(x, str) and IBM_RULE.fullmatch(x)] # noqa: E731
709
+ self.pages[key] = {
710
+ "url": url,
711
+ "title": title,
712
+ "engine": f"IBM Equal Access {self.ibm['version']}".strip(),
713
+ "tags": [self.ibm["ruleset"], *self.ibm["levels"], *(["recommendations"] if self.ibm["recommendations"] else [])],
714
+ "passed": plain(ibm.get("passed")),
715
+ "incomplete": plain(ibm.get("incomplete")),
716
+ "issues": sorted(found, key=lambda i: (order.get(i["impact"], 9), -i["count"])),
717
+ }
718
+ return
602
719
  axe = await self._axe(session)
603
720
  if axe is not None:
604
721
  issues_list = []