@capagents/forgeqe 3.4.6 → 3.4.8

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 (110) hide show
  1. package/dist/forgeqe.js +2149 -2010
  2. package/dist/requirement-agent/requirements_agent/config.py +7 -8
  3. package/dist/requirement-agent/requirements_agent/llm/providers.py +11 -1
  4. package/dist/template.html +2 -2
  5. package/dist/web/assets/{3d-force-graph-nC19sloS.js → 3d-force-graph-CiCC5APC.js} +1 -1
  6. package/dist/web/assets/{Agent-D_W8YJWv.js → Agent-BB5w6CFT.js} +7 -7
  7. package/dist/web/assets/{AgentWork-CPYvG2HI.js → AgentWork-BIDUzmaq.js} +1 -1
  8. package/dist/web/assets/{ApiTests-CElarw4P.js → ApiTests-B9xJf6Cy.js} +5 -5
  9. package/dist/web/assets/{Browse-hN_pjYbP.js → Browse-DWBe9mKl.js} +1 -1
  10. package/dist/web/assets/Chat-DHpceBhs.js +3 -0
  11. package/dist/web/assets/CommandPalette-C94g3GC3.js +1 -0
  12. package/dist/web/assets/{Compare-DBNzy6Hm.js → Compare-BZBgd0y1.js} +1 -1
  13. package/dist/web/assets/{Compare-DlSaG3td.js → Compare-DdpFDNye.js} +1 -1
  14. package/dist/web/assets/Cost-DeG7MOk_.js +1 -0
  15. package/dist/web/assets/{Data-BSemg5Ky.js → Data-C23A9m-E.js} +1 -1
  16. package/dist/web/assets/Desktop-DEMEf1js.js +1 -0
  17. package/dist/web/assets/{DesktopReview-CDv_Swu0.js → DesktopReview-QI-8PPuf.js} +1 -1
  18. package/dist/web/assets/{DeviceScreen-DDERg3YQ.js → DeviceScreen-DJiqz1aE.js} +1 -1
  19. package/dist/web/assets/Evidence-CCgOWjCG.js +1 -0
  20. package/dist/web/assets/{Explore-GAaQCWbY.js → Explore-BaWlUaKG.js} +1 -1
  21. package/dist/web/assets/Features-BVmUtZ3B.js +1 -0
  22. package/dist/web/assets/{FileTree-a0-UuNhM.js → FileTree-hV2COTtr.js} +1 -1
  23. package/dist/web/assets/{Flags-B9BwmpT9.js → Flags-B4d9s8zr.js} +1 -1
  24. package/dist/web/assets/Flaky-CZw09rGV.js +1 -0
  25. package/dist/web/assets/{Impact-D-2WTh3g.js → Impact-C0RrcnHq.js} +2 -2
  26. package/dist/web/assets/{Jobs-BtLMd2Pe.js → Jobs-DJLhtCP4.js} +1 -1
  27. package/dist/web/assets/{KindPage-YFqKZMNZ.js → KindPage-BDDN_Tvk.js} +1 -1
  28. package/dist/web/assets/{LiveDevice-BDmDTtX_.js → LiveDevice-mowq_cHn.js} +1 -1
  29. package/dist/web/assets/{Migration-Bs1Qc0Yg.js → Migration-BMN6ORSe.js} +4 -4
  30. package/dist/web/assets/Mobile-Cb-MttFC.js +2 -0
  31. package/dist/web/assets/Observability-Jj9dRXFD.js +1 -0
  32. package/dist/web/assets/{OwnItems-CO-zBy4W.js → OwnItems-DE8fyJHx.js} +1 -1
  33. package/dist/web/assets/PageAgent--Trp4TeQ.js +1 -0
  34. package/dist/web/assets/Product-D6eFHH3k.js +6 -0
  35. package/dist/web/assets/Production-BHY4nlNS.js +1 -0
  36. package/dist/web/assets/Quality-D0ZwjBaV.js +1 -0
  37. package/dist/web/assets/Readiness-Ck09aYm6.js +1 -0
  38. package/dist/web/assets/Record-CZ8vdz9z.js +1 -0
  39. package/dist/web/assets/{Regression-DuP8VGvl.js → Regression-DpksCvrY.js} +2 -2
  40. package/dist/web/assets/RelationGraph-ceeoXUfO.js +1 -0
  41. package/dist/web/assets/Reports-DwQ4rGuE.js +2 -0
  42. package/dist/web/assets/{Requirements-BnOO72Q7.js → Requirements-CrrPYfmf.js} +1 -1
  43. package/dist/web/assets/Responsive-D-_Z1zWt.js +3 -0
  44. package/dist/web/assets/RunDiff-6ubx_siR.js +1 -0
  45. package/dist/web/assets/Settings-B-VqCcSI.js +21 -0
  46. package/dist/web/assets/{SiteScan-BVI8Z-cC.js → SiteScan-Atalzdep.js} +1 -1
  47. package/dist/web/assets/{Steps-CZxAX4yk.js → Steps-DJKLOcXA.js} +1 -1
  48. package/dist/web/assets/{TestData-CyqXcyZv.js → TestData-D8X3YVNO.js} +1 -1
  49. package/dist/web/assets/{TestManagement-UKBq1Jcj.js → TestManagement-CFkof7HP.js} +2 -2
  50. package/dist/web/assets/WhatsNew-Zh7ANIT4.js +1 -0
  51. package/dist/web/assets/agentSettingsSheet-BXo7tt4e.js +1 -0
  52. package/dist/web/assets/api-C5wO4oo1.js +1 -0
  53. package/dist/web/assets/choice-DU4-gNa8.js +1 -0
  54. package/dist/web/assets/{dataParts-DD4VTinq.js → dataParts-XwGL6chT.js} +1 -1
  55. package/dist/web/assets/{desktopAppPath-Ch1JeF98.js → desktopAppPath-ClRxEs7y.js} +1 -1
  56. package/dist/web/assets/{flowTheme-BP9HI_83.js → flowTheme-C6XgxapL.js} +1 -1
  57. package/dist/web/assets/index-4aprf7A6.css +2 -0
  58. package/dist/web/assets/index-Bm0NGw2p.js +186 -0
  59. package/dist/web/assets/{nav-DS7OIItb.js → nav-BVGAdkgR.js} +1 -1
  60. package/dist/web/assets/{pageBack-BKHdI-pD.js → pageBack-C6KF2YWt.js} +1 -1
  61. package/dist/web/assets/paletteCommands-4ZbMQrvq.js +5 -0
  62. package/dist/web/assets/{parts-EZhmj8re.js → parts-Bw9UqYIt.js} +1 -1
  63. package/dist/web/assets/{productParts-Cjy7N4bQ.js → productParts-C2WZmf3J.js} +1 -1
  64. package/dist/web/assets/{qualityParts-Bnl_yBH6.js → qualityParts-xNbrX_EB.js} +1 -1
  65. package/dist/web/assets/{recordTest-DOqE44_1.js → recordTest-ecnqAff5.js} +1 -1
  66. package/dist/web/assets/searchRecents-BRxclL5B.js +1 -0
  67. package/dist/web/assets/{stepper-PKh2muBc.js → stepper-ghyjNRgc.js} +1 -1
  68. package/dist/web/assets/surface-CJmzHqOR.js +1 -0
  69. package/dist/web/assets/uploadBuild-sQwJpid1.js +1 -0
  70. package/dist/web/assets/{wizardParts-DgElx0Cb.js → wizardParts-CtlGV71f.js} +1 -1
  71. package/dist/web/index.html +8 -8
  72. package/package.json +1 -1
  73. package/py/forgeqe_engine/capture.py +80 -2
  74. package/py/forgeqe_engine/d365.py +117 -11
  75. package/py/forgeqe_engine/llm.py +30 -1
  76. package/py/forgeqe_engine/memory.py +91 -25
  77. package/py/forgeqe_engine/recordsession.py +9 -1
  78. package/py/forgeqe_engine/service.py +8 -0
  79. package/py/forgeqe_engine/webrecord_page.py +87 -4
  80. package/dist/web/assets/Chat-CJsKzudh.js +0 -3
  81. package/dist/web/assets/CommandPalette-Bupa5F4q.js +0 -1
  82. package/dist/web/assets/Cost-DsERWen5.js +0 -1
  83. package/dist/web/assets/Desktop-BcXzby1F.js +0 -1
  84. package/dist/web/assets/Evidence-BYQvjtqD.js +0 -1
  85. package/dist/web/assets/Features-BoFooP6n.js +0 -1
  86. package/dist/web/assets/Flaky-NIz-XNcl.js +0 -1
  87. package/dist/web/assets/Mobile-zXRXR_3S.js +0 -2
  88. package/dist/web/assets/Observability-qNxOzrmI.js +0 -1
  89. package/dist/web/assets/PageAgent-C0u0uyou.js +0 -1
  90. package/dist/web/assets/Product-5nybx8oL.js +0 -6
  91. package/dist/web/assets/Production-C2FVz9Df.js +0 -1
  92. package/dist/web/assets/Quality-CwlN84zJ.js +0 -1
  93. package/dist/web/assets/Readiness-gzFYSc8y.js +0 -1
  94. package/dist/web/assets/Record-DeucQwHe.js +0 -1
  95. package/dist/web/assets/RelationGraph-8Ko7oUzf.js +0 -1
  96. package/dist/web/assets/Reports-Bk5A2rMW.js +0 -2
  97. package/dist/web/assets/Responsive-9eqRKydd.js +0 -3
  98. package/dist/web/assets/RunDiff-DAiOiWdE.js +0 -1
  99. package/dist/web/assets/Settings-jkOoqeEY.js +0 -21
  100. package/dist/web/assets/WhatsNew-BnWCLSSu.js +0 -1
  101. package/dist/web/assets/agentSettingsSheet-Bca1rnig.js +0 -1
  102. package/dist/web/assets/api-BJHzfOse.js +0 -1
  103. package/dist/web/assets/choice-W0qOx_1k.js +0 -1
  104. package/dist/web/assets/coverage-DbHm8BUP.js +0 -5
  105. package/dist/web/assets/index-B9F7yrF9.css +0 -2
  106. package/dist/web/assets/index-DZMkBMxL.js +0 -186
  107. package/dist/web/assets/palette-BEo5X3wD.js +0 -1
  108. package/dist/web/assets/paletteCommands-DdFd3e0-.js +0 -1
  109. package/dist/web/assets/sectionList-B6NF3ZMb.js +0 -1
  110. package/dist/web/assets/surface-c1kG1KPS.js +0 -1
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{I as n,P as r}from"./surface-CJmzHqOR.js";import{t as i}from"./utils-DJRAScIl.js";import{t as a}from"./jsx-runtime-LKYXHABd.js";import{U as o}from"./api-C5wO4oo1.js";import{I as s,P as c}from"./pageBack-C6KF2YWt.js";import{Gr as l,kr as u}from"./line-icons-Cwj9OmCz.js";import{Fn as d,kt as f}from"./index-Bm0NGw2p.js";import{f as p,r as m}from"./dataParts-XwGL6chT.js";var h=e(t(),1),g=a();function _(e,t){return`forgeqe mobile upload <file> --to ${e}${t?` --app ${t}`:``}`}function v({open:e,builds:t,apps:a,busy:_,act:v,cloud:y=`testmu`,app:b=``,problem:x,onClose:S,onDone:C}){let[w,T]=(0,h.useState)(t?.[0]??``),[E,D]=(0,h.useState)(b),[O,k]=(0,h.useState)(``),[A,j]=(0,h.useState)(!1),[M,N]=(0,h.useState)(y);(0,h.useEffect)(()=>{e&&(N(y),D(b))},[e,y,b]),(0,h.useEffect)(()=>T(e=>t?.includes(e)?e:t?.[0]??``),[t]);let P=M===`browserstack`?`BrowserStack`:`TestMu AI`;return(0,g.jsx)(d,{open:e,onClose:S,title:`Upload a build`,description:`Sends an .apk, .aab, .ipa or a .zip of an .app to ${P}, so its devices can install it. The build leaves this computer for ${P}'s storage.`,footer:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(c,{onClick:S,children:[(0,g.jsx)(l,{"aria-hidden":`true`}),`Cancel`]}),(0,g.jsxs)(c,{variant:`primary`,disabled:_||!w,onClick:async()=>{let e=``;await v(async()=>{let t=await o.upload({file:w,cloud:M,...E?{app:E}:{},...O.trim()?{name:O.trim()}:{},...M===`testmu`?{virtual:A}:{}});e=t.saved&&t.app?`Uploaded: ${t.app} now installs ${t.id} on ${P}.`:`Uploaded to ${P} as ${t.id}.${t.app?` ${t.app} comes from env.yaml: set its ${M===`browserstack`?`browserstack_app`:`testmu_app`}: to that id there.`:``}`})&&(C(e),S())},children:[(0,g.jsx)(u,{"aria-hidden":`true`}),`Upload`]})]}),children:(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[x&&(0,g.jsx)(`p`,{role:`alert`,className:i(s.fail,`m-0`),children:x}),(0,g.jsx)(m,{label:`Cloud`,children:(0,g.jsx)(f,{label:`Cloud`,value:M,onChange:N,options:[{id:`testmu`,label:`TestMu AI`},{id:`browserstack`,label:`BrowserStack`}],className:`self-start`})}),t===null?(0,g.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Finding the builds in the project…`}):t.length?(0,g.jsx)(m,{label:`File`,hint:`An app build found in the project.`,children:(0,g.jsx)(n,{value:w,onChange:e=>T(e.target.value),children:t.map(e=>(0,g.jsx)(`option`,{value:e,children:e},e))})}):(0,g.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`No .apk, .aab, .ipa or .zip in the project: put the build in the project's folder first.`}),(0,g.jsx)(m,{label:`For app`,hint:`Optional: the id is saved as this app's build on ${P}; other places keep their own.`,children:(0,g.jsxs)(n,{value:E,onChange:e=>D(e.target.value),children:[(0,g.jsx)(`option`,{value:``,children:`No app`}),a.map(e=>(0,g.jsx)(`option`,{value:e,children:e},e))]})}),(0,g.jsx)(m,{label:`Name`,hint:`Optional: the name ${P} shows.`,children:(0,g.jsx)(r,{value:O,maxLength:120,onChange:e=>k(e.target.value)})}),M===`testmu`&&(0,g.jsx)(p,{on:A,set:j,children:`For TestMu's emulators and simulators`})]})})}export{_ as n,v as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{z as n}from"./surface-c1kG1KPS.js";import{t as r}from"./utils-DJRAScIl.js";import{t as i}from"./jsx-runtime-LKYXHABd.js";import{N as a,P as o}from"./pageBack-BKHdI-pD.js";import{Et as s,a as c,et as l,gr as u,lt as d}from"./line-icons-Cwj9OmCz.js";import"./choice-W0qOx_1k.js";import{t as f}from"./step-mark-BCkZt2-_.js";import"./stepper-PKh2muBc.js";var p=e(t(),1),m=i(),h=[s,l,u,d],g={playwright:`Microsoft`,cypress:`JavaScript only`,webdriverio:`WebDriver and BiDi`,selenium:`WebDriver`};function _({steps:e,at:t,reached:n,onGo:i}){return(0,m.jsx)(`nav`,{"aria-label":`Steps`,className:`min-w-0`,children:(0,m.jsx)(`ol`,{className:`m-0 flex list-none flex-wrap gap-4 p-0 @3xl:flex-col @3xl:flex-nowrap @3xl:gap-0`,children:e.map((a,s)=>{let c=s===t,l=s<n&&!c,u=s<=n&&!c,d=s===e.length-1,p=(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:r(`text-body-sm leading-8 font-medium @3xl:hidden`,c||l?`text-ink`:`text-muted`),children:a.short}),(0,m.jsx)(`span`,{className:r(`hidden text-body-lg leading-8 font-medium @3xl:inline`,c||l?`text-ink`:u?`text-ink-2`:`text-muted`),children:a.name})]});return(0,m.jsxs)(`li`,{"aria-current":c?`step`:void 0,className:r(`relative flex min-w-0 gap-2 @3xl:gap-4 @3xl:pb-8`,d&&`@3xl:pb-0`),children:[!d&&(0,m.jsx)(`span`,{"aria-hidden":`true`,className:r(`absolute top-10 bottom-2 left-4 hidden w-px @3xl:block`,l?`bg-ink/30`:`bg-line`)}),(0,m.jsx)(f,{size:`lg`,state:l?`done`:c?`current`:`pending`,n:s+1}),(0,m.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[u?(0,m.jsx)(o,{variant:`link`,size:`inline`,onClick:()=>i(s),"aria-label":a.name,className:`w-fit justify-start text-left whitespace-normal`,children:p}):(0,m.jsx)(`span`,{children:p}),(0,m.jsx)(`span`,{className:r(`hidden text-body-sm leading-relaxed @3xl:block`,c?`text-ink-2`:`text-muted`),children:a.about}),a.answer&&(0,m.jsx)(`span`,{className:`sr-only flex min-w-0 flex-col gap-1 text-body-sm text-ink @3xl:not-sr-only @3xl:mt-2 @3xl:border-l-2 @3xl:border-line @3xl:pl-2`,children:a.answer}),l&&s<t&&(0,m.jsx)(o,{variant:`link`,size:`inline`,onClick:()=>i(s),"aria-label":`Change: ${a.name}`,className:`hidden min-h-8 w-fit @3xl:inline-flex`,children:`Change`})]})]},a.name)})})})}function v({id:e,label:t,help:n,children:r}){return(0,m.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,m.jsx)(`label`,{htmlFor:e,className:`text-body-sm font-medium`,children:t}),r,n&&(0,m.jsx)(`span`,{className:`text-body-sm text-muted`,children:n})]})}function y({busy:e,onBack:t,next:n,onNext:r,disabled:i,aside:a}){return(0,m.jsxs)(`div`,{className:`sticky bottom-0 flex flex-wrap items-center gap-4 border-t border-line-soft bg-canvas py-4`,children:[(0,m.jsx)(`span`,{className:`min-w-0 flex-1 text-body-sm`,children:a}),t&&(0,m.jsxs)(o,{variant:`ghost`,disabled:e,onClick:t,children:[(0,m.jsx)(c,{"aria-hidden":`true`}),`Back`]}),(0,m.jsx)(o,{variant:`primary`,disabled:e||i,onClick:r,children:n})]})}function b({id:e,at:t,moved:r,children:i}){let o=h[t],s=(0,p.useRef)(null);return(0,p.useEffect)(()=>{let e=s.current;r&&e&&(e.getBoundingClientRect().top<0&&e.scrollIntoView({block:`start`,behavior:n()}),e.focus({preventScroll:!0}))},[t,r]),(0,m.jsxs)(`h2`,{ref:s,id:e,tabIndex:-1,className:`m-0 flex scroll-mt-4 items-center gap-2 text-headline-sm outline-none`,children:[o&&(0,m.jsx)(a,{icon:o,size:18,className:`flex-none text-icon`}),(0,m.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:i})]})}export{b as a,_ as i,v as n,y as r,g as t};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{z as n}from"./surface-CJmzHqOR.js";import{t as r}from"./utils-DJRAScIl.js";import{t as i}from"./jsx-runtime-LKYXHABd.js";import{N as a,P as o}from"./pageBack-C6KF2YWt.js";import{Et as s,a as c,et as l,gr as u,lt as d}from"./line-icons-Cwj9OmCz.js";import"./choice-DU4-gNa8.js";import{t as f}from"./step-mark-BCkZt2-_.js";import"./stepper-ghyjNRgc.js";var p=e(t(),1),m=i(),h=[s,l,u,d],g={playwright:`Microsoft`,cypress:`JavaScript only`,webdriverio:`WebDriver and BiDi`,selenium:`WebDriver`};function _({steps:e,at:t,reached:n,onGo:i}){return(0,m.jsx)(`nav`,{"aria-label":`Steps`,className:`min-w-0`,children:(0,m.jsx)(`ol`,{className:`m-0 flex list-none flex-wrap gap-4 p-0 @3xl:flex-col @3xl:flex-nowrap @3xl:gap-0`,children:e.map((a,s)=>{let c=s===t,l=s<n&&!c,u=s<=n&&!c,d=s===e.length-1,p=(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:r(`text-body-sm leading-8 font-medium @3xl:hidden`,c||l?`text-ink`:`text-muted`),children:a.short}),(0,m.jsx)(`span`,{className:r(`hidden text-body-lg leading-8 font-medium @3xl:inline`,c||l?`text-ink`:u?`text-ink-2`:`text-muted`),children:a.name})]});return(0,m.jsxs)(`li`,{"aria-current":c?`step`:void 0,className:r(`relative flex min-w-0 gap-2 @3xl:gap-4 @3xl:pb-8`,d&&`@3xl:pb-0`),children:[!d&&(0,m.jsx)(`span`,{"aria-hidden":`true`,className:r(`absolute top-10 bottom-2 left-4 hidden w-px @3xl:block`,l?`bg-ink/30`:`bg-line`)}),(0,m.jsx)(f,{size:`lg`,state:l?`done`:c?`current`:`pending`,n:s+1}),(0,m.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[u?(0,m.jsx)(o,{variant:`link`,size:`inline`,onClick:()=>i(s),"aria-label":a.name,className:`w-fit justify-start text-left whitespace-normal`,children:p}):(0,m.jsx)(`span`,{children:p}),(0,m.jsx)(`span`,{className:r(`hidden text-body-sm leading-relaxed @3xl:block`,c?`text-ink-2`:`text-muted`),children:a.about}),a.answer&&(0,m.jsx)(`span`,{className:`sr-only flex min-w-0 flex-col gap-1 text-body-sm text-ink @3xl:not-sr-only @3xl:mt-2 @3xl:border-l-2 @3xl:border-line @3xl:pl-2`,children:a.answer}),l&&s<t&&(0,m.jsx)(o,{variant:`link`,size:`inline`,onClick:()=>i(s),"aria-label":`Change: ${a.name}`,className:`hidden min-h-8 w-fit @3xl:inline-flex`,children:`Change`})]})]},a.name)})})})}function v({id:e,label:t,help:n,children:r}){return(0,m.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,m.jsx)(`label`,{htmlFor:e,className:`text-body-sm font-medium`,children:t}),r,n&&(0,m.jsx)(`span`,{className:`text-body-sm text-muted`,children:n})]})}function y({busy:e,onBack:t,next:n,onNext:r,disabled:i,aside:a}){return(0,m.jsxs)(`div`,{className:`sticky bottom-0 flex flex-wrap items-center gap-4 border-t border-line-soft bg-canvas py-4`,children:[(0,m.jsx)(`span`,{className:`min-w-0 flex-1 text-body-sm`,children:a}),t&&(0,m.jsxs)(o,{variant:`ghost`,disabled:e,onClick:t,children:[(0,m.jsx)(c,{"aria-hidden":`true`}),`Back`]}),(0,m.jsx)(o,{variant:`primary`,disabled:e||i,onClick:r,children:n})]})}function b({id:e,at:t,moved:r,children:i}){let o=h[t],s=(0,p.useRef)(null);return(0,p.useEffect)(()=>{let e=s.current;r&&e&&(e.getBoundingClientRect().top<0&&e.scrollIntoView({block:`start`,behavior:n()}),e.focus({preventScroll:!0}))},[t,r]),(0,m.jsxs)(`h2`,{ref:s,id:e,tabIndex:-1,className:`m-0 flex scroll-mt-4 items-center gap-2 text-headline-sm outline-none`,children:[o&&(0,m.jsx)(a,{icon:o,size:18,className:`flex-none text-icon`}),(0,m.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:i})]})}export{b as a,_ as i,v as n,y as r,g as t};
@@ -7,22 +7,22 @@
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-DZMkBMxL.js"></script>
10
+ <script type="module" crossorigin src="/assets/index-Bm0NGw2p.js"></script>
11
11
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-XKyaHtl9.js">
12
12
  <link rel="modulepreload" crossorigin href="/assets/react-BDur5s0O.js">
13
13
  <link rel="modulepreload" crossorigin href="/assets/route-9BkoTWUE.js">
14
14
  <link rel="modulepreload" crossorigin href="/assets/utils-DJRAScIl.js">
15
15
  <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-LKYXHABd.js">
16
- <link rel="modulepreload" crossorigin href="/assets/surface-c1kG1KPS.js">
16
+ <link rel="modulepreload" crossorigin href="/assets/surface-CJmzHqOR.js">
17
17
  <link rel="modulepreload" crossorigin href="/assets/line-icons-Cwj9OmCz.js">
18
- <link rel="modulepreload" crossorigin href="/assets/sectionList-B6NF3ZMb.js">
19
- <link rel="modulepreload" crossorigin href="/assets/api-BJHzfOse.js">
20
- <link rel="modulepreload" crossorigin href="/assets/palette-BEo5X3wD.js">
21
- <link rel="modulepreload" crossorigin href="/assets/nav-DS7OIItb.js">
18
+ <link rel="modulepreload" crossorigin href="/assets/paletteCommands-4ZbMQrvq.js">
19
+ <link rel="modulepreload" crossorigin href="/assets/api-C5wO4oo1.js">
20
+ <link rel="modulepreload" crossorigin href="/assets/searchRecents-BRxclL5B.js">
21
+ <link rel="modulepreload" crossorigin href="/assets/nav-BVGAdkgR.js">
22
22
  <link rel="modulepreload" crossorigin href="/assets/default-DB4ZMZxa.js">
23
- <link rel="modulepreload" crossorigin href="/assets/pageBack-BKHdI-pD.js">
23
+ <link rel="modulepreload" crossorigin href="/assets/pageBack-C6KF2YWt.js">
24
24
  <link rel="modulepreload" crossorigin href="/assets/collapse-C0q3vXUR.js">
25
- <link rel="stylesheet" crossorigin href="/assets/index-B9F7yrF9.css">
25
+ <link rel="stylesheet" crossorigin href="/assets/index-4aprf7A6.css">
26
26
  </head>
27
27
  <body>
28
28
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capagents/forgeqe",
3
- "version": "3.4.6",
3
+ "version": "3.4.8",
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": {
@@ -374,6 +374,81 @@ async def verify_locators(session: Any, backend_node_id: Optional[int], locators
374
374
  return sorted(locators, key=lambda l: (not l.get("verified"), -int(l.get("confidence") or 0), -BASE.get(str(l.get("type")), 0)))
375
375
 
376
376
 
377
+ # The row a cell is in, as the page script finds it (webrecord_page.py isRow): its role, else a <tr>.
378
+ _ROW_OF_FN = (
379
+ "function(){const up=(x)=>x.parentElement||(x.parentNode&&x.parentNode.nodeType===11&&x.parentNode.host)||null;"
380
+ "for(let x=up(this);x;x=up(x)){const r=(x.getAttribute('role')||'').trim().split(/\\s+/)[0];if(r?r==='row':x.tagName==='TR')return x}return null}"
381
+ )
382
+
383
+
384
+ async def _ax_under(cdp: Any, object_id: str, role: str, name: str = "") -> List[int]:
385
+ """backend node ids of the elements of `role` (named `name`, when given) in the subtree of the node `object_id`."""
386
+ params: Dict[str, Any] = {"objectId": object_id, "role": role}
387
+ if name:
388
+ params["accessibleName"] = name
389
+ res = await _send(cdp, "Accessibility", "queryAXTree", params)
390
+ return [n["backendDOMNodeId"] for n in (res or {}).get("nodes") or [] if n.get("backendDOMNodeId") and not n.get("ignored")]
391
+
392
+
393
+ async def _ax_by_role(cdp: Any, role: str, name: str, object_id: str) -> List[int]:
394
+ """Every element Playwright would know by `role` and `name`, from the document `object_id`'s element is in."""
395
+ hits: List[int] = []
396
+ for chrome in chrome_roles(role):
397
+ hits += await _ax_matches(cdp, chrome, name, object_id)
398
+ return list(dict.fromkeys(hits))
399
+
400
+
401
+ async def verify_within(session: Any, backend_node_id: Optional[int], loc: Dict[str, Any]) -> Optional[Dict[str, Any]]:
402
+ """
403
+ A locator by a named part of the page or a keyed row (memory.within_locator's two role shapes), counted again in
404
+ Chrome's accessibility tree while the element is still there: the part (or the key cell) must be the only one of its
405
+ role and name, and inside it, the element the only one of its role and name. The page script counted it with its own
406
+ reading of names; the browser's own decides. The locator unchanged when it is another shape or cannot be asked; None
407
+ when the browser finds it is not this element alone.
408
+ """
409
+ w = loc.get("within") if isinstance(loc, dict) else None
410
+ if not backend_node_id or not isinstance(w, dict) or "t" in w:
411
+ return loc
412
+ c, k, i = w.get("c") or {}, w.get("k"), w.get("i") or {}
413
+ if i.get("type") != "role":
414
+ return loc
415
+ role, _, name = str(i.get("value") or "").partition("|")
416
+ try:
417
+ cdp = await _cdp(session)
418
+ target = await _object_for(cdp, backend_node_id)
419
+ if not target:
420
+ return loc
421
+ # Gone or hidden since the event (the Save that closed its dialog): nothing to count it against now, so what the
422
+ # page script counted while it showed stands.
423
+ here = await _send(cdp, "Runtime", "callFunctionOn", {"objectId": target, "functionDeclaration": "function(){return this.isConnected && this.getClientRects().length > 0}", "returnByValue": True})
424
+ if ((here or {}).get("result") or {}).get("value") is not True:
425
+ return loc
426
+ if isinstance(k, dict):
427
+ cells = await _ax_by_role(cdp, str(k.get("role") or ""), str(k.get("name") or ""), target)
428
+ if len(cells) != 1:
429
+ return None
430
+ cell = await _object_for(cdp, cells[0])
431
+ row = await _send(cdp, "Runtime", "callFunctionOn", {"objectId": cell, "functionDeclaration": _ROW_OF_FN}) if cell else {}
432
+ box = ((row or {}).get("result") or {}).get("objectId")
433
+ else:
434
+ scopes = await _ax_by_role(cdp, str(c.get("role") or ""), str(c.get("name") or ""), target)
435
+ if len(scopes) != 1:
436
+ return None
437
+ box = await _object_for(cdp, scopes[0])
438
+ if not box:
439
+ return None
440
+ hits: List[int] = []
441
+ for chrome in chrome_roles(role):
442
+ hits += await _ax_under(cdp, box, chrome, name)
443
+ hits = list(dict.fromkeys(hits))
444
+ if len(hits) == 1 and (hits[0] == backend_node_id or await _contains(cdp, target, hits[0])):
445
+ return loc
446
+ return None
447
+ except Exception as ex:
448
+ logger.debug("capture: an anchored locator was not checked: %s", ex)
449
+ return loc
450
+
451
+
377
452
  # Whether `o` is this element or inside it, across shadow roots (a web component's own controls).
378
453
  _WITHIN_FN = "function(o){for(let x=o;x;x=x.parentElement||(x.parentNode&&x.parentNode.nodeType===11&&x.parentNode.host)||null)if(x===this)return true;return false}"
379
454
 
@@ -436,7 +511,7 @@ _FACTS_FN = r"""function(kept, d365) {
436
511
  // The D365 names around it, itself first (d365.py control), as the page script reads them.
437
512
  const path = [];
438
513
  for (let x = el, i = 0; x && x.nodeType === 1 && i <= d365.path_up && x !== document.body && path.length < d365.path_max; x = x.parentElement, i++) {
439
- for (const k of d365.path_attrs) { const v = x.getAttribute(k); if (v && path.length < d365.path_max) path.push([k, v.slice(0, 200)]); }
514
+ for (const k of d365.path_attrs) { const v = x.getAttribute(k); if (v && (k !== 'role' || d365.path_roles.includes(v)) && path.length < d365.path_max) path.push([k, v.slice(0, 200)]); }
440
515
  }
441
516
  if (path.length) out.d365_path = path;
442
517
  }
@@ -454,7 +529,10 @@ _FACTS_FN = r"""function(kept, d365) {
454
529
 
455
530
  # Chrome's accessibility tree names some roles its own way; Playwright's getByRole uses the ARIA name. Read as Chrome
456
531
  # names them, an image, a <select>'s option or its list had no locator by role at all.
457
- CHROME_ROLES = {"image": "img", "MenuListOption": "option", "MenuListPopup": "listbox", "ListBoxOption": "option"}
532
+ # A table with no header row is a layout table to Chrome (LayoutTable, LayoutTableRow, LayoutTableCell), where
533
+ # Playwright's getByRole still finds its rows and cells.
534
+ CHROME_ROLES = {"image": "img", "MenuListOption": "option", "MenuListPopup": "listbox", "ListBoxOption": "option",
535
+ "LayoutTable": "table", "LayoutTableRow": "row", "LayoutTableCell": "cell"}
458
536
 
459
537
 
460
538
  def playwright_role(role: str) -> str:
@@ -98,7 +98,7 @@ def generated_path(xpath: str) -> bool:
98
98
  def page_config() -> Dict[str, Any]:
99
99
  """What the page scripts need to tell a D365 page and read its attributes (webrecord_page.py, capture.py)."""
100
100
  return {"host": HOST_JS, "shell": SHELL_ID, "attrs": list(ATTRS), "gen": GENERATED_JS, "up": MAX_UP, "min_prefix": MIN_PREFIX, "trim": _TRIM,
101
- "path_attrs": list(PATH_ATTRS), "path_up": MAX_PATH_UP, "path_max": MAX_PATH}
101
+ "path_attrs": list(PATH_ATTRS), "path_up": MAX_PATH_UP, "path_max": MAX_PATH, "path_roles": list(PATH_ROLES)}
102
102
 
103
103
 
104
104
  def _attrs(raw: Any) -> Dict[str, str]:
@@ -236,17 +236,31 @@ def note() -> str:
236
236
  # written test uses the skill's page objects. Every part is matched by a fixed pattern and kept only in its shape.
237
237
 
238
238
  # What the page script reads around an element (itself first, then up to MAX_PATH_UP ancestors), and how many it keeps.
239
- PATH_ATTRS = ("data-id", "data-lp-id", "id", "col-id")
239
+ PATH_ATTRS = ("data-id", "data-lp-id", "id", "col-id", "role")
240
240
  MAX_PATH_UP = 14
241
- MAX_PATH = 16
241
+ MAX_PATH = 20
242
+ # The roles the trail keeps (a grid's header, row and checkbox, a menu's item, a dialog), so other roles never fill it.
243
+ PATH_ROLES = ("columnheader", "row", "gridcell", "checkbox", "menuitem", "option", "dialog", "alertdialog")
242
244
 
243
245
  # The controls the recorder names, as the catalogue's sections and the skill's recipes do.
244
246
  CONTROLS = frozenset({
245
247
  "text", "date", "time", "lookup", "lookup_search", "lookup_result", "lookup_value", "lookup_clear", "choice", "status",
246
248
  "boolean", "multi_select", "field", "command", "overflow", "tab", "sitemap", "grid_cell", "open_record", "quick_find",
247
249
  "bpf_stage", "bpf_next", "quick_create_save", "dialog_button",
250
+ # Grid (elements.md "Grid"): the view selector and a view in its list, a column header (sort, filter), a row's
251
+ # checkbox and Select All, paging.
252
+ "grid_view_selector", "grid_view", "grid_column", "grid_row_select", "grid_select_all", "grid_first_page",
253
+ "grid_next_page", "grid_previous_page",
254
+ # Lookup (elements.md "Lookup"): "+ New" and Advanced lookup with its dialog's search, results and Done.
255
+ "lookup_new", "lookup_advanced", "advanced_lookup_search", "advanced_lookup_result", "advanced_lookup_done",
256
+ # Business process flow: Set Active, pin and close the stage's flyout.
257
+ "bpf_set_active", "bpf_pin", "bpf_close",
258
+ # Quick Create: Cancel, the launcher (+) and a table in its menu.
259
+ "quick_create_cancel", "quick_create_launcher", "quick_create_item",
248
260
  })
249
261
  SCOPES = frozenset({"header", "bpf", "quick_create"})
262
+ # The data dialogs a dialog button is in (elements.md "Dialogs"): Activate/Deactivate, duplicate records found.
263
+ DIALOGS = frozenset({"set_state", "duplicates"})
250
264
  # A logical name (field, table, column, subgrid, tab, command): letters, digits, underscore, a command's dots.
251
265
  LOGICAL = re.compile(r"^[A-Za-z][A-Za-z0-9_]{0,99}$")
252
266
  COMMAND_ID = re.compile(r"^[A-Za-z][A-Za-z0-9_]*(?:\.[A-Za-z][A-Za-z0-9_]*){0,5}$")
@@ -269,7 +283,7 @@ def clean_path(raw: Any) -> List[List[str]]:
269
283
  return []
270
284
  out: List[List[str]] = []
271
285
  for item in raw[:MAX_PATH]:
272
- if isinstance(item, (list, tuple)) and len(item) == 2 and item[0] in PATH_ATTRS and plain(item[1]):
286
+ if isinstance(item, (list, tuple)) and len(item) == 2 and item[0] in PATH_ATTRS and plain(item[1]) and (item[0] != "role" or item[1] in PATH_ROLES):
273
287
  out.append([str(item[0]), str(item[1])])
274
288
  return out
275
289
 
@@ -290,6 +304,8 @@ def _field_kind(field: str, rest: str, tag: str) -> str:
290
304
  return "lookup_clear"
291
305
  if "selected_tag" in sub:
292
306
  return "lookup_value"
307
+ if "addNewBtnContainer" in sub:
308
+ return "lookup_new"
293
309
  if sub == "search" or sub.endswith("_search") or tag == "button" and "search" in sub:
294
310
  return "lookup_search"
295
311
  return "lookup"
@@ -308,6 +324,25 @@ def _field_kind(field: str, rest: str, tag: str) -> str:
308
324
  return "text"
309
325
 
310
326
 
327
+ # A control whose kind is all there is to it: by a fixed part of its data-id or id (elements.md), nearest first.
328
+ _BY_DATA_ID = (
329
+ ("setActiveButton", "bpf_set_active"),
330
+ ("quickCreateLauncher", "quick_create_launcher"),
331
+ ("loadFirstPage", "grid_first_page"),
332
+ ("moveToNextPage", "grid_next_page"),
333
+ ("moveToPreviousPage", "grid_previous_page"),
334
+ )
335
+ _BY_ID = (
336
+ ("stageDockModeButton", "bpf_pin"),
337
+ ("stageContentClose", "bpf_close"),
338
+ )
339
+ ADVANCED_LOOKUP = "MscrmControls.FieldControls.AdvancedLookupControl"
340
+ QUICK_CREATE_MENU = "MenuSectionItemsquickCreate"
341
+ # Words the catalogue finds these by (elements.md: `//button[.//label[text()='Advanced lookup']]`, the Done button).
342
+ ADVANCED_LOOKUP_WORDS = "advanced lookup"
343
+ DONE_WORDS = "done"
344
+
345
+
311
346
  def control(f: Dict[str, Any]) -> Dict[str, str]:
312
347
  """
313
348
  What D365 control an element is, from its D365 names and those around it (`d365_path`, nearest first), as the
@@ -319,7 +354,7 @@ def control(f: Dict[str, Any]) -> Dict[str, str]:
319
354
  tag = str(f.get("tag") or "")
320
355
  role = str(f.get("role") or "")
321
356
  attrs = f.get("attributes") or {}
322
- own = [[k, str(attrs[k])] for k in PATH_ATTRS if plain(attrs.get(k))]
357
+ own = [[k, str(attrs[k])] for k in PATH_ATTRS if plain(attrs.get(k)) and (k != "role" or attrs[k] in PATH_ROLES)]
323
358
  trail = own + [p for p in clean_path(f.get("d365_path")) if p not in own]
324
359
  text = _one_line(f.get("name") or f.get("text"))
325
360
  out: Dict[str, str] = {}
@@ -331,6 +366,12 @@ def control(f: Dict[str, Any]) -> Dict[str, str]:
331
366
  out["scope"] = "bpf"
332
367
 
333
368
  values = [v for _, v in trail]
369
+ # The roles of the element and around it, nearest first (`PATH_ROLES` only).
370
+ roles = ([role] if role in PATH_ROLES else []) + [v for k, v in trail if k == "role" and v in PATH_ROLES]
371
+ if any(v == "SetStateDialog" for v in values):
372
+ out["dialog"] = "set_state"
373
+ elif any("ManageDuplicates" in v for v in values):
374
+ out["dialog"] = "duplicates"
334
375
  if any("quickCreateRoot" in v for v in values):
335
376
  out["scope"] = "quick_create"
336
377
  for _, v in trail:
@@ -341,18 +382,52 @@ def control(f: Dict[str, Any]) -> Dict[str, str]:
341
382
 
342
383
  def done(kind: str, **parts: str) -> Dict[str, str]:
343
384
  res = {"control": kind, **{k: v for k, v in parts.items() if v}, **{k: v for k, v in out.items() if k not in parts}}
344
- if text and kind in ("lookup_result", "lookup_value", "grid_cell", "open_record", "tab", "bpf_stage", "command", "choice", "status", "dialog_button"):
385
+ if text and kind in TEXT_KINDS:
345
386
  res.setdefault("text", text)
387
+ if kind != "dialog_button":
388
+ res.pop("dialog", None)
346
389
  return _shaped(res)
347
390
 
391
+ # Advanced lookup's dialog: its search box, a result row, Done (elements.md AdvancedLookup_*).
392
+ if any(ADVANCED_LOOKUP in v for k, v in trail if k == "data-lp-id"):
393
+ if tag == "input" and str(attrs.get("type") or "text") == "text":
394
+ return done("advanced_lookup_search")
395
+ if "row" in roles or "gridcell" in roles:
396
+ return done("advanced_lookup_result")
397
+ if (tag == "button" or role == "button") and text.lower() == DONE_WORDS:
398
+ return done("advanced_lookup_done")
399
+ return {}
400
+ # A table in Quick Create's menu (Nav_QuickCreateMenuItems): by its name.
401
+ if any(QUICK_CREATE_MENU in v for k, v in trail if k == "id") and "menuitem" in roles:
402
+ return done("quick_create_item")
403
+
348
404
  # The element's own D365 name first, then the nearest around it.
349
- for k, v in trail:
405
+ for i, (k, v) in enumerate(trail):
350
406
  if k not in ("data-id", "id"):
351
407
  continue
352
408
  m = _FIELD.match(v)
353
409
  if m:
354
410
  scope_of(m.group(1) or "")
355
- return done(_field_kind(m.group(2), m.group(3) or "", tag), field=m.group(2))
411
+ kind = _field_kind(m.group(2), m.group(3) or "", tag)
412
+ if kind == "lookup" and text.lower() == ADVANCED_LOOKUP_WORDS:
413
+ kind = "lookup_advanced"
414
+ return done(kind, field=m.group(2))
415
+ if k == "data-id":
416
+ hit = next((c for part, c in _BY_DATA_ID if part in v), "")
417
+ if hit:
418
+ return done(hit)
419
+ if k == "id":
420
+ hit = next((c for part, c in _BY_ID if part in v), "")
421
+ if hit:
422
+ return done(hit)
423
+ if v.startswith("quickCreateCancel"):
424
+ return done("quick_create_cancel")
425
+ if "ViewSelector" in v:
426
+ # A view in the selector's list is inside it (a menu item), the selector itself is not.
427
+ nearer = [x for kk, x in trail[:i] if kk == "role"] + ([role] if role else [])
428
+ return done("grid_view" if any(r in ("menuitem", "option") for r in nearer) else "grid_view_selector")
429
+ if k == "data-id" and (v.startswith("ignore_save") or v.startswith("close_dialog")) and out.get("dialog") == "duplicates":
430
+ return done("dialog_button")
356
431
  m = _COMMAND.search(v)
357
432
  if m and k == "data-id":
358
433
  return done("command", bar=m.group(1), table=m.group(2), command=m.group(3))
@@ -379,13 +454,37 @@ def control(f: Dict[str, Any]) -> Dict[str, str]:
379
454
  scope_of(m.group(1) or "")
380
455
  classes = [c for c in f.get("classes") or [] if isinstance(c, str)]
381
456
  return done("multi_select" if any(c.startswith("msos-") for c in classes) else "field", field=m.group(2))
382
- # A grid cell, by its column (`col-id`): a link in it opens the record.
457
+ # Select All (Grid_SelectAll: `button[title*="Select All"]`), a row's checkbox, a column's header.
458
+ title = str(attrs.get("title") or attrs.get("aria-label") or "")
459
+ in_grid = any("PCFGridControl" in v or "data-set-body-container" in v or _SUBGRID_GRID.match(v) for v in values)
460
+ if title.startswith("Select All") and (tag == "button" or role == "button" or "checkbox" in roles[:1]):
461
+ return done("grid_select_all")
383
462
  column = next((v for k, v in trail if k == "col-id" and _COLUMN.match(v)), "")
463
+ if roles[:1] == ["checkbox"] and ("row" in roles or in_grid):
464
+ return done("grid_row_select")
465
+ if "columnheader" in roles and "gridcell" not in roles[: roles.index("columnheader")]:
466
+ return done("grid_column", column=column) if column else {}
467
+ # A grid cell, by its column (`col-id`): a link in it opens the record.
384
468
  if column or role in ("gridcell", "row") and any("PCFGridControl" in v or "data-set-body-container" in v for v in values):
385
469
  return done("open_record" if tag == "a" or role == "link" else "grid_cell", column=column)
386
470
  return {}
387
471
 
388
472
 
473
+ # Controls a step names by the words on them as well (a record, a view, a table, a column's label).
474
+ TEXT_KINDS = frozenset({
475
+ "lookup_result", "lookup_value", "grid_cell", "open_record", "tab", "bpf_stage", "command", "choice", "status",
476
+ "dialog_button", "grid_view", "grid_column", "advanced_lookup_result", "quick_create_item",
477
+ })
478
+ # Controls a recipe finds only by their words: without them they are not named.
479
+ NEEDS_TEXT = frozenset({"grid_view", "advanced_lookup_result", "quick_create_item"})
480
+
481
+
482
+ FIELD_KINDS = frozenset({
483
+ "text", "date", "time", "lookup", "lookup_search", "lookup_result", "lookup_value", "lookup_clear", "choice", "status",
484
+ "boolean", "multi_select", "field", "lookup_new", "lookup_advanced",
485
+ })
486
+
487
+
389
488
  def _shaped(c: Dict[str, str]) -> Dict[str, str]:
390
489
  """A control's parts, each kept only in its shape: a control of `CONTROLS`, logical names, a command id, one line."""
391
490
  if c.get("control") not in CONTROLS:
@@ -402,11 +501,17 @@ def _shaped(c: Dict[str, str]) -> Dict[str, str]:
402
501
  out["column"] = c["column"]
403
502
  if c.get("scope") in SCOPES:
404
503
  out["scope"] = c["scope"]
504
+ if out["control"] == "dialog_button" and c.get("dialog") in DIALOGS:
505
+ out["dialog"] = c["dialog"]
405
506
  t = _one_line(c.get("text"))
406
507
  if t:
407
508
  out["text"] = t
509
+ if out["control"] in NEEDS_TEXT and "text" not in out:
510
+ return {}
511
+ if out["control"] == "grid_column" and "column" not in out:
512
+ return {}
408
513
  # A field's control without its field, a command without its id: not named after all.
409
- if out["control"] in ("text", "date", "time", "lookup", "lookup_search", "lookup_result", "lookup_value", "lookup_clear", "choice", "status", "boolean", "multi_select", "field") and "field" not in out:
514
+ if out["control"] in FIELD_KINDS and "field" not in out:
410
515
  return {}
411
516
  if out["control"] == "command" and "command" not in out:
412
517
  return {}
@@ -438,7 +543,8 @@ def control_words(c: Dict[str, Any]) -> str:
438
543
  c = _shaped(dict(c)) if isinstance(c, dict) else {}
439
544
  if not c:
440
545
  return ""
441
- kind = c["control"].replace("_", " ")
546
+ kind = re.sub(r"^bpf\b", "BPF", c["control"].replace("_", " "))
442
547
  name = c.get("field") or c.get("command") or c.get("tab") or c.get("entity") or c.get("column") or ""
443
548
  where = {"header": " in the header", "bpf": " in the process stage", "quick_create": " in Quick Create"}.get(c.get("scope", ""), "")
549
+ where += {"set_state": " in the Set state dialog", "duplicates": " in Duplicate records found"}.get(c.get("dialog", ""), "")
444
550
  return f"{kind[:1].upper()}{kind[1:]} {name}".strip() + where
@@ -53,6 +53,28 @@ def _resolve_api_key(cfg: Dict[str, Any]) -> str:
53
53
  return ""
54
54
 
55
55
 
56
+ # The most an Ollama profile's "context" may ask for: above any model's window, so a typo cannot ask for unbounded memory.
57
+ OLLAMA_MAX_CONTEXT = 2_097_152
58
+
59
+
60
+ def ollama_context(cfg: Dict[str, Any]) -> Optional[int]:
61
+ """llms.json's "context" for an Ollama profile as Ollama's num_ctx: a whole number of tokens within bounds, else None."""
62
+ v = cfg.get("context")
63
+ if isinstance(v, bool) or not isinstance(v, (int, float)) or v != int(v):
64
+ return None
65
+ n = int(v)
66
+ return n if 2_048 <= n <= OLLAMA_MAX_CONTEXT else None
67
+
68
+
69
+ def takes_images(cfg: Optional[Dict[str, Any]]) -> bool:
70
+ """The profile's ``vision`` when set; otherwise yes, except for Ollama, whose models are mostly text-only (as the
71
+ desktop agent decides, forgeqe_desktop.models.takes_images, and src/desktop/run.ts' visionProblem)."""
72
+ c = cfg or {}
73
+ if isinstance(c.get("vision"), bool):
74
+ return c["vision"]
75
+ return str(c.get("provider") or "azure").lower() != "ollama"
76
+
77
+
56
78
  def uses_entra(cfg: Dict[str, Any]) -> bool:
57
79
  return str(cfg.get("auth") or "key").strip().lower() == "entra"
58
80
 
@@ -121,7 +143,14 @@ def _build_llm(llm_config: Optional[Dict[str, Any]]):
121
143
  host = (cfg.get("endpoint") or cfg.get("apiEndpoint") or "http://localhost:11434").rstrip("/")
122
144
  # llms.json often holds the OpenAI-compatible /v1 URL; the native Ollama client wants the bare host.
123
145
  host = re.sub(r"/v1$", "", host)
124
- return ChatOllama(model=str(cfg.get("model") or "llama3.2"), host=host)
146
+ # A server behind a proxy that wants a key gets the profile's, as the agent runtime and the desktop agent send
147
+ # it; Ollama's own API also takes the context window, which its OpenAI-compatible one cannot be told.
148
+ return ChatOllama(
149
+ model=str(cfg.get("model") or "llama3.2"),
150
+ host=host,
151
+ client_params={"headers": {"Authorization": f"Bearer {api_key}"}} if api_key else None,
152
+ ollama_options={"num_ctx": num_ctx} if (num_ctx := ollama_context(cfg)) else None,
153
+ )
125
154
 
126
155
  if provider == "azure":
127
156
  from browser_use.llm.azure.chat import ChatAzureOpenAI
@@ -66,6 +66,11 @@ BASE = {
66
66
  "css": 0.50,
67
67
  # Anchored on the container that holds it, by a text only that container has (within_locator).
68
68
  "within": 0.66,
69
+ # By a part of the page's role and name (the dialog "New Contact") and the element's role and name inside it: as a
70
+ # person names it, and unique where its own name is not.
71
+ "within_named": 0.86,
72
+ # A row by the one cell that names it (filter({ has })), then the element's role and name in it.
73
+ "within_key": 0.80,
69
74
  "role_pattern": 0.80,
70
75
  # A text by a pattern: the words that hold, with the state a page adds to them (state_pattern).
71
76
  "text_pattern": 0.55,
@@ -102,6 +107,7 @@ SHAKY_TEXT = (
102
107
  r"|\b(?:ago|just now|today|yesterday|tomorrow)\b"
103
108
  r"|^\d{1,2}[/.-]\d{1,2}[/.-]\d{2,4}$"
104
109
  )
110
+ SHAKY_RE = re.compile(SHAKY_TEXT, re.I)
105
111
 
106
112
  _GENERATED = (
107
113
  re.compile(r"\d{4,}"),
@@ -494,55 +500,115 @@ def _container_css(v: Any) -> bool:
494
500
  )
495
501
 
496
502
 
503
+ # A part of the page Playwright finds by its role and accessible name (the page script's scopeFor): the dialog named
504
+ # "New Contact", the region "Billing". Kept in step with SCOPE_ROLES in webrecord_page.py and replay.ts.
505
+ NAMED_SCOPE_ROLES = frozenset({
506
+ "dialog", "alertdialog", "region", "form", "group", "tabpanel", "navigation", "complementary", "search", "toolbar",
507
+ "menu", "menubar", "list", "listbox", "grid", "table", "treegrid", "tree", "tablist", "article",
508
+ })
509
+ # The cell a row is found by (filter({ has })): KEY_ROLES in webrecord_page.py and replay.ts.
510
+ KEY_ROLES = frozenset({"cell", "gridcell", "rowheader"})
511
+
512
+
513
+ def _plain_name(v: Any, limit: int = 80) -> Optional[str]:
514
+ """A name read from the page, as a locator may hold it: one line, already whitespace-folded, capped; else None."""
515
+ if not isinstance(v, str) or not v or len(v) > limit or v != " ".join(v.split()) or _clean(v, limit) != v:
516
+ return None
517
+ return v
518
+
519
+
497
520
  def within_locator(raw: Any) -> Optional[Dict[str, Any]]:
498
521
  """
499
- A locator anchored on the container that holds the element (the page script's anchorFor, counted there as finding
500
- exactly it): the container by its role or a tag and class, a text only it has, and the element inside it by its
501
- role and name, its text, or a tag and class. Read as data: only these shapes, each value one line and capped.
522
+ A locator anchored on the container that holds the element (the page script's anchorFor or scopeFor, counted there
523
+ as finding exactly it), in one of three shapes:
524
+
525
+ - a container by its role or a tag and class, filtered by a text only it has (``t``);
526
+ - a part of the page by its role and accessible name (``c: {role, name}``), the dialog named "New Contact";
527
+ - a row filtered by the one cell that names it (``c: {role: row}``, ``k: {role, name}``), the row of "INV-1042".
528
+
529
+ Then the element inside it by its role and name, its text, or a tag and class. Read as data: only these shapes,
530
+ each value one line and capped.
502
531
  """
503
532
  if not isinstance(raw, dict):
504
533
  return None
505
- c, t, i = raw.get("c"), raw.get("t"), raw.get("i")
506
- if not isinstance(c, dict) or not isinstance(i, dict) or not isinstance(t, str):
507
- return None
508
- text = _clean(t, 80)
509
- if not text or len(t) > 80 or t != " ".join(t.split()):
534
+ c, t, k, i = raw.get("c"), raw.get("t"), raw.get("k"), raw.get("i")
535
+ if not isinstance(c, dict) or not isinstance(i, dict) or not set(raw) <= {"c", "t", "k", "i"}:
510
536
  return None
511
- if c.get("role") in WITHIN_ROLES and set(c) == {"role"}:
512
- box, box_words = f"page.getByRole({_q(c['role'])})", c["role"]
513
- within = {"c": {"role": c["role"]}}
514
- elif _container_css(c.get("css")) and set(c) == {"css"}:
515
- box, box_words = f"page.locator({_q(c['css'])})", c["css"]
516
- within = {"c": {"css": c["css"]}}
537
+ within: Dict[str, Any] = {}
538
+ shaky = False
539
+ if t is not None:
540
+ # A container filtered by a text only it has.
541
+ if not isinstance(t, str) or k is not None or "name" in c:
542
+ return None
543
+ text = _clean(t, 80)
544
+ if not text or len(t) > 80 or t != " ".join(t.split()):
545
+ return None
546
+ if c.get("role") in WITHIN_ROLES and set(c) == {"role"}:
547
+ box, box_words = f"page.getByRole({_q(c['role'])})", c["role"]
548
+ within["c"] = {"role": c["role"]}
549
+ elif _container_css(c.get("css")) and set(c) == {"css"}:
550
+ box, box_words = f"page.locator({_q(c['css'])})", c["css"]
551
+ within["c"] = {"css": c["css"]}
552
+ else:
553
+ return None
554
+ box = f"{box}.filter({{ hasText: {_q(text)} }})"
555
+ box_words = f"{box_words} with {text!r}"
556
+ within["t"] = text
557
+ shaky = bool(re.search(r"\d", text))
558
+ base = BASE["within"]
559
+ elif k is not None:
560
+ # A row by the one cell that names it.
561
+ if c != {"role": "row"} or not isinstance(k, dict) or set(k) != {"role", "name"} or k.get("role") not in KEY_ROLES:
562
+ return None
563
+ key = _plain_name(k.get("name"))
564
+ if not key:
565
+ return None
566
+ has = f"page.getByRole({_q(k['role'])}, {{ name: {_q(key)}, exact: true }})"
567
+ box = f"page.getByRole({_q('row')}).filter({{ has: {has} }})"
568
+ box_words = f"row with {k['role']} {key!r}"
569
+ within.update(c={"role": "row"}, k={"role": k["role"], "name": key})
570
+ shaky = bool(SHAKY_RE.search(key))
571
+ base = BASE["within_key"]
517
572
  else:
518
- return None
573
+ # A part of the page by its role and name.
574
+ if set(c) != {"role", "name"} or c.get("role") not in NAMED_SCOPE_ROLES:
575
+ return None
576
+ name = _plain_name(c.get("name"))
577
+ if not name:
578
+ return None
579
+ box = f"page.getByRole({_q(c['role'])}, {{ name: {_q(name)}, exact: true }})"
580
+ box_words = f"{c['role']} {name!r}"
581
+ within["c"] = {"role": c["role"], "name": name}
582
+ shaky = bool(re.search(r"\d", name))
583
+ base = BASE["within_named"]
519
584
  kind, value = i.get("type"), i.get("value")
520
- if not isinstance(value, str) or not value or len(value) > 200 or value != " ".join(value.split()):
585
+ if not isinstance(value, str) or not value or len(value) > 200 or value != " ".join(value.split()) or set(i) != {"type", "value"}:
521
586
  return None
522
587
  if kind == "role":
523
588
  role, _, name = value.partition("|")
524
589
  if role not in ROLES:
525
590
  return None
526
591
  inner = f"getByRole({_q(role)}, {{ name: {_q(name)}, exact: true }})" if name else f"getByRole({_q(role)})"
527
- elif kind == "text" and len(value) <= 80:
592
+ elif kind == "text" and len(value) <= 80 and "t" in within:
528
593
  inner = f"getByText({_q(value)}, {{ exact: true }})"
529
- elif kind == "css" and _container_css(value):
594
+ elif kind == "css" and _container_css(value) and "t" in within:
530
595
  inner = f"locator({_q(value)})"
531
596
  else:
532
597
  return None
533
- within.update(t=text, i={"type": kind, "value": value})
598
+ within["i"] = {"type": kind, "value": value}
534
599
  loc = {
535
600
  "type": "within",
536
- "value": f"{box_words} with {text!r} > {value}",
601
+ "value": f"{box_words} > {value}",
537
602
  "within": within,
538
- "playwright": f"{box}.filter({{ hasText: {_q(text)} }}).{inner}",
539
- "base": BASE["within"],
603
+ "playwright": f"{box}.{inner}",
604
+ "base": base,
540
605
  "matches": 1,
541
606
  "verified": True,
542
607
  }
543
- # Digits in the anchor are often data that changes (a price, an order number): less trusted.
544
- if re.search(r"\d", text):
545
- loc["base"] = round(BASE["within"] * 0.6, 3)
608
+ # Digits in what it is anchored on are often data that changes (a price, a date): less trusted. A row's key cell
609
+ # is judged by the narrower rule (SHAKY_TEXT): an invoice number is the steadiest key a row has.
610
+ if shaky:
611
+ loc["base"] = round(base * 0.6, 3)
546
612
  loc["confidence"] = confidence(loc)
547
613
  return loc
548
614