@qadet/runner 0.7.21 → 0.7.22

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 (3) hide show
  1. package/README.md +9 -16
  2. package/package.json +1 -1
  3. package/qadet.mjs +1 -1
package/README.md CHANGED
@@ -8,34 +8,27 @@ The AI, the plans and the tests live in your Qadet workspace. The runner needs n
8
8
 
9
9
  - Node.js 22 or newer
10
10
  - Google Chrome
11
- - A runner token from **Runner tokens** in your Qadet workspace (choose **Set up a runner**)
12
11
 
13
- ## Install
12
+ ## Install, connect and start
14
13
 
15
- Copy the install command from **Runner tokens**. It names the runner version your workspace expects, for example:
14
+ On **Runners** in your Qadet workspace, choose **Set up a runner** and paste the one command it shows into a terminal. It names the runner version your workspace expects, for example:
16
15
 
17
16
  ```sh
18
- npm install --global @qadet/runner@0.6.0
17
+ npm install --global @qadet/runner@0.7.22 && qadet connect https://qadet.nodellm.dev && qadet service install
19
18
  ```
20
19
 
21
- When your workspace needs a newer runner, the runner prints the update command and **Runner tokens** flags the token.
20
+ `qadet connect` opens your browser: check the code matches the one in your terminal and press **Allow this computer**. No token to copy. `qadet service install` starts the runner in the background, at every login, and keeps it up to date.
22
21
 
23
- ## Connect and run
24
-
25
- ```sh
26
- qadet connect # once: asks for your workspace address and token, and checks them
27
- qadet agent # whenever you want to run tests; stop it with Ctrl+C
28
- ```
29
-
30
- While `qadet agent` runs, the runs you start in Qadet open in Chrome on this computer, one at a time, and report their steps, screenshots and recording back to the workspace.
22
+ To run it only while you test, use `qadet agent` in a terminal instead, and stop it with Ctrl+C. While it runs, the runs you start in Qadet open in Chrome on this computer and report their steps, screenshots and recording back to the workspace.
31
23
 
32
24
  | Command | Does |
33
25
  |---|---|
34
- | `qadet connect` | Saves the workspace address and token for this user. The token is asked for at a prompt, so it never lands in your shell history. |
26
+ | `qadet connect <url>` | Connects this computer: your browser opens, and you press **Allow this computer**. |
35
27
  | `qadet status` | Checks the connection. |
36
28
  | `qadet connect <url> --again` | Signs in afresh, such as to switch to another organization or account. |
37
29
  | `qadet disconnect` | Removes the saved connection. |
38
- | `qadet agent` | Takes the runs you start in Qadet. |
30
+ | `qadet service install` | Runs the runner in the background, starting at every login. `qadet service status` and `qadet service uninstall` check and remove it. |
31
+ | `qadet agent` | Takes the runs you start in Qadet, in this terminal. |
39
32
  | `qadet help` | Lists every command. |
40
33
 
41
34
  ## Behind a proxy
@@ -44,7 +37,7 @@ If your network reaches the internet through a proxy, set `HTTPS_PROXY` (or `HTT
44
37
 
45
38
  ## Troubleshooting
46
39
 
47
- - **Qadet says no runner is connected:** start `qadet agent`, and check `qadet status`. If the token expired or was revoked, create a new one and run `qadet connect` again.
40
+ - **Qadet says no runner is connected:** check `qadet service status` (or start `qadet agent`) and `qadet status`. If the computer was removed or needs reconnecting, run `qadet connect <url>` again.
48
41
  - **A run says it couldn't reach the app:** open the app's address in Chrome on this computer. If it doesn't open here, the runner can't reach it either; check your VPN and the project's browser access settings in Qadet.
49
42
 
50
43
  More in the docs: https://qadet.nodellm.dev/docs/runner
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qadet/runner",
3
- "version": "0.7.21",
3
+ "version": "0.7.22",
4
4
  "description": "Runs Qadet tests in Chrome on this computer",
5
5
  "type": "module",
6
6
  "files": [
package/qadet.mjs CHANGED
@@ -292,7 +292,7 @@ ${s}
292
292
  return Date.now() - window.__qadetLastChange
293
293
  })()`,rY=a(async e=>{if(Gf(e))return!0;let t=await e.evaluate(tY).catch(()=>0);return typeof t!="number"||t<500},"busy"),Zx=a(async(e,t,n=Date.now)=>{let i=e.locator(t).first(),r=n(),o;for(;n()-r<eY;){if(await i.isVisible().catch(()=>!1))return!0;if(await rY(e)?o=void 0:o??=n(),o!==void 0&&n()-o>=XV)return!1;await e.waitForTimeout(150).catch(()=>{})}return!1},"targetReady")});var nY,iY,ad,oY,jC,sY,Xx,aY,hA,eN,Ad,tN,rN=y(()=>{"use strict";nY=[/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,/\b[0-9a-f]{8}-(?:[0-9a-f]{4}-){1,3}(?:[0-9a-f]{1,12})?/gi,/ \(\d+\)/g,/\bSelect row \d+\b/gi,/\b[A-Z]{1,5}-\d{3,}\b/g,/\b(?=[A-Z0-9]*[A-Z])[A-Z0-9]{4,6}-[A-Z0-9]{4,6}\b/g,/#\d+\b/g,/\b\d{1,4}[/.-]\d{1,2}[/.-]\d{1,4}\b/g,/\b\d{1,2}\s+(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]*\.?(?:\s+\d{2,4})?\b/gi,/\b\d{1,2}:\d{2}:\d{2}\s*(?:am|pm)?\b/gi,/\b(?:just now|\d+\s+(?:seconds?|minutes?|hours?|days?) ago|yesterday|today)\b/gi,/\b(?=[a-z]*\d)(?=\d*[a-z])[a-z0-9]{6}\b/g],iY=/\b\d{1,2}:\d{2}\s*(?:am|pm)?\b/gi,ad=/\[name="((?:[^"\\]|\\.)*)"i\]/,oY=/name: '((?:[^'\\]|\\.)*)'/,jC=/\{\{[A-Za-z_][A-Za-z0-9_]*\}\}/g,sY=a(e=>String.fromCharCode(57344+e),"KEPT"),Xx=/[\ue000-\uf8ff]/,aY=a((e,t)=>{let n=[],i=a(c=>(n.push(c),sY(n.length-1)),"hold"),r=e.replace(jC,i);t&&!jC.test(t)&&(r=r.replaceAll(t,()=>i(t))),jC.lastIndex=0;let o=r;for(let c of nY)o=o.replace(c,"\0");if(o.includes("\0")&&(o=o.replace(iY,"\0")),o===r)return;let s=o.split("\0").map(c=>c.replace(/^[\s\p{P}]+|[\s\p{P}]+$/gu,"")).filter(c=>c.replace(/[\ue000-\uf8ff]/g,"").length>=3||Xx.test(c));return(s.find(c=>Xx.test(c))??s[0])?.replace(/[\ue000-\uf8ff]/g,c=>n[c.charCodeAt(0)-57344]??"")},"stableName"),hA=/\.([A-Za-z][\w-]*?__)[A-Za-z0-9_-]{5}(?![\w-])/g,eN=a((e,t)=>{hA.test(e.selector)&&(hA.lastIndex=0,e={selector:e.selector.replace(hA,'[class*="$1"]'),code:e.code.replace(hA,'[class*="$1"]')}),hA.lastIndex=0;let n=e.selector.replace(/internal:label="Select row \d+"i/g,'internal:label="Select row"i'),i=e.code.replace(/\.getByLabel\('Select row \d+'\)/g,".getByLabel('Select row')"),r=n.match(ad)?.[1],o=r&&aY(r.replace(/\\"/g,'"'),t);return o?{selector:n.replace(ad,`[name=${JSON.stringify(o)}i]`),code:i.replace(oY,`name: '${o.replace(/'/g,"\\'")}'`)}:n===e.selector&&i===e.code?e:{selector:n,code:i}},"stableTarget"),Ad=a(e=>ad.test(e)?e.replace(ad,'[name="$1"s]'):void 0,"exactName"),tN=a((e,t,n)=>t===0?{selector:`${e.selector} >> nth=0`,code:`${e.code}.first()`}:t===n-1?{selector:`${e.selector} >> nth=-1`,code:`${e.code}.last()`}:{selector:`${e.selector} >> nth=${t}`,code:`${e.code}.nth(${t})`},"nthTarget")});var AY,cY,uY,nN,lY,iN,qr,oN,dY,gY,qC,cd,fY,hY,pY,mY,IY,EY,sN,QY,CY,WC=y(()=>{"use strict";Mx();Yn();od();Ox();Gx();YC();jx();Of();xc();Wx();ia();Kx();qn();jr();rN();AY=10*1024*1024,cY={ctrl:"Control",control:"Control",cmd:"Meta",command:"Meta",meta:"Meta",win:"Meta",alt:"Alt",option:"Alt",shift:"Shift",esc:"Escape",escape:"Escape",return:"Enter",enter:"Enter",del:"Delete",space:"Space"},uY=a(e=>e.split("+").map(t=>t.trim()).map(t=>cY[t.toLowerCase()]??t).join("+"),"keyName"),nN=a(async(e,t)=>{let n=await e.evaluate(i=>i.maxLength??-1).catch(()=>-1);if(n>0&&n<=2&&t.length>n){await e.click(),await e.page().keyboard.type(t,{delay:30});return}try{await e.fill(t)}catch(i){if(!/is not an <input>/.test(String(i)))throw i;let r=e.locator('input:not([type=hidden]), textarea, [contenteditable=""], [contenteditable="true"]').first();if(await r.count()===0)throw i;await r.fill(t)}},"fillField"),lY=a(async(e,t)=>{let n=a(o=>e.locator(o).count().catch(()=>0),"count");if(await n(t)<=1)return t;let i=t.replace(/(\[name="[^"]*")i\]/g,"$1s]");if(i!==t&&await n(i)===1)return i;let r=`${t} >> visible=true`;return await n(r)===1?r:t},"oneMatch"),iN=new Set(["click","double_click","hover","fill","fillSecret","select"]),qr=a(async(e,t,{secrets:n,inbox:i,readDocument:r,fetchFixture:o})=>{let s=n.expandStep(t),A="target"in s&&s.target&&iN.has(s.action)?{...s,target:{...s.target,selector:await lY(e,s.target.selector)}}:s;if("target"in A&&A.target&&fY.has(A.action)){await zx(e,A.target.selector);let c=HC(A.target.selector);c&&await e.locator(A.target.selector).count().catch(()=>0)===0&&await e.locator(c).filter({visible:!0}).count().catch(()=>0)===1&&(A={...A,target:{...A.target,selector:`${c} >> visible=true`}})}if("target"in A&&A.target&&iN.has(A.action)){let c=e.locator(A.target.selector);if(!await Zx(e,A.target.selector)&&await c.count().catch(()=>0)===0)throw new Error(`${A.target.code}: the page settled without it (nothing on the page matches it)`)}switch(A.action){case"click":return hY(e,A.target.selector);case"double_click":return pY(e,A.target.selector);case"hover":return mY(e,A.target.selector);case"drag":{let c=e.locator(A.from.selector),u=e.locator(A.to.selector),l=await c.boundingBox(),d=await u.boundingBox();if(l&&d){let g=l.x+l.width/2,h=l.y+l.height/2,p=d.x+d.width/2,m=d.y+d.height/2;return await e.mouse.move(g,h),await e.mouse.down(),await e.mouse.move(p,m,{steps:10}),e.mouse.up()}return c.dragTo(u)}case"draw":{let c=e.locator(A.target.selector);await c.scrollIntoViewIfNeeded();let u=await c.boundingBox();if(!u)throw new Error(`${A.target.code} is not visible to draw on`);let l=A.points[0];if(!l)throw new Error("At least 2 points are required to draw.");await e.mouse.move(u.x+l.x,u.y+l.y),await e.mouse.down();for(let d=1;d<A.points.length;d++){let g=A.points[d];g&&await e.mouse.move(u.x+g.x,u.y+g.y,{steps:5})}return e.mouse.up()}case"remember":{let c=await qx(e.locator(A.target.selector)).catch(u=>{let l=n.typedInto(A.target.selector);if(l!==void 0&&/password/i.test(u.message))return l;throw u});return n.remember(A.name,c)}case"rememberValue":return n.remember(A.name,n.expand(A.value));case"fill":{let c=n.expand(A.value);return n.noteTyped(A.target.selector,c),nN(e.locator(A.target.selector),c)}case"fillSecret":{let c=e.locator(A.target.selector);return await nN(c,n.value(A.secret)),Lv(c)}case"uploadCsv":{let c=Jx(A.fileName,n.expand(A.content)),u=e.locator(A.target.selector),d=await u.evaluate(g=>g.matches('input[type="file"]'))?u:u.locator('input[type="file"]');if(await d.count()!==1)throw new Error("The saved upload target no longer identifies one file input.");return d.setInputFiles({name:c.fileName,mimeType:"text/csv",buffer:Buffer.from(c.content,"utf8")})}case"uploadFile":{let c;if(A.fixtureId!==void 0){if(!o)throw new Error("Project fixtures cannot be loaded for this replay.");if(c=await o(A.fixtureId),c.content.byteLength>AY)throw new Error("Project fixtures cannot exceed 10 MB.")}else c={content:Hx(A.fileName,n.expand(A.content??""),A.sizeBytes),fileName:A.fileName,mimeType:A.mimeType};let u=e.locator(A.target.selector),d=await u.evaluate(g=>g.matches('input[type="file"]'))?u:u.locator('input[type="file"]');if(await d.count()!==1)throw new Error("The saved upload target no longer identifies one file input.");return d.setInputFiles({name:c.fileName,mimeType:c.mimeType,buffer:c.content})}case"select":return sN(e,A.target.selector,n.expand(A.option));case"selectMany":return EY(e,A.target.selector,A.options.map(c=>n.expand(c)));case"answerDialog":Rc.set(e,{accept:A.accept,text:A.text===void 0?void 0:n.expand(A.text)});return;case"press":return e.keyboard.press(uY(A.key));case"navigate":return e.goto(n.expand(A.url));case"expectText":{let c=n.expand(A.text),u=A.within&&{...A.within,containing:n.expand(A.within.containing)},l=a(d=>rd(e,c,u,A.exact,d),"shown");if(!await l(A.wait?A.wait*1e3:void 0)&&!await dY(e,()=>l(1e3)))throw new Error(`"${A.text}" is not${td(A.within)||" on the page"}`);return}case"expectNoText":{let c=n.expand(A.text);if(c!==c.trim()&&c.trim()){if(await e.evaluate(l=>(globalThis.document.body?.textContent??"").includes(l),c))throw new Error(`"${A.text}" is still on the page`);return}if(!await vx(e,n.expand(A.text),A.within&&{...A.within,containing:n.expand(A.within.containing)},A.exact,A.wait?A.wait*1e3:void 0))throw new Error(`"${A.text}" is still${td(A.within)||" on the page"}`);return}case"expectPath":try{await e.waitForURL(c=>un(A.path,VC(c)))}catch{throw new Error(`Expected to be on ${A.path} but was on ${id(e)}`)}return;case"expectRequest":{let c=await Yv(e,A.method,n.expand(A.path),A.responseStatus);if(!c.passed)throw new Error(c.reason);return}case"followEmailLink":{if(!i)throw new Error("This project has no test inbox, so the email link can not be found");let c=await i.link(n.expand(A.to),A.subject&&n.expand(A.subject),A.linkText);return await e.context().clearCookies(),e.goto(c.url)}case"expectVisible":if(!await Rx(e,A.target.selector))throw new Error(`${A.target.code} is not visible`);return;case"expectHidden":if(!await $x(e,A.target.selector))throw new Error(`${A.target.code} is still shown`);return;case"expectEnabled":if(!await Fx(e,A.target.selector,A.enabled))throw new Error(`${A.target.code} is ${A.enabled?"disabled":"enabled"}`);return;case"expectCount":{let c=A.within&&{...A.within,containing:n.expand(A.within.containing)};if(!await Dx(e,n.expand(A.text),A.count,c,A.exact))throw new Error(`"${n.expand(A.text)}" does not show ${A.count} times${td(c)}`);return}case"expectMedia":if(!await Sx(e,A.target.selector,A.state))throw new Error(`${A.target.code} is not ${A.state}`);return;case"expectOrder":{let c=A.texts.map(u=>n.expand(u));if(!await kx(e,c))throw new Error(`${c.map(u=>`"${u}"`).join(", ")} are not shown in this order`);return}case"expectValue":if(!await Ux(e,A.target.selector,n.expand(A.value)))throw new Error(`${A.target.code} does not hold "${n.expand(A.value)}"`);return;case"expectChecked":if(!await Tx(e,A.target.selector,A.checked))throw new Error(`${A.target.code} is not ${A.checked?"on":"off"}`);return;case"expectAttribute":{let c=A.value===void 0?void 0:n.expand(A.value);if(!await _x(e,A.target.selector,A.name,{value:c,absent:A.absent}))throw new Error(A.absent?`${A.target.code} has ${A.name}`:c===void 0?`${A.target.code} has no ${A.name}`:`${A.target.code} has no ${A.name}="${c}"`);return}case"expectInvalid":if(!await Lx(e,A.target.selector))throw new Error(`${A.target.code} was accepted, not refused`);return;case"expectDownload":{let{name:c,text:u}=await sd(e,A.target.selector,r);if(!u.toLowerCase().includes(n.expand(A.text).toLowerCase()))throw new Error(`${c} does not contain "${A.text}"`)}}},"runStep"),oN=a(async(e,t,n)=>{try{await qr(e,t,n),kr(t)||await nd(e)}catch(i){if(kr(t))throw i;await e.waitForLoadState("load").catch(()=>{}),await e.waitForTimeout(1e3),"target"in t&&await qC(e,t.target.selector);let r="target"in t?await CY(e,t.target):void 0;await qr(e,r?{...t,target:r}:t,n).catch(()=>{throw i})}},"runStepSettled"),dY=a(async(e,t)=>{for(let n=0;n<4;n++){if(!await e.evaluate(()=>{let r=globalThis,o=r.document.scrollingElement;return!o||o.scrollHeight<=o.clientHeight+20?!1:(r.scrollTo(0,o.scrollHeight),!0)}).catch(()=>!1))return!1;if(await t())return!0}return!1},"loadMoreUntil"),gY=120,qC=a(async(e,t)=>{let n=a(()=>e.locator(t).count().catch(()=>0),"found");if(await n()>0)return;let i=await e.locator("*").evaluateAll(r=>r.map((o,s)=>({element:o,index:s})).filter(({element:o})=>{let s=globalThis.getComputedStyle(o);return/(auto|scroll)/.test(s.overflowY)&&o.scrollHeight>o.clientHeight+20}).map(({index:o})=>o)).catch(()=>[]);for(let r of i.slice(0,5)){let o=e.locator("*").nth(r);await o.evaluate(s=>{s.scrollTop=0});for(let s=0;s<gY;s++){let A=await o.evaluate(c=>(c.scrollTop+=c.clientHeight*.8,c.dispatchEvent(new Event("scroll")),c.scrollTop+c.clientHeight>=c.scrollHeight-1));if(await e.waitForTimeout(30),await n()>0)return;if(A)break}}},"scrollUntilShown"),cd=a(e=>{let t=eN(e,Oc);return t===e||t.selector.includes(" >> nth=")||/\{\{[A-Za-z_][A-Za-z0-9_]*\}\}/.test(t.selector)?t:tN(t,0,2)},"savedTarget"),fY=new Set(["click","double_click","hover"]),hY=a(async(e,t)=>{let n=e.locator(t);if(await n.count()<=1)return Dr(n,A=>A.click());let r=Ad(t);if(r&&await e.locator(r).count()===1)return Dr(e.locator(r),A=>A.click());let o=await n.evaluateAll(A=>A.map(c=>c.href??null)),s=o.every(A=>A&&A===o[0]);return Dr(s?n.first():n,A=>A.click())},"clickTarget"),pY=a(async(e,t)=>{let n=e.locator(t);if(await n.count()<=1)return Dr(n,o=>o.dblclick());let r=Ad(t);return r&&await e.locator(r).count()===1?Dr(e.locator(r),o=>o.dblclick()):Dr(n.first(),o=>o.dblclick())},"doubleClickTarget"),mY=a(async(e,t)=>{let n=e.locator(t);if(await n.count()<=1)return Dr(n,o=>o.hover());let r=Ad(t);return r&&await e.locator(r).count()===1?Dr(e.locator(r),o=>o.hover()):Dr(n.first(),o=>o.hover())},"hoverTarget"),IY='[role="listbox"]:visible, .ant-select-dropdown:visible, .MuiPopover-root:visible, .MuiMenu-list:visible, [class*="dropdown" i]:visible, [class*="menu" i]:visible',EY=a(async(e,t,n)=>{let i=e.locator(t);if(await i.evaluate(o=>o.tagName==="SELECT").catch(()=>!1))return i.selectOption(n.map(o=>({label:o})));for(let o of n)await sN(e,t,o)},"selectOptions"),sN=a(async(e,t,n)=>{let i=e.locator(t);if(await i.evaluate(c=>c.tagName==="SELECT").catch(()=>!1))return i.selectOption(n);await i.click();let o=e.getByRole("option",{name:n,exact:!0}).filter({visible:!0}),s=e.locator(IY).getByText(n,{exact:!0}).filter({visible:!0}),A=o.or(s).first();await A.waitFor({state:"visible",timeout:5e3}).catch(()=>{throw new Error(`The dropdown opened, but no option "${n}" showed`)}),await A.click()},"selectOption"),QY=[["sign in","log in","login","signin"],["sign up","register","create account","signup"],["sign out","log out","logout","signout"]],CY=a(async(e,t)=>{let n=t.selector.match(/^internal:role=(button|link)\[name="([^"]+)"i\]$/);if(!n||await e.locator(t.selector).count().catch(()=>0)>0)return;let[,i,r=""]=n,o=QY.find(s=>s.includes(r.toLowerCase()));for(let s of o??[]){if(s===r.toLowerCase())continue;let A=`internal:role=${i}[name=${JSON.stringify(s)}i]`;if(await e.locator(A).count().catch(()=>0)===1)return{selector:A,code:`getByRole('${i}', { name: '${s}' })`}}},"sameWordsTarget")});var BY,yY,wY,bY,Zo,ZC=y(()=>{"use strict";Zi();Yn();od();YC();Lc();io();xc();ia();JC();jr();Br();WC();BY=new Set(["click","double_click","hover","drag","draw","navigate"]),yY=a(e=>{switch(e.type){case"view":case"whole_page":case"locate":case"count":return!0;case"probe":return e.step.action!=="expectDownload";case"play":return!e.record&&(e.step.action==="click"||e.step.action==="press"&&e.step.key==="Escape");default:return!1}},"repairMay"),wY=1920*1080,bY=/^qadet-target-\d+$/,Zo=class{constructor(t,n,i,r){this.page=t;this.context=n;this.findings=i;this.recorder=r;t.on("filechooser",()=>{this.filePickerOpened=!0})}page;context;findings;recorder;static{a(this,"PageHost")}steps=[];positions=[];recorded=0;toldFindings=0;cancelled=!1;filePickerOpened=!1;handles=new Map;real(t){return this.handles.size?JSON.parse(JSON.stringify(t),(n,i)=>i&&typeof i=="object"&&bY.test(i.selector??"")?{...i,...this.handles.get(i.selector)}:i):t}shown(t){let n=new Map([...this.handles].map(([i,r])=>[r.selector,i]));return this.secrets.redactAll(n.size?JSON.parse(JSON.stringify(t),(i,r)=>{let o=r&&typeof r=="object"&&n.get(r.selector);return o?{...r,selector:o,code:this.secrets.redact(r.code)}:r}):t)}selector(t){return this.secrets.expand(this.handles.get(t)?.selector??t)}get secrets(){return this.context.secrets}handle(t){if(!this.recorder&&!yY(t))return Promise.reject(new Error("A repair may only look at the page, click or press Escape"));switch(t.type){case"view":return this.view(!0);case"whole_page":return t.find?qC(this.page,`internal:text=${JSON.stringify(t.find)}i`).then(()=>this.view(!1)):this.view(!1);case"locate":return this.locate(t.ref);case"look":return this.look(t.ref);case"count":return this.count(t.selector,t.element);case"play":return this.play(this.real(t.step),t.record);case"probe":return this.probe(this.real(t.step));case"record":return this.recordStep(this.real(t.step),t.status,t.error);case"read":return this.read(t);case"drop":return this.drop(t.from,t.reason);default:return}}async view(t){let n=await $c(this.page),i=this.findings.slice(this.toldFindings).map(({kind:r,message:o})=>({kind:r,message:o}));return t&&(this.toldFindings=this.findings.length),this.secrets.redactAll({...n,problems:t?i:[]})}async locate(t){let{target:n,locator:i}=await Vf(this.page,t),r=await i.evaluate(A=>({tag:A.tagName.toLowerCase(),fileInput:A.matches('input[type="file"]'),role:A.getAttribute("role")??void 0,name:A.getAttribute("aria-label")??void 0})),o=this.secrets.tokenizeStep(n),s=this.secrets.redactAll(o);if(JSON.stringify(s)!==JSON.stringify(o)){let A=`qadet-target-${this.handles.size+1}`;return this.handles.set(A,o),this.secrets.redactAll({target:{selector:A,code:s.code},...r})}return this.secrets.redactAll({target:o,...r})}async look(t){let{locator:n}=await Vf(this.page,t),i=await n.boundingBox();if(!i)throw new Error(`${t} isn't visible, so there is nothing to look at`);if(i.width*i.height>wY)throw new Error(`${t} is too large to look at (${Math.round(i.width)}\xD7${Math.round(i.height)}). Look at the smaller element that draws the target, such as its canvas or image.`);return{image:(await n.screenshot({scale:"css",type:"png",animations:"disabled"})).toString("base64"),width:Math.round(i.width),height:Math.round(i.height)}}async count(t,n){let i=this.page.locator(this.selector(t)),r=await i.count();if(!n)return{count:r};let o=await this.page.locator(this.selector(n)).elementHandle({timeout:2e3}).catch(()=>null),s=o?await i.evaluateAll((A,c)=>A.indexOf(c),o):-1;return{count:r,index:s}}async play(t,n=!1){try{if(kr(t)||Sc(this.page),Mc(this.page,this.recorded+1),this.filePickerOpened=!1,await this.notePlace(t),await qr(this.page,t,this.context),BY.has(t.action)&&(await Vv(this.page),await xx(this.page)),t.action==="click"&&this.filePickerOpened)return{filePicker:!0,error:"The click opened the system file picker"};await nd(this.page);let i=this.secrets.tokenizeStep(t);if(!n)return{saved:this.shown(i)};let r=await this.save(i,"passed");return{saved:this.shown(i),position:r,view:await this.view(!0)}}catch(i){return i instanceof Ve?{cancelled:!0}:{error:this.secrets.redact(ze(i))}}}async probe(t){let n=this.secrets.tokenizeStep(t),i=this.secrets.missing([t]);if(i.length)return{saved:this.shown(n),passed:!1,detail:`{{${i.join("}}, {{")}}} has no value: nothing remembered it. Read the value off the page with remember_value first, or check the text itself.`};let r="within"in t&&t.within?{...t.within,containing:this.secrets.expand(t.within.containing)}:void 0;if(r&&!await Nx(this.page,r))return{saved:this.shown(n),passed:!1,scopeMissing:!0};if(t.action==="expectPath")return{saved:this.shown(n),passed:un(t.path,id(this.page))};try{return await this.notePlace(t),await qr(this.page,t,this.context),{saved:this.shown(n),passed:!0}}catch(o){if(o instanceof Ve)throw o;let s=r&&t.action==="expectText"?await rd(this.page,this.secrets.expand(t.text),void 0,t.exact,1e3):void 0;return{saved:this.shown(n),passed:!1,detail:this.secrets.redact(ze(o)),elsewhere:s}}}async recordStep(t,n,i){try{let r=this.secrets.tokenizeStep(t),o=await this.save(r,n,i);return{saved:this.shown(r),position:o,view:await this.view(!0)}}catch(r){if(r instanceof Ve)return{cancelled:!0};throw r}}place={};async notePlace(t){this.recorder&&(this.place={startedMs:Date.now()-this.recorder.startedAt,box:await ed(this.page,t,n=>this.secrets.expand(n))})}async save(t,n,i){let{recorder:r}=this;if(!r)throw new Error("This run saves no steps");let o=++this.recorded;this.steps.push(t),this.positions.push(o);let s=await aa(this.page,r.runDir,o,t.action,!0);return await this.reported(r.reporter.step({position:o,elapsedMs:Date.now()-r.startedAt,step:t,status:n,error:i&&this.secrets.redact(i),screenshot:s,url:this.page.url(),...this.place})),this.place={},o}async read(t){if(t.kind==="download"){if(!t.selector)throw new Error("Name what gives the file");let{name:r,text:o}=await sd(this.page,this.selector(t.selector),this.context.readDocument);return this.secrets.redactAll({name:r,text:o})}let{inbox:n}=this.context;if(!n)throw new Error("This project has no test inbox, so emails can not be read");if(!t.to)throw new Error("Name the address the email was sent to");let i=await n.latest(this.secrets.expand(t.to),t.subject&&this.secrets.expand(t.subject));return this.secrets.redactAll({subject:i.subject,text:i.text,links:i.links.map(({text:r,url:o})=>({text:r,url:o}))})}async resume(t,n){for(let[i,r]of t.entries()){let o=await this.play("target"in r?{...r,target:cd(r.target)}:r,!0);if(o.cancelled)return this.cancelled=!0,{intents:[],error:"The run was cancelled"};if(o.error||o.filePicker){let s=`step ${i+1} (${this.secrets.redact(r.intent)}) no longer replays: ${o.error??"it opened the file picker"}`;return this.positions.length&&await this.drop(this.positions[0]??1,`The saved progress ${s}`),await this.page.goto(n),{intents:[],error:s}}}return{intents:t.map(i=>this.secrets.redact(i.intent))}}async drop(t,n){let i=this.positions.findIndex(r=>r>=t);return!this.recorder||i===-1||t<1?!1:(this.steps.splice(i),this.positions.splice(i),await this.reported(this.recorder.reporter.dropSteps(t,n)),!0)}async reported(t){try{await t}catch(n){throw n instanceof Ve&&(this.cancelled=!0),n}}}});var AN,vY,cN,ft,KC,kY,aN,DY,uN,VAe,YAe,HAe,jAe,qAe,WAe,ZAe,SY,xY,lN,dN,gN,fN,KAe,ud=y(()=>{"use strict";jo();jr();AN=3,vY=["explore","repair","checkUpdate"],cN=f.object({url:f.string(),token:f.string()}),ft=f.string().min(1).max(64),KC=f.object({selector:f.string(),code:f.string()}),kY=f.object({cost:f.number().optional(),total_tokens:f.number().optional()}),aN=f.object({passed:f.boolean(),reason:f.string(),verdict:f.enum(["passed","failed","blocked","inconclusive"]).optional()}),DY=f.object({intent:f.string(),passed:f.boolean(),position:f.number().int()}),uN=f.object({url:f.string(),tree:f.string(),dialog:f.boolean(),validation:f.array(f.object({label:f.string(),message:f.string()})),gone:f.array(f.string()),spoken:f.array(f.string()),problems:f.array(f.object({kind:f.string(),message:f.string()}))}),VAe=f.object({target:KC,tag:f.string(),fileInput:f.boolean(),role:f.string().optional(),name:f.string().optional()}),YAe=f.object({saved:ar.optional(),view:uN.optional(),position:f.number().int().optional(),error:f.string().optional(),filePicker:f.boolean().optional(),cancelled:f.boolean().optional()}),HAe=f.object({saved:ar,passed:f.boolean(),detail:f.string().optional(),scopeMissing:f.boolean().optional(),elsewhere:f.boolean().optional()}),jAe=f.object({position:f.number().int().optional(),view:uN.optional(),saved:ar.optional(),cancelled:f.boolean().optional()}),qAe=f.object({subject:f.string(),text:f.string(),links:f.array(f.object({text:f.string(),url:f.string()}))}),WAe=f.object({name:f.string(),text:f.string()}),ZAe=f.object({image:f.string(),width:f.number(),height:f.number()}),SY=f.object({kind:f.enum(["step","check"]),step:ar,error:f.string(),feedback:f.string().optional()}),xY=KC.extend({intent:f.string()}),lN=f.object({total_tokens:f.number(),cost:f.number().optional()}),dN=f.object({target:KC.nullable(),opening:xY.optional(),reason:f.string(),automatic:f.boolean(),usage:lN}),gN=f.object({update:ar.nullable(),was:f.string(),now:f.string(),reason:f.string(),automatic:f.boolean(),usage:lN}),fN=f.discriminatedUnion("type",[f.object({type:f.literal("view"),id:ft}),f.object({type:f.literal("whole_page"),id:ft,find:f.string().optional()}),f.object({type:f.literal("locate"),id:ft,ref:f.string()}),f.object({type:f.literal("look"),id:ft,ref:f.string()}),f.object({type:f.literal("count"),id:ft,selector:f.string(),element:f.string().optional()}),f.object({type:f.literal("play"),id:ft,step:ar,record:f.boolean().optional()}),f.object({type:f.literal("probe"),id:ft,step:ar}),f.object({type:f.literal("record"),id:ft,step:ar,status:f.enum(["passed","failed"]),error:f.string().optional()}),f.object({type:f.literal("read"),id:ft,kind:f.enum(["email","download"]),to:f.string().optional(),subject:f.string().optional(),selector:f.string().optional()}),f.object({type:f.literal("drop"),id:ft,from:f.number().int(),reason:f.string()}),f.object({type:f.literal("reply"),id:ft,value:f.unknown()}),f.object({type:f.literal("error"),id:ft,message:f.string()}),f.object({type:f.literal("finish"),verdict:aN.optional(),checks:f.array(DY),suggestedPrompt:f.string().optional(),ownSignIn:f.boolean().optional(),leftBehind:f.array(f.string()),usage:kY,error:f.string().optional(),aiError:f.string().optional(),limited:f.boolean(),knowledgeUsed:f.array(f.string())}),f.object({type:f.literal("failed"),message:f.string()}),f.object({type:f.literal("decided"),verdict:aN})]),KAe=f.discriminatedUnion("type",[f.object({type:f.literal("start"),protocol:f.number().int(),runId:f.number().int().positive(),token:f.string().min(1).max(2048),job:f.enum(vY),resumed:f.array(f.string().max(500)).max(200).optional(),early:f.boolean().optional(),sees:f.boolean().optional()}),f.object({type:f.literal("reply"),id:ft,value:f.unknown()}),f.object({type:f.literal("error"),id:ft,message:f.string().max(2e3)}),f.object({type:f.literal("ask"),id:ft,question:SY})])});var ld,hN=y(()=>{"use strict";qn();Br();ld=class{constructor(t,n,i){this.socket=t;this.schema=n;this.handle=i}socket;schema;handle;static{a(this,"Channel")}pending=new Map;next=0;closed;request(t,n=6e4){if(this.closed)return Promise.reject(this.closed);let i=String(++this.next);return new Promise((r,o)=>{let s=setTimeout(()=>{this.pending.delete(i),o(new Error(`No answer within ${n/1e3} s`))},n);this.pending.set(i,{resolve:r,reject:o,timer:s}),this.send({...t,id:i})})}send(t){this.closed||this.socket.send(JSON.stringify(t))}async receive(t){let n=(()=>{try{return this.schema.safeParse(JSON.parse(t))}catch{return}})();if(!n?.success){this.close(new Error("The other side sent a message this one does not understand")),this.socket.close(4008,"Unreadable message");return}let i=n.data;if(i.type==="reply"||i.type==="error"){let r=i.id===void 0?void 0:this.pending.get(i.id);if(!r)return;this.pending.delete(i.id),clearTimeout(r.timer),i.type==="reply"?r.resolve(i.value):r.reject(new Error(i.message));return}try{let r=await this.handle(i);i.id!==void 0&&this.send({type:"reply",id:i.id,value:r})}catch(r){i.id!==void 0&&this.send({type:"error",id:i.id,message:ot(ze(r))})}}close(t){if(!this.closed){this.closed=t;for(let{reject:n,timer:i}of this.pending.values())clearTimeout(i),n(t);this.pending.clear()}}}});var NY,RY,XC,pN,mN,$Y,IN,EN,eB=y(()=>{"use strict";hN();Br();ud();NY=a(e=>`Qadet's agent service isn't reachable at ${e}`,"unreachable"),RY=a((e,t,n,i,r,o)=>{let s=new URL("run",e.url.endsWith("/")?e.url:`${e.url}/`),A=new WebSocket(s),c={send:a(g=>A.send(g),"send"),close:a((g,h)=>{try{let p=g===void 0||g===1e3||g>=3e3&&g<=4999?g:4e3;A.close(p,h)}catch{try{A.close()}catch{}}},"close")},u=new ld(c,fN,g=>g.type==="finish"||g.type==="failed"||g.type==="decided"?r(g):i.handle(g)),l=new Promise((g,h)=>{A.addEventListener("open",()=>{u.send({type:"start",protocol:AN,runId:t,token:e.token,job:n,...o?.length?{resumed:o}:{},...n==="explore"?{early:!0,sees:!0}:{}}),g()}),A.addEventListener("error",()=>h(new Error(NY(e.url))))});A.addEventListener("message",g=>{u.receive(String(g.data))});let d=new Promise(g=>A.addEventListener("close",()=>{u.close(new Error("Qadet's agent service closed the connection")),g()}));return{channel:u,opened:l,closed:d,close:a(()=>A.close(1e3,"Done"),"close")}},"connect"),XC=a(e=>({usage:{cost:0,total_tokens:0},error:e,limited:!1,knowledgeUsed:[],checks:[],leftBehind:[]}),"failed"),pN=a(async(e,t,n,i=mN,r,o)=>{let s,A;try{({closed:A}=await IN(e,t,"explore",n,c=>{if(c.type==="failed")s=XC(c.message);else if(c.type==="decided")o?.(c.verdict);else if(c.type==="finish"){let{type:u,...l}=c;s=l}},i,r))}catch(c){return XC(ze(c))}return await A,s??XC("Qadet's agent service stopped before the test had a verdict")},"exploreWithAgent"),mN=9e4,$Y=3e3,IN=a(async(e,t,n,i,r,o=mN,s)=>{let A=Date.now()+o;for(;;){let c=RY(e,t,n,i,r,s);try{return await c.opened,c}catch(u){if(Date.now()>=A)throw u;await new Promise(l=>setTimeout(l,$Y))}}},"connectWhenUp"),EN=a(async(e,t,n,i)=>{let r,{channel:o,close:s}=await IN(e,t,n,i,A=>{A.type==="failed"&&(r=A.message)});return{ask:a(async A=>{if(r)throw new Error(r);return o.request({type:"ask",question:A},24e4).catch(c=>{throw new Error(r??c.message)})},"ask"),close:s}},"adviserFor")});var dd,tB=y(()=>{"use strict";Br();dd=a(e=>{let t=Promise.resolve(),n,i=a(async()=>{if(await t,n instanceof Ve)throw n},"settled"),r=a(o=>async(...s)=>(await i(),o(...s)),"after");return{...e,step:a(async o=>{if(n!==void 0)throw n;t=t.then(()=>e.step(o).catch(s=>{n??=s}))},"step"),video:r(e.video),finish:r(e.finish),dropSteps:r(e.dropSteps),...e.decided&&{decided:r(e.decided)}}},"reportingInBackground")});var FY,UY,QN,CN=y(()=>{"use strict";FY=/\[data-(testid|test|qa|cy)="([a-z][\w-]*?[-_])(?:[0-7][0-9A-HJKMNP-TV-Z]{25}|[0-9a-f]{8}-[0-9a-f-]{27}|[0-9a-f]{24}|\d{5,})"\]/i,UY=new Set("open opens the a an to from in on of for and with click select choose view go page details detail product products item items card link button its this that first".split(" ")),QN=a(async(e,t,n)=>{let i=t.selector.match(FY);if(!i)return;let[,r,o]=i,s=n.replace(/["“”']/g," ").split(/\s+/).map(c=>c.replace(/[^\p{L}\p{N}-]/gu,"")).filter(c=>c.length>2&&!UY.has(c.toLowerCase())),A=`[data-${r}^="${o}"]`;if(s.length===0)return await e.locator(A).filter({visible:!0}).first().count().catch(()=>0)===0?void 0:{selector:`${A} >> visible=true >> nth=0`,code:`locator('${A}').first()`};for(let c=Math.min(s.length,4);c>=1;c--)for(let u=0;u+c<=s.length;u++){let l=s.slice(u,u+c).join(" ");if(await e.locator(A).filter({hasText:l,visible:!0}).count().catch(()=>0)===1)return{selector:`${A} >> visible=true >> internal:has-text=${JSON.stringify(l)}i`,code:`locator('${A}').filter({ hasText: ${JSON.stringify(l)} })`}}},"recordIdFallback")});var _Y,BN,TY,wN,yN,bN,vN,rB,Ko,kN,DN=y(()=>{"use strict";_Y=new Set(["navigate","fill","fillSecret","click","press"]),BN=/\b(log\s*-?\s*in|sign\s*-?\s*in|submit|continue|next|enter)\b/i,TY=a(e=>e.action==="press"||e.action==="click"&&(BN.test(e.intent)||BN.test(e.target.code)),"submits"),wN=a(e=>{let t=e.findIndex(u=>u.action==="fillSecret");if(t===-1||e.slice(0,t+1).some(u=>!_Y.has(u.action)||u.cleanup))return 0;let i=e.slice(t+1),r=i.findIndex(u=>u.action!=="click"&&u.action!=="press"),o=r===-1?i:i.slice(0,r),s=o.findIndex(TY),A=s===-1?o.length?0:-1:s;if(A===-1)return 0;let c=t+1+A+1;return e.slice(c).some(u=>!u.action.startsWith("expect"))?c:0},"signInLength"),yN=/\b(sign|log)\s*-?\s*out\b/i,bN=a(e=>e.some(t=>t.action==="click"&&(yN.test(t.intent)||yN.test(t.target.code))),"signsOut"),vN=a((e,t)=>{let n=t.findLast(r=>r.action==="navigate"),i=t.flatMap(r=>r.action==="fill"?[r.value]:r.action==="fillSecret"?[`secret:${r.secret}`]:[]);return JSON.stringify([new URL(n?.url??e).origin,...i])},"sessionKey"),rB=class{constructor(t=()=>Date.now()){this.now=t}now;static{a(this,"Sessions")}saved=new Map;ending=new Map;get(t){if(this.ending.has(t))return;let n=this.saved.get(t);return n&&this.now()-n.savedAt>18e5&&this.saved.delete(t),this.saved.get(t)}save(t,n,i){this.ending.has(t)||this.saved.set(t,{state:n,url:i,savedAt:this.now()})}drop(t){this.saved.delete(t)}end(t){this.saved.delete(t),this.ending.set(t,(this.ending.get(t)??0)+1)}ended(t){let n=(this.ending.get(t)??1)-1;n>0?this.ending.set(t,n):this.ending.delete(t)}},Ko=new rB,kN=a(async(e,t,n)=>(await e.goto(n),await e.waitForLoadState("load").catch(()=>{}),new URL(e.url()).pathname===new URL(n).pathname&&!await e.locator('input[type="password"]:visible').count()?!0:(await t.clearCookies(),await e.evaluate(()=>{localStorage.clear(),sessionStorage.clear()}),!1)),"resume")});var Wr,SN,LY,pA=y(()=>{"use strict";Zi();Yn();Lc();io();JC();qn();jr();Kl();Br();ZC();ud();eB();tB();CN();WC();DN();Wr=a(async(e,t,n,i)=>{let r=dd(n),{browser:o}=i.settings,{agent:s}=i,A=new oo(i.secrets,i.remembered),c=await Uc(),u=A.missing(e.steps);if(u.length){let M=`Needs ${u.join(", ")}, which an earlier test remembers. Run the suite that orders them.`;return await r.finish({passed:!1,reason:M,verdict:"blocked",findings:[],durationMs:0,steps:[]}),{name:e.name,passed:!1,failure:{step:0,reason:M},findings:[],steps:[],repairedSteps:[],spend:{repairs:0,tokens:0,cost:0},durationMs:0,runDir:c,reportUrl:r.url}}let l=Date.now(),d=i.settings.inbox?new qo(i.settings.inbox,new Date(l),i.protectedAccounts):null,g=e.ownSignIn?0:wN(e.steps),h=g?vN(e.startUrl,e.steps.slice(0,g)):void 0,p=h&&bN(e.steps)?h:void 0,m=h&&!p?Ko.get(h):void 0;p&&Ko.end(p);let{browser:E,context:I,page:Q,video:k,recordingDirectory:D,recordingError:x,videoSize:U}=await Xi(o,void 0,m?.state),P=Date.now(),L=Pc(Q),K={secrets:A,inbox:d,readDocument:r.readDocument,fetchFixture:r.fetchFixture},we=e.steps.map(M=>"target"in M?{...M,target:cd(M.target)}:M),Be={repairs:0,tokens:0,cost:0},ue=[],ke,tr=!1,nt,Qr,ea,Yi=0,Hi=new Map,Gn=a((M,je,$e)=>{let Fe=A.tokenizeStep({...M,target:je});if(!$e)return[Fe];let{intent:it,...Ce}=$e;return[A.tokenizeStep({action:"click",intent:it,target:Ce}),Fe]},"replacementFor"),Le=a(async(M,je,$e)=>{let Fe=A.tokenizeStep({...M,target:je});if(!$e)return await qr(Q,Fe,K),[Fe];let{intent:it,...Ce}=$e,re=A.tokenizeStep({action:"click",intent:it,target:Ce});return await Q.locator(je.selector).isVisible()||await qr(Q,re,K),await qr(Q,Fe,K),[re,Fe]},"runRepaired"),zr=a(()=>{let M=i.budget?.maxCost;return M!==void 0&&Be.cost>=M},"budgetSpent"),ji=a(M=>{Be.repairs++,Be.tokens+=M.total_tokens,Be.cost+=M.cost??0},"count"),Vn=new Zo(Q,K,L),vc=a(async(M,je,$e,Fe)=>{if(!s)throw $e;if(zr())throw new Error(`${ze($e)}. ${M==="check"?"Not updated":"No repair"}: this run's AI budget is spent`);let it=await EN(s,r.runId,M==="check"?"checkUpdate":"repair",Vn);try{return await it.ask(A.redactAll({kind:M,step:A.expandStep(je),error:ze($e),feedback:Fe}))}catch(Ce){throw new Error(`${ze($e)}. ${M==="check"?"Not updated":"No repair"}: the AI couldn't answer (${ok(Ce)})`)}finally{it.close()}},"ask"),ta=a(async(M,je,$e)=>{let Fe;for(let it=0;it<=3;it++){let Ce=gN.parse(await vc("check",M,$e,Fe));ji(Ce.usage);let re=Ce.update&&A.tokenizeStep(Vn.real(Ce.update));if(!re)throw new Error(`${ze($e)}. The check stands: Qadet found no sign the app changed on purpose`);if("target"in re&&!SN(re.target.selector)){Fe="That target uses an id the app makes for a record or a render, which changes between runs. Find the element by its label, role and name, or text instead.";continue}let De="target"in re?re.target.selector:`text=${JSON.stringify("text"in re&&re.text?A.expand(re.text):"")}`,Nt=await t({number:je,intent:M.intent,was:{selector:"target"in M?M.target.selector:"",code:Ce.was},proposed:{selector:"target"in re?re.target.selector:"",code:Ce.now},reason:Ce.reason,screenshot:await Tc(Q,De),automatic:Ce.automatic||LY(M,re),check:!0,replacement:[re]});if(Nt===!0)return re;if(Nt===!1||it===3)throw $e;Fe=Nt.revisionFeedback}throw $e},"updateCheck"),ce=a(async(M,je)=>{let $e="target"in M&&!kr(M)&&Hi.get(M.target.selector);if($e)return Le(M,$e.target,$e.opening);try{return await oN(Q,M,K),[M]}catch(Fe){if("target"in M&&!kr(M)){let re=await QN(Q,M.target,A.expand(M.intent));if(re&&await t({number:je,intent:M.intent,was:M.target,proposed:re,reason:"Found the record the step names by its name, as its saved id no longer exists",screenshot:await Tc(Q,re.selector),automatic:!0,check:!1,replacement:Gn(M,re)})===!0)return Hi.set(M.target.selector,{target:re}),Le(M,re)}if(!s)throw Fe;if(kr(M))return[await ta(M,je,Fe)];if(!("target"in M))throw Fe;let it,Ce;for(let re=0;re<=3;re++){let De=dN.parse(await vc("step",M,Fe,it));ji(De.usage);let Nt=De.target&&A.tokenizeStep(Vn.real(De.target));if(!Nt)throw new Error(`${ze(Fe)}. No repair: ${De.reason}`);Ce=(De.opening&&A.tokenizeStep(Vn.real(De.opening)))??Ce;let Wi=await t({number:je,intent:M.intent,was:M.target,proposed:Nt,opening:Ce,reason:De.reason,screenshot:await Tc(Q,A.expand(Nt.selector)),automatic:De.automatic||!!M.cleanup,check:!1,replacement:Gn(M,Nt,Ce)});if(Wi===!0)return Hi.set(M.target.selector,{target:Nt,opening:Ce}),Le(M,Nt,Ce);if(Wi===!1||re===3)throw Fe;it=Wi.revisionFeedback}throw Fe}},"runWithRepair");try{let M=m&&h?await kN(Q,I,m.url):!1;m&&h&&!M&&Ko.drop(h),M||await Q.goto(e.startUrl);let je=0,$e="",Fe=!!i.cleanup,it=!1;for(let Ce=0;Ce<we.length;Ce++){let re=we[Ce],De=Ce+1;if(M&&je<g){je++,await r.step({position:De,elapsedMs:Date.now()-P,step:re,status:"skipped",url:Q.url()});continue}if(ke&&!re.cleanup)continue;if(re.cleanup&&!Fe){await r.step({position:De,elapsedMs:Date.now()-P,step:re,status:"skipped",url:Q.url()});continue}h&&je===g-1&&($e=Q.url()),kr(re)||Sc(Q),Mc(Q,De);let Nt=Date.now()-P,Wi=await ed(Q,re,Cr=>A.expand(Cr));try{let Cr=await ce(re,De);we.splice(Ce,1,...Cr);for(let[rr,ra]of Cr.entries()){let mv=ra!==re;mv&&ue.push(De+rr);let mz=await aa(Q,c,De+rr,ra.action);await r.step({position:De+rr,elapsedMs:Date.now()-P,step:ra,status:"passed",repaired:mv,screenshot:mz,url:Q.url(),...rr===0?{startedMs:Nt,box:Wi}:{}})}Ce+=Cr.length-1,je++,re.cleanup&&(it=!0),h&&!M&&je===g&&(await Q.waitForURL(rr=>rr.href!==$e,{timeout:1e4}).catch(()=>{}),Q.url()!==$e&&Ko.save(h,await I.storageState(),Q.url()))}catch(Cr){if(Cr instanceof Ve)throw Cr;let rr=ze(Cr),ra=await aa(Q,c,De,`${re.action}-failed`);if(await r.step({position:De,elapsedMs:Date.now()-P,step:re,status:"failed",error:rr,startedMs:Nt,box:Wi,screenshot:ra,url:Q.url()}),re.cleanup){L.push({kind:"cleanup",message:ke&&!it?`Cleanup didn't start: the test failed at step ${ke.step}, possibly before it made anything to remove. Cleanup step ${De}: ${rr}`:`Test data may be left behind: cleanup step ${De} failed (${rr})`,page:Q.url()});break}ke={step:De,reason:rr},tr=no(Cr)}}}catch(M){nt=M}finally{p&&Ko.ended(p);let M=await eo({browser:E,context:I,video:k});Qr=M.videoPath,ea=M.closeError,Yi=Date.now()-P}let qi=o.videoRecording,pv=!nt&&!ke;try{await r.video({path:Qr,directory:D,mode:qi.mode,passed:pv,durationMs:Yi,width:U.width,height:U.height,retentionDays:qi.retentionDays,error:x??(ea?"Browser context did not close cleanly.":void 0)})}catch(M){process.stderr.write(`Could not report the video recording: ${M instanceof Error?M.message:String(M)}
294
294
  `)}if(nt)throw nt;let kc={name:e.name,passed:pv,failure:ke,findings:L,steps:we,repairedSteps:ue,spend:Be,durationMs:Date.now()-l,runDir:c,reportUrl:r.url};return await _c(c,kc),await r.finish({passed:kc.passed,reason:ke?`Failed at step ${ke.step}: ${ke.reason}`:"Every step passed",failureKind:tr?"environment":void 0,findings:L,durationMs:kc.durationMs,steps:we,remembered:A.rememberedValues}),kc},"replay"),SN=a(e=>!Fc.test(e)&&[...e.matchAll(/data-(?:testid|test|qa|cy)=\\?"?([^"\]\\]+)/g)].every(t=>oa(t[1]??"")),"lastingTarget"),LY=a((e,t)=>{if(e.action!==t.action||!("target"in e)||!("target"in t))return!1;let{target:n,intent:i,...r}=e,{target:o,intent:s,...A}=t;return JSON.stringify(r)===JSON.stringify(A)&&SN(o.selector)&&JSON.stringify(n)!==JSON.stringify(o)},"sameCheckElsewhere")});var nB,iB,gd,fd,oB=y(()=>{"use strict";pA();nB=a(e=>({step:a(async()=>{},"step"),video:a(async()=>{},"video"),dropSteps:a(async()=>{},"dropSteps"),readDocument:a((t,n)=>e.readDocument(t,n),"readDocument"),fetchFixture:a(t=>e.fetchFixture(t),"fetchFixture"),finish:a(async()=>{},"finish"),runId:e.runId}),"quietReporter"),iB=a(e=>({...e,settings:{...e.settings,browser:{...e.settings.browser,videoRecording:{...e.settings.browser.videoRecording,enabled:!1,mode:"disabled"}}}}),"withoutVideo"),gd=a(async({test:e,rows:t,firstRow:n,context:i,reporter:r,budget:o})=>{let s=e.steps,A=0,c=[];for(let[u,l]of t.entries()){let d=o?o.maxCost-A:void 0,g=await Wr({...e,steps:s,rows:void 0,checkpoint:void 0},async h=>!h.check,nB(r),iB({...i,remembered:{...i.remembered,...l},budget:d===void 0?i.budget:d>0?{maxCost:d}:null,agent:d!==void 0&&d<=0?null:i.agent}));A+=g.spend.cost,g.passed&&g.repairedSteps.length&&(s=g.steps),c.push({row:n+u,passed:g.passed,reason:g.failure?`Step ${g.failure.step}: ${g.failure.reason}`:"",aiCalls:g.spend.repairs})}return{results:c,steps:s,cost:A}},"replayRows"),fd=a(e=>{let t=e.filter(i=>!i.passed),n=t[0];return{passed:t.length===0,reason:n?`${t.length} of ${e.length} rows failed; row ${n.row} at ${n.reason}`:`All ${e.length} rows passed`}},"summarizeRows")});var xN,hd,sB=y(()=>{"use strict";Yn();Lc();io();qn();Kl();Br();pA();eB();tB();ZC();oB();xN=a(async(e,t)=>{try{await e.video(t)}catch(n){process.stderr.write(`Could not report the video recording: ${n instanceof Error?n.message:String(n)}
295
- `)}},"reportVideo"),hd=a(async({url:e,prompt:t,context:n,reporter:i,checkpoint:r=[],rows:o=[]})=>{let s=dd(i),{settings:A}=n,c=o[0]??{},u=new oo(n.secrets,{...n.remembered,...c}),l=await Uc(),d=Date.now(),{browser:g,context:h,page:p,video:m,recordingDirectory:E,recordingError:I,videoSize:Q}=await Xi(A.browser),k=Date.now(),D=0,x=A.inbox?new qo(A.inbox,new Date(d),n.protectedAccounts):null,U=Pc(p),P=new Zo(p,{secrets:u,inbox:x,readDocument:s.readDocument,fetchFixture:s.fetchFixture},U,{runDir:l,reporter:s,startedAt:d}),L,K=!1,we=!1,Be,ue,ke,tr,nt,Qr=!1,ea=a(ce=>{Qr||P.cancelled||!s.decided||(Qr=!0,s.decided({verdict:ce.verdict??(ce.passed?"passed":"failed"),reason:ce.reason}).catch(()=>{}))},"showDecision");try{if(await p.goto(e),!n.agent)throw new Error("Exploring needs an AI model. An admin can choose one in Settings.");let ce=r.length?await P.resume(r,e):{intents:[]};if(nt=ce.error,P.cancelled)throw new Ve;ue=await pN(n.agent,s.runId,P,void 0,ce.intents,ea),{error:L,limited:K,verdict:Be}=ue,Be&&!L&&ea(Be)}catch(ce){ce instanceof Ve||(L=ze(ce),we=no(ce))}for(let ce of ue?.leftBehind??[])U.push({kind:"cleanup",message:ce,page:p.url()});let Yi=ue?.usage??{cost:0,total_tokens:0},Hi=await eo({browser:g,context:h,video:m});ke=Hi.videoPath,tr=Hi.closeError,D=Date.now()-k;let Gn=A.browser.videoRecording;if(P.cancelled)throw await xN(s,{path:ke,directory:E,mode:Gn.mode,passed:!1,durationMs:D,width:Q.width,height:Q.height,retentionDays:Gn.retentionDays,error:I??(tr?"Browser context did not close cleanly.":void 0)}),new Ve;let Le=L||!Be?{passed:!1,reason:L??"The agent stopped before reaching a verdict",verdict:we?"blocked":K||!L?"inconclusive":void 0,failureKind:we?"environment":void 0}:Be,zr=P.steps,ji,Vn=a(ce=>Wr({name:"verification",prompt:t,startUrl:e,steps:zr},async()=>ce,nB(s),iB({...n,budget:n.budget&&{maxCost:n.budget.maxCost-(Yi.cost??0)},agent:ce?n.agent:null})),"repeatSteps"),vc=Object.keys(n.remembered??{}).some(ce=>JSON.stringify(zr).includes(`{{${ce}}}`));if(Le.passed&&vc)Le={...Le,reason:`${Le.reason??"Exploration passed all checks."} (Steps saved without repeating them now: they use values earlier tests in this ordered test run remembered, so they repeat when the whole run does.)`};else if(Le.passed&&o.length>1){let ce=await gd({test:{name:"row",prompt:t,startUrl:e,steps:zr},rows:o.slice(1),firstRow:2,context:n,reporter:s,budget:n.budget&&{maxCost:n.budget.maxCost-(Yi.cost??0)}});zr=ce.steps,ji=[{row:1,passed:!0,reason:"",aiCalls:0},...ce.results];let qi=fd(ji);Le=qi.passed?{...Le,reason:`${Le.reason} ${qi.reason}.`}:{passed:!1,reason:qi.reason,verdict:"failed"}}else if(Le.passed){let ce=await Vn(!0);ce.passed&&ce.repairedSteps.length&&(zr=ce.steps,ce=await Vn(!1)),ce.passed||(Le={passed:!0,reason:`${Le.reason??"Exploration passed all checks."} (Note: saved steps need review before automated headless replay: step ${ce.failure?.step}: ${ce.failure?.reason})`,verdict:"passed"},zr=[])}nt&&(Le={...Le,reason:`${Le.reason} (Saved progress discarded: ${nt})`}),await xN(s,{path:ke,directory:E,mode:Gn.mode,passed:Le.passed,durationMs:D,width:Q.width,height:Q.height,retentionDays:Gn.retentionDays,error:I??(tr?"Browser context did not close cleanly.":void 0)});let ta={url:e,prompt:t,...Le,steps:zr,checks:ue?.checks??[],findings:U,knowledgeUsed:ue?.knowledgeUsed??[],suggestedPrompt:ue?.suggestedPrompt,ownSignIn:ue?.ownSignIn,remembered:Object.fromEntries(Object.entries(u.rememberedValues).filter(([ce])=>!(ce in c))),limited:K&&!Le.passed,rowResults:ji,aiError:ue?.aiError,usage:Yi,durationMs:Date.now()-d,runDir:l,reportUrl:s.url};return await _c(l,ta),await s.finish(ta),ta},"explore")});var ht,mA=y(()=>{"use strict";ht="0.7.21"});import{randomUUID as uB}from"node:crypto";import{chmod as MY,mkdir as PY,readFile as zY,rm as RN,writeFile as OY}from"node:fs/promises";import{homedir as $N}from"node:os";import{dirname as JY,posix as AB,win32 as GY}from"node:path";var cB,lB,VY,Xo,pd,YY,NN,aB,Zr,HY,es,md,hi=y(()=>{"use strict";jo();cB=f.object({url:f.string().url(),token:f.string().min(1),runnerId:f.string().uuid().optional()}),lB=a(({platform:e=process.platform,home:t=$N(),appData:n=process.env.APPDATA,xdgConfigHome:i=process.env.XDG_CONFIG_HOME}={})=>{let r=e==="win32"?GY:AB;return e==="win32"?r.join(n||r.join(t,"AppData","Roaming"),"Qadet","connection.json"):e==="darwin"?r.join(t,"Library","Application Support","Qadet","connection.json"):r.join(i||r.join(t,".config"),"qadet","connection.json")},"connectionPathFor"),VY=a(({platform:e=process.platform,home:t=$N(),xdgConfigHome:n=process.env.XDG_CONFIG_HOME}={})=>e==="darwin"?AB.join(n||AB.join(t,".config"),"qadet","connection.json"):void 0,"oldConnectionPathFor"),Xo=lB(),pd=VY(),YY=uB(),NN=a(e=>zY(e,"utf8").catch(()=>{}),"readSaved"),aB=a((e=process.env,t)=>{let n=e.QADET_URL?.trim()||t?.url,i=e.QADET_TOKEN?.trim()||t?.token;return!n||!i?t:cB.parse({url:new URL(n).origin,token:i,runnerId:t?.runnerId??YY})},"connectionFromEnv"),Zr=a(async(e=process.env)=>{let t=await NN(Xo);if(t)return aB(e,await HY(cB.parse(JSON.parse(t))));let n=pd&&await NN(pd);if(n&&pd){let i={...cB.parse(JSON.parse(n)),runnerId:uB()};return await es(i),await RN(pd,{force:!0}),aB(e,i)}return aB(e)},"readConnection"),HY=a(async e=>{if(e.runnerId)return e;let t={...e,runnerId:uB()};return await es(t),t},"withRunnerId"),es=a(async e=>(await PY(JY(Xo),{recursive:!0,mode:448}),await OY(Xo,`${JSON.stringify(e,null,2)}
295
+ `)}},"reportVideo"),hd=a(async({url:e,prompt:t,context:n,reporter:i,checkpoint:r=[],rows:o=[]})=>{let s=dd(i),{settings:A}=n,c=o[0]??{},u=new oo(n.secrets,{...n.remembered,...c}),l=await Uc(),d=Date.now(),{browser:g,context:h,page:p,video:m,recordingDirectory:E,recordingError:I,videoSize:Q}=await Xi(A.browser),k=Date.now(),D=0,x=A.inbox?new qo(A.inbox,new Date(d),n.protectedAccounts):null,U=Pc(p),P=new Zo(p,{secrets:u,inbox:x,readDocument:s.readDocument,fetchFixture:s.fetchFixture},U,{runDir:l,reporter:s,startedAt:d}),L,K=!1,we=!1,Be,ue,ke,tr,nt,Qr=!1,ea=a(ce=>{Qr||P.cancelled||!s.decided||(Qr=!0,s.decided({verdict:ce.verdict??(ce.passed?"passed":"failed"),reason:ce.reason}).catch(()=>{}))},"showDecision");try{if(await p.goto(e),!n.agent)throw new Error("Exploring needs an AI model. An admin can choose one in Settings.");let ce=r.length?await P.resume(r,e):{intents:[]};if(nt=ce.error,P.cancelled)throw new Ve;ue=await pN(n.agent,s.runId,P,void 0,ce.intents,ea),{error:L,limited:K,verdict:Be}=ue,Be&&!L&&ea(Be)}catch(ce){ce instanceof Ve||(L=ze(ce),we=no(ce))}for(let ce of ue?.leftBehind??[])U.push({kind:"cleanup",message:ce,page:p.url()});let Yi=ue?.usage??{cost:0,total_tokens:0},Hi=await eo({browser:g,context:h,video:m});ke=Hi.videoPath,tr=Hi.closeError,D=Date.now()-k;let Gn=A.browser.videoRecording;if(P.cancelled)throw await xN(s,{path:ke,directory:E,mode:Gn.mode,passed:!1,durationMs:D,width:Q.width,height:Q.height,retentionDays:Gn.retentionDays,error:I??(tr?"Browser context did not close cleanly.":void 0)}),new Ve;let Le=L||!Be?{passed:!1,reason:L??"The agent stopped before reaching a verdict",verdict:we?"blocked":K||!L?"inconclusive":void 0,failureKind:we?"environment":void 0}:Be,zr=P.steps,ji,Vn=a(ce=>Wr({name:"verification",prompt:t,startUrl:e,steps:zr},async()=>ce,nB(s),iB({...n,budget:n.budget&&{maxCost:n.budget.maxCost-(Yi.cost??0)},agent:ce?n.agent:null})),"repeatSteps"),vc=Object.keys(n.remembered??{}).some(ce=>JSON.stringify(zr).includes(`{{${ce}}}`));if(Le.passed&&vc)Le={...Le,reason:`${Le.reason??"Exploration passed all checks."} (Steps saved without repeating them now: they use values earlier tests in this ordered test run remembered, so they repeat when the whole run does.)`};else if(Le.passed&&o.length>1){let ce=await gd({test:{name:"row",prompt:t,startUrl:e,steps:zr},rows:o.slice(1),firstRow:2,context:n,reporter:s,budget:n.budget&&{maxCost:n.budget.maxCost-(Yi.cost??0)}});zr=ce.steps,ji=[{row:1,passed:!0,reason:"",aiCalls:0},...ce.results];let qi=fd(ji);Le=qi.passed?{...Le,reason:`${Le.reason} ${qi.reason}.`}:{passed:!1,reason:qi.reason,verdict:"failed"}}else if(Le.passed){let ce=await Vn(!0);ce.passed&&ce.repairedSteps.length&&(zr=ce.steps,ce=await Vn(!1)),ce.passed||(Le={passed:!0,reason:`${Le.reason??"Exploration passed all checks."} (Note: saved steps need review before automated headless replay: step ${ce.failure?.step}: ${ce.failure?.reason})`,verdict:"passed"},zr=[])}nt&&(Le={...Le,reason:`${Le.reason} (Saved progress discarded: ${nt})`}),await xN(s,{path:ke,directory:E,mode:Gn.mode,passed:Le.passed,durationMs:D,width:Q.width,height:Q.height,retentionDays:Gn.retentionDays,error:I??(tr?"Browser context did not close cleanly.":void 0)});let ta={url:e,prompt:t,...Le,steps:zr,checks:ue?.checks??[],findings:U,knowledgeUsed:ue?.knowledgeUsed??[],suggestedPrompt:ue?.suggestedPrompt,ownSignIn:ue?.ownSignIn,remembered:Object.fromEntries(Object.entries(u.rememberedValues).filter(([ce])=>!(ce in c))),limited:K&&!Le.passed,rowResults:ji,aiError:ue?.aiError,usage:Yi,durationMs:Date.now()-d,runDir:l,reportUrl:s.url};return await _c(l,ta),await s.finish(ta),ta},"explore")});var ht,mA=y(()=>{"use strict";ht="0.7.22"});import{randomUUID as uB}from"node:crypto";import{chmod as MY,mkdir as PY,readFile as zY,rm as RN,writeFile as OY}from"node:fs/promises";import{homedir as $N}from"node:os";import{dirname as JY,posix as AB,win32 as GY}from"node:path";var cB,lB,VY,Xo,pd,YY,NN,aB,Zr,HY,es,md,hi=y(()=>{"use strict";jo();cB=f.object({url:f.string().url(),token:f.string().min(1),runnerId:f.string().uuid().optional()}),lB=a(({platform:e=process.platform,home:t=$N(),appData:n=process.env.APPDATA,xdgConfigHome:i=process.env.XDG_CONFIG_HOME}={})=>{let r=e==="win32"?GY:AB;return e==="win32"?r.join(n||r.join(t,"AppData","Roaming"),"Qadet","connection.json"):e==="darwin"?r.join(t,"Library","Application Support","Qadet","connection.json"):r.join(i||r.join(t,".config"),"qadet","connection.json")},"connectionPathFor"),VY=a(({platform:e=process.platform,home:t=$N(),xdgConfigHome:n=process.env.XDG_CONFIG_HOME}={})=>e==="darwin"?AB.join(n||AB.join(t,".config"),"qadet","connection.json"):void 0,"oldConnectionPathFor"),Xo=lB(),pd=VY(),YY=uB(),NN=a(e=>zY(e,"utf8").catch(()=>{}),"readSaved"),aB=a((e=process.env,t)=>{let n=e.QADET_URL?.trim()||t?.url,i=e.QADET_TOKEN?.trim()||t?.token;return!n||!i?t:cB.parse({url:new URL(n).origin,token:i,runnerId:t?.runnerId??YY})},"connectionFromEnv"),Zr=a(async(e=process.env)=>{let t=await NN(Xo);if(t)return aB(e,await HY(cB.parse(JSON.parse(t))));let n=pd&&await NN(pd);if(n&&pd){let i={...cB.parse(JSON.parse(n)),runnerId:uB()};return await es(i),await RN(pd,{force:!0}),aB(e,i)}return aB(e)},"readConnection"),HY=a(async e=>{if(e.runnerId)return e;let t={...e,runnerId:uB()};return await es(t),t},"withRunnerId"),es=a(async e=>(await PY(JY(Xo),{recursive:!0,mode:448}),await OY(Xo,`${JSON.stringify(e,null,2)}
296
296
  `,{mode:384}),process.platform!=="win32"&&await MY(Xo,384),Xo),"saveConnection"),md=a(()=>RN(Xo,{force:!0}),"forgetConnection")});import{createPrivateKey as jY,createPublicKey as qY,generateKeyPairSync as WY,sign as ZY}from"node:crypto";import{chmod as KY,mkdir as XY,readFile as eH,writeFile as tH}from"node:fs/promises";import{dirname as FN,join as rH}from"node:path";var nH,UN,_N,TN,LN=y(()=>{"use strict";hi();nH=a((e=FN(lB()))=>rH(e,"device-key.pem"),"deviceKeyPath"),UN=a(async(e=nH())=>{let t=await eH(e,"utf8").catch(()=>{});if(t)return jY(t);let{privateKey:n}=WY("ed25519");return await XY(FN(e),{recursive:!0,mode:448}),await tH(e,n.export({type:"pkcs8",format:"pem"}),{mode:384}),process.platform!=="win32"&&await KY(e,384),n},"loadDeviceKey"),_N=a(e=>qY(e).export({type:"spki",format:"pem"}).toString(),"publicPem"),TN=a((e,t,n=Date.now())=>{let i=String(Math.floor(n/1e3)),r=`qadet-reconnect
297
297
  ${t}
298
298
  ${i}`;return{key:t,signed_at:i,signature:ZY(null,Buffer.from(r),e).toString("base64")}},"signedReconnect")});var Id,dB=y(()=>{"use strict";jo();Kl();ud();Id=f.object({settings:f.object({browser:f.object({channel:f.string(),hostMap:f.array(f.object({host:f.string(),address:f.string()})).default([]),acceptInvalidCertificates:f.boolean().default(!1),allowedHosts:f.array(f.string()).default([]),maskSelectors:f.array(f.string()).default([]),device:f.enum(["desktop","mobile","tablet"]).default("desktop"),slowPages:f.boolean().default(!1),videoRecording:f.object({enabled:f.boolean().default(!1),mode:f.enum(["all","failures_only","disabled"]).default("disabled"),width:f.number().int().min(1).max(7680).default(1280),height:f.number().int().min(1).max(4320).default(720),retentionDays:f.number().int().min(1).max(365).default(30)}).default({enabled:!1,mode:"disabled",width:1280,height:720,retentionDays:30})}),inbox:Cx.nullable().default(null)}),secrets:f.record(f.string(),f.string()),remembered:f.record(f.string(),f.string()).default({}),agent:cN.nullable().default(null),budget:f.object({maxCost:f.number().positive()}).nullable().default(null),protectedAccounts:f.array(f.string()).default([]),cleanup:f.string().nullable().default(null),fixtures:f.array(f.object({id:f.number().int(),name:f.string(),domain:f.string().optional(),description:f.string().optional(),fileName:f.string(),mimeType:f.string(),byteSize:f.number().int().nonnegative()})).default([])})});import{hostname as oH}from"node:os";import{setTimeout as sH}from"node:timers/promises";var MN,PN,aH,hB,gB,ON,JN,Ed,fB,GN,VN,YN,HN,jN,AH,cH,uH,pB,Qd,qN,WN,zN,Cd,lH,dH,mB,IB,IA=y(()=>{"use strict";qn();jr();Br();mA();hi();dB();MN=!1,PN=!1,aH=10080*6e4,hB=a((e,t)=>{let n=a(o=>o.split(/[.-]/).map(s=>Number.parseInt(s,10)||0),"parts"),[i,r]=[n(e),n(t)];for(let o=0;o<Math.max(i.length,r.length);o++){let s=(i[o]??0)-(r[o]??0);if(s)return s>0}return!1},"isNewer"),ON=a(()=>gB,"tokenExpires"),JN=!1,Ed=a(()=>JN,"isPaused"),GN=a(()=>{let e=fB;return fB=void 0,e},"takeAsk"),YN=a(()=>VN,"askedToUpdateTo"),jN=a(()=>HN,"latestRunner"),AH=a(e=>{e&&(HN=e),!(MN||!e||ht==="dev"||!hB(e,ht))&&(MN=!0,process.stdout.write(`A newer Qadet runner is available (${e}); this runner (${ht}) can keep running. Update it only if Qadet says an update is required.