@flowriki/agent 0.1.0-beta.30 → 0.1.0-beta.32

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.
@@ -1 +1 @@
1
- "use strict";(()=>{function U(e,t,i){function u(n){let o=e.__flAccName;if(o){let l=o(n);return l||t(n.placeholder)||t(n.title)||""}return g(n)}function g(n){let o=n.getAttribute&&n.getAttribute("aria-labelledby");if(o){let b=o.split(/\s+/).map(y=>document.getElementById(y)).filter(Boolean).map(y=>t(y.textContent)).filter(Boolean).join(" ");if(b)return b}let l=t(n.getAttribute&&n.getAttribute("aria-label"));if(l)return l;if(n.id){let b=document.querySelector('label[for="'+CSS.escape(n.id)+'"]');if(b&&t(b.textContent))return t(b.textContent)}let a=n.closest&&n.closest("label");if(a&&t(a.textContent))return t(a.textContent);let s=n.tagName.toLowerCase(),m=(n.type||"").toLowerCase();return(["button","a","summary"].includes(s)||n.getAttribute&&n.getAttribute("role")==="button")&&t(n.textContent)?t(n.textContent):s==="input"&&["submit","button","reset"].includes(m)&&n.value?t(n.value):t(n.placeholder)||t(n.title)||""}let T="input,select,textarea,button,meter,output,progress,[contenteditable]";function h(n){let o=n.parentElement;if(!o||!n.matches?.(T))return"";for(let l of Array.from(o.querySelectorAll("label"))){let a=l.getAttribute("for");if(a&&document.getElementById(a))continue;let s=t(l.textContent);if(s)return s}return""}let L=new WeakMap,H=crypto.randomUUID(),D=0;function R(n){let o=n.getRootNode(),l=E=>o.querySelectorAll(E).length===1,a=[],s=n.getAttribute?.("data-testid");s&&l(`[data-testid=${JSON.stringify(s)}]`)&&a.push({strategy:"testId",value:s});let m=t(n.placeholder);m&&l(`[placeholder=${JSON.stringify(n.placeholder)}]`)&&a.push({strategy:"placeholder",value:m});let b=t(n.getAttribute?.("alt"));b&&l(`[alt=${JSON.stringify(n.getAttribute("alt"))}]`)&&a.push({strategy:"altText",value:b});let y=n.getAttribute?.("title");return y&&l(`[title=${JSON.stringify(y)}]`)&&a.push({strategy:"title",value:t(y)}),n.id&&!/:r|[a-f0-9]{12}|\d{6}/i.test(n.id)&&l(`#${CSS.escape(n.id)}`)&&a.push({strategy:"css",value:`#${CSS.escape(n.id)}`}),a.slice(0,4)}function O(n){let o=L.get(n);o||(o=`${H}:${++D}`,L.set(n,o));let l=R(n),a={__targetId:o,...l.length?{candidates:l}:{}},s=n.getRootNode(),m=u(n);if(m)return{...a,name:m};let b=h(n);if(b)return{...a,name:b,nameFrom:"adjacent-label"};let y=t(Array.from(n.childNodes||[]).filter(I=>I.nodeType===3).map(I=>I.textContent).join(" "));if(y&&y.length<=80)return{...a,name:y,nameFrom:"text"};let E=l[0];return E?{...a,name:"",locator:E.strategy==="placeholder"||E.strategy==="altText"?{strategy:"css",value:`[${E.strategy==="altText"?"alt":"placeholder"}=${JSON.stringify(E.value)}]`}:E}:{...a,name:""}}function $(n){let o=n.getAttribute&&n.getAttribute("role");if(o)return o;let l=n.tagName.toLowerCase(),a=(n.type||"").toLowerCase();return l==="button"?"button":l==="a"&&n.href?"link":l==="select"?n.multiple||n.size>1?"listbox":"combobox":l==="textarea"?"textbox":l==="input"?["submit","button","reset","file"].includes(a)?"button":a==="checkbox"||a==="radio"?a:a==="number"?"spinbutton":a==="search"?"searchbox":a==="range"?"slider":"textbox":n.isContentEditable?"textbox":V[l]??""}let V={li:"listitem",ul:"list",ol:"list",tr:"row",td:"cell",th:"columnheader",table:"table",nav:"navigation",main:"main",header:"banner",footer:"contentinfo",aside:"complementary",form:"form",dialog:"dialog",details:"group",fieldset:"group",img:"img",h1:"heading",h2:"heading",h3:"heading",h4:"heading",h5:"heading",h6:"heading"};function M(n){let o=n,l=null;for(let a=0;o&&a<6&&!(o===document.body||o===document.documentElement);a++){let s="";try{s=getComputedStyle(o).cursor}catch{break}if(s==="pointer")l=o;else if(l)break;o=o.parentElement}return l}let C="tr, [role=row], li, [role=listitem], [role=article], [role=gridcell]";function B(n){try{let o=n.cloneNode(!0);for(let l of Array.from(o.querySelectorAll(i+", input, select, textarea")))l.remove();for(let l of Array.from(o.querySelectorAll("td, th, li, p, div, span, tr")))l.append(" ");return t(o.textContent).slice(0,120)}catch{return""}}function q(n,o,l){if(!l)return!1;let a;try{a=Array.from(document.querySelectorAll(i+", input, select, textarea"))}catch{return!1}if(a.length>400)return!0;let s=0;for(let m of a)if(m!==n&&$(m)===o&&O(m).name===l&&++s>0)return!0;return!1}function N(n,o,l){if(!q(n,o,l))return null;let a=n.closest&&n.closest(C);if(!a)return null;let s=B(a);if(!s)return null;let m=a.getAttribute&&a.getAttribute("role"),b=a.tagName.toLowerCase();return{scope:s,scopeRole:m||(b==="tr"?"row":b==="li"?"listitem":b)}}function r(n){if(!n.closest)return null;let o=n.closest("nav, main, aside, header, footer, [role=navigation], [role=main], [role=complementary], [role=banner], [role=contentinfo], [role=search]");if(!o)return null;let l=o.getAttribute&&o.getAttribute("role");if(l)return{scope:u(o),scopeRole:l};let a=o.tagName.toLowerCase();return a==="nav"?{scope:u(o),scopeRole:"navigation"}:a==="main"?{scope:u(o),scopeRole:"main"}:a==="aside"?{scope:u(o),scopeRole:"complementary"}:o.closest("article, aside, main, nav, section")!==o&&o.closest("article, aside, main, nav, section")!==null?null:a==="header"?{scope:u(o),scopeRole:"banner"}:a==="footer"?{scope:u(o),scopeRole:"contentinfo"}:null}let c=new WeakMap;function f(n,o){n&&o&&Object.keys(o).length&&c.set(n,o)}function w(n,o,l){let a=c.get(n);if(a&&(a.scopeRole||a.nth!==void 0||a.warning))return{scope:a.scope??"",...a.scopeRole?{scopeRole:a.scopeRole}:{},...a.nth===void 0?{}:{nth:a.nth},...a.warning?{warning:a.warning}:{}};let s=N(n,o,l);return s||{scope:S(n)}}function S(n){let o=n.closest&&n.closest("form, fieldset, section, [role=group], [role=region], [role=dialog], [role=alertdialog], dialog");return o?u(o):""}function A(n){if(n.id)return"#"+CSS.escape(n.id);let o=[],l=n;for(;l&&l.nodeType===1&&l!==document.body;){let a=Array.from(l.parentNode?l.parentNode.children:[]).filter(s=>s.tagName===l.tagName);o.unshift(a.length>1?`${l.tagName.toLowerCase()}:nth-of-type(${a.indexOf(l)+1})`:l.tagName.toLowerCase()),l=l.parentElement}return"body > "+o.join(" > ")}return{accName:u,identify:O,roleOf:$,pointerTarget:M,scoping:w,cssPath:A,isAmbiguous:q,landmarkScope:r,remember:f}}var ge=Object.prototype.toString;function Q(e){return typeof e=="function"||ge.call(e)==="[object Function]"}function ye(e){var t=Number(e);return isNaN(t)?0:t===0||!isFinite(t)?t:(t>0?1:-1)*Math.floor(Math.abs(t))}var he=Math.pow(2,53)-1;function ve(e){var t=ye(e);return Math.min(Math.max(t,0),he)}function v(e,t){var i=Array,u=Object(e);if(e==null)throw new TypeError("Array.from requires an array-like object - not null or undefined");if(typeof t<"u"&&!Q(t))throw new TypeError("Array.from: when provided, the second argument must be a function");for(var g=ve(u.length),T=Q(i)?Object(new i(g)):new Array(g),h=0,L;h<g;)L=u[h],t?T[h]=t(L,h):T[h]=L,h+=1;return T.length=g,T}function P(e){"@babel/helpers - typeof";return P=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},P(e)}function we(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function X(e,t){for(var i=0;i<t.length;i++){var u=t[i];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(e,Y(u.key),u)}}function Se(e,t,i){return t&&X(e.prototype,t),i&&X(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ee(e,t,i){return t=Y(t),t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Y(e){var t=xe(e,"string");return P(t)=="symbol"?t:t+""}function xe(e,t){if(P(e)!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var u=i.call(e,t||"default");if(P(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ae=(function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];we(this,e),Ee(this,"items",void 0),this.items=t}return Se(e,[{key:"add",value:function(i){return this.has(i)===!1&&this.items.push(i),this}},{key:"clear",value:function(){this.items=[]}},{key:"delete",value:function(i){var u=this.items.length;return this.items=this.items.filter(function(g){return g!==i}),u!==this.items.length}},{key:"forEach",value:function(i){var u=this;this.items.forEach(function(g){i(g,g,u)})}},{key:"has",value:function(i){return this.items.indexOf(i)!==-1}},{key:"size",get:function(){return this.items.length}}])})(),Z=typeof Set>"u"?Set:Ae;function p(e){var t;return(t=e.localName)!==null&&t!==void 0?t:e.tagName.toLowerCase()}var Te={article:"article",aside:"complementary",button:"button",datalist:"listbox",dd:"definition",details:"group",dialog:"dialog",dt:"term",fieldset:"group",figure:"figure",form:"form",footer:"contentinfo",h1:"heading",h2:"heading",h3:"heading",h4:"heading",h5:"heading",h6:"heading",header:"banner",hr:"separator",html:"document",legend:"legend",li:"listitem",math:"math",main:"main",menu:"list",nav:"navigation",ol:"list",optgroup:"group",option:"option",output:"status",progress:"progressbar",section:"region",summary:"button",table:"table",tbody:"rowgroup",textarea:"textbox",tfoot:"rowgroup",td:"cell",th:"columnheader",thead:"rowgroup",tr:"row",ul:"list"},Le={caption:new Set(["aria-label","aria-labelledby"]),code:new Set(["aria-label","aria-labelledby"]),deletion:new Set(["aria-label","aria-labelledby"]),emphasis:new Set(["aria-label","aria-labelledby"]),generic:new Set(["aria-label","aria-labelledby","aria-roledescription"]),insertion:new Set(["aria-label","aria-labelledby"]),none:new Set(["aria-label","aria-labelledby"]),paragraph:new Set(["aria-label","aria-labelledby"]),presentation:new Set(["aria-label","aria-labelledby"]),strong:new Set(["aria-label","aria-labelledby"]),subscript:new Set(["aria-label","aria-labelledby"]),superscript:new Set(["aria-label","aria-labelledby"])};function Ne(e,t){return["aria-atomic","aria-busy","aria-controls","aria-current","aria-description","aria-describedby","aria-details","aria-dropeffect","aria-flowto","aria-grabbed","aria-hidden","aria-keyshortcuts","aria-label","aria-labelledby","aria-live","aria-owns","aria-relevant","aria-roledescription"].some(function(i){var u;return e.hasAttribute(i)&&!((u=Le[t])!==null&&u!==void 0&&u.has(i))})}function ee(e,t){return Ne(e,t)}function G(e){var t=Re(e);if(t===null||_.indexOf(t)!==-1){var i=Ce(e);if(_.indexOf(t||"")===-1||ee(e,i||""))return i}return t}function Ce(e){var t=Te[p(e)];if(t!==void 0)return t;switch(p(e)){case"a":case"area":case"link":if(e.hasAttribute("href"))return"link";break;case"img":return e.getAttribute("alt")===""&&!ee(e,"img")?"presentation":"img";case"input":{var i=e,u=i.type;switch(u){case"button":case"image":case"reset":case"submit":return"button";case"checkbox":case"radio":return u;case"range":return"slider";case"email":case"tel":case"text":case"url":return e.hasAttribute("list")?"combobox":"textbox";case"search":return e.hasAttribute("list")?"combobox":"searchbox";case"number":return"spinbutton";default:return null}}case"select":return e.hasAttribute("multiple")||e.size>1?"listbox":"combobox"}return null}function Re(e){var t=e.getAttribute("role");if(t!==null){var i=t.trim().split(" ")[0];if(i.length>0)return i}return null}var _=["presentation","none"];function d(e){return e!==null&&e.nodeType===e.ELEMENT_NODE}function W(e){return d(e)&&p(e)==="caption"}function j(e){return d(e)&&p(e)==="input"}function te(e){return d(e)&&p(e)==="optgroup"}function re(e){return d(e)&&p(e)==="select"}function ne(e){return d(e)&&p(e)==="table"}function ie(e){return d(e)&&p(e)==="textarea"}function ae(e){var t=e.ownerDocument===null?e:e.ownerDocument,i=t.defaultView;if(i===null)throw new TypeError("no window available");return i}function oe(e){return d(e)&&p(e)==="fieldset"}function le(e){return d(e)&&p(e)==="legend"}function ue(e){return d(e)&&p(e)==="slot"}function Ie(e){return d(e)&&e.ownerSVGElement!==void 0}function se(e){return d(e)&&p(e)==="svg"}function ce(e){return Ie(e)&&p(e)==="title"}function k(e,t){if(d(e)&&e.hasAttribute(t)){var i=e.getAttribute(t).split(" "),u=e.getRootNode?e.getRootNode():e.ownerDocument;return i.map(function(g){return u.getElementById(g)}).filter(function(g){return g!==null})}return[]}function x(e,t){return d(e)?t.indexOf(G(e))!==-1:!1}function Oe(e){return e.trim().replace(/\s\s+/g," ")}function Me(e,t){if(!d(e))return!1;if(e.hasAttribute("hidden")||e.getAttribute("aria-hidden")==="true")return!0;var i=t(e);return i.getPropertyValue("display")==="none"||i.getPropertyValue("visibility")==="hidden"}function Pe(e){return x(e,["button","combobox","listbox","textbox"])||pe(e,"range")}function pe(e,t){if(!d(e))return!1;if(t==="range")return x(e,["meter","progressbar","scrollbar","slider","spinbutton"]);throw new TypeError("No knowledge about abstract role '".concat(t,"'. This is likely a bug :("))}function fe(e,t){var i=v(e.querySelectorAll(t));return k(e,"aria-owns").forEach(function(u){i.push.apply(i,v(u.querySelectorAll(t)))}),i}function _e(e){return re(e)?e.selectedOptions||fe(e,"[selected]"):fe(e,'[aria-selected="true"]')}function je(e){return x(e,_)}function ke(e){return W(e)}function He(e){return x(e,["button","cell","checkbox","columnheader","gridcell","heading","label","legend","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","row","rowheader","switch","tab","tooltip","treeitem"])}function De(e){return!1}function $e(e){return j(e)||ie(e)?e.value:e.textContent||""}function de(e){var t=e.getPropertyValue("content");return/^["'].*["']$/.test(t)?t.slice(1,-1):""}function me(e){var t=p(e);return t==="button"||t==="input"&&e.getAttribute("type")!=="hidden"||t==="meter"||t==="output"||t==="progress"||t==="select"||t==="textarea"}function be(e){if(me(e))return e;var t=null;return e.childNodes.forEach(function(i){if(t===null&&d(i)){var u=be(i);u!==null&&(t=u)}}),t}function Ve(e){if(e.control!==void 0)return e.control;var t=e.getAttribute("for");return t!==null?e.ownerDocument.getElementById(t):be(e)}function qe(e){var t=e.labels;if(t===null)return t;if(t!==void 0)return v(t);if(!me(e))return null;var i=e.ownerDocument;return v(i.querySelectorAll("label")).filter(function(u){return Ve(u)===e})}function Ge(e){var t=e.assignedNodes();return t.length===0?v(e.childNodes):t}function z(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=new Z,u=typeof Map>"u"?void 0:new Map,g=ae(e),T=t.compute,h=T===void 0?"name":T,L=t.computedStyleSupportsPseudoElements,H=L===void 0?t.getComputedStyle!==void 0:L,D=t.getComputedStyle,R=D===void 0?g.getComputedStyle.bind(g):D,O=t.hidden,$=O===void 0?!1:O,V=function(c,f){if(f!==void 0)throw new Error("use uncachedGetComputedStyle directly for pseudo elements");if(u===void 0)return R(c);var w=u.get(c);if(w)return w;var S=R(c,f);return u.set(c,S),S};function M(r,c){var f="";if(d(r)&&H){var w=R(r,"::before"),S=de(w);f="".concat(S," ").concat(f)}var A=ue(r)?Ge(r):v(r.childNodes).concat(k(r,"aria-owns"));if(A.forEach(function(l){var a=N(l,{isEmbeddedInLabel:c.isEmbeddedInLabel,isReferenced:!1,recursion:!0}),s=d(l)?V(l).getPropertyValue("display"):"inline",m=s!=="inline"?" ":"";f+="".concat(m).concat(a).concat(m)}),d(r)&&H){var n=R(r,"::after"),o=de(n);f="".concat(f," ").concat(o)}return f.trim()}function C(r,c){var f=r.getAttributeNode(c);return f!==null&&!i.has(f)&&f.value.trim()!==""?(i.add(f),f.value):null}function B(r){return d(r)?C(r,"title"):null}function q(r){if(!d(r))return null;if(oe(r)){i.add(r);for(var c=v(r.childNodes),f=0;f<c.length;f+=1){var w=c[f];if(le(w))return N(w,{isEmbeddedInLabel:!1,isReferenced:!1,recursion:!1})}}else if(ne(r)){i.add(r);for(var S=v(r.childNodes),A=0;A<S.length;A+=1){var n=S[A];if(W(n))return N(n,{isEmbeddedInLabel:!1,isReferenced:!1,recursion:!1})}}else if(se(r)){i.add(r);for(var o=v(r.childNodes),l=0;l<o.length;l+=1){var a=o[l];if(ce(a))return a.textContent}return null}else if(p(r)==="img"||p(r)==="area"){var s=C(r,"alt");if(s!==null)return s}else if(te(r)){var m=C(r,"label");if(m!==null)return m}if(j(r)&&(r.type==="button"||r.type==="submit"||r.type==="reset")){var b=C(r,"value");if(b!==null)return b;if(r.type==="submit")return"Submit";if(r.type==="reset")return"Reset"}var y=qe(r);if(y!==null&&y.length!==0)return i.add(r),v(y).map(function(J){return N(J,{isEmbeddedInLabel:!0,isReferenced:!1,recursion:!0})}).filter(function(J){return J.length>0}).join(" ");if(j(r)&&r.type==="image"){var E=C(r,"alt");if(E!==null)return E;var I=C(r,"title");return I!==null?I:"Submit Query"}if(x(r,["button"])){var K=M(r,{isEmbeddedInLabel:!1,isReferenced:!1});if(K!=="")return K}return null}function N(r,c){if(i.has(r))return"";if(!$&&Me(r,V)&&!c.isReferenced)return i.add(r),"";var f=d(r)?r.getAttributeNode("aria-labelledby"):null,w=f!==null&&!i.has(f)?k(r,"aria-labelledby"):[];if(h==="name"&&!c.isReferenced&&w.length>0)return i.add(f),w.map(function(s){return N(s,{isEmbeddedInLabel:c.isEmbeddedInLabel,isReferenced:!0,recursion:!1})}).join(" ");var S=c.recursion&&Pe(r)&&h==="name";if(!S){var A=(d(r)&&r.getAttribute("aria-label")||"").trim();if(A!==""&&h==="name")return i.add(r),A;if(!je(r)){var n=q(r);if(n!==null)return i.add(r),n}}if(x(r,["menu"]))return i.add(r),"";if(S||c.isEmbeddedInLabel||c.isReferenced){if(x(r,["combobox","listbox"])){i.add(r);var o=_e(r);return o.length===0?j(r)?r.value:"":v(o).map(function(s){return N(s,{isEmbeddedInLabel:c.isEmbeddedInLabel,isReferenced:!1,recursion:!0})}).join(" ")}if(pe(r,"range"))return i.add(r),r.hasAttribute("aria-valuetext")?r.getAttribute("aria-valuetext"):r.hasAttribute("aria-valuenow")?r.getAttribute("aria-valuenow"):r.getAttribute("value")||"";if(x(r,["textbox"]))return i.add(r),$e(r)}if(He(r)||d(r)&&c.isReferenced||ke(r)||De(r)){var l=M(r,{isEmbeddedInLabel:c.isEmbeddedInLabel,isReferenced:!1});if(l!=="")return i.add(r),l}if(r.nodeType===r.TEXT_NODE)return i.add(r),r.textContent||"";if(c.recursion)return i.add(r),M(r,{isEmbeddedInLabel:c.isEmbeddedInLabel,isReferenced:!1});var a=B(r);return a!==null?(i.add(r),a):(i.add(r),"")}return Oe(N(e,{isEmbeddedInLabel:!1,isReferenced:h==="description",recursion:!1}))}function Be(e){return x(e,["caption","code","deletion","emphasis","generic","insertion","none","paragraph","presentation","strong","subscript","superscript"])}function F(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Be(e)?"":z(e,t)}window.__flAccName=e=>{try{return F(e).replace(/\s+/g," ").trim()}catch{return""}};window.__flCreateTargetIdentity=U;})();
1
+ "use strict";(()=>{function U(e,t,i){function u(r){let a=e.__flAccName;if(a){let l=a(r);return l||t(r.placeholder)||t(r.title)||""}return b(r)}function b(r){let a=r.getAttribute&&r.getAttribute("aria-labelledby");if(a){let p=a.split(/\s+/).map(y=>document.getElementById(y)).filter(Boolean).map(y=>t(y.textContent)).filter(Boolean).join(" ");if(p)return p}let l=t(r.getAttribute&&r.getAttribute("aria-label"));if(l)return l;if(r.id){let p=document.querySelector('label[for="'+CSS.escape(r.id)+'"]');if(p&&t(p.textContent))return t(p.textContent)}let o=r.closest&&r.closest("label");if(o&&t(o.textContent))return t(o.textContent);let s=r.tagName.toLowerCase(),g=(r.type||"").toLowerCase();return(["button","a","summary"].includes(s)||r.getAttribute&&r.getAttribute("role")==="button")&&t(r.textContent)?t(r.textContent):s==="input"&&["submit","button","reset"].includes(g)&&r.value?t(r.value):t(r.placeholder)||t(r.title)||""}let L="input,select,textarea,button,meter,output,progress,[contenteditable]";function h(r){let a=r.parentElement;if(!a||!r.matches?.(L))return"";for(let l of Array.from(a.querySelectorAll("label"))){let o=l.getAttribute("for");if(o&&document.getElementById(o))continue;let s=t(l.textContent).replace(/\s*\*+$/,"");if(s)return s}return""}function C(r,a){return r.getAttribute?.("aria-label")||r.getAttribute?.("aria-labelledby")||r.labels?.length||a!==t(r.placeholder)&&a!==t(r.title)?!1:(r.parentElement?.querySelectorAll("input:not([type=hidden]),select,textarea,[contenteditable]")??[]).length===1}let M=new WeakMap,D=crypto.randomUUID(),I=0;function V(r){let a=r.getRootNode(),l=E=>a.querySelectorAll(E).length===1,o=[],s=r.getAttribute?.("data-testid");s&&l(`[data-testid=${JSON.stringify(s)}]`)&&o.push({strategy:"testId",value:s});let g=t(r.placeholder);g&&l(`[placeholder=${JSON.stringify(r.placeholder)}]`)&&o.push({strategy:"placeholder",value:g});let p=t(r.getAttribute?.("alt"));p&&l(`[alt=${JSON.stringify(r.getAttribute("alt"))}]`)&&o.push({strategy:"altText",value:p});let y=r.getAttribute?.("title");return y&&l(`[title=${JSON.stringify(y)}]`)&&o.push({strategy:"title",value:t(y)}),r.id&&!/:r|[a-f0-9]{12}|\d{6}/i.test(r.id)&&l(`#${CSS.escape(r.id)}`)&&o.push({strategy:"css",value:`#${CSS.escape(r.id)}`}),o.slice(0,4)}function q(r){let a=M.get(r);a||(a=`${D}:${++I}`,M.set(r,a));let l=V(r),o={__targetId:a,...l.length?{candidates:l}:{}},s=r.getRootNode(),g=u(r),p=h(r);if(g&&!(p&&C(r,g)))return{...o,name:g};if(p)return{...o,name:p,nameFrom:"adjacent-label"};let y=t(Array.from(r.childNodes||[]).filter(O=>O.nodeType===3).map(O=>O.textContent).join(" "));if(y&&y.length<=80)return{...o,name:y,nameFrom:"text"};let E=l[0];return E?{...o,name:"",locator:E.strategy==="placeholder"||E.strategy==="altText"?{strategy:"css",value:`[${E.strategy==="altText"?"alt":"placeholder"}=${JSON.stringify(E.value)}]`}:E}:{...o,name:""}}function P(r){let a=r.getAttribute&&r.getAttribute("role");if(a)return a;let l=r.tagName.toLowerCase(),o=(r.type||"").toLowerCase();return l==="button"?"button":l==="a"&&r.href?"link":l==="select"?r.multiple||r.size>1?"listbox":"combobox":l==="textarea"?"textbox":l==="input"?["submit","button","reset","file"].includes(o)?"button":o==="checkbox"||o==="radio"?o:o==="number"?"spinbutton":o==="search"?"searchbox":o==="range"?"slider":"textbox":r.isContentEditable?"textbox":_[l]??""}let _={li:"listitem",ul:"list",ol:"list",tr:"row",td:"cell",th:"columnheader",table:"table",nav:"navigation",main:"main",header:"banner",footer:"contentinfo",aside:"complementary",form:"form",dialog:"dialog",details:"group",fieldset:"group",img:"img",h1:"heading",h2:"heading",h3:"heading",h4:"heading",h5:"heading",h6:"heading"};function R(r){let a=r,l=null;for(let o=0;a&&o<6&&!(a===document.body||a===document.documentElement);o++){let s="";try{s=getComputedStyle(a).cursor}catch{break}if(s==="pointer")l=a;else if(l)break;a=a.parentElement}return l}let B="tr, [role=row], li, [role=listitem], [role=article], [role=gridcell]";function J(r){try{let a=r.cloneNode(!0);for(let l of Array.from(a.querySelectorAll(i+", input, select, textarea")))l.remove();for(let l of Array.from(a.querySelectorAll("td, th, li, p, div, span, tr")))l.append(" ");return t(a.textContent).slice(0,120)}catch{return""}}function A(r,a,l){if(!l)return!1;let o;try{o=Array.from(document.querySelectorAll(i+", input, select, textarea"))}catch{return!1}if(o.length>400)return!0;let s=0;for(let g of o)if(g!==r&&P(g)===a&&q(g).name===l&&++s>0)return!0;return!1}function n(r,a,l){if(!A(r,a,l))return null;let o=r.closest&&r.closest(B);if(!o)return null;let s=J(o);if(!s)return null;let g=o.getAttribute&&o.getAttribute("role"),p=o.tagName.toLowerCase();return{scope:s,scopeRole:g||(p==="tr"?"row":p==="li"?"listitem":p)}}function f(r){if(!r.closest)return null;let a=r.closest("nav, main, aside, header, footer, [role=navigation], [role=main], [role=complementary], [role=banner], [role=contentinfo], [role=search]");if(!a)return null;let l=a.getAttribute&&a.getAttribute("role");if(l)return{scope:u(a),scopeRole:l};let o=a.tagName.toLowerCase();return o==="nav"?{scope:u(a),scopeRole:"navigation"}:o==="main"?{scope:u(a),scopeRole:"main"}:o==="aside"?{scope:u(a),scopeRole:"complementary"}:a.closest("article, aside, main, nav, section")!==a&&a.closest("article, aside, main, nav, section")!==null?null:o==="header"?{scope:u(a),scopeRole:"banner"}:o==="footer"?{scope:u(a),scopeRole:"contentinfo"}:null}let c=new WeakMap;function w(r,a){r&&a&&Object.keys(a).length&&c.set(r,a)}function S(r,a,l){let o=c.get(r);if(o&&(o.scopeRole||o.nth!==void 0||o.warning))return{scope:o.scope??"",...o.scopeRole?{scopeRole:o.scopeRole}:{},...o.nth===void 0?{}:{nth:o.nth},...o.warning?{warning:o.warning}:{}};let s=n(r,a,l);return s||{scope:T(r)}}function T(r){let a=r.closest&&r.closest("form, fieldset, section, [role=group], [role=region], [role=dialog], [role=alertdialog], dialog");return a?u(a):""}function N(r){if(r.id)return"#"+CSS.escape(r.id);let a=[],l=r;for(;l&&l.nodeType===1&&l!==document.body;){let o=Array.from(l.parentNode?l.parentNode.children:[]).filter(s=>s.tagName===l.tagName);a.unshift(o.length>1?`${l.tagName.toLowerCase()}:nth-of-type(${o.indexOf(l)+1})`:l.tagName.toLowerCase()),l=l.parentElement}return"body > "+a.join(" > ")}return{accName:u,identify:q,roleOf:P,pointerTarget:R,scoping:S,cssPath:N,isAmbiguous:A,landmarkScope:f,remember:w}}var ge=Object.prototype.toString;function Q(e){return typeof e=="function"||ge.call(e)==="[object Function]"}function ye(e){var t=Number(e);return isNaN(t)?0:t===0||!isFinite(t)?t:(t>0?1:-1)*Math.floor(Math.abs(t))}var he=Math.pow(2,53)-1;function ve(e){var t=ye(e);return Math.min(Math.max(t,0),he)}function v(e,t){var i=Array,u=Object(e);if(e==null)throw new TypeError("Array.from requires an array-like object - not null or undefined");if(typeof t<"u"&&!Q(t))throw new TypeError("Array.from: when provided, the second argument must be a function");for(var b=ve(u.length),L=Q(i)?Object(new i(b)):new Array(b),h=0,C;h<b;)C=u[h],t?L[h]=t(C,h):L[h]=C,h+=1;return L.length=b,L}function j(e){"@babel/helpers - typeof";return j=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j(e)}function we(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function X(e,t){for(var i=0;i<t.length;i++){var u=t[i];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(e,Y(u.key),u)}}function Se(e,t,i){return t&&X(e.prototype,t),i&&X(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ee(e,t,i){return t=Y(t),t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Y(e){var t=xe(e,"string");return j(t)=="symbol"?t:t+""}function xe(e,t){if(j(e)!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var u=i.call(e,t||"default");if(j(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ae=(function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];we(this,e),Ee(this,"items",void 0),this.items=t}return Se(e,[{key:"add",value:function(i){return this.has(i)===!1&&this.items.push(i),this}},{key:"clear",value:function(){this.items=[]}},{key:"delete",value:function(i){var u=this.items.length;return this.items=this.items.filter(function(b){return b!==i}),u!==this.items.length}},{key:"forEach",value:function(i){var u=this;this.items.forEach(function(b){i(b,b,u)})}},{key:"has",value:function(i){return this.items.indexOf(i)!==-1}},{key:"size",get:function(){return this.items.length}}])})(),Z=typeof Set>"u"?Set:Ae;function m(e){var t;return(t=e.localName)!==null&&t!==void 0?t:e.tagName.toLowerCase()}var Te={article:"article",aside:"complementary",button:"button",datalist:"listbox",dd:"definition",details:"group",dialog:"dialog",dt:"term",fieldset:"group",figure:"figure",form:"form",footer:"contentinfo",h1:"heading",h2:"heading",h3:"heading",h4:"heading",h5:"heading",h6:"heading",header:"banner",hr:"separator",html:"document",legend:"legend",li:"listitem",math:"math",main:"main",menu:"list",nav:"navigation",ol:"list",optgroup:"group",option:"option",output:"status",progress:"progressbar",section:"region",summary:"button",table:"table",tbody:"rowgroup",textarea:"textbox",tfoot:"rowgroup",td:"cell",th:"columnheader",thead:"rowgroup",tr:"row",ul:"list"},Le={caption:new Set(["aria-label","aria-labelledby"]),code:new Set(["aria-label","aria-labelledby"]),deletion:new Set(["aria-label","aria-labelledby"]),emphasis:new Set(["aria-label","aria-labelledby"]),generic:new Set(["aria-label","aria-labelledby","aria-roledescription"]),insertion:new Set(["aria-label","aria-labelledby"]),none:new Set(["aria-label","aria-labelledby"]),paragraph:new Set(["aria-label","aria-labelledby"]),presentation:new Set(["aria-label","aria-labelledby"]),strong:new Set(["aria-label","aria-labelledby"]),subscript:new Set(["aria-label","aria-labelledby"]),superscript:new Set(["aria-label","aria-labelledby"])};function Ne(e,t){return["aria-atomic","aria-busy","aria-controls","aria-current","aria-description","aria-describedby","aria-details","aria-dropeffect","aria-flowto","aria-grabbed","aria-hidden","aria-keyshortcuts","aria-label","aria-labelledby","aria-live","aria-owns","aria-relevant","aria-roledescription"].some(function(i){var u;return e.hasAttribute(i)&&!((u=Le[t])!==null&&u!==void 0&&u.has(i))})}function ee(e,t){return Ne(e,t)}function G(e){var t=Re(e);if(t===null||k.indexOf(t)!==-1){var i=Ce(e);if(k.indexOf(t||"")===-1||ee(e,i||""))return i}return t}function Ce(e){var t=Te[m(e)];if(t!==void 0)return t;switch(m(e)){case"a":case"area":case"link":if(e.hasAttribute("href"))return"link";break;case"img":return e.getAttribute("alt")===""&&!ee(e,"img")?"presentation":"img";case"input":{var i=e,u=i.type;switch(u){case"button":case"image":case"reset":case"submit":return"button";case"checkbox":case"radio":return u;case"range":return"slider";case"email":case"tel":case"text":case"url":return e.hasAttribute("list")?"combobox":"textbox";case"search":return e.hasAttribute("list")?"combobox":"searchbox";case"number":return"spinbutton";default:return null}}case"select":return e.hasAttribute("multiple")||e.size>1?"listbox":"combobox"}return null}function Re(e){var t=e.getAttribute("role");if(t!==null){var i=t.trim().split(" ")[0];if(i.length>0)return i}return null}var k=["presentation","none"];function d(e){return e!==null&&e.nodeType===e.ELEMENT_NODE}function z(e){return d(e)&&m(e)==="caption"}function H(e){return d(e)&&m(e)==="input"}function te(e){return d(e)&&m(e)==="optgroup"}function re(e){return d(e)&&m(e)==="select"}function ne(e){return d(e)&&m(e)==="table"}function ie(e){return d(e)&&m(e)==="textarea"}function ae(e){var t=e.ownerDocument===null?e:e.ownerDocument,i=t.defaultView;if(i===null)throw new TypeError("no window available");return i}function oe(e){return d(e)&&m(e)==="fieldset"}function le(e){return d(e)&&m(e)==="legend"}function ue(e){return d(e)&&m(e)==="slot"}function Ie(e){return d(e)&&e.ownerSVGElement!==void 0}function se(e){return d(e)&&m(e)==="svg"}function ce(e){return Ie(e)&&m(e)==="title"}function $(e,t){if(d(e)&&e.hasAttribute(t)){var i=e.getAttribute(t).split(" "),u=e.getRootNode?e.getRootNode():e.ownerDocument;return i.map(function(b){return u.getElementById(b)}).filter(function(b){return b!==null})}return[]}function x(e,t){return d(e)?t.indexOf(G(e))!==-1:!1}function Oe(e){return e.trim().replace(/\s\s+/g," ")}function Me(e,t){if(!d(e))return!1;if(e.hasAttribute("hidden")||e.getAttribute("aria-hidden")==="true")return!0;var i=t(e);return i.getPropertyValue("display")==="none"||i.getPropertyValue("visibility")==="hidden"}function Pe(e){return x(e,["button","combobox","listbox","textbox"])||pe(e,"range")}function pe(e,t){if(!d(e))return!1;if(t==="range")return x(e,["meter","progressbar","scrollbar","slider","spinbutton"]);throw new TypeError("No knowledge about abstract role '".concat(t,"'. This is likely a bug :("))}function fe(e,t){var i=v(e.querySelectorAll(t));return $(e,"aria-owns").forEach(function(u){i.push.apply(i,v(u.querySelectorAll(t)))}),i}function _e(e){return re(e)?e.selectedOptions||fe(e,"[selected]"):fe(e,'[aria-selected="true"]')}function je(e){return x(e,k)}function ke(e){return z(e)}function He(e){return x(e,["button","cell","checkbox","columnheader","gridcell","heading","label","legend","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","row","rowheader","switch","tab","tooltip","treeitem"])}function $e(e){return!1}function De(e){return H(e)||ie(e)?e.value:e.textContent||""}function de(e){var t=e.getPropertyValue("content");return/^["'].*["']$/.test(t)?t.slice(1,-1):""}function me(e){var t=m(e);return t==="button"||t==="input"&&e.getAttribute("type")!=="hidden"||t==="meter"||t==="output"||t==="progress"||t==="select"||t==="textarea"}function be(e){if(me(e))return e;var t=null;return e.childNodes.forEach(function(i){if(t===null&&d(i)){var u=be(i);u!==null&&(t=u)}}),t}function Ve(e){if(e.control!==void 0)return e.control;var t=e.getAttribute("for");return t!==null?e.ownerDocument.getElementById(t):be(e)}function qe(e){var t=e.labels;if(t===null)return t;if(t!==void 0)return v(t);if(!me(e))return null;var i=e.ownerDocument;return v(i.querySelectorAll("label")).filter(function(u){return Ve(u)===e})}function Ge(e){var t=e.assignedNodes();return t.length===0?v(e.childNodes):t}function F(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=new Z,u=typeof Map>"u"?void 0:new Map,b=ae(e),L=t.compute,h=L===void 0?"name":L,C=t.computedStyleSupportsPseudoElements,M=C===void 0?t.getComputedStyle!==void 0:C,D=t.getComputedStyle,I=D===void 0?b.getComputedStyle.bind(b):D,V=t.hidden,q=V===void 0?!1:V,P=function(f,c){if(c!==void 0)throw new Error("use uncachedGetComputedStyle directly for pseudo elements");if(u===void 0)return I(f);var w=u.get(f);if(w)return w;var S=I(f,c);return u.set(f,S),S};function _(n,f){var c="";if(d(n)&&M){var w=I(n,"::before"),S=de(w);c="".concat(S," ").concat(c)}var T=ue(n)?Ge(n):v(n.childNodes).concat($(n,"aria-owns"));if(T.forEach(function(a){var l=A(a,{isEmbeddedInLabel:f.isEmbeddedInLabel,isReferenced:!1,recursion:!0}),o=d(a)?P(a).getPropertyValue("display"):"inline",s=o!=="inline"?" ":"";c+="".concat(s).concat(l).concat(s)}),d(n)&&M){var N=I(n,"::after"),r=de(N);c="".concat(c," ").concat(r)}return c.trim()}function R(n,f){var c=n.getAttributeNode(f);return c!==null&&!i.has(c)&&c.value.trim()!==""?(i.add(c),c.value):null}function B(n){return d(n)?R(n,"title"):null}function J(n){if(!d(n))return null;if(oe(n)){i.add(n);for(var f=v(n.childNodes),c=0;c<f.length;c+=1){var w=f[c];if(le(w))return A(w,{isEmbeddedInLabel:!1,isReferenced:!1,recursion:!1})}}else if(ne(n)){i.add(n);for(var S=v(n.childNodes),T=0;T<S.length;T+=1){var N=S[T];if(z(N))return A(N,{isEmbeddedInLabel:!1,isReferenced:!1,recursion:!1})}}else if(se(n)){i.add(n);for(var r=v(n.childNodes),a=0;a<r.length;a+=1){var l=r[a];if(ce(l))return l.textContent}return null}else if(m(n)==="img"||m(n)==="area"){var o=R(n,"alt");if(o!==null)return o}else if(te(n)){var s=R(n,"label");if(s!==null)return s}if(H(n)&&(n.type==="button"||n.type==="submit"||n.type==="reset")){var g=R(n,"value");if(g!==null)return g;if(n.type==="submit")return"Submit";if(n.type==="reset")return"Reset"}var p=qe(n);if(p!==null&&p.length!==0)return i.add(n),v(p).map(function(W){return A(W,{isEmbeddedInLabel:!0,isReferenced:!1,recursion:!0})}).filter(function(W){return W.length>0}).join(" ");if(H(n)&&n.type==="image"){var y=R(n,"alt");if(y!==null)return y;var E=R(n,"title");return E!==null?E:"Submit Query"}if(x(n,["button"])){var O=_(n,{isEmbeddedInLabel:!1,isReferenced:!1});if(O!=="")return O}return null}function A(n,f){if(i.has(n))return"";if(!q&&Me(n,P)&&!f.isReferenced)return i.add(n),"";var c=d(n)?n.getAttributeNode("aria-labelledby"):null,w=c!==null&&!i.has(c)?$(n,"aria-labelledby"):[];if(h==="name"&&!f.isReferenced&&w.length>0)return i.add(c),w.map(function(o){return A(o,{isEmbeddedInLabel:f.isEmbeddedInLabel,isReferenced:!0,recursion:!1})}).join(" ");var S=f.recursion&&Pe(n)&&h==="name";if(!S){var T=(d(n)&&n.getAttribute("aria-label")||"").trim();if(T!==""&&h==="name")return i.add(n),T;if(!je(n)){var N=J(n);if(N!==null)return i.add(n),N}}if(x(n,["menu"]))return i.add(n),"";if(S||f.isEmbeddedInLabel||f.isReferenced){if(x(n,["combobox","listbox"])){i.add(n);var r=_e(n);return r.length===0?H(n)?n.value:"":v(r).map(function(o){return A(o,{isEmbeddedInLabel:f.isEmbeddedInLabel,isReferenced:!1,recursion:!0})}).join(" ")}if(pe(n,"range"))return i.add(n),n.hasAttribute("aria-valuetext")?n.getAttribute("aria-valuetext"):n.hasAttribute("aria-valuenow")?n.getAttribute("aria-valuenow"):n.getAttribute("value")||"";if(x(n,["textbox"]))return i.add(n),De(n)}if(He(n)||d(n)&&f.isReferenced||ke(n)||$e(n)){var a=_(n,{isEmbeddedInLabel:f.isEmbeddedInLabel,isReferenced:!1});if(a!=="")return i.add(n),a}if(n.nodeType===n.TEXT_NODE)return i.add(n),n.textContent||"";if(f.recursion)return i.add(n),_(n,{isEmbeddedInLabel:f.isEmbeddedInLabel,isReferenced:!1});var l=B(n);return l!==null?(i.add(n),l):(i.add(n),"")}return Oe(A(e,{isEmbeddedInLabel:!1,isReferenced:h==="description",recursion:!1}))}function Be(e){return x(e,["caption","code","deletion","emphasis","generic","insertion","none","paragraph","presentation","strong","subscript","superscript"])}function K(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Be(e)?"":F(e,t)}window.__flAccName=e=>{try{return K(e).replace(/\s+/g," ").trim()}catch{return""}};window.__flCreateTargetIdentity=U;})();
@@ -6,7 +6,7 @@ import os from "os";
6
6
  import path from "path";
7
7
  import { createRequire } from "module";
8
8
  import { spawnSync } from "child_process";
9
- var AGENT_VERSION = "0.1.0-beta.30";
9
+ var AGENT_VERSION = "0.1.0-beta.32";
10
10
  async function prepareBrowsers() {
11
11
  if (browsersReady()) {
12
12
  return { ok: true, already: true, message: "chromium is already installed" };
@@ -462,9 +462,10 @@ import fs7 from "fs";
462
462
  import path7 from "path";
463
463
 
464
464
  // ../engine-playwright/dist/index.js
465
+ import { randomBytes } from "crypto";
465
466
  import path3 from "path";
466
467
 
467
- // ../test-model/dist/chunk-GALEMMJW.js
468
+ // ../test-model/dist/chunk-OL5BRAEM.js
468
469
  import { z as z3 } from "zod";
469
470
  var LocatorOverrideSchema = z3.object({
470
471
  strategy: z3.enum(["css", "xpath", "id", "testId", "text", "label", "placeholder", "altText", "title"]),
@@ -940,6 +941,7 @@ function parseFlowDocument(input) {
940
941
  raw.schemaVersion = version;
941
942
  }
942
943
  liftSignInFirst(raw);
944
+ if (Array.isArray(raw.steps)) raw.steps = mirrorCheckTargets(raw.steps);
943
945
  return FlowDocumentSchema.parse(raw);
944
946
  }
945
947
  var SIGN_IN_FIRST_STEP_ID = "sign-in-first";
@@ -952,6 +954,36 @@ function liftSignInFirst(raw) {
952
954
  raw["signIn"] = auth;
953
955
  raw.steps = raw.steps.slice(1);
954
956
  }
957
+ var CHECK_TARGET_FIELDS = [
958
+ "role",
959
+ "name",
960
+ "scope",
961
+ "scopeRole",
962
+ "frame",
963
+ "pageId",
964
+ "nameFrom",
965
+ "locator",
966
+ "candidates",
967
+ "nth"
968
+ ];
969
+ var unset = (value) => value === void 0 || value === null || value === "" || Array.isArray(value) && value.length === 0;
970
+ function mirrorCheckTargets(steps) {
971
+ return steps.map((step) => {
972
+ const held = step;
973
+ if (held["type"] !== "assert") return step;
974
+ const proposals = held["proposals"];
975
+ if (!Array.isArray(proposals)) return step;
976
+ const first = proposals[0];
977
+ const target = first?.["target"];
978
+ if (!target) return step;
979
+ const fill2 = {};
980
+ for (const field of CHECK_TARGET_FIELDS) {
981
+ if (!unset(held[field]) || unset(target[field])) continue;
982
+ fill2[field] = target[field];
983
+ }
984
+ return Object.keys(fill2).length === 0 ? step : { ...held, ...fill2 };
985
+ });
986
+ }
955
987
 
956
988
  // ../test-model/dist/index.js
957
989
  import { z as z4 } from "zod";
@@ -1140,6 +1172,13 @@ var TestCaseSchema = z22.object({
1140
1172
  });
1141
1173
  });
1142
1174
  }).transform((testCase) => {
1175
+ const occurrences = testCase.occurrences.map((occurrence) => {
1176
+ const steps = mirrorCheckTargets(occurrence.steps);
1177
+ return steps.some((step, at) => step !== occurrence.steps[at]) ? { ...occurrence, steps } : occurrence;
1178
+ });
1179
+ if (occurrences.some((occurrence, at) => occurrence !== testCase.occurrences[at])) {
1180
+ testCase = { ...testCase, occurrences };
1181
+ }
1143
1182
  if (!testCase.defaultActorId || testCase.defaultActorId === "default") return testCase;
1144
1183
  if (testCase.actors?.some((actor) => actor.id === testCase.defaultActorId)) return testCase;
1145
1184
  const { defaultActorId: _gone, ...rest } = testCase;
@@ -1719,7 +1758,7 @@ var DeliveredHelperSchema = z42.object({
1719
1758
  }).strict();
1720
1759
 
1721
1760
  // ../engine-playwright/dist/index.js
1722
- import { createHmac, randomBytes } from "crypto";
1761
+ import { createHmac, randomBytes as randomBytes2 } from "crypto";
1723
1762
  import { errors as errors2 } from "playwright";
1724
1763
 
1725
1764
  // ../core/dist/index.js
@@ -1883,13 +1922,17 @@ function describePlan(step, p) {
1883
1922
  let root = "page";
1884
1923
  for (const frame of step.frame ?? []) root += `.frameLocator(${quote(frameSelector(frame))})`;
1885
1924
  if (!p.overridden && (step.scope || step.scopeRole)) root = scopeExpression(root, step.scope ?? "", step.scopeRole);
1886
- let base = p.viaAdjacentLabel ? `${root}.getByText(${quote(p.arg)}, { exact: true }).locator('xpath=..').getByRole(${quote(step.role || "textbox")})` : p.method === "getByRole" ? `${root}.getByRole(${quote(p.arg)}, { name: ${quote(p.name ?? "")}, exact: true })` : `${root}.${p.method}(${quote(p.arg)}${p.exact !== void 0 ? `, { exact: ${p.exact} }` : ""})`;
1925
+ let base = p.viaAdjacentLabel ? `${root}.getByText(${adjacentLabelPattern(p.arg)}).locator('xpath=..').getByRole(${quote(step.role || "textbox")})` : p.method === "getByRole" ? `${root}.getByRole(${quote(p.arg)}, { name: ${quote(p.name ?? "")}, exact: true })` : `${root}.${p.method}(${quote(p.arg)}${p.exact !== void 0 ? `, { exact: ${p.exact} }` : ""})`;
1887
1926
  if (p.inputRole) base = `${root}.getByRole(${quote(p.inputRole)}, { name: ${quote(p.arg)}, exact: true }).or(${base}.and(${root}.locator(${quote(inputSelector(p.inputRole))})))`;
1888
1927
  if (p.visible) base += ".filter({ visible: true })";
1889
1928
  if (step.nth !== void 0) base += `.nth(${step.nth})`;
1890
1929
  if (step.pageId && step.pageId !== "main") base += ` // page ${quote(step.pageId)}`;
1891
1930
  return base;
1892
1931
  }
1932
+ function adjacentLabelPattern(name) {
1933
+ const bare = name.trim().replace(/\s*\*+$/, "");
1934
+ return new RegExp(`^${bare.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&")}(\\s*\\*)?$`);
1935
+ }
1893
1936
  function frameSelector(name) {
1894
1937
  const positional = /^nth:(\d+)$/.exec(name);
1895
1938
  if (positional) return `iframe, frame >> nth=${positional[1]}`;
@@ -3505,11 +3548,21 @@ import { fileURLToPath } from "url";
3505
3548
  import "playwright";
3506
3549
  import fs32 from "fs";
3507
3550
  import "playwright";
3551
+ import fs42 from "fs";
3552
+ function makeUnique(now = Date.now()) {
3553
+ return `${now.toString(36)}${randomBytes(3).toString("hex")}`;
3554
+ }
3555
+ function runtimeValue(values, name) {
3556
+ if (values.has(name)) return values.get(name);
3557
+ if (name === "unique") {
3558
+ const value = makeUnique();
3559
+ values.set(name, value);
3560
+ return value;
3561
+ }
3562
+ throw new Error(`Runtime value "${name}" has not been captured yet`);
3563
+ }
3508
3564
  function withRuntimeValues(step, values) {
3509
- const expand = (text) => text.replace(/\{\{([a-zA-Z][a-zA-Z0-9_]*)\}\}/g, (_, name) => {
3510
- if (!values.has(name)) throw new Error(`Runtime value "${name}" has not been captured yet`);
3511
- return values.get(name);
3512
- });
3565
+ const expand = (text) => text.replace(/\{\{([a-zA-Z][a-zA-Z0-9_]*)\}\}/g, (_, name) => runtimeValue(values, name));
3513
3566
  return {
3514
3567
  ...step,
3515
3568
  value: step.secret ? step.value : expand(step.value),
@@ -3525,10 +3578,8 @@ async function performHelperStep(page, step, options) {
3525
3578
  if (!options.runHelper) {
3526
3579
  throw new Error("helpers run only on runs started from the dashboard \u2014 this machine was not sent any");
3527
3580
  }
3528
- const inputs = Object.fromEntries(Object.entries(helper.inputs ?? {}).map(([name, text]) => [name, text.replace(NAME, (_, used) => {
3529
- if (!options.values.has(used)) throw new Error(`Runtime value "${used}" has not been captured yet`);
3530
- return options.values.get(used);
3531
- })]));
3581
+ const inputs = Object.fromEntries(Object.entries(helper.inputs ?? {}).map(([name, text]) => [name, text.replace(NAME, (_, used) => runtimeValue(options.values, used))]));
3582
+ inputs["unique"] ??= runtimeValue(options.values, "unique");
3532
3583
  const got = await options.runHelper(helper.helperId, inputs);
3533
3584
  if (got.value.length > 16384) throw new Error("The helper's value is over 16 KB");
3534
3585
  options.values.set(helper.saveAs, got.value);
@@ -3561,7 +3612,7 @@ function authenticationResolver(input) {
3561
3612
  return matches[0];
3562
3613
  };
3563
3614
  }
3564
- var PEPPER = randomBytes(32);
3615
+ var PEPPER = randomBytes2(32);
3565
3616
  function preparationKey(identity) {
3566
3617
  const material = JSON.stringify([
3567
3618
  identity.scope,
@@ -4260,7 +4311,7 @@ async function fromPlan(page, step, plan, opts = {}) {
4260
4311
  }));
4261
4312
  root = containers.reduce((a, b2) => a.or(b2));
4262
4313
  }
4263
- if (plan.viaAdjacentLabel) return root.getByText(plan.arg, { exact: true }).locator("xpath=..").getByRole(step.role || "textbox", { includeHidden: opts.includeHidden });
4314
+ if (plan.viaAdjacentLabel) return root.getByText(adjacentLabelPattern(plan.arg)).locator("xpath=..").getByRole(step.role || "textbox", { includeHidden: opts.includeHidden });
4264
4315
  let loc;
4265
4316
  switch (plan.method) {
4266
4317
  case "getByTestId":
@@ -5974,25 +6025,17 @@ async function startRecordingSession(opts) {
5974
6025
  },
5975
6026
  addAssertion(assertion) {
5976
6027
  const parsed = RecordedAssertionSchema.parse({ enabled: true, ...assertion });
5977
- const step = {
6028
+ const step = mirrorCheckTargets([{
5978
6029
  id: `st_${crypto.randomUUID().slice(0, 8)}`,
5979
6030
  type: "assert",
5980
- // Mirrored from the target so a step list can name what is being
5981
- // checked without reaching inside the assertion to find out.
5982
- role: parsed.target?.role ?? "",
5983
- name: parsed.target?.name ?? "",
5984
- ...parsed.target?.nameFrom ? { nameFrom: parsed.target.nameFrom } : {},
5985
- scope: parsed.target?.scope ?? "",
5986
- ...parsed.target?.scopeRole ? { scopeRole: parsed.target.scopeRole } : {},
5987
- ...parsed.target?.frame?.length ? { frame: parsed.target.frame } : {},
5988
- ...parsed.target?.locator ? { locator: parsed.target.locator } : {},
5989
- ...parsed.target?.candidates?.length ? { candidates: parsed.target.candidates } : {},
5990
- ...parsed.target?.pageId ? { pageId: parsed.target.pageId } : {},
6031
+ role: "",
6032
+ name: "",
6033
+ scope: "",
5991
6034
  value: "",
5992
6035
  secret: false,
5993
6036
  legacySelector: "",
5994
6037
  proposals: [parsed]
5995
- };
6038
+ }])[0];
5996
6039
  if ((parsed.kind === "text" || parsed.kind === "class" || parsed.kind === "attribute") && identifiedByOwnWords(parsed.target)) {
5997
6040
  step.warning = "Nothing identifies this element except the text being checked, so a change to that text reads as a missing element rather than a failed check. Give it a test ID, or choose a locator.";
5998
6041
  }
@@ -6578,23 +6621,17 @@ async function startDebugSession(opts) {
6578
6621
  },
6579
6622
  addAssertion(assertion) {
6580
6623
  const parsed = RecordedAssertionSchema.parse({ enabled: true, ...assertion });
6581
- const step = {
6624
+ const step = mirrorCheckTargets([{
6582
6625
  id: `st_${crypto.randomUUID().slice(0, 8)}`,
6583
6626
  type: "assert",
6584
- // Mirrored from the target so the step list can name what is being
6585
- // checked without reaching inside the assertion to find out.
6586
- role: parsed.target?.role ?? "",
6587
- name: parsed.target?.name ?? "",
6588
- ...parsed.target?.nameFrom ? { nameFrom: parsed.target.nameFrom } : {},
6589
- scope: parsed.target?.scope ?? "",
6590
- ...parsed.target?.scopeRole ? { scopeRole: parsed.target.scopeRole } : {},
6591
- ...parsed.target?.frame?.length ? { frame: parsed.target.frame } : {},
6592
- ...parsed.target?.locator ? { locator: parsed.target.locator } : {},
6627
+ role: "",
6628
+ name: "",
6629
+ scope: "",
6593
6630
  value: "",
6594
6631
  secret: false,
6595
6632
  legacySelector: "",
6596
6633
  proposals: [parsed]
6597
- };
6634
+ }])[0];
6598
6635
  RecordedStepSchema.parse(step);
6599
6636
  const at = cursor ? steps.findIndex((s2) => s2.id === cursor) : steps.length;
6600
6637
  const insertAt = at === -1 ? steps.length : at;
@@ -6618,6 +6655,29 @@ async function startDebugSession(opts) {
6618
6655
  };
6619
6656
  return session;
6620
6657
  }
6658
+ var script = null;
6659
+ async function fieldNames(page) {
6660
+ script ??= fs42.readFileSync(accNameScriptPath(), "utf8");
6661
+ if (!await page.evaluate(() => Boolean(window.__flCreateTargetIdentity)).catch(() => false)) {
6662
+ await page.evaluate(script).catch(() => void 0);
6663
+ }
6664
+ return page.evaluate(() => {
6665
+ const w = window;
6666
+ if (!w.__flCreateTargetIdentity) return [];
6667
+ const clean = (s2) => (s2 || "").replace(/\s+/g, " ").trim();
6668
+ const { identify, roleOf, accName } = w.__flCreateTargetIdentity(w, clean, "button");
6669
+ const found = [];
6670
+ for (const el of Array.from(document.querySelectorAll("input:not([type=hidden]),select,textarea"))) {
6671
+ const who = identify(el);
6672
+ if (who.nameFrom !== "adjacent-label") continue;
6673
+ const placeholder = clean(el.placeholder);
6674
+ const title = clean(el.title);
6675
+ const hint = placeholder || title || accName(el);
6676
+ if (hint) found.push({ role: roleOf(el), hint, hintFrom: placeholder ? "placeholder" : title ? "title" : "name", label: who.name });
6677
+ }
6678
+ return found;
6679
+ }).catch(() => []);
6680
+ }
6621
6681
 
6622
6682
  // ../results/dist/chunk-LYCTVHPR.js
6623
6683
  import { z as z5 } from "zod";
@@ -11210,12 +11270,15 @@ export {
11210
11270
  resolveService,
11211
11271
  connect,
11212
11272
  RecordedStepSchema,
11273
+ mirrorCheckTargets,
11274
+ runtimeValue,
11213
11275
  authenticationResolver,
11214
11276
  checkAssertion,
11215
11277
  openRunSession,
11216
11278
  closeRunSession,
11217
11279
  replayFlow,
11218
11280
  executeStep,
11281
+ fieldNames,
11219
11282
  helperRunner,
11220
11283
  resolveCheckouts,
11221
11284
  start,
package/dist/cli.js CHANGED
@@ -10,15 +10,18 @@ import {
10
10
  disconnect,
11
11
  doctor,
12
12
  executeStep,
13
+ fieldNames,
13
14
  helperRunner,
15
+ mirrorCheckTargets,
14
16
  openRunSession,
15
17
  prepareBrowsers,
16
18
  replayFlow,
17
19
  resolveCheckouts,
18
20
  resolveService,
21
+ runtimeValue,
19
22
  start,
20
23
  status
21
- } from "./chunk-JYXRKBN5.js";
24
+ } from "./chunk-4EYN6N5Q.js";
22
25
 
23
26
  // src/cli.ts
24
27
  import { parseArgs } from "util";
@@ -170,6 +173,21 @@ function scopeOf(within) {
170
173
  if (!said) return { scope: "" };
171
174
  return LANDMARKS.has(said.toLowerCase()) ? { scope: "", scopeRole: said.toLowerCase() } : { scope: said };
172
175
  }
176
+ function asLabelled(target, fields) {
177
+ const field = fields.find((f) => f.role === target.role && (f.label === target.name || f.hint === target.name));
178
+ if (!field) return target;
179
+ return {
180
+ ...target,
181
+ name: field.label,
182
+ nameFrom: "adjacent-label",
183
+ ...field.hintFrom === "name" ? {} : { candidates: [{ strategy: field.hintFrom, value: field.hint }] }
184
+ };
185
+ }
186
+ function labelTree(tree, fields) {
187
+ let out = tree;
188
+ for (const f of fields) out = out.split(`- ${f.role} ${JSON.stringify(f.hint)}`).join(`- ${f.role} ${JSON.stringify(f.label)}`);
189
+ return out;
190
+ }
173
191
  function describe(step) {
174
192
  const target = step.name ? `${step.role || "element"} "${step.name}"` : step.role || "";
175
193
  const where = step.scope ? ` in "${step.scope}"` : step.scopeRole ? ` in the ${step.scopeRole}` : "";
@@ -274,7 +292,10 @@ var AuthoringSession = class {
274
292
  async snapshot() {
275
293
  const { page, draft } = this.requireOpen();
276
294
  await page.waitForLoadState("domcontentloaded", { timeout: 1e4 }).catch(() => void 0);
277
- let tree = await page.locator("body").ariaSnapshot({ timeout: 8e3 }).catch((e) => `(could not read the page: ${e.message})`);
295
+ let tree = labelTree(
296
+ await page.locator("body").ariaSnapshot({ timeout: 8e3 }).catch((e) => `(could not read the page: ${e.message})`),
297
+ await fieldNames(page)
298
+ );
278
299
  if (tree.length > MAX_TREE) tree = `${tree.slice(0, MAX_TREE)}
279
300
  \u2026 (cut \u2014 the page is long; act on what is above, or scroll with press "PageDown")`;
280
301
  const title = await page.title().catch(() => "");
@@ -293,11 +314,11 @@ ${tree}`;
293
314
  if ((input.action === "fill" || input.action === "select" || input.action === "press" || input.action === "navigate") && input.value === void 0) {
294
315
  throw new Error(`${input.action} needs a value`);
295
316
  }
317
+ const target = navigating ? { role: "", name: "" } : asLabelled({ role: input.role ?? "", name: input.name ?? "" }, await fieldNames(page));
296
318
  const step = RecordedStepSchema.parse({
297
319
  id: `s${draft.steps.length + 1}_${Date.now().toString(36)}`,
298
320
  type: input.action,
299
- role: navigating ? "" : input.role ?? "",
300
- name: navigating ? "" : input.name ?? "",
321
+ ...target,
301
322
  ...scopeOf(input.within),
302
323
  value: input.action === "check" ? input.value === "false" ? "false" : "true" : input.value ?? "",
303
324
  secret: false,
@@ -338,14 +359,16 @@ ${await this.snapshot()}`;
338
359
  value: input.value,
339
360
  enabled: true,
340
361
  ...input.op && input.op !== "equals" ? { op: input.op } : {},
341
- ...input.role ? { target: { role: input.role, name: input.name ?? "", ...scopeOf(input.within) } } : {}
362
+ ...input.role ? { target: { ...asLabelled({ role: input.role, name: input.name ?? "" }, await fieldNames(page)), ...scopeOf(input.within) } } : {}
342
363
  });
364
+ const filled = (text2) => text2.replace(/\{\{([a-zA-Z][a-zA-Z0-9_]*)\}\}/g, (_, name) => runtimeValue(this.values, name));
365
+ const expected = Array.isArray(assertion.value) ? assertion.value.map(filled) : filled(assertion.value);
343
366
  try {
344
- await checkAssertion(page, assertion.kind, assertion.value, 5e3, assertion);
367
+ await checkAssertion(page, assertion.kind, expected, 5e3, { ...assertion, value: expected });
345
368
  } catch (error) {
346
369
  throw new Error(`That is not true of the page right now, so it was not kept: ${error.message.split("\n")[0]}`);
347
370
  }
348
- const step = RecordedStepSchema.parse({
371
+ const step = RecordedStepSchema.parse(mirrorCheckTargets([{
349
372
  id: `c${draft.steps.length + 1}_${Date.now().toString(36)}`,
350
373
  type: "assert",
351
374
  role: "",
@@ -355,7 +378,7 @@ ${await this.snapshot()}`;
355
378
  secret: false,
356
379
  legacySelector: "",
357
380
  proposals: [assertion]
358
- });
381
+ }])[0]);
359
382
  draft.steps.push(step);
360
383
  return `Step ${draft.steps.length} kept: ${describe(step)}.`;
361
384
  }
@@ -499,8 +522,11 @@ How to write a good Flowriki test:
499
522
  step fails there, fix it (remove_step, act again) and replay again.
500
523
  8. Save with save_flow and give the person the review link it returns.
501
524
  Test data you invent (a new user's email or password for a sign-up) is fine to
502
- type; prefer an address the project's mailbox helper can read, such as
503
- qa+something@ the mailbox's own domain.`;
525
+ type. For anything that must be NEW on every run \u2014 a sign-up's email or
526
+ username \u2014 use {{unique}}: it is different on every run and the same within
527
+ one, e.g. qa+{{unique}}@ the domain of the project's mailbox helper, so the
528
+ helper can read that address's verification email with {"email": "qa+{{unique}}@\u2026"}.
529
+ A test that types a fixed new email passes once and fails every run after.`;
504
530
  var text = (value, isError = false) => ({ content: [{ type: "text", text: value }], ...isError ? { isError } : {} });
505
531
  var str = (value) => typeof value === "string" ? value : value === void 0 || value === null ? void 0 : String(value);
506
532
  function authoringTools(service, session) {
package/dist/engine.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  resolveCheckouts,
10
10
  start,
11
11
  status
12
- } from "./chunk-JYXRKBN5.js";
12
+ } from "./chunk-4EYN6N5Q.js";
13
13
  export {
14
14
  AGENT_VERSION,
15
15
  browsersReady,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowriki/agent",
3
- "version": "0.1.0-beta.30",
3
+ "version": "0.1.0-beta.32",
4
4
  "description": "Run Flowriki UI tests on your own computer. Connects this machine to your Flowriki account.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",