shiplightai 0.1.96 → 0.1.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/dist/cjs/debugger-manager.cjs +8 -8
- package/dist/cjs/debugger-pw.cjs +68 -68
- package/dist/cjs/fixture.cjs +83 -79
- package/dist/cjs/index.cjs +90 -86
- package/dist/cjs/reporter.cjs +23 -23
- package/dist/cli.js +81 -81
- package/dist/debugger-manager.js +10 -10
- package/dist/debugger-pw.d.ts +1 -1
- package/dist/debugger-pw.js +68 -68
- package/dist/fixture.d.ts +52 -10
- package/dist/fixture.js +83 -79
- package/dist/index.js +90 -86
- package/dist/reporter.js +22 -22
- package/dist/spec/actions.md +14 -14
- package/dist/spec/yaml.md +2 -1
- package/dist/static-embedded/assets/{index-CqR_WNuS.js → index-DVb6b-JE.js} +3 -4
- package/dist/static-embedded/assets/{index-Bk-qqDWJ.js → index-eFclB13U.js} +2 -2
- package/dist/static-embedded/index.html +1 -1
- package/package.json +3 -4
package/dist/cjs/reporter.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";var vt=Object.create;var q=Object.defineProperty;var xt=Object.getOwnPropertyDescriptor;var kt=Object.getOwnPropertyNames;var At=Object.getPrototypeOf,Tt=Object.prototype.hasOwnProperty;var Et=(e,t)=>{for(var r in t)q(e,r,{get:t[r],enumerable:!0})},$e=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of kt(t))!Tt.call(e,n)&&n!==r&&q(e,n,{get:()=>t[n],enumerable:!(i=xt(t,n))||i.enumerable});return e};var D=(e,t,r)=>(r=e!=null?vt(At(e)):{},$e(t||!e||!e.__esModule?q(r,"default",{value:e,enumerable:!0}):r,e)),$t=e=>$e(q({},"__esModule",{value:!0}),e);var Mr={};Et(Mr,{default:()=>St});module.exports=$t(Mr);var x=D(require("fs"),1),v=D(require("path"),1);var B=(e,t,r)=>{e.forEach((i,n)=>{let a=`${t}.${n}`;i.type==="DRAFT"?r[a]={description:i.description||"Draft",action_entity:void 0}:i.type==="ACTION"?r[a]={description:i.description||"Action",action_entity:i.action_entity,locator:i.locator}:i.type==="STEP"&&i.statements?B(i.statements,a,r):i.type==="IF_ELSE"?(r[a]={description:"IF "+(i.condition?.expression||""),action_entity:void 0},i.then&&B(i.then,`${a}.then`,r),i.else&&B(i.else,`${a}.else`,r)):i.type==="WHILE_LOOP"&&(r[a]={description:"WHILE "+(i.condition?.expression||""),action_entity:void 0},i.body&&B(i.body,`${a}.body`,r))})};function Z(e){if(!e?.statements||!Array.isArray(e.statements))return{};let t={};return B(e.statements,"main",t),e.teardown&&Array.isArray(e.teardown)&&B(e.teardown,"teardown",t),t}var c=require("zod"),Me=c.z.enum(["JS_CODE","AI_MODE"]),fe=c.z.object({type:Me,expression:c.z.string()}),Pe=c.z.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),H=c.z.object({uid:c.z.string(),type:Pe,comment:c.z.string().optional()}),Oe=c.z.object({action_data:c.z.object({action_name:c.z.string(),kwargs:c.z.record(c.z.any()).optional(),args:c.z.array(c.z.any()).optional()}),action_description:c.z.string().optional(),url:c.z.string().optional(),xpath:c.z.string().nullable().optional(),locator:c.z.string().nullable().optional(),css_selector:c.z.string().nullable().optional(),unique_selector:c.z.string().nullable().optional(),element_index:c.z.number().nullable().optional(),frame_path:c.z.array(c.z.any()).optional(),artifacts:c.z.record(c.z.any()).optional(),feedback:c.z.string().optional(),original_browser_use_action:c.z.any().optional()}).passthrough(),Ie=H.extend({type:c.z.literal("DRAFT"),description:c.z.string()}),Le=H.extend({type:c.z.literal("ACTION"),description:c.z.string(),action_entity:Oe.optional(),locator:c.z.string().optional(),use_pure_vision:c.z.boolean().optional()}),L=c.z.lazy(()=>c.z.union([Ie,Le,H.extend({type:c.z.literal("STEP"),description:c.z.string().optional().default(""),statements:c.z.array(L),reference_id:c.z.number().optional(),template_path:c.z.string().optional(),template_params:c.z.record(c.z.string()).optional()}),H.extend({type:c.z.literal("IF_ELSE"),description:c.z.string().optional(),condition:fe,then:c.z.array(L),else:c.z.array(L).optional()}),H.extend({type:c.z.literal("WHILE_LOOP"),description:c.z.string().optional(),condition:fe,body:c.z.array(L),timeout_ms:c.z.number().optional()})])),Ce=c.z.object({name:c.z.string(),statements:c.z.array(L),teardown:c.z.array(L).optional(),skip:c.z.union([c.z.boolean(),c.z.string()]).optional(),timeout:c.z.number().optional(),fail:c.z.union([c.z.boolean(),c.z.string()]).optional(),only:c.z.boolean().optional(),slow:c.z.boolean().optional()}),Q=c.z.object({tests:c.z.array(Ce).min(1),beforeAll:c.z.array(L).optional(),afterAll:c.z.array(L).optional(),beforeEach:c.z.array(L).optional(),afterEach:c.z.array(L).optional()}),he=c.z.object({comment:c.z.string().optional(),version:c.z.string().optional(),goal:c.z.string().optional(),url:c.z.string().optional(),baseURL:c.z.string().optional(),final_feedback:c.z.string().optional(),completed:c.z.boolean().optional(),success:c.z.boolean().optional(),statements:c.z.array(L).optional(),teardown:c.z.array(L).optional(),last_modified_at:c.z.string().optional(),testGroup:Q.optional()}).refine(e=>e.testGroup!==void 0?e.goal===void 0&&(e.statements===void 0||e.statements.length===0):e.goal!==void 0,{message:"TestFlow must have either goal/statements (single test) or testGroup (suite), not both"});var E=require("yaml"),C=require("uuid");function ge(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(ge);let t=e,r=Object.keys(t);if(r.length===1){let n=r[0];if(n.startsWith("{ ")&&n.endsWith(" }")&&t[n]===null)return`{{${n.slice(2,-2)}}}`}let i={};for(let[n,a]of Object.entries(t))i[n]=ge(a);return i}var Ne=1024*1024;function W(e){if(e.length>Ne)throw new Error(`YAML input too large (${e.length} bytes, max ${Ne})`);let t=ge((0,E.parse)(e));if(!t||typeof t!="object")throw new Error("Invalid YAML: expected an object at root level");if(t.suite)return Mt(t);let r={version:"1.3.0",goal:t.goal,url:t.url,baseURL:t.base_url,statements:N(t.statements??[])};t.final_feedback&&(r.final_feedback=t.final_feedback),t.teardown&&Array.isArray(t.teardown)&&(r.teardown=N(t.teardown));let i=he.safeParse(r);if(!i.success)throw new Error(`Invalid TestFlow after YAML conversion: ${JSON.stringify(i.error.errors)}`);let n=i.data;return Re(e,n),n}function Mt(e){let t=e.suite;if(!t||typeof t!="object")throw new Error("Invalid suite: expected an object");let r=t.tests;if(!Array.isArray(r)||r.length===0)throw new Error('Suite must have a non-empty "tests" array');let n={tests:r.map(s=>{if(!s.name)throw new Error('Each test in a suite must have a "name" field');if(!Array.isArray(s.statements)||s.statements.length===0)throw new Error(`Suite test "${s.name}" must have a non-empty "statements" array`);let l={name:s.name,statements:N(s.statements)};return Array.isArray(s.teardown)&&s.teardown.length>0&&(l.teardown=N(s.teardown)),s.skip!==void 0&&(l.skip=s.skip),typeof s.timeout=="number"&&(l.timeout=s.timeout),s.fail!==void 0&&(l.fail=s.fail),s.only===!0&&(l.only=!0),s.slow===!0&&(l.slow=!0),l})};Array.isArray(t.beforeAll)&&t.beforeAll.length>0&&(n.beforeAll=N(t.beforeAll)),Array.isArray(t.afterAll)&&t.afterAll.length>0&&(n.afterAll=N(t.afterAll)),Array.isArray(t.beforeEach)&&t.beforeEach.length>0&&(n.beforeEach=N(t.beforeEach)),Array.isArray(t.afterEach)&&t.afterEach.length>0&&(n.afterEach=N(t.afterEach));let a=Q.safeParse(n);if(!a.success)throw new Error(`Invalid TestGroup: ${JSON.stringify(a.error.errors)}`);return{version:"1.3.0",baseURL:t.base_url||void 0,testGroup:a.data}}function N(e){if(!Array.isArray(e))throw new Error("Expected an array of statements");return e.map(Pt)}function Pt(e){if(typeof e=="string")throw new Error(`Plain string statements are not supported. Use an object with a "desc" key instead. Example: { "desc": "${e}" }`);if(typeof e!="object"||e===null)throw new Error(`Invalid statement: expected object, got ${typeof e}`);let t=e;if("IF"in t)return Ot(t);if("WHILE"in t)return It(t);if("STEP"in t)return Lt(t);if("VERIFY"in t){let r=t.VERIFY,i={statement:typeof r=="string"?r:String(r)};return typeof t.js=="string"&&(i.code=t.js),{uid:(0,C.v4)(),type:"ACTION",description:String(r),action_entity:{action_description:String(r),action_data:{action_name:"verify",kwargs:i}}}}if("URL"in t){let r=t.URL,i=t.new_tab===!0?!0:void 0,n=typeof t.timeout_seconds=="number"?t.timeout_seconds:void 0,a={url:typeof r=="string"?r:String(r)};return i&&(a.new_tab=!0),n!==void 0&&(a.timeout_seconds=n),{uid:(0,C.v4)(),type:"ACTION",description:`Navigate to ${r}`,action_entity:{action_description:`Navigate to ${r}`,action_data:{action_name:"go_to_url",kwargs:a}}}}if("WAIT_UNTIL"in t){let r=typeof t.WAIT_UNTIL=="string"?t.WAIT_UNTIL:String(t.WAIT_UNTIL),i=me(r),n=typeof t.timeout_seconds=="number"?t.timeout_seconds:60;if(typeof t.js=="string"){if(i.type==="JS_CODE")throw new Error('WAIT_UNTIL cannot combine a "js:"-prefixed condition with a sibling "js:" key \u2014 put the intent in WAIT_UNTIL and the expression in js:');return{uid:(0,C.v4)(),type:"ACTION",description:`Wait until: ${r}`,action_entity:{action_description:`Wait until: ${r}`,action_data:{action_name:"ai_wait_until",kwargs:{condition:r,condition_type:"JS_CODE",js:t.js,timeout_seconds:n}}}}}return{uid:(0,C.v4)(),type:"ACTION",description:`Wait until: ${i.expression}`,action_entity:{action_description:`Wait until: ${i.expression}`,action_data:{action_name:"ai_wait_until",kwargs:{condition:i.expression,condition_type:i.type,timeout_seconds:n}}}}}if("WAIT"in t){let r=t.WAIT,i=typeof t.seconds=="number"?t.seconds:3;return{uid:(0,C.v4)(),type:"ACTION",description:typeof r=="string"?r:`Wait ${i}s`,action_entity:{action_description:typeof r=="string"?r:`Wait ${i}s`,action_data:{action_name:"wait",kwargs:{seconds:i}}}}}if("CODE"in t){let r=t.CODE;if(r==null)throw new Error('CODE statement has no code. Use "CODE: |" followed by indented code on the next line.');let i=typeof t.description=="string"?t.description:"Code block";return{uid:(0,C.v4)(),type:"ACTION",description:i,action_entity:{action_description:i,action_data:{action_name:"js_code",kwargs:{code:typeof r=="string"?r:String(r)}}}}}if("js"in t&&!("VERIFY"in t)&&!("action"in t)){if("intent"in t||"desc"in t)throw new Error("A `js:` statement uses `description:`, not `intent:`. Raw JS does not self-heal \u2014 use `description: + js:` for code, or express it as a structured action (`intent:` + `action:`/`locator:`) to keep self-healing.");let r=typeof t.description=="string"&&t.description.trim()!==""?t.description:"Code block",i=t.js;return{uid:(0,C.v4)(),type:"ACTION",description:r,action_entity:{action_description:r,action_data:{action_name:"js_code",kwargs:{code:typeof i=="string"?i:String(i)}}}}}if("call"in t&&typeof t.call=="string"){let{call:r,...i}=t;return De({...i,action:"function",functionName:r})}if("action"in t)return De(t);if("intent"in t&&typeof t.intent=="string"||"desc"in t&&typeof t.desc=="string")return{uid:(0,C.v4)(),type:"DRAFT",description:typeof t.intent=="string"?t.intent:t.desc};throw new Error(`Cannot infer statement type from object: ${JSON.stringify(t)}`)}function me(e){if(typeof e!="string")throw new Error(`Condition must be a string, got ${typeof e}`);return e.startsWith("js:")?{type:"JS_CODE",expression:e.slice(3)}:{type:"AI_MODE",expression:e}}function Ot(e){let t=me(e.IF),r=e.THEN;if(!Array.isArray(r))throw new Error("IF_ELSE requires a THEN array");let i={uid:(0,C.v4)(),type:"IF_ELSE",condition:t,then:N(r)};return"ELSE"in e&&Array.isArray(e.ELSE)&&(i.else=N(e.ELSE)),i}function It(e){let t=me(e.WHILE),r=e.DO;if(!Array.isArray(r))throw new Error("WHILE_LOOP requires a DO array");let i={uid:(0,C.v4)(),type:"WHILE_LOOP",condition:t,body:N(r)};return typeof e.timeout_ms=="number"&&(i.timeout_ms=e.timeout_ms),i}function Lt(e){let t=typeof e.STEP=="string"?e.STEP:"";if(!Array.isArray(e.statements))throw new Error("STEP requires a statements array");let r={uid:(0,C.v4)(),type:"STEP",description:t,statements:N(e.statements)};if(typeof e.reference_id=="number"&&(r.reference_id=e.reference_id),typeof e.template_path=="string"&&(r.template_path=e.template_path),e.template_params&&typeof e.template_params=="object"&&!Array.isArray(e.template_params)){let i=e.template_params,n={};for(let[a,o]of Object.entries(i))n[a]=String(o);r.template_params=n}return r}var Ct=new Set(["action","intent","desc","locator","xpath","use_pure_vision"]);function De(e){let t=typeof e.action=="string"?e.action:String(e.action),r=typeof e.intent=="string"?e.intent:typeof e.desc=="string"?e.desc:"",i=typeof e.locator=="string"?e.locator:void 0,n=typeof e.xpath=="string"?e.xpath:void 0,a=typeof e.use_pure_vision=="boolean"?e.use_pure_vision:void 0,o={};for(let[u,_]of Object.entries(e))Ct.has(u)||(o[u]=_);t==="verify"&&typeof o.js=="string"&&(o.code=o.js,delete o.js),(t==="ai_action"||t==="ai_step")&&(o.statement===void 0&&(o.statement=r),a&&(o.use_pure_vision=!0));let s={action_description:r,action_data:{action_name:t,kwargs:Object.keys(o).length>0?o:{}}};i&&(s.locator=i),n&&(s.xpath=n);let l={uid:(0,C.v4)(),type:"ACTION",description:r,action_entity:s};return a&&(l.use_pure_vision=!0),l}function Re(e,t){let r;try{r=(0,E.parseDocument)(e)}catch{return}let i=r.contents;if(!i||!(0,E.isMap)(i))return;if(r.commentBefore)t.comment=r.commentBefore;else{let l=i.items?.[0];l?.key&&l.key.commentBefore&&(t.comment=l.key.commentBefore)}let n=i,a=n.get("statements",!0);(0,E.isSeq)(a)&&t.statements&&j(a,t.statements);let o=n.get("teardown",!0);(0,E.isSeq)(o)&&t.teardown&&j(o,t.teardown)}function j(e,t){e.commentBefore&&t.length>0&&(t[0].comment=e.commentBefore);for(let r=0;r<Math.min(e.items.length,t.length);r++){let i=e.items[r];i.commentBefore&&!(r===0&&e.commentBefore)&&(t[r].comment=i.commentBefore);let n=t[r];if(n.type==="STEP"&&(0,E.isMap)(i)){let a=i.get("statements",!0);(0,E.isSeq)(a)&&j(a,n.statements)}else if(n.type==="IF_ELSE"&&(0,E.isMap)(i)){let a=i.get("THEN",!0);(0,E.isSeq)(a)&&j(a,n.then);let o=i.get("ELSE",!0);(0,E.isSeq)(o)&&n.else&&j(o,n.else)}else if(n.type==="WHILE_LOOP"&&(0,E.isMap)(i)){let a=i.get("DO",!0);(0,E.isSeq)(a)&&j(a,n.body)}}}var Rt=require("uuid");var Fe=require("yaml");var G=(e=>(e.DRAFT="DRAFT",e.STEP="STEP",e.ACTION="ACTION",e.IF_ELSE="IF_ELSE",e.WHILE_LOOP="WHILE_LOOP",e))(G||{});var Be=112;var Wt=1080-Be;var We={"Blackberry PlayBook":{name:"Blackberry PlayBook",userAgent:"Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/26.0 Safari/536.2+",screen:{width:600,height:1024},viewport:{width:600,height:1024},deviceScaleFactor:1,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"BlackBerry Z30":{name:"BlackBerry Z30",userAgent:"Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/26.0 Mobile Safari/537.10+",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy Note 3":{name:"Galaxy Note 3",userAgent:"Mozilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy Note II":{name:"Galaxy Note II",userAgent:"Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy S III":{name:"Galaxy S III",userAgent:"Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy S5":{name:"Galaxy S5",userAgent:"Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S8":{name:"Galaxy S8",userAgent:"Mozilla/5.0 (Linux; Android 7.0; SM-G950U Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:740},viewport:{width:360,height:740},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S9+":{name:"Galaxy S9+",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; SM-G965U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:320,height:658},viewport:{width:320,height:658},deviceScaleFactor:4.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S24":{name:"Galaxy S24",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-S921U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:780},viewport:{width:360,height:780},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy A55":{name:"Galaxy A55",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-A556B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:480,height:1040},viewport:{width:480,height:1040},deviceScaleFactor:2.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy Tab S4":{name:"Galaxy Tab S4",userAgent:"Mozilla/5.0 (Linux; Android 8.1.0; SM-T837A) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:712,height:1138},viewport:{width:712,height:1138},deviceScaleFactor:2.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy Tab S9":{name:"Galaxy Tab S9",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-X710) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:640,height:1024},viewport:{width:640,height:1024},deviceScaleFactor:2.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"iPad (gen 5)":{name:"iPad (gen 5)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 6)":{name:"iPad (gen 6)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 7)":{name:"iPad (gen 7)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:810,height:1080},viewport:{width:810,height:1080},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 11)":{name:"iPad (gen 11)",userAgent:"Mozilla/5.0 (iPad; CPU OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/19E241 Safari/604.1",screen:{width:656,height:944},viewport:{width:656,height:944},deviceScaleFactor:2.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad Mini":{name:"iPad Mini",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad Pro 11":{name:"iPad Pro 11",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:834,height:1194},viewport:{width:834,height:1194},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 6":{name:"iPhone 6",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 6 Plus":{name:"iPhone 6 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 7":{name:"iPhone 7",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 7 Plus":{name:"iPhone 7 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 8":{name:"iPhone 8",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 8 Plus":{name:"iPhone 8 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone SE":{name:"iPhone SE",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/26.0 Mobile/14E304 Safari/602.1",screen:{width:320,height:568},viewport:{width:320,height:568},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone SE (3rd gen)":{name:"iPhone SE (3rd gen)",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/26.0 Mobile/19E241 Safari/602.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone X":{name:"iPhone X",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:812},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone XR":{name:"iPhone XR",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:896},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11":{name:"iPhone 11",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:715},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11 Pro":{name:"iPhone 11 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:635},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11 Pro Max":{name:"iPhone 11 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:715},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12":{name:"iPhone 12",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Pro":{name:"iPhone 12 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Pro Max":{name:"iPhone 12 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Mini":{name:"iPhone 12 Mini",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:629},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13":{name:"iPhone 13",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Pro":{name:"iPhone 13 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Pro Max":{name:"iPhone 13 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Mini":{name:"iPhone 13 Mini",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:629},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14":{name:"iPhone 14",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Plus":{name:"iPhone 14 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Pro":{name:"iPhone 14 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:660},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Pro Max":{name:"iPhone 14 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:740},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15":{name:"iPhone 15",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:659},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Plus":{name:"iPhone 15 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:739},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Pro":{name:"iPhone 15 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:659},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Pro Max":{name:"iPhone 15 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:739},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Kindle Fire HDX":{name:"Kindle Fire HDX",userAgent:"Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true",screen:{width:800,height:1280},viewport:{width:800,height:1280},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"LG Optimus L70":{name:"LG Optimus L70",userAgent:"Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:384,height:640},viewport:{width:384,height:640},deviceScaleFactor:1.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Microsoft Lumia 550":{name:"Microsoft Lumia 550",userAgent:"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 550) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36 Edge/14.14263",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Microsoft Lumia 950":{name:"Microsoft Lumia 950",userAgent:"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36 Edge/14.14263",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:4,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 10":{name:"Nexus 10",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:800,height:1280},viewport:{width:800,height:1280},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 4":{name:"Nexus 4",userAgent:"Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:384,height:640},viewport:{width:384,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 5":{name:"Nexus 5",userAgent:"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 5X":{name:"Nexus 5X",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 6":{name:"Nexus 6",userAgent:"Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 6P":{name:"Nexus 6P",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 7":{name:"Nexus 7",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:600,height:960},viewport:{width:600,height:960},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nokia Lumia 520":{name:"Nokia Lumia 520",userAgent:"Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)",screen:{width:320,height:533},viewport:{width:320,height:533},deviceScaleFactor:1.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nokia N9":{name:"Nokia N9",userAgent:"Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13",screen:{width:480,height:854},viewport:{width:480,height:854},deviceScaleFactor:1,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Pixel 2":{name:"Pixel 2",userAgent:"Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:411,height:731},viewport:{width:411,height:731},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 2 XL":{name:"Pixel 2 XL",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:411,height:823},viewport:{width:411,height:823},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 3":{name:"Pixel 3",userAgent:"Mozilla/5.0 (Linux; Android 9; Pixel 3 Build/PQ1A.181105.017.A1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:393,height:786},viewport:{width:393,height:786},deviceScaleFactor:2.75,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 4":{name:"Pixel 4",userAgent:"Mozilla/5.0 (Linux; Android 10; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:353,height:745},viewport:{width:353,height:745},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 4a (5G)":{name:"Pixel 4a (5G)",userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 4a (5G)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:892},viewport:{width:412,height:765},deviceScaleFactor:2.63,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 5":{name:"Pixel 5",userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:393,height:851},viewport:{width:393,height:727},deviceScaleFactor:2.75,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 7":{name:"Pixel 7",userAgent:"Mozilla/5.0 (Linux; Android 14; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:915},viewport:{width:412,height:839},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Moto G4":{name:"Moto G4",userAgent:"Mozilla/5.0 (Linux; Android 7.0; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Desktop Chrome HiDPI":{name:"Desktop Chrome HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Edge HiDPI":{name:"Desktop Edge HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Firefox HiDPI":{name:"Desktop Firefox HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0.1) Gecko/20100101 Firefox/142.0.1",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"firefox"},"Desktop Safari":{name:"Desktop Safari",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Safari/605.1.15",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"webkit"},"Desktop Chrome":{name:"Desktop Chrome",displayName:"Playwright Chromium",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Chrome Medium Resolution":{name:"Desktop Chrome Medium Resolution",displayName:"Playwright Chromium",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Chrome (Branded)":{name:"Desktop Chrome (Branded)",displayName:"Google Chrome",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"chrome"},"Desktop Chrome Medium Resolution (Branded)":{name:"Desktop Chrome Medium Resolution (Branded)",displayName:"Google Chrome",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"chrome"},"Desktop Edge":{name:"Desktop Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1920,height:1080},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Edge (Branded)":{name:"Desktop Edge (Branded)",displayName:"Microsoft Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"msedge"},"Desktop Edge Medium Resolution (Branded)":{name:"Desktop Edge Medium Resolution (Branded)",displayName:"Microsoft Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"msedge"},"Desktop Firefox":{name:"Desktop Firefox",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0.1) Gecko/20100101 Firefox/142.0.1",screen:{width:1920,height:1080},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"firefox"}};var Ge={desktop:["Desktop Chrome","Desktop Chrome Medium Resolution","Desktop Chrome (Branded)","Desktop Chrome Medium Resolution (Branded)","Desktop Edge (Branded)","Desktop Edge Medium Resolution (Branded)","Desktop Safari"],mobile:["iPhone 15 Pro Max","iPhone 15 Pro","iPhone 15 Plus","iPhone 15","iPhone 14 Pro Max","iPhone 14 Pro","iPhone 14 Plus","iPhone 14","iPhone 13 Pro Max","iPhone 13 Pro","iPhone 13","iPhone 13 Mini","iPhone 12 Pro Max","iPhone 12 Pro","iPhone 12","iPhone 12 Mini","iPhone 11 Pro Max","iPhone 11 Pro","iPhone 11","iPhone XR","iPhone X","iPhone SE (3rd gen)","iPhone SE","iPhone 8 Plus","iPhone 8","iPhone 7 Plus","iPhone 7","iPhone 6 Plus","iPhone 6","Galaxy S24","Galaxy A55","Galaxy S9+","Galaxy S8","Galaxy S5","Galaxy Note 3","Galaxy Note II","Galaxy S III","Pixel 7","Pixel 5","Pixel 4a (5G)","Pixel 4","Pixel 3","Pixel 2 XL","Pixel 2","Nexus 6P","Nexus 6","Nexus 5X","Nexus 5","Nexus 4","Moto G4","LG Optimus L70","Microsoft Lumia 950","Microsoft Lumia 550","Nokia Lumia 520","Nokia N9","BlackBerry Z30"]},J=(e,t=!1)=>{let r=["chromium"];return t&&r.push("webkit"),Ge[e].map(i=>We[i]).filter(i=>i.defaultBrowserType&&r.includes(i.defaultBrowserType))};var Gt={desktop:{label:"Desktop",type:"desktop",devices:J("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:J("mobile")}},Ut={desktop:{label:"Desktop",type:"desktop",devices:J("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:J("mobile",!0)}};var ye=Object.freeze(["lite","standard","pro"]);function _e(e){return typeof e=="string"&&ye.includes(e)}var te=1,re="SHIPLIGHT_TIER_MAP",ie="WEB_AGENT_TIER",je=Object.freeze(["WEB_AGENT_MODEL","WEB_AGENT_FALLBACK_MODELS","COMPUTER_USE_MODEL"]),ne=Ke({version:te,defaultTier:"lite",tiers:{lite:{webagent:{primary:"google:gemini-3-flash-preview",fallbacks:["anthropic:claude-haiku-4-5","openai:gpt-5.6-luna"]}},standard:{webagent:{primary:"google:gemini-3.5-flash",fallbacks:["anthropic:claude-sonnet-5","openai:gpt-5.6-terra"]}},pro:{webagent:{primary:"anthropic:claude-opus-4-8",fallbacks:["openai:gpt-5.6-sol","anthropic:claude-opus-4-7"]}}},computerUse:{primary:"google:gemini-3-flash-preview",fallbacks:[]}});function Ke(e){if(e!==null&&typeof e=="object"){for(let t of Object.values(e))Ke(t);Object.freeze(e)}return e}function ee(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ue(e){if(!ee(e))return;let{primary:t,fallbacks:r}=e;if(!(typeof t!="string"||t.trim()!==t||t==="")){if(r===void 0)return{primary:t,fallbacks:[]};if(Array.isArray(r)&&r.every(i=>typeof i=="string"&&i.trim()===i&&i!==""))return{primary:t,fallbacks:[...r]}}}function be(e){if(!ee(e)||e.version!==te||!_e(e.defaultTier)||!ee(e.tiers))return;let t={};for(let i of ye){let n=e.tiers[i];if(!ee(n))return;let a=Ue(n.webagent);if(!a)return;t[i]={webagent:a}}let r=Ue(e.computerUse);if(r)return{version:te,defaultTier:e.defaultTier,tiers:t,computerUse:r}}function Ve(e){if(e)try{return be(JSON.parse(e))}catch{return}}function He(e){return{primary:e.primary,fallbacks:[...e.fallbacks]}}function oe(e){let t=Ve(e[re]),r=t??ne,i=t?"server":"baked",n=e[ie]||void 0,a=_e(n)?n:void 0,o=n!==void 0&&a===void 0?n:void 0,s=a??r.defaultTier,l=a?"env":i==="server"?"org-default":"baked-default",u=je.filter(_=>!!e[_]);return{tier:s,tierSource:l,mapSource:i,webagent:He(r.tiers[s].webagent),computerUse:He(r.computerUse),ignoredEnvVars:[...u],...o!==void 0&&{invalidTier:o}}}function we(e){return!!(e.GOOGLE_API_KEY||Se(e)||e.ANTHROPIC_API_KEY||e.OPENAI_API_KEY)}function Se(e){let t=e.GOOGLE_GENAI_USE_VERTEXAI;return(t==="true"||t==="True")&&!!e.GOOGLE_CLOUD_PROJECT}function ae(e){return!e.SHIPLIGHT_API_TOKEN||we(e)?!1:!!(e[re]||e[ie])}var Ht=Object.freeze([...ne.tiers.standard.webagent.fallbacks]);var Vt=require("yaml");var se=D(require("path"),1),qe=require("crypto"),X=require("yaml");var ce=require("fs"),K=require("path"),Y=require("yaml");var Ye=5e3;function zt(e){let t=e.frame_path;return!t||t.length===0?"page":`page.frameLocator('${t[0]}')`}function Jt(e){let t=e.xpath;return typeof t=="string"&&t.trim()?!t.startsWith("xpath=")&&!t.startsWith("/")&&!t.startsWith("//")?`xpath=//${t}`:t.startsWith("xpath=")?t:`xpath=${t}`:null}function Xe(e){let t=zt(e),r=e.locator;if(typeof r=="string"&&r.trim())return r=r.trim(),r.endsWith("first()")?`${t}.${r}`:`${t}.${r}.first()`;let i=Jt(e);if(i){let n=JSON.stringify(i);return`${t}.locator(${n}).first()`}return null}var I=new Map;function f(e,t){I.set(e,t)}function U(e,t,r=[]){let i=[...r];return t.locator?i.push(`locator: ${JSON.stringify(t.locator)}`):t.xpath&&i.push(`xpath: ${JSON.stringify(t.xpath)}`),t.frame_path&&t.frame_path.length>0&&i.push(`frame_path: ${JSON.stringify(t.frame_path)}`),i.length===0?[`await agent.execAction("${e}", page, {});`]:[`await agent.execAction("${e}", page, {`,...i.map(n=>` ${n},`),"});"]}f("click",e=>{let t=Xe(e);if(!t)return['await agent.execAction("click", page, {});'];let r=e.action_data?.kwargs?.timeout_ms??Ye;return[`await ${t}.click({ timeout: ${r} });`]});f("click_element",I.get("click"));f("click_element_by_index",I.get("click"));f("double_click",e=>U("double_click",e));f("double_click_on_element",I.get("double_click"));f("right_click",e=>U("right_click",e));f("right_click_on_element",I.get("right_click"));f("hover",e=>U("hover",e));f("hover_element_by_index",I.get("hover"));f("input_text",e=>{let t=e.action_data?.kwargs?.text??e.action_data?.kwargs?.value??"";return U("input_text",e,[`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`])});f("fill",I.get("input_text"));f("clear_input",e=>U("clear_input",e));f("press",e=>{let t=e.action_data?.kwargs?.keys;return[`await page.keyboard.press(${JSON.stringify(t)});`]});f("send_keys",I.get("press"));f("send_keys_on_element",e=>{let t=Xe(e),r=e.action_data?.kwargs?.keys||"";if(!t)return['await agent.execAction("send_keys_on_element", page, {',` action_data: { kwargs: { keys: ${JSON.stringify(r)} } },`,"});"];let i=e.action_data?.kwargs?.timeout_ms??Ye;return[`await ${t}.press(${JSON.stringify(r)}, { timeout: ${i} });`]});f("select_dropdown_option",e=>{let t=e.action_data?.kwargs?.text||e.action_data?.kwargs?.option||"";return U("select_dropdown_option",e,[`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`])});f("scroll",e=>{let t=e.action_data?.kwargs?.down??!0;return[`await page.evaluate('window.scrollBy(0, window.innerHeight * ${(e.action_data?.kwargs?.num_pages??1)*(t?1:-1)})');`]});f("scroll_down",I.get("scroll"));f("scroll_up",I.get("scroll"));f("scroll_element",I.get("scroll"));f("scroll_to_text",e=>{let t=e.action_data?.kwargs?.text||"";return[`await page.getByText(${JSON.stringify(t)}, { exact: false }).first().scrollIntoViewIfNeeded();`]});f("scroll_on_element",e=>U("scroll_on_element",e,[`action_data: { kwargs: ${JSON.stringify(e.action_data?.kwargs||{})} }`]));f("go_to_url",e=>{let t=e.action_data?.kwargs?.url||"";return e.action_data?.kwargs?.new_tab===!0?['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { url: ${JSON.stringify(t)}, new_tab: true } },`,"});"]:['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { url: ${JSON.stringify(t)} } },`,"});"]});f("open_tab",I.get("go_to_url"));f("go_back",()=>['await agent.execAction("go_back", page, {});']);f("reload_page",()=>['await agent.execAction("reload_page", page, {});']);f("wait",e=>[`await page.waitForTimeout(${(e.action_data?.kwargs?.seconds||1)*1e3});`]);f("wait_for_page_ready",()=>["await page.waitForLoadState('domcontentloaded');"]);f("verify",(e,t)=>{let r=e.action_data?.kwargs,i=typeof r?.code=="string",n=i?r?.statement||e.action_description:e.action_description||r?.statement;if(i&&n){let o=r.code.split(`
|
|
1
|
+
"use strict";var Tt=Object.create;var Z=Object.defineProperty;var Et=Object.getOwnPropertyDescriptor;var $t=Object.getOwnPropertyNames;var Mt=Object.getPrototypeOf,Pt=Object.prototype.hasOwnProperty;var Ot=(e,t)=>{for(var r in t)Z(e,r,{get:t[r],enumerable:!0})},Pe=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of $t(t))!Pt.call(e,n)&&n!==r&&Z(e,n,{get:()=>t[n],enumerable:!(i=Et(t,n))||i.enumerable});return e};var R=(e,t,r)=>(r=e!=null?Tt(Mt(e)):{},Pe(t||!e||!e.__esModule?Z(r,"default",{value:e,enumerable:!0}):r,e)),It=e=>Pe(Z({},"__esModule",{value:!0}),e);var Dr={};Ot(Dr,{default:()=>At});module.exports=It(Dr);var x=R(require("fs"),1),v=R(require("path"),1);var c=require("zod"),Oe=c.z.enum(["JS_CODE","AI_MODE"]),ge=c.z.object({type:Oe,expression:c.z.string()}),Ie=c.z.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),j=c.z.object({uid:c.z.string(),type:Ie,comment:c.z.string().optional()}),Le=c.z.object({action_data:c.z.object({action_name:c.z.string(),kwargs:c.z.record(c.z.any()).optional(),args:c.z.array(c.z.any()).optional()}),action_description:c.z.string().optional(),url:c.z.string().optional(),xpath:c.z.string().nullable().optional(),locator:c.z.string().nullable().optional(),css_selector:c.z.string().nullable().optional(),unique_selector:c.z.string().nullable().optional(),element_index:c.z.number().nullable().optional(),frame_path:c.z.array(c.z.any()).optional(),artifacts:c.z.record(c.z.any()).optional(),feedback:c.z.string().optional(),original_browser_use_action:c.z.any().optional()}).passthrough(),Ce=j.extend({type:c.z.literal("DRAFT"),description:c.z.string()}),Ne=j.extend({type:c.z.literal("ACTION"),description:c.z.string(),action_entity:Le.optional(),locator:c.z.string().optional(),use_pure_vision:c.z.boolean().optional()}),L=c.z.lazy(()=>c.z.union([Ce,Ne,j.extend({type:c.z.literal("STEP"),description:c.z.string().optional().default(""),statements:c.z.array(L),reference_id:c.z.number().optional(),template_path:c.z.string().optional(),template_params:c.z.record(c.z.string()).optional()}),j.extend({type:c.z.literal("IF_ELSE"),description:c.z.string().optional(),condition:ge,then:c.z.array(L),else:c.z.array(L).optional()}),j.extend({type:c.z.literal("WHILE_LOOP"),description:c.z.string().optional(),condition:ge,body:c.z.array(L),timeout_ms:c.z.number().optional()})])),De=c.z.object({name:c.z.string(),statements:c.z.array(L),teardown:c.z.array(L).optional(),skip:c.z.union([c.z.boolean(),c.z.string()]).optional(),timeout:c.z.number().optional(),fail:c.z.union([c.z.boolean(),c.z.string()]).optional(),only:c.z.boolean().optional(),slow:c.z.boolean().optional()}),Q=c.z.object({tests:c.z.array(De).min(1),beforeAll:c.z.array(L).optional(),afterAll:c.z.array(L).optional(),beforeEach:c.z.array(L).optional(),afterEach:c.z.array(L).optional()}),me=c.z.object({comment:c.z.string().optional(),version:c.z.string().optional(),goal:c.z.string().optional(),url:c.z.string().optional(),baseURL:c.z.string().optional(),final_feedback:c.z.string().optional(),completed:c.z.boolean().optional(),success:c.z.boolean().optional(),statements:c.z.array(L).optional(),teardown:c.z.array(L).optional(),last_modified_at:c.z.string().optional(),testGroup:Q.optional()}).refine(e=>e.testGroup!==void 0?e.goal===void 0&&(e.statements===void 0||e.statements.length===0):e.goal!==void 0,{message:"TestFlow must have either goal/statements (single test) or testGroup (suite), not both"});var E=require("yaml"),C=require("uuid");function ye(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(ye);let t=e,r=Object.keys(t);if(r.length===1){let n=r[0];if(n.startsWith("{ ")&&n.endsWith(" }")&&t[n]===null)return`{{${n.slice(2,-2)}}}`}let i={};for(let[n,a]of Object.entries(t))i[n]=ye(a);return i}var Re=1024*1024;function W(e){if(e.length>Re)throw new Error(`YAML input too large (${e.length} bytes, max ${Re})`);let t=ye((0,E.parse)(e));if(!t||typeof t!="object")throw new Error("Invalid YAML: expected an object at root level");if(t.suite)return Lt(t);let r={version:"1.3.0",goal:t.goal,url:t.url,baseURL:t.base_url,statements:N(t.statements??[])};t.final_feedback&&(r.final_feedback=t.final_feedback),t.teardown&&Array.isArray(t.teardown)&&(r.teardown=N(t.teardown));let i=me.safeParse(r);if(!i.success)throw new Error(`Invalid TestFlow after YAML conversion: ${JSON.stringify(i.error.errors)}`);let n=i.data;return Be(e,n),n}function Lt(e){let t=e.suite;if(!t||typeof t!="object")throw new Error("Invalid suite: expected an object");let r=t.tests;if(!Array.isArray(r)||r.length===0)throw new Error('Suite must have a non-empty "tests" array');let n={tests:r.map(s=>{if(!s.name)throw new Error('Each test in a suite must have a "name" field');if(!Array.isArray(s.statements)||s.statements.length===0)throw new Error(`Suite test "${s.name}" must have a non-empty "statements" array`);let l={name:s.name,statements:N(s.statements)};return Array.isArray(s.teardown)&&s.teardown.length>0&&(l.teardown=N(s.teardown)),s.skip!==void 0&&(l.skip=s.skip),typeof s.timeout=="number"&&(l.timeout=s.timeout),s.fail!==void 0&&(l.fail=s.fail),s.only===!0&&(l.only=!0),s.slow===!0&&(l.slow=!0),l})};Array.isArray(t.beforeAll)&&t.beforeAll.length>0&&(n.beforeAll=N(t.beforeAll)),Array.isArray(t.afterAll)&&t.afterAll.length>0&&(n.afterAll=N(t.afterAll)),Array.isArray(t.beforeEach)&&t.beforeEach.length>0&&(n.beforeEach=N(t.beforeEach)),Array.isArray(t.afterEach)&&t.afterEach.length>0&&(n.afterEach=N(t.afterEach));let a=Q.safeParse(n);if(!a.success)throw new Error(`Invalid TestGroup: ${JSON.stringify(a.error.errors)}`);return{version:"1.3.0",baseURL:(t.base_url??e.base_url)||void 0,testGroup:a.data}}function N(e){if(!Array.isArray(e))throw new Error("Expected an array of statements");return e.map(Ct)}function Ct(e){if(typeof e=="string")throw new Error(`Plain string statements are not supported. Use an object with a "desc" key instead. Example: { "desc": "${e}" }`);if(typeof e!="object"||e===null)throw new Error(`Invalid statement: expected object, got ${typeof e}`);let t=e;if("IF"in t)return Nt(t);if("WHILE"in t)return Dt(t);if("STEP"in t)return Rt(t);if("VERIFY"in t){let r=t.VERIFY,i={statement:typeof r=="string"?r:String(r)};return typeof t.js=="string"&&(i.code=t.js),{uid:(0,C.v4)(),type:"ACTION",description:String(r),action_entity:{action_description:String(r),action_data:{action_name:"verify",kwargs:i}}}}if("URL"in t){let r=t.URL,i=t.new_tab===!0?!0:void 0,n=typeof t.timeout_seconds=="number"?t.timeout_seconds:void 0,a={url:typeof r=="string"?r:String(r)};return i&&(a.new_tab=!0),n!==void 0&&(a.timeout_seconds=n),{uid:(0,C.v4)(),type:"ACTION",description:`Navigate to ${r}`,action_entity:{action_description:`Navigate to ${r}`,action_data:{action_name:"go_to_url",kwargs:a}}}}if("WAIT_UNTIL"in t){let r=typeof t.WAIT_UNTIL=="string"?t.WAIT_UNTIL:String(t.WAIT_UNTIL),i=_e(r),n=typeof t.timeout_seconds=="number"?t.timeout_seconds:60;if(typeof t.js=="string"){if(i.type==="JS_CODE")throw new Error('WAIT_UNTIL cannot combine a "js:"-prefixed condition with a sibling "js:" key \u2014 put the intent in WAIT_UNTIL and the expression in js:');return{uid:(0,C.v4)(),type:"ACTION",description:`Wait until: ${r}`,action_entity:{action_description:`Wait until: ${r}`,action_data:{action_name:"ai_wait_until",kwargs:{condition:r,condition_type:"JS_CODE",js:t.js,timeout_seconds:n}}}}}return{uid:(0,C.v4)(),type:"ACTION",description:`Wait until: ${i.expression}`,action_entity:{action_description:`Wait until: ${i.expression}`,action_data:{action_name:"ai_wait_until",kwargs:{condition:i.expression,condition_type:i.type,timeout_seconds:n}}}}}if("WAIT"in t){let r=t.WAIT,i=typeof t.seconds=="number"?t.seconds:3;return{uid:(0,C.v4)(),type:"ACTION",description:typeof r=="string"?r:`Wait ${i}s`,action_entity:{action_description:typeof r=="string"?r:`Wait ${i}s`,action_data:{action_name:"wait",kwargs:{seconds:i}}}}}if("CODE"in t){let r=t.CODE;if(r==null)throw new Error('CODE statement has no code. Use "CODE: |" followed by indented code on the next line.');let i=typeof t.description=="string"?t.description:"Code block";return{uid:(0,C.v4)(),type:"ACTION",description:i,action_entity:{action_description:i,action_data:{action_name:"js_code",kwargs:{code:typeof r=="string"?r:String(r)}}}}}if("js"in t&&!("VERIFY"in t)&&!("action"in t)){if("intent"in t||"desc"in t)throw new Error("A `js:` statement uses `description:`, not `intent:`. Raw JS does not self-heal \u2014 use `description: + js:` for code, or express it as a structured action (`intent:` + `action:`/`locator:`) to keep self-healing.");let r=typeof t.description=="string"&&t.description.trim()!==""?t.description:"Code block",i=t.js;return{uid:(0,C.v4)(),type:"ACTION",description:r,action_entity:{action_description:r,action_data:{action_name:"js_code",kwargs:{code:typeof i=="string"?i:String(i)}}}}}if("call"in t&&typeof t.call=="string"){let{call:r,...i}=t;return Fe({...i,action:"function",functionName:r})}if("action"in t)return Fe(t);if("intent"in t&&typeof t.intent=="string"||"desc"in t&&typeof t.desc=="string")return{uid:(0,C.v4)(),type:"DRAFT",description:typeof t.intent=="string"?t.intent:t.desc};throw new Error(`Cannot infer statement type from object: ${JSON.stringify(t)}`)}function _e(e){if(typeof e!="string")throw new Error(`Condition must be a string, got ${typeof e}`);return e.startsWith("js:")?{type:"JS_CODE",expression:e.slice(3)}:{type:"AI_MODE",expression:e}}function Nt(e){let t=_e(e.IF),r=e.THEN;if(!Array.isArray(r))throw new Error("IF_ELSE requires a THEN array");let i={uid:(0,C.v4)(),type:"IF_ELSE",condition:t,then:N(r)};return"ELSE"in e&&Array.isArray(e.ELSE)&&(i.else=N(e.ELSE)),i}function Dt(e){let t=_e(e.WHILE),r=e.DO;if(!Array.isArray(r))throw new Error("WHILE_LOOP requires a DO array");let i={uid:(0,C.v4)(),type:"WHILE_LOOP",condition:t,body:N(r)};return typeof e.timeout_ms=="number"&&(i.timeout_ms=e.timeout_ms),i}function Rt(e){let t=typeof e.STEP=="string"?e.STEP:"";if(!Array.isArray(e.statements))throw new Error("STEP requires a statements array");let r={uid:(0,C.v4)(),type:"STEP",description:t,statements:N(e.statements)};if(typeof e.reference_id=="number"&&(r.reference_id=e.reference_id),typeof e.template_path=="string"&&(r.template_path=e.template_path),e.template_params&&typeof e.template_params=="object"&&!Array.isArray(e.template_params)){let i=e.template_params,n={};for(let[a,o]of Object.entries(i))n[a]=String(o);r.template_params=n}return r}var Ft=new Set(["action","intent","desc","locator","xpath","use_pure_vision"]);function Fe(e){let t=typeof e.action=="string"?e.action:String(e.action),r=typeof e.intent=="string"?e.intent:typeof e.desc=="string"?e.desc:"",i=typeof e.locator=="string"?e.locator:void 0,n=typeof e.xpath=="string"?e.xpath:void 0,a=typeof e.use_pure_vision=="boolean"?e.use_pure_vision:void 0,o={};for(let[u,_]of Object.entries(e))Ft.has(u)||(o[u]=_);t==="verify"&&typeof o.js=="string"&&(o.code=o.js,delete o.js),(t==="ai_action"||t==="ai_step")&&(o.statement===void 0&&(o.statement=r),a&&(o.use_pure_vision=!0));let s={action_description:r,action_data:{action_name:t,kwargs:Object.keys(o).length>0?o:{}}};i&&(s.locator=i),n&&(s.xpath=n);let l={uid:(0,C.v4)(),type:"ACTION",description:r,action_entity:s};return a&&(l.use_pure_vision=!0),l}function Be(e,t){let r;try{r=(0,E.parseDocument)(e)}catch{return}let i=r.contents;if(!i||!(0,E.isMap)(i))return;if(r.commentBefore)t.comment=r.commentBefore;else{let l=i.items?.[0];l?.key&&l.key.commentBefore&&(t.comment=l.key.commentBefore)}let n=i,a=n.get("statements",!0);(0,E.isSeq)(a)&&t.statements&&K(a,t.statements);let o=n.get("teardown",!0);(0,E.isSeq)(o)&&t.teardown&&K(o,t.teardown)}function K(e,t){e.commentBefore&&t.length>0&&(t[0].comment=e.commentBefore);for(let r=0;r<Math.min(e.items.length,t.length);r++){let i=e.items[r];i.commentBefore&&!(r===0&&e.commentBefore)&&(t[r].comment=i.commentBefore);let n=t[r];if(n.type==="STEP"&&(0,E.isMap)(i)){let a=i.get("statements",!0);(0,E.isSeq)(a)&&K(a,n.statements)}else if(n.type==="IF_ELSE"&&(0,E.isMap)(i)){let a=i.get("THEN",!0);(0,E.isSeq)(a)&&K(a,n.then);let o=i.get("ELSE",!0);(0,E.isSeq)(o)&&n.else&&K(o,n.else)}else if(n.type==="WHILE_LOOP"&&(0,E.isMap)(i)){let a=i.get("DO",!0);(0,E.isSeq)(a)&&K(a,n.body)}}}var We=require("yaml");var U=(e,t,r)=>{e.forEach((i,n)=>{let a=`${t}.${n}`;i.type==="DRAFT"?r[a]={description:i.description||"Draft",action_entity:void 0}:i.type==="ACTION"?r[a]={description:i.description||"Action",action_entity:i.action_entity,locator:i.locator}:i.type==="STEP"&&i.statements?U(i.statements,a,r):i.type==="IF_ELSE"?(r[a]={description:"IF "+(i.condition?.expression||""),action_entity:void 0},i.then&&U(i.then,`${a}.then`,r),i.else&&U(i.else,`${a}.else`,r)):i.type==="WHILE_LOOP"&&(r[a]={description:"WHILE "+(i.condition?.expression||""),action_entity:void 0},i.body&&U(i.body,`${a}.body`,r))})};function ee(e){if(!e?.statements||!Array.isArray(e.statements))return{};let t={};return U(e.statements,"main",t),e.teardown&&Array.isArray(e.teardown)&&U(e.teardown,"teardown",t),t}var Ut=require("uuid");var G=(e=>(e.DRAFT="DRAFT",e.STEP="STEP",e.ACTION="ACTION",e.IF_ELSE="IF_ELSE",e.WHILE_LOOP="WHILE_LOOP",e))(G||{});var Ue=112;var jt=1080-Ue;var Ge={"Blackberry PlayBook":{name:"Blackberry PlayBook",userAgent:"Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/26.0 Safari/536.2+",screen:{width:600,height:1024},viewport:{width:600,height:1024},deviceScaleFactor:1,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"BlackBerry Z30":{name:"BlackBerry Z30",userAgent:"Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/26.0 Mobile Safari/537.10+",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy Note 3":{name:"Galaxy Note 3",userAgent:"Mozilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy Note II":{name:"Galaxy Note II",userAgent:"Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy S III":{name:"Galaxy S III",userAgent:"Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy S5":{name:"Galaxy S5",userAgent:"Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S8":{name:"Galaxy S8",userAgent:"Mozilla/5.0 (Linux; Android 7.0; SM-G950U Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:740},viewport:{width:360,height:740},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S9+":{name:"Galaxy S9+",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; SM-G965U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:320,height:658},viewport:{width:320,height:658},deviceScaleFactor:4.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S24":{name:"Galaxy S24",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-S921U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:780},viewport:{width:360,height:780},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy A55":{name:"Galaxy A55",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-A556B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:480,height:1040},viewport:{width:480,height:1040},deviceScaleFactor:2.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy Tab S4":{name:"Galaxy Tab S4",userAgent:"Mozilla/5.0 (Linux; Android 8.1.0; SM-T837A) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:712,height:1138},viewport:{width:712,height:1138},deviceScaleFactor:2.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy Tab S9":{name:"Galaxy Tab S9",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-X710) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:640,height:1024},viewport:{width:640,height:1024},deviceScaleFactor:2.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"iPad (gen 5)":{name:"iPad (gen 5)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 6)":{name:"iPad (gen 6)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 7)":{name:"iPad (gen 7)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:810,height:1080},viewport:{width:810,height:1080},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 11)":{name:"iPad (gen 11)",userAgent:"Mozilla/5.0 (iPad; CPU OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/19E241 Safari/604.1",screen:{width:656,height:944},viewport:{width:656,height:944},deviceScaleFactor:2.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad Mini":{name:"iPad Mini",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad Pro 11":{name:"iPad Pro 11",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:834,height:1194},viewport:{width:834,height:1194},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 6":{name:"iPhone 6",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 6 Plus":{name:"iPhone 6 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 7":{name:"iPhone 7",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 7 Plus":{name:"iPhone 7 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 8":{name:"iPhone 8",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 8 Plus":{name:"iPhone 8 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone SE":{name:"iPhone SE",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/26.0 Mobile/14E304 Safari/602.1",screen:{width:320,height:568},viewport:{width:320,height:568},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone SE (3rd gen)":{name:"iPhone SE (3rd gen)",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/26.0 Mobile/19E241 Safari/602.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone X":{name:"iPhone X",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:812},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone XR":{name:"iPhone XR",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:896},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11":{name:"iPhone 11",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:715},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11 Pro":{name:"iPhone 11 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:635},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11 Pro Max":{name:"iPhone 11 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:715},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12":{name:"iPhone 12",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Pro":{name:"iPhone 12 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Pro Max":{name:"iPhone 12 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Mini":{name:"iPhone 12 Mini",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:629},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13":{name:"iPhone 13",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Pro":{name:"iPhone 13 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Pro Max":{name:"iPhone 13 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Mini":{name:"iPhone 13 Mini",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:629},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14":{name:"iPhone 14",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Plus":{name:"iPhone 14 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Pro":{name:"iPhone 14 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:660},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Pro Max":{name:"iPhone 14 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:740},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15":{name:"iPhone 15",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:659},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Plus":{name:"iPhone 15 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:739},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Pro":{name:"iPhone 15 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:659},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Pro Max":{name:"iPhone 15 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:739},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Kindle Fire HDX":{name:"Kindle Fire HDX",userAgent:"Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true",screen:{width:800,height:1280},viewport:{width:800,height:1280},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"LG Optimus L70":{name:"LG Optimus L70",userAgent:"Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:384,height:640},viewport:{width:384,height:640},deviceScaleFactor:1.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Microsoft Lumia 550":{name:"Microsoft Lumia 550",userAgent:"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 550) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36 Edge/14.14263",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Microsoft Lumia 950":{name:"Microsoft Lumia 950",userAgent:"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36 Edge/14.14263",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:4,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 10":{name:"Nexus 10",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:800,height:1280},viewport:{width:800,height:1280},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 4":{name:"Nexus 4",userAgent:"Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:384,height:640},viewport:{width:384,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 5":{name:"Nexus 5",userAgent:"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 5X":{name:"Nexus 5X",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 6":{name:"Nexus 6",userAgent:"Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 6P":{name:"Nexus 6P",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 7":{name:"Nexus 7",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:600,height:960},viewport:{width:600,height:960},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nokia Lumia 520":{name:"Nokia Lumia 520",userAgent:"Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)",screen:{width:320,height:533},viewport:{width:320,height:533},deviceScaleFactor:1.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nokia N9":{name:"Nokia N9",userAgent:"Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13",screen:{width:480,height:854},viewport:{width:480,height:854},deviceScaleFactor:1,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Pixel 2":{name:"Pixel 2",userAgent:"Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:411,height:731},viewport:{width:411,height:731},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 2 XL":{name:"Pixel 2 XL",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:411,height:823},viewport:{width:411,height:823},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 3":{name:"Pixel 3",userAgent:"Mozilla/5.0 (Linux; Android 9; Pixel 3 Build/PQ1A.181105.017.A1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:393,height:786},viewport:{width:393,height:786},deviceScaleFactor:2.75,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 4":{name:"Pixel 4",userAgent:"Mozilla/5.0 (Linux; Android 10; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:353,height:745},viewport:{width:353,height:745},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 4a (5G)":{name:"Pixel 4a (5G)",userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 4a (5G)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:892},viewport:{width:412,height:765},deviceScaleFactor:2.63,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 5":{name:"Pixel 5",userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:393,height:851},viewport:{width:393,height:727},deviceScaleFactor:2.75,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 7":{name:"Pixel 7",userAgent:"Mozilla/5.0 (Linux; Android 14; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:915},viewport:{width:412,height:839},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Moto G4":{name:"Moto G4",userAgent:"Mozilla/5.0 (Linux; Android 7.0; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Desktop Chrome HiDPI":{name:"Desktop Chrome HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Edge HiDPI":{name:"Desktop Edge HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Firefox HiDPI":{name:"Desktop Firefox HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0.1) Gecko/20100101 Firefox/142.0.1",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"firefox"},"Desktop Safari":{name:"Desktop Safari",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Safari/605.1.15",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"webkit"},"Desktop Chrome":{name:"Desktop Chrome",displayName:"Playwright Chromium",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Chrome Medium Resolution":{name:"Desktop Chrome Medium Resolution",displayName:"Playwright Chromium",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Chrome (Branded)":{name:"Desktop Chrome (Branded)",displayName:"Google Chrome",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"chrome"},"Desktop Chrome Medium Resolution (Branded)":{name:"Desktop Chrome Medium Resolution (Branded)",displayName:"Google Chrome",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"chrome"},"Desktop Edge":{name:"Desktop Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1920,height:1080},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Edge (Branded)":{name:"Desktop Edge (Branded)",displayName:"Microsoft Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"msedge"},"Desktop Edge Medium Resolution (Branded)":{name:"Desktop Edge Medium Resolution (Branded)",displayName:"Microsoft Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"msedge"},"Desktop Firefox":{name:"Desktop Firefox",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0.1) Gecko/20100101 Firefox/142.0.1",screen:{width:1920,height:1080},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"firefox"}};var He={desktop:["Desktop Chrome","Desktop Chrome Medium Resolution","Desktop Chrome (Branded)","Desktop Chrome Medium Resolution (Branded)","Desktop Edge (Branded)","Desktop Edge Medium Resolution (Branded)","Desktop Safari"],mobile:["iPhone 15 Pro Max","iPhone 15 Pro","iPhone 15 Plus","iPhone 15","iPhone 14 Pro Max","iPhone 14 Pro","iPhone 14 Plus","iPhone 14","iPhone 13 Pro Max","iPhone 13 Pro","iPhone 13","iPhone 13 Mini","iPhone 12 Pro Max","iPhone 12 Pro","iPhone 12","iPhone 12 Mini","iPhone 11 Pro Max","iPhone 11 Pro","iPhone 11","iPhone XR","iPhone X","iPhone SE (3rd gen)","iPhone SE","iPhone 8 Plus","iPhone 8","iPhone 7 Plus","iPhone 7","iPhone 6 Plus","iPhone 6","Galaxy S24","Galaxy A55","Galaxy S9+","Galaxy S8","Galaxy S5","Galaxy Note 3","Galaxy Note II","Galaxy S III","Pixel 7","Pixel 5","Pixel 4a (5G)","Pixel 4","Pixel 3","Pixel 2 XL","Pixel 2","Nexus 6P","Nexus 6","Nexus 5X","Nexus 5","Nexus 4","Moto G4","LG Optimus L70","Microsoft Lumia 950","Microsoft Lumia 550","Nokia Lumia 520","Nokia N9","BlackBerry Z30"]},Y=(e,t=!1)=>{let r=["chromium"];return t&&r.push("webkit"),He[e].map(i=>Ge[i]).filter(i=>i.defaultBrowserType&&r.includes(i.defaultBrowserType))};var Kt={desktop:{label:"Desktop",type:"desktop",devices:Y("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:Y("mobile")}},Vt={desktop:{label:"Desktop",type:"desktop",devices:Y("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:Y("mobile",!0)}};var be=Object.freeze(["lite","standard","pro"]);function we(e){return typeof e=="string"&&be.includes(e)}var re=1,ie="SHIPLIGHT_TIER_MAP",ne="WEB_AGENT_TIER",Ve=Object.freeze(["WEB_AGENT_MODEL","WEB_AGENT_FALLBACK_MODELS","COMPUTER_USE_MODEL"]),oe=ze({version:re,defaultTier:"lite",tiers:{lite:{webagent:{primary:"google:gemini-3-flash-preview",fallbacks:["anthropic:claude-haiku-4-5","openai:gpt-5.6-luna"]}},standard:{webagent:{primary:"google:gemini-3.5-flash",fallbacks:["anthropic:claude-sonnet-5","openai:gpt-5.6-terra"]}},pro:{webagent:{primary:"anthropic:claude-opus-4-8",fallbacks:["openai:gpt-5.6-sol","anthropic:claude-opus-4-7"]}}},computerUse:{primary:"google:gemini-3-flash-preview",fallbacks:[]}});function ze(e){if(e!==null&&typeof e=="object"){for(let t of Object.values(e))ze(t);Object.freeze(e)}return e}function te(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function je(e){if(!te(e))return;let{primary:t,fallbacks:r}=e;if(!(typeof t!="string"||t.trim()!==t||t==="")){if(r===void 0)return{primary:t,fallbacks:[]};if(Array.isArray(r)&&r.every(i=>typeof i=="string"&&i.trim()===i&&i!==""))return{primary:t,fallbacks:[...r]}}}function Se(e){if(!te(e)||e.version!==re||!we(e.defaultTier)||!te(e.tiers))return;let t={};for(let i of be){let n=e.tiers[i];if(!te(n))return;let a=je(n.webagent);if(!a)return;t[i]={webagent:a}}let r=je(e.computerUse);if(r)return{version:re,defaultTier:e.defaultTier,tiers:t,computerUse:r}}function Je(e){if(e)try{return Se(JSON.parse(e))}catch{return}}function Ke(e){return{primary:e.primary,fallbacks:[...e.fallbacks]}}function ae(e){let t=Je(e[ie]),r=t??oe,i=t?"server":"baked",n=e[ne]||void 0,a=we(n)?n:void 0,o=n!==void 0&&a===void 0?n:void 0,s=a??r.defaultTier,l=a?"env":i==="server"?"org-default":"baked-default",u=Ve.filter(_=>!!e[_]);return{tier:s,tierSource:l,mapSource:i,webagent:Ke(r.tiers[s].webagent),computerUse:Ke(r.computerUse),ignoredEnvVars:[...u],...o!==void 0&&{invalidTier:o}}}function ve(e){return!!(e.GOOGLE_API_KEY||xe(e)||e.ANTHROPIC_API_KEY||e.OPENAI_API_KEY)}function xe(e){let t=e.GOOGLE_GENAI_USE_VERTEXAI;return(t==="true"||t==="True")&&!!e.GOOGLE_CLOUD_PROJECT}function se(e){return!e.SHIPLIGHT_API_TOKEN||ve(e)?!1:!!(e[ie]||e[ne])}var zt=Object.freeze([...oe.tiers.standard.webagent.fallbacks]);var qt=require("yaml");var le=R(require("path"),1),et=require("crypto"),q=require("yaml");var ue=require("fs"),V=require("path"),X=require("yaml"),rt=require("fs"),D=require("path");var Ze=5e3;function Zt(e){let t=e.frame_path;return!t||t.length===0?"page":`page.frameLocator('${t[0]}')`}function Qt(e){let t=e.xpath;return typeof t=="string"&&t.trim()?!t.startsWith("xpath=")&&!t.startsWith("/")&&!t.startsWith("//")?`xpath=//${t}`:t.startsWith("xpath=")?t:`xpath=${t}`:null}function Qe(e){let t=Zt(e),r=e.locator;if(typeof r=="string"&&r.trim())return r=r.trim(),r.endsWith("first()")?`${t}.${r}`:`${t}.${r}.first()`;let i=Qt(e);if(i){let n=JSON.stringify(i);return`${t}.locator(${n}).first()`}return null}var I=new Map;function f(e,t){I.set(e,t)}function H(e,t,r=[]){let i=[...r];return t.locator?i.push(`locator: ${JSON.stringify(t.locator)}`):t.xpath&&i.push(`xpath: ${JSON.stringify(t.xpath)}`),t.frame_path&&t.frame_path.length>0&&i.push(`frame_path: ${JSON.stringify(t.frame_path)}`),i.length===0?[`await agent.execAction("${e}", page, {});`]:[`await agent.execAction("${e}", page, {`,...i.map(n=>` ${n},`),"});"]}f("click",e=>{let t=Qe(e);if(!t)return['await agent.execAction("click", page, {});'];let r=e.action_data?.kwargs?.timeout_ms??Ze;return[`await ${t}.click({ timeout: ${r} });`]});f("click_element",I.get("click"));f("click_element_by_index",I.get("click"));f("double_click",e=>H("double_click",e));f("double_click_on_element",I.get("double_click"));f("right_click",e=>H("right_click",e));f("right_click_on_element",I.get("right_click"));f("hover",e=>H("hover",e));f("hover_element_by_index",I.get("hover"));f("input_text",e=>{let t=e.action_data?.kwargs?.text??e.action_data?.kwargs?.value??"";return H("input_text",e,[`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`])});f("fill",I.get("input_text"));f("clear_input",e=>H("clear_input",e));f("press",e=>{let t=e.action_data?.kwargs?.keys;return[`await page.keyboard.press(${JSON.stringify(t)});`]});f("send_keys",I.get("press"));f("send_keys_on_element",e=>{let t=Qe(e),r=e.action_data?.kwargs?.keys||"";if(!t)return['await agent.execAction("send_keys_on_element", page, {',` action_data: { kwargs: { keys: ${JSON.stringify(r)} } },`,"});"];let i=e.action_data?.kwargs?.timeout_ms??Ze;return[`await ${t}.press(${JSON.stringify(r)}, { timeout: ${i} });`]});f("select_dropdown_option",e=>{let t=e.action_data?.kwargs?.text||e.action_data?.kwargs?.option||"";return H("select_dropdown_option",e,[`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`])});f("scroll",e=>{let t=e.action_data?.kwargs?.down??!0;return[`await page.evaluate('window.scrollBy(0, window.innerHeight * ${(e.action_data?.kwargs?.num_pages??1)*(t?1:-1)})');`]});f("scroll_down",I.get("scroll"));f("scroll_up",I.get("scroll"));f("scroll_element",I.get("scroll"));f("scroll_to_text",e=>{let t=e.action_data?.kwargs?.text||"";return[`await page.getByText(${JSON.stringify(t)}, { exact: false }).first().scrollIntoViewIfNeeded();`]});f("scroll_on_element",e=>H("scroll_on_element",e,[`action_data: { kwargs: ${JSON.stringify(e.action_data?.kwargs||{})} }`]));f("go_to_url",e=>{let t=e.action_data?.kwargs?.url||"";return e.action_data?.kwargs?.new_tab===!0?['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { url: ${JSON.stringify(t)}, new_tab: true } },`,"});"]:['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { url: ${JSON.stringify(t)} } },`,"});"]});f("open_tab",I.get("go_to_url"));f("go_back",()=>['await agent.execAction("go_back", page, {});']);f("reload_page",()=>['await agent.execAction("reload_page", page, {});']);f("wait",e=>[`await page.waitForTimeout(${(e.action_data?.kwargs?.seconds||1)*1e3});`]);f("wait_for_page_ready",()=>["await page.waitForLoadState('domcontentloaded');"]);f("verify",(e,t)=>{let r=e.action_data?.kwargs,i=typeof r?.code=="string",n=i?r?.statement||e.action_description:e.action_description||r?.statement;if(i&&n){let o=r.code.split(`
|
|
2
2
|
`),s=JSON.stringify(n);return["{ const _t = Date.now(); try {",...o.map(l=>` ${l}`),` console.log(\`[VERIFY:JS] \u2713 \${((Date.now()-_t)/1000).toFixed(1)}s: ${s}\`);`,"} catch (_e) {",` console.log(\`[VERIFY:JS\u2192AI] JS failed \${((Date.now()-_t)/1000).toFixed(1)}s: (\${_e instanceof Error ? _e.message : String(_e)}), falling back to AI: ${s}\`);`,` await agent.assert(page, ${s}, ${JSON.stringify(t||"")});`,"} }"]}return i?r.code.split(`
|
|
3
3
|
`):n?[`await agent.assert(page, ${JSON.stringify(n)}, ${JSON.stringify(t||"")});`]:["// Skipping verify: missing statement or code"]});f("ai_assert",I.get("verify"));f("assert",I.get("verify"));f("ai_action",(e,t)=>{let r=e.action_data?.kwargs?.statement;if(!r)return["// Skipping ai_action: missing statement"];let i=JSON.stringify(r),n=e.action_data?.kwargs?.use_pure_vision;return[`await agent.execute(page, ${i}, '${t||""}', ${n});`]});f("ai_step",(e,t)=>{let r=e.action_data?.kwargs?.statement;return r?[`await agent.run(page, ${JSON.stringify(r)}, '${t||""}');`]:["// Skipping ai_step: missing statement"]});f("ai_extract",(e,t)=>{let r=e.action_data?.kwargs?.element_description,i=e.action_data?.kwargs?.variable_name;if(!r||!i)return["// Skipping ai_extract: missing element_description or variable_name"];let n=JSON.stringify(r),a=JSON.stringify(i);return[`await agent.extract(page, ${n}, ${a}, '${t||""}');`]});f("ai_wait_until",(e,t)=>{let r=e.action_data?.kwargs?.condition,i=e.action_data?.kwargs?.timeout_seconds||60;if(!r)return["// Skipping ai_wait_until: missing condition"];if(e.action_data?.kwargs?.condition_type==="JS_CODE"){let a=e.action_data?.kwargs?.js,o=typeof a=="string"?a:r,s=typeof a=="string"?`, ${JSON.stringify(r)}`:"";return[`await agent.waitForJs(page, async () => (${o}), ${i}, '${t||""}'${s});`]}return[`await agent.waitUntilCondition(page, ${JSON.stringify(r)}, ${i}, '${t||""}');`]});f("save_variable",e=>{let t=e.action_data?.kwargs?.name||"",r=e.action_data?.kwargs?.value;return['await agent.execAction("save_variable", page, {',` action_data: { kwargs: { name: ${JSON.stringify(t)}, value: ${JSON.stringify(r)} } },`,"});"]});f("js_code",e=>{let t=e.action_data?.kwargs?.code;if(!t)return["// Skipping js_code: missing code"];let r=["{"],i=t.split(`
|
|
4
|
-
`);for(let n of i)r.push(` ${n}`);return r.push("}"),r});f("function",(e,t,r)=>{let i=e.action_data?.kwargs||{},n=i.functionName;if(n&&n.includes("#")){let[o,s]=n.split("#");if(o&&s){let l=o.replace(/\.(ts|js|mjs)$/,"");if(
|
|
5
|
-
`):["// Skipping js_action: missing code"]});function
|
|
6
|
-
`);return e.codeStartLine!=null&&e.codeLine!=null?`<div class="step-code"><pre class="code-block">${t.map((n,a)=>{let o=e.codeStartLine+a,s=o===e.codeLine,l=String(o).padStart(4);return`<span class="code-line${s?" code-line-active":""}">${l} \u2502 ${A(n)}</span>`}).join("")}</pre></div>`:`<div class="step-code"><pre class="code-block">${t.map(i=>`<span class="code-line code-line-body">${A(i)}</span>`).join("")}</pre></div>`}function
|
|
4
|
+
`);for(let n of i)r.push(` ${n}`);return r.push("}"),r});f("function",(e,t,r)=>{let i=e.action_data?.kwargs||{},n=i.functionName;if(n&&n.includes("#")){let[o,s]=n.split("#");if(o&&s){let l=o.replace(/\.(ts|js|mjs)$/,"");if(le.default.isAbsolute(o))return[`throw new Error(${JSON.stringify(`Absolute paths are not supported in call: references. Use a path relative to the project root (got: "${o}")`)})`];if(!l.startsWith(".")&&r?.projectRoot&&r?.yamlDir){let g=le.default.resolve(r.projectRoot,l),d=le.default.relative(r.yamlDir,g).replace(/\\/g,"/");l=d.startsWith("..")?d:"./"+d}let u=`import { ${s} } from '${l}';`;r?.imports?.add(u);let _={...i,functionName:s},b=Ye(_);return b?[b.endsWith(";")?b:`${b};`]:["// Skipping function: invalid export pattern"]}}let a=Ye(i);return a?[a.endsWith(";")?a:`${a};`]:["// Skipping function: missing functionName"]});f("generate_2fa_code",e=>{let t=e.action_data?.kwargs?.otp_secret_key||"";return['await agent.execAction("generate_2fa_code", page, {',` action_data: { kwargs: { otp_secret_key: ${JSON.stringify(t)} } },`,"});"]});f("upload_file",e=>{let t=e.action_data?.kwargs||{},r=[],i={};return t.paths?i.paths=t.paths:t.path&&(i.path=t.path),t.use_file_input&&(i.use_file_input=!0),r.push(`action_data: { kwargs: ${JSON.stringify(i)} }`),e.locator?r.push(`locator: ${JSON.stringify(e.locator)}`):e.xpath&&r.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&r.push(`frame_path: ${JSON.stringify(e.frame_path)}`),['await agent.execAction("upload_file", page, {',...r.map(n=>` ${n},`),"});"]});f("wait_for_download_complete",e=>['await agent.execAction("wait_for_download_complete", page, {',` action_data: { kwargs: { timeout_seconds: ${e.action_data?.kwargs?.timeout_seconds||10} } },`,"});"]);f("switch_tab",e=>['await agent.execAction("switch_tab", page, {',` action_data: { kwargs: { page_id: ${e.action_data?.kwargs?.page_id??e.action_data?.kwargs?.tab_index??0} } },`,"});"]);f("close_tab",e=>{let t=e.action_data?.kwargs?.page_id;return t=t??e.action_data?.kwargs?.index,['await agent.execAction("close_tab", page, {',` action_data: { kwargs: { page_id: ${t} } },`,"});"]});f("set_date_for_native_date_picker",e=>{let t=e.action_data?.kwargs?.date??"",r=[];return r.push(`action_data: { kwargs: { date: ${JSON.stringify(t)} } }`),e.locator?r.push(`locator: ${JSON.stringify(e.locator)}`):e.xpath&&r.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&r.push(`frame_path: ${JSON.stringify(e.frame_path)}`),['await agent.execAction("set_date_for_native_date_picker", page, {',...r.map(i=>` ${i},`),"});"]});f("done",()=>["// Done - no action needed"]);function ke(e,t){let r=t.action_data?.kwargs||{},i=[];return typeof r.relative_x=="number"&&typeof r.relative_y=="number"?(i.push(`action_data: { kwargs: { relative_x: ${r.relative_x}, relative_y: ${r.relative_y} } }`),t.locator?i.push(`locator: ${JSON.stringify(t.locator)}`):t.xpath&&i.push(`xpath: ${JSON.stringify(t.xpath)}`),t.frame_path&&t.frame_path.length>0&&i.push(`frame_path: ${JSON.stringify(t.frame_path)}`)):typeof r.x=="number"&&typeof r.y=="number"&&i.push(`action_data: { kwargs: { x: ${r.x}, y: ${r.y} } }`),[`await agent.execAction("${e}", page, {`,...i.map(n=>` ${n},`),"});"]}f("click_by_coordinates",e=>ke("click_by_coordinates",e));f("right_click_by_coordinates",e=>ke("right_click_by_coordinates",e));f("double_click_by_coordinates",e=>ke("double_click_by_coordinates",e));f("drag_drop",e=>{let t=e.action_data?.kwargs||{},r={};typeof t.relative_x=="number"&&(r.relative_x=t.relative_x),typeof t.relative_y=="number"&&(r.relative_y=t.relative_y),typeof t.delta_x=="number"&&(r.delta_x=t.delta_x),typeof t.delta_y=="number"&&(r.delta_y=t.delta_y),typeof t.coord_source_x=="number"&&(r.coord_source_x=t.coord_source_x),typeof t.coord_source_y=="number"&&(r.coord_source_y=t.coord_source_y),typeof t.coord_target_x=="number"&&(r.coord_target_x=t.coord_target_x),typeof t.coord_target_y=="number"&&(r.coord_target_y=t.coord_target_y);let i=[`action_data: { kwargs: ${JSON.stringify(r)} }`];return e.locator?i.push(`locator: ${JSON.stringify(e.locator)}`):e.xpath&&i.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&i.push(`frame_path: ${JSON.stringify(e.frame_path)}`),['await agent.execAction("drag_drop", page, {',...i.map(n=>` ${n},`),"});"]});f("get_dropdown_options",e=>{let t=[];return e.xpath&&t.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&t.push(`frame_path: ${JSON.stringify(e.frame_path)}`),t.length===0?['await agent.execAction("get_dropdown_options", page, {});']:['await agent.execAction("get_dropdown_options", page, {',...t.map(r=>` ${r},`),"});"]});f("extract_email_content",e=>{let t=e.action_data?.kwargs||{};return['await agent.execAction("extract_email_content", page, {',` action_data: { kwargs: ${JSON.stringify(t)} },`,"});"]});f("js_action",e=>{let t=e.action_data?.kwargs?.code;return t?t.split(`
|
|
5
|
+
`):["// Skipping js_action: missing code"]});function Ye(e){let t=e.functionName;if(!t)return null;let r=Array.isArray(e.args)?e.args.map(String):Array.isArray(e.parameterValues)?e.parameterValues.map(String):[];if(r.length===0)return`await ${t}()`;let i=["page","testContext","request","agent"],n=["undefined","null","true","false"],a=r.map(o=>i.includes(o)||n.includes(o)||/^-?\d+(\.\d+)?$/.test(o)?o:o.startsWith("$")?`agent.agentServices.readVariable('${o.substring(1)}')`:`"${o}"`);return`await ${t}(${a.join(", ")})`}var Xe=5;function tt(e,t,r){let i={expandingPaths:new Set([(0,V.resolve)(t)]),depth:0,referencedPaths:new Set,basePath:r},n={...e};Array.isArray(n.statements)&&(n.statements=F(n.statements,t,i)),Array.isArray(n.teardown)&&(n.teardown=F(n.teardown,t,i));for(let a of["beforeAll","afterAll","beforeEach","afterEach"])Array.isArray(n[a])&&(n[a]=F(n[a],t,i));return{doc:n,referencedTemplatePaths:Array.from(i.referencedPaths)}}function F(e,t,r){let i=[];for(let n of e)if(er(n)){let a=tr(n,t,r);i.push(a)}else i.push(rr(n,t,r));return i}function er(e){return typeof e=="object"&&e!==null&&typeof e.template=="string"}function tr(e,t,r){if(r.depth>=Xe)throw new Error(`Template expansion exceeded maximum depth of ${Xe}. Check for deeply nested or circular template references.`);let i=(0,V.resolve)((0,V.dirname)(t),e.template),n=!(0,ue.existsSync)(i)&&r.basePath?(0,V.resolve)(r.basePath,e.template):i;if(r.expandingPaths.has(n))throw new Error(`Circular template reference detected: ${n} is already being expanded. Stack: ${Array.from(r.expandingPaths).join(" \u2192 ")} \u2192 ${n}`);r.referencedPaths.add(n);let a;try{a=(0,ue.readFileSync)(n,"utf-8")}catch(k){throw new Error(`Failed to read template file: ${n} (referenced from ${t}): ${k.message}`)}let o=(0,X.parse)(a);if(!o||typeof o!="object")throw new Error(`Invalid template file: ${n} \u2014 expected a YAML object`);let s=o.params||[],l=e.params||{};for(let k of s)if(!(k in l))throw new Error(`Template ${e.template} requires param "${k}" but it was not provided. Required params: [${s.join(", ")}]`);let u=o.statements;if(!Array.isArray(u))throw new Error(`Template ${e.template} must have a "statements" array`);if(Object.keys(l).length>0){let y=(0,X.stringify)(u);for(let[$,p]of Object.entries(l))y=y.split(`<<${$}>>`).join(String(p));u=(0,X.parse)(y)}let _={expandingPaths:new Set([...r.expandingPaths,n]),depth:r.depth+1,referencedPaths:r.referencedPaths},b=F(u,n,_),d={STEP:o.name||e.template.replace(/\.yaml$/,"").split("/").pop()||e.template,template_path:e.template,statements:b};return Object.keys(l).length>0&&(d.template_params=l),d}function rr(e,t,r){if(typeof e!="object"||e===null)return e;let i={...e};return Array.isArray(i.statements)&&(i.statements=F(i.statements,t,r)),Array.isArray(i.THEN)&&(i.THEN=F(i.THEN,t,r)),Array.isArray(i.ELSE)&&(i.ELSE=F(i.ELSE,t,r)),Array.isArray(i.DO)&&(i.DO=F(i.DO,t,r)),i}var ce=new Map;function ir(e){let t=[],r=e;for(;;){let i=ce.get(r);if(i!==void 0){for(let a of t)ce.set(a,i);return i}if(t.push(r),(0,rt.existsSync)((0,D.join)(r,".git"))){for(let a of t)ce.set(a,r);return r}let n=(0,D.dirname)(r);if(n===r){for(let a of t)ce.set(a,null);return null}r=n}}function qe(e){return e.split(/[\\/]/).join("/")}function nr(e){if(!(0,D.isAbsolute)(e))return qe(e);let t=ir((0,D.dirname)(e));return qe(t?(0,D.relative)(t,e):e)}var it=class extends Error{constructor(e){super(e),this.name="YamlValidationError"}};function nt(e,t,r){let i=(0,q.parse)(e),n=i?.name,a=i?.tags,o=i?.use;if(i&&(i.name!==void 0||i.tags!==void 0||i.use!==void 0)&&(delete i.name,delete i.tags,delete i.use),i?.suite){if(i.goal||i.statements)throw new it('YAML file cannot have both "suite" and top-level "goal"/"statements". Use either suite format or single-test format.');return ar(i,n,a,o,t,r)}return or(i,n,a,o,t,r)}function or(e,t,r,i,n,a){let o=e?.beforeEach,s=e?.afterEach,l=ot(e?.parameters),u=e?.timeout,_=e?.skip,b=e?.fail,g=e?.only,d=e?.slow;if(e&&(delete e.beforeEach,delete e.afterEach,delete e.parameters,delete e.timeout,delete e.skip,delete e.fail,delete e.only,delete e.slow),e?.url)throw new it(`The "url" field is not supported in local YAML tests. Use "base_url: ${e.url}" and add "- URL: /" as the first statement instead.`);e&&!e.goal&&t&&(e.goal=t);let k=[];if(n&&e&&typeof e=="object"){let p=tt(e,n,a);e=p.doc,k=p.referencedTemplatePaths}let y=(0,q.stringify)(e),$=W(y);return n&&(B($.statements??[],n,"main"),$.teardown&&B($.teardown,n,"teardown")),{testFlow:$,name:t,tags:r,use:i,beforeEach:o,afterEach:s,parameters:l,timeout:u,skip:_,fail:b,only:g,slow:d,referencedTemplatePaths:k}}function ar(e,t,r,i,n,a){let o=e.suite;if(!Array.isArray(o.tests)||o.tests.length===0)throw new Error('Suite must have a non-empty "tests" array.');let s=o.beforeAll,l=o.afterAll,u=o.beforeEach,_=o.afterEach,b=[],g=o.tests.map((y,$)=>{if(!y.name)throw new Error('Each test in a suite must have a "name" field.');if(!Array.isArray(y.statements)||y.statements.length===0)throw new Error(`Suite test "${y.name}" must have a non-empty "statements" array.`);let p={goal:y.name,statements:y.statements};y.teardown&&(p.teardown=y.teardown);let h=[],m=p;if(n&&typeof p=="object"){let M=tt(p,n,a);m=M.doc,h=M.referencedTemplatePaths,b.push(...h)}let w=(0,q.stringify)(m),T=W(w);if(n){let M=`tests[${$}]`;B(T.statements??[],n,M),T.teardown&&B(T.teardown,n,`${M}.teardown`)}let S=ot(y.parameters);return{testFlow:T,name:y.name,tags:Array.isArray(y.tags)?y.tags:void 0,parameters:S,timeout:y.timeout,skip:y.skip,fail:y.fail,only:y.only,slow:y.slow}}),d=o.base_url??e.base_url,k=d?{...i,baseURL:d}:i;return{suite:{beforeAll:s,afterAll:l,beforeEach:u,afterEach:_,tests:g},name:t,tags:r,use:k,referencedTemplatePaths:b}}function ot(e){if(!(!Array.isArray(e)||e.length===0))return e.map((t,r)=>{if(!t.name)throw new Error(`Parameter set at index ${r} must have a "name" field.`);if(!t.values||typeof t.values!="object")throw new Error(`Parameter set "${t.name}" must have a "values" object.`);return{name:t.name,values:t.values}})}function B(e,t,r){for(let i=0;i<e.length;i++){let n=e[i],a=`${r}.${i}`,o=n.description||"";if(n.uid=sr(t,a,o),n.type===G.STEP)B(n.statements,t,a);else if(n.type===G.IF_ELSE){let s=n;B(s.then,t,`${a}.then`),s.else&&B(s.else,t,`${a}.else`)}else n.type===G.WHILE_LOOP&&B(n.body,t,`${a}.body`)}}function sr(e,t,r){let i=nr(e),n=(0,et.createHash)("sha256").update(`${i}:${t}:${r}`).digest("hex");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20,32)}`}var Ae=R(require("path"),1);function cr(e){switch(e){case"env":return"from WEB_AGENT_TIER";case"org-default":return"org default";case"baked-default":return"built-in default"}return e}function A(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function de(e){if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;let t=Math.floor(e/6e4),r=(e%6e4/1e3).toFixed(0);return`${t}m ${r}s`}function lr(e){return`passed after ${e||"?"} ${e===1?"retry":"retries"}`}function ur(e,t){let r=e||"?",i=e===1?"retry":"retries";return t==="passed"?`passed after ${r} ${i}`:`failed after ${r} ${i}`}function pe(e){switch(e){case"passed":case"success":return'<span class="status-icon passed">✔</span>';case"flaky":return'<span class="status-icon flaky">↻</span>';case"failed":case"failure":case"timedOut":return'<span class="status-icon failed">✘</span>';case"skipped":return'<span class="status-icon skipped">─</span>';case"interrupted":return'<span class="status-icon failed">⚠</span>';default:return'<span class="status-icon pending">○</span>'}}function pr(e){return`<span class="badge badge-${e}">${e}</span>`}function dr(e){if(!e.code)return"";let t=e.code.split(`
|
|
6
|
+
`);return e.codeStartLine!=null&&e.codeLine!=null?`<div class="step-code"><pre class="code-block">${t.map((n,a)=>{let o=e.codeStartLine+a,s=o===e.codeLine,l=String(o).padStart(4);return`<span class="code-line${s?" code-line-active":""}">${l} \u2502 ${A(n)}</span>`}).join("")}</pre></div>`:`<div class="step-code"><pre class="code-block">${t.map(i=>`<span class="code-line code-line-body">${A(i)}</span>`).join("")}</pre></div>`}function fr(e){let t=e.duration!=null?`<span class="step-duration">${de(e.duration)}</span>`:"",r=pe(e.status);if(e.screenshot||e.message||e.error||e.code){let n="";e.screenshot&&(n=`<img src="${A(e.screenshot)}" alt="Step screenshot" class="step-screenshot" />`);let a=e.screenshot?"":dr(e),o="";e.error&&(o=`<div class="step-error"><pre>${A(e.error)}</pre></div>`);let s="";e.message&&!e.error&&(s=`<div class="step-message">${A(e.message)}</div>`);let l=e.status==="failure"?" open":"";return`
|
|
7
7
|
<details class="step-details step step-${e.status}"${l}>
|
|
8
8
|
<summary class="step-header">
|
|
9
9
|
${r}
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
<span class="step-description">${A(e.description)}</span>
|
|
27
27
|
${t}
|
|
28
28
|
</div>
|
|
29
|
-
</div>`}function
|
|
29
|
+
</div>`}function hr(e,t,r,i){let n=[];e&&n.push(`
|
|
30
30
|
<details class="artifact-section">
|
|
31
31
|
<summary class="artifact-summary">Video</summary>
|
|
32
32
|
<div class="artifact-content">
|
|
@@ -58,38 +58,38 @@
|
|
|
58
58
|
<p class="trace-hint">Run this command in your terminal to open the interactive Trace Viewer</p>
|
|
59
59
|
<p class="trace-hint"><a href="${A(t)}" class="attachment-link" download>Download trace.zip</a></p>
|
|
60
60
|
</div>
|
|
61
|
-
</details>`)}return n.length===0?"":`<div class="test-artifacts">${n.join("")}</div>`}function
|
|
62
|
-
`),o="";t&&!e.some(l=>l.error)&&(o=`<div class="test-error"><pre>${A(t)}</pre></div>`);let s=
|
|
61
|
+
</details>`)}return n.length===0?"":`<div class="test-artifacts">${n.join("")}</div>`}function at(e,t,r,i,n){let a=e.map(fr).join(`
|
|
62
|
+
`),o="";t&&!e.some(l=>l.error)&&(o=`<div class="test-error"><pre>${A(t)}</pre></div>`);let s=hr(r,i,e,n);return`
|
|
63
63
|
${o}
|
|
64
64
|
<div class="steps-list">
|
|
65
65
|
${a||'<div class="no-steps">No YAML step details available</div>'}
|
|
66
66
|
</div>
|
|
67
|
-
${s}`}function
|
|
67
|
+
${s}`}function gr(e,t){let r=e.flaky?"flaky":e.status,i=pe(r),n;if(e.attempts&&e.attempts.length>1){let a=`tabs-${t}`,s=e.attempts.length-1,l=e.attempts.map((g,d)=>{let k=d===s,y=g.status==="passed"?"passed":"failed",$=`Attempt ${g.attemptNumber}`;return`<button class="attempt-tab ${k?"active":""} attempt-tab-${y}"
|
|
68
68
|
onclick="switchAttemptTab('${a}', ${d})"
|
|
69
|
-
data-tab-index="${d}">${
|
|
69
|
+
data-tab-index="${d}">${pe(y)} ${$} <span class="attempt-tab-badge badge-${y}">${g.status}</span></button>`}).join(""),u=e.attempts.map((g,d)=>{let k=d===s,y=at(g.steps,g.error,g.videoPath,g.tracePath,`${t}-attempt-${d}`);return`<div class="attempt-panel ${k?"active":""}" data-panel-index="${d}">
|
|
70
70
|
<div class="attempt-meta">
|
|
71
|
-
${
|
|
72
|
-
<span class="attempt-meta-text">Attempt ${g.attemptNumber} — ${g.status} in ${
|
|
71
|
+
${pe(g.status==="passed"?"passed":"failed")}
|
|
72
|
+
<span class="attempt-meta-text">Attempt ${g.attemptNumber} — ${g.status} in ${de(g.duration)}</span>
|
|
73
73
|
</div>
|
|
74
74
|
${y}
|
|
75
|
-
</div>`}).join(""),_=e.flaky?`Flaky — ${
|
|
75
|
+
</div>`}).join(""),_=e.flaky?`Flaky — ${lr(e.retries)}`:`Retried — ${ur(e.retries,e.status)}`;n=`
|
|
76
76
|
<div class="${e.flaky?"flaky-note":"retried-note"}">${_}</div>
|
|
77
77
|
<div class="attempt-tabs" id="${a}">
|
|
78
78
|
<div class="attempt-tab-bar">${l}</div>
|
|
79
79
|
${u}
|
|
80
|
-
</div>`}else n=
|
|
80
|
+
</div>`}else n=at(e.steps,e.error,e.videoPath,e.tracePath,String(t));return`
|
|
81
81
|
<details class="test-details" ${e.status==="failed"||e.status==="timedOut"?"open":""}>
|
|
82
82
|
<summary class="test-summary test-${r}">
|
|
83
83
|
${i}
|
|
84
84
|
<span class="test-title">${A(e.title)}</span>
|
|
85
85
|
<span class="test-file">${A(e.file)}</span>
|
|
86
|
-
${
|
|
87
|
-
<span class="test-duration">${
|
|
86
|
+
${pr(r)}
|
|
87
|
+
<span class="test-duration">${de(e.duration)}</span>
|
|
88
88
|
</summary>
|
|
89
89
|
<div class="test-body">
|
|
90
90
|
${n}
|
|
91
91
|
</div>
|
|
92
|
-
</details>`}function
|
|
92
|
+
</details>`}function st(e,t){return!e||!t||Ae.default.isAbsolute(e)?e:Ae.default.join(t,e)}function mr(e,t){return t?{...e,tracePath:st(e.tracePath,t),attempts:e.attempts?.map(r=>({...r,tracePath:st(r.tracePath,t)}))}:e}function ct(e){let t=e.tests.filter(u=>u.flaky).length,r=e.tests.filter(u=>!u.flaky&&u.retries!=null&&u.retries>0).length,i=e.tests.filter(u=>u.status==="passed"&&!u.flaky).length,n=e.tests.filter(u=>u.status==="failed"||u.status==="timedOut").length,a=e.tests.filter(u=>u.status==="skipped").length,o=e.tests.length,l=e.tests.map(u=>mr(u,e.outputDir)).map((u,_)=>gr(u,_)).join(`
|
|
93
93
|
`);return`<!DOCTYPE html>
|
|
94
94
|
<html lang="en">
|
|
95
95
|
<head>
|
|
@@ -739,7 +739,7 @@
|
|
|
739
739
|
${r>0?`<span class="summary-stat retried">${r} retried</span>`:""}
|
|
740
740
|
${n>0?`<span class="summary-stat failed">${n} failed</span>`:""}
|
|
741
741
|
${a>0?`<span class="summary-stat skipped">${a} skipped</span>`:""}
|
|
742
|
-
<span class="summary-stat">${
|
|
742
|
+
<span class="summary-stat">${de(e.totalDuration)}</span>
|
|
743
743
|
${e.timestamp?`<span class="summary-stat" style="margin-left:auto;color:var(--color-text-secondary)">${new Date(e.timestamp).toLocaleString()}</span>`:""}
|
|
744
744
|
</div>
|
|
745
745
|
</div>${e.cacheSummary?`
|
|
@@ -756,7 +756,7 @@
|
|
|
756
756
|
${l}
|
|
757
757
|
</div>
|
|
758
758
|
<div class="footer">
|
|
759
|
-
Generated by Shiplight Reporter${e.shiplightVersion?` \xB7 shiplightai v${A(e.shiplightVersion)}`:""}${e.modelTierProvenance?` \xB7 tier: ${A(e.modelTierProvenance.tier)} (${A(
|
|
759
|
+
Generated by Shiplight Reporter${e.shiplightVersion?` \xB7 shiplightai v${A(e.shiplightVersion)}`:""}${e.modelTierProvenance?` \xB7 tier: ${A(e.modelTierProvenance.tier)} (${A(cr(e.modelTierProvenance.tierSource))}) \u2192 ${A(e.modelTierProvenance.webagentPrimary)} [${e.modelTierProvenance.mapSource==="server"?"org settings":"built-in defaults"}]`:""}
|
|
760
760
|
</div>
|
|
761
761
|
</div>
|
|
762
762
|
|
|
@@ -883,9 +883,9 @@
|
|
|
883
883
|
});
|
|
884
884
|
</script>
|
|
885
885
|
</body>
|
|
886
|
-
</html>`}var ct=D(require("fs"),1),ke=D(require("path"),1),lt=require("glob");function ur(e){let t=e.toLowerCase();return t.includes("claude")||t.includes("anthropic")?"anthropic":t.includes("gemini")||t.includes("google")?"gemini":t.startsWith("gpt")||t.startsWith("o1")||t.startsWith("o3")||t.startsWith("o4")||t.includes("openai")?"openai":"unknown"}function pr(e){switch(e.actionType){case"execute":case"run":return"action";case"generate":return"draft";case"assert":return"verify_ai";case"evaluate":return e.conditionKind==="while"?"evaluate_while":e.conditionKind==="wait_until"?"evaluate_wait_until":"evaluate_if";default:return null}}function ot(e,t){let r=e[t];return typeof r=="number"?r:0}function dr(e,t,r,i){return`${e}\0${t}\0${r}\0${i}`}function at(e,t={}){let r=t.routing??"proxy",i=t.providerOf??ur,n=new Map;for(let o of e??[]){let s=pr(o);if(s)for(let l of o.tokenUsages??[]){let u=l.model??"unknown",_=i(u),b=dr(s,_,u,r),g=n.get(b);g||(g={operation:s,provider:_,model:u,routing:r,calls:0,input_tokens:0,output_tokens:0,thinking_tokens:0,cache_read_tokens:0},n.set(b,g)),g.calls+=1,g.input_tokens+=l.prompt_tokens||0,g.output_tokens+=l.completion_tokens||0,g.thinking_tokens+=ot(l,"thinking_tokens"),g.cache_read_tokens+=ot(l,"cache_read_tokens")}}return{by_operation:Array.from(n.values()).sort((o,s)=>o.operation!==s.operation?o.operation.localeCompare(s.operation):o.provider!==s.provider?o.provider.localeCompare(s.provider):o.model.localeCompare(s.model))}}var fr=D(require("dotenv"),1),hr="__shiplightDotenvCache__";function gr(){return globalThis[hr]}function pe(){let e=gr();return e===void 0?process.env:e}function mr(e){if(!e)return!1;let t=e.trim().toLowerCase();return t==="1"||t==="true"||t==="yes"||t==="on"}var st={anthropic:e=>e.ANTHROPIC_API_KEY||mr(e.ANTHROPIC_MODELS_USE_VERTEXAI)?"byok":"proxy",gemini:e=>{let t=e.GOOGLE_GENAI_USE_VERTEXAI;return e.GOOGLE_API_KEY||t==="True"||t==="true"?"byok":"proxy"},openai:e=>e.OPENAI_API_KEY?e.OPENAI_BASE_URL?"custom_endpoint":"byok":"proxy"},yr=/^(gpt-|o\d|chatgpt-)/;function _r(e,t){return e!=="unknown"?e:yr.test(t)?"openai":"unknown"}function br(e,t){let r=t.SHIPLIGHT_USAGE_ROUTING;if(r==="proxy"||r==="byok"||r==="custom_endpoint")return r;let i=st[e];return i?i(t):Object.values(st).some(a=>a(t)!=="proxy")?"byok":"proxy"}function ut(e,t){let r=t?.length?t:[ke.join(e,"test-results")],i=[];for(let s of r){let l;try{l=(0,lt.globSync)("**/ai-actions.json",{cwd:s})}catch{continue}for(let u of l)try{let _=JSON.parse(ct.readFileSync(ke.join(s,u),"utf-8"));Array.isArray(_)&&i.push(..._)}catch{}}if(i.length===0)return;let n=pe(),a=at(i,{routing:"proxy"}),o=a.by_operation.map(s=>{let l=_r(s.provider,s.model);return{...s,provider:l,routing:br(l,n)}});return o.sort(wr),o.length>0?{...a,by_operation:o}:void 0}function pt(e){let t=new Map;for(let r of e){if(!r.stepId||r.tokenUsages.length===0)continue;let i=t.get(r.stepId)??[];for(let n of r.tokenUsages)i.push({model:n.model,promptTokens:n.prompt_tokens,completionTokens:n.completion_tokens,totalTokens:n.total_tokens});t.set(r.stepId,i)}return t}function wr(e,t){return e.operation!==t.operation?e.operation.localeCompare(t.operation):e.provider!==t.provider?e.provider.localeCompare(t.provider):e.model!==t.model?e.model.localeCompare(t.model):e.routing.localeCompare(t.routing)}var de=class{records=new Map;recordStatementSource(t,r,i,n,a,o){this.records.set(t,{statement_hash:t,statement_path:r,description:i,source:n,original_action_entity:a,cached_action_entity:n==="cache_hit"?o:void 0})}recordHealedEntities(t,r){for(let[i,n]of t){let a=r.get(i);if(!a)continue;let o=this.records.get(a);o&&((o.source==="original"||o.source==="cache_hit")&&(o.pre_heal_source=o.source),o.source="healed",o.healed_action_entity=n,o.heal_reason=Sr(o.original_action_entity,n))}}recordFailed(t){let r=this.records.get(t);r&&(r.source="failed")}getStatementDetails(){return Array.from(this.records.values())}getSummary(){let t=0,r=0,i=0,n=0,a=0;for(let o of this.records.values())switch(o.source){case"original":t++;break;case"cache_hit":r++;break;case"healed":i++,o.pre_heal_source==="cache_hit"&&n++;break;case"failed":a++;break}return{total_statements:this.records.size,original:t,cache_hits:r,healed:i,healed_from_cache:n,failed:a}}getConsoleSummary(){let t=this.getSummary();if(t.total_statements===0)return"";let r=[];return t.cache_hits>0&&r.push(`${t.cache_hits} cached`),t.healed>0&&r.push(`${t.healed} healed`),t.original>0&&r.push(`${t.original} original`),t.failed>0&&r.push(`${t.failed} failed`),`[Shiplight Cache] ${r.join(", ")}`}};function Sr(e,t){if(!e||!t)return;let r=e.locator!==t.locator||e.xpath!==t.xpath,i=e.action_data?.action_name!==t.action_data?.action_name;if(r&&i)return"both";if(r)return"locator_changed";if(i)return"action_changed"}var dt="__shiplightRunCacheMetadata__";function Ae(){let e=globalThis;return e[dt]??(e[dt]={})}function ft(){let e=Ae();return e.collector??=new de,e.collector}function ht(){let e=Ae();return e.cacheInPlay===!0&&e.incomplete!==!0&&e.collector!==void 0&&e.collector.getSummary().total_statements>0}function gt(e){let t=Ae();if(!t.collector||e.size===0)return;let r=new Map;for(let i of e.keys())r.set(i,i);t.collector.recordHealedEntities(e,r)}function mt(e){if(!ae(e))return;let t=oe(e);return{tier:t.tier,tierSource:t.tierSource,mapSource:t.mapSource,webagentPrimary:t.webagent.primary,computerUsePrimary:t.computerUse.primary,...t.invalidTier!==void 0&&{invalidTier:t.invalidTier}}}var yt="0.1.96",_t=yt!=="dev"?yt:void 0;var Do=3600*1e3,Ro=10080*60*1e3;var xr={before:0,main:1,teardown:2,after:3};function bt(e){let t=e.split(".")[0];return xr[t]??1}function wt(e){return e.split(".").map(t=>{let r=Number(t);return Number.isNaN(r)?0:r})}function kr(e){return[...e].sort(([t],[r])=>{let i=bt(t),n=bt(r);if(i!==n)return i-n;let a=wt(t),o=wt(r);for(let s=0;s<Math.max(a.length,o.length);s++){let l=a[s]??-1,u=o[s]??-1;if(l!==u)return l-u}return 0})}function Ar(e){let t=new Set;for(let r of e)if(t.add(r.category),r.category==="hook")for(let i of r.steps)t.add(i.category);return t}function Tr(e,t){let r=e.toLowerCase();return r.includes("before")?"before":r.includes("after")?"after":t}function Te(e,t="main",r,i,n){r===void 0&&(r=!Ar(e).has("test.step")),n||(n=new Map);let a=[];for(let o of e){if(o.category==="fixture"||o.category==="test.attach")continue;if(o.category==="hook"){let l=Tr(o.title,t);a.push(...Te(o.steps,l,r,i,n));continue}if(o.category==="test.step"||r&&(o.category==="expect"||o.category==="pw:api")){let l=n.get(t)??0;n.set(t,l+1);let u=`${t}.${l}`,_={stepId:u,description:o.title,status:o.error?"failure":o.duration===-1?"skipped":"success",duration:o.duration>=0?o.duration:void 0};o.error&&(_.error=o.error.message??o.error.stack),i&&o.location&&i.set(u,o.location),a.push(_),o.steps.length>0&&a.push(...Te(o.steps,u,r,i,n))}}return a}function Er(e,t){let r=v.isAbsolute(e)?e:v.join(process.cwd(),e),i=v.join(r,"latest");try{if(x.lstatSync(i).isSymbolicLink())x.unlinkSync(i);else{console.warn("[report] 'latest' exists and is not a symlink; skipping update");return}}catch{}try{process.platform==="win32"?x.symlinkSync(v.join(r,t),i,"junction"):x.symlinkSync(t,i,"dir")}catch(n){console.warn(`[report] Could not create 'latest' symlink: ${n instanceof Error?n.message:String(n)}`)}}function $r(e){let t=new Map;if(!e)return t;let r;try{r=JSON.parse(e)}catch{return t}if(!r?.entries||typeof r.entries!="object")return t;for(let[i,n]of Object.entries(r.entries))n?.action_entity&&t.set(i,n.action_entity);return t}var Ee=class{outputFolder;openMode;latestSymlinkDir;collected=[];config;runStartTime;constructor(t={}){this.outputFolder=t.outputFolder||"shiplight-report",this.openMode=t.open||"on-failure",this.latestSymlinkDir=t.latestSymlinkDir}onBegin(t,r){this.config=t,this.runStartTime=new Date().toISOString()}onTestEnd(t,r){this.collected.push({test:t,result:r})}projectOutputDirs(){let t=new Set;for(let r of this.config?.projects??[])r.outputDir&&t.add(r.outputDir);return Array.from(t)}async onEnd(t){if(this.collected.length===0)return;let r=new Map;for(let u of this.collected){let _=u.test.titlePath().join(" > "),b=r.get(_);b||(b=[],r.set(_,b)),b.push(u)}let i=[];for(let[,u]of r.entries()){let _=u[0].test.location.file,b=[],g,d,k;for(let h=0;h<u.length;h++){let{test:m,result:w}=u[h],T=await this.buildReportTest(m,w,_);g=T,d||(d=T.startTime),k=T.endTime,b.push({attemptNumber:h+1,status:w.status,duration:w.duration,steps:T.steps,error:T.error,videoPath:T.videoPath,tracePath:T.tracePath})}let y=b[b.length-1],{test:$}=u[u.length-1],p={title:$.title,baseTitle:g?.baseTitle,file:v.relative(process.cwd(),_),status:y.status,duration:y.duration,steps:y.steps,error:y.error,videoPath:y.videoPath,tracePath:y.tracePath,actionStepsMap:g?.actionStepsMap,tags:g?.tags,baseUrl:g?.baseUrl,skip:g?.skip,slow:g?.slow,timeout:g?.timeout,parameterSetName:g?.parameterSetName,startTime:d,endTime:k,suiteName:g?.suiteName};b.length>1&&(p.retries=b.length-1,p.attempts=b,b.some(m=>m.status==="failed"||m.status==="timedOut")&&y.status==="passed"&&(p.flaky=!0)),i.push(p)}let n={tests:i,totalDuration:t.duration,timestamp:new Date().toISOString(),shiplightVersion:_t,usageSummary:ut(process.cwd(),this.projectOutputDirs()),cacheSummary:ht()?ft().getSummary():void 0,modelTierProvenance:mt(pe())},a=v.isAbsolute(this.outputFolder)?this.outputFolder:v.join(process.cwd(),this.outputFolder);x.mkdirSync(a,{recursive:!0});let o=v.join(a,"screenshots");for(let u=0;u<n.tests.length;u++){let _=n.tests[u],b=_.attempts&&_.attempts.length>0,g=[{obj:_,prefix:b?`test-${u}-attempt-0`:`test-${u}`,screenshotSubDir:`test-${u}`}];if(_.attempts)for(let d=0;d<_.attempts.length;d++)g.push({obj:_.attempts[d],prefix:`test-${u}-attempt-${d+1}`,screenshotSubDir:`test-${u}/attempt-${d}`});for(let{obj:d,prefix:k,screenshotSubDir:y}of g){let $=v.join(o,y),p=!1;for(let h of d.steps)if(h.screenshot&&v.isAbsolute(h.screenshot))try{p||(x.mkdirSync($,{recursive:!0}),p=!0);let m=`${h.stepId.replace(/\./g,"-")}.png`;x.copyFileSync(h.screenshot,v.join($,m)),h.screenshot=`screenshots/${y}/${m}`}catch(m){console.warn(`[reporter] Failed to copy screenshot for ${h.stepId}:`,m)}if(d.videoPath&&v.isAbsolute(d.videoPath)){let h=v.extname(d.videoPath)||".webm",m=`${k}-video${h}`;try{x.copyFileSync(d.videoPath,v.join(a,m)),d.videoPath=m}catch{d.videoPath=void 0}}if(d.tracePath&&v.isAbsolute(d.tracePath)){let h=v.extname(d.tracePath)||".zip",m=`${k}-trace${h}`;try{x.copyFileSync(d.tracePath,v.join(a,m)),d.tracePath=m}catch{d.tracePath=void 0}}}}let s=v.join(a,"report-data.json");x.writeFileSync(s,JSON.stringify(n,null,2),"utf-8");let l=v.join(a,"index.html");if(x.writeFileSync(l,nt({...n,outputDir:a}),"utf-8"),console.log(`
|
|
887
|
-
Shiplight report written to: ${l}`),this.latestSymlinkDir&&
|
|
886
|
+
</html>`}var dt=R(require("fs"),1),Te=R(require("path"),1),ft=require("glob");function yr(e){let t=e.toLowerCase();return t.includes("claude")||t.includes("anthropic")?"anthropic":t.includes("gemini")||t.includes("google")?"gemini":t.startsWith("gpt")||t.startsWith("o1")||t.startsWith("o3")||t.startsWith("o4")||t.includes("openai")?"openai":"unknown"}function _r(e){switch(e.actionType){case"execute":case"run":return"action";case"generate":return"draft";case"assert":return"verify_ai";case"evaluate":return e.conditionKind==="while"?"evaluate_while":e.conditionKind==="wait_until"?"evaluate_wait_until":"evaluate_if";default:return null}}function lt(e,t){let r=e[t];return typeof r=="number"?r:0}function br(e,t,r,i){return`${e}\0${t}\0${r}\0${i}`}function ut(e,t={}){let r=t.routing??"proxy",i=t.providerOf??yr,n=new Map;for(let o of e??[]){let s=_r(o);if(s)for(let l of o.tokenUsages??[]){let u=l.model??"unknown",_=i(u),b=br(s,_,u,r),g=n.get(b);g||(g={operation:s,provider:_,model:u,routing:r,calls:0,input_tokens:0,output_tokens:0,thinking_tokens:0,cache_read_tokens:0},n.set(b,g)),g.calls+=1,g.input_tokens+=l.prompt_tokens||0,g.output_tokens+=l.completion_tokens||0,g.thinking_tokens+=lt(l,"thinking_tokens"),g.cache_read_tokens+=lt(l,"cache_read_tokens")}}return{by_operation:Array.from(n.values()).sort((o,s)=>o.operation!==s.operation?o.operation.localeCompare(s.operation):o.provider!==s.provider?o.provider.localeCompare(s.provider):o.model.localeCompare(s.model))}}var wr=R(require("dotenv"),1),Sr="__shiplightDotenvCache__";function vr(){return globalThis[Sr]}function fe(){let e=vr();return e===void 0?process.env:e}function xr(e){if(!e)return!1;let t=e.trim().toLowerCase();return t==="1"||t==="true"||t==="yes"||t==="on"}var pt={anthropic:e=>e.ANTHROPIC_API_KEY||xr(e.ANTHROPIC_MODELS_USE_VERTEXAI)?"byok":"proxy",gemini:e=>{let t=e.GOOGLE_GENAI_USE_VERTEXAI;return e.GOOGLE_API_KEY||t==="True"||t==="true"?"byok":"proxy"},openai:e=>e.OPENAI_API_KEY?e.OPENAI_BASE_URL?"custom_endpoint":"byok":"proxy"},kr=/^(gpt-|o\d|chatgpt-)/;function Ar(e,t){return e!=="unknown"?e:kr.test(t)?"openai":"unknown"}function Tr(e,t){let r=t.SHIPLIGHT_USAGE_ROUTING;if(r==="proxy"||r==="byok"||r==="custom_endpoint")return r;let i=pt[e];return i?i(t):Object.values(pt).some(a=>a(t)!=="proxy")?"byok":"proxy"}function ht(e,t){let r=t?.length?t:[Te.join(e,"test-results")],i=[];for(let s of r){let l;try{l=(0,ft.globSync)("**/ai-actions.json",{cwd:s})}catch{continue}for(let u of l)try{let _=JSON.parse(dt.readFileSync(Te.join(s,u),"utf-8"));Array.isArray(_)&&i.push(..._)}catch{}}if(i.length===0)return;let n=fe(),a=ut(i,{routing:"proxy"}),o=a.by_operation.map(s=>{let l=Ar(s.provider,s.model);return{...s,provider:l,routing:Tr(l,n)}});return o.sort(Er),o.length>0?{...a,by_operation:o}:void 0}function gt(e){let t=new Map;for(let r of e){if(!r.stepId||r.tokenUsages.length===0)continue;let i=t.get(r.stepId)??[];for(let n of r.tokenUsages)i.push({model:n.model,promptTokens:n.prompt_tokens,completionTokens:n.completion_tokens,totalTokens:n.total_tokens});t.set(r.stepId,i)}return t}function Er(e,t){return e.operation!==t.operation?e.operation.localeCompare(t.operation):e.provider!==t.provider?e.provider.localeCompare(t.provider):e.model!==t.model?e.model.localeCompare(t.model):e.routing.localeCompare(t.routing)}var he=class{records=new Map;recordStatementSource(t,r,i,n,a,o){this.records.set(t,{statement_hash:t,statement_path:r,description:i,source:n,original_action_entity:a,cached_action_entity:n==="cache_hit"?o:void 0})}recordHealedEntities(t,r){for(let[i,n]of t){let a=r.get(i);if(!a)continue;let o=this.records.get(a);o&&((o.source==="original"||o.source==="cache_hit")&&(o.pre_heal_source=o.source),o.source="healed",o.healed_action_entity=n,o.heal_reason=$r(o.original_action_entity,n))}}recordFailed(t){let r=this.records.get(t);r&&(r.source="failed")}getStatementDetails(){return Array.from(this.records.values())}getSummary(){let t=0,r=0,i=0,n=0,a=0;for(let o of this.records.values())switch(o.source){case"original":t++;break;case"cache_hit":r++;break;case"healed":i++,o.pre_heal_source==="cache_hit"&&n++;break;case"failed":a++;break}return{total_statements:this.records.size,original:t,cache_hits:r,healed:i,healed_from_cache:n,failed:a}}getConsoleSummary(){let t=this.getSummary();if(t.total_statements===0)return"";let r=[];return t.cache_hits>0&&r.push(`${t.cache_hits} cached`),t.healed>0&&r.push(`${t.healed} healed`),t.original>0&&r.push(`${t.original} original`),t.failed>0&&r.push(`${t.failed} failed`),`[Shiplight Cache] ${r.join(", ")}`}};function $r(e,t){if(!e||!t)return;let r=e.locator!==t.locator||e.xpath!==t.xpath,i=e.action_data?.action_name!==t.action_data?.action_name;if(r&&i)return"both";if(r)return"locator_changed";if(i)return"action_changed"}var mt="__shiplightRunCacheMetadata__";function Ee(){let e=globalThis;return e[mt]??(e[mt]={})}function yt(){let e=Ee();return e.collector??=new he,e.collector}function _t(){let e=Ee();return e.cacheInPlay===!0&&e.incomplete!==!0&&e.collector!==void 0&&e.collector.getSummary().total_statements>0}function bt(e){let t=Ee();if(!t.collector||e.size===0)return;let r=new Map;for(let i of e.keys())r.set(i,i);t.collector.recordHealedEntities(e,r)}function wt(e){if(!se(e))return;let t=ae(e);return{tier:t.tier,tierSource:t.tierSource,mapSource:t.mapSource,webagentPrimary:t.webagent.primary,computerUsePrimary:t.computerUse.primary,...t.invalidTier!==void 0&&{invalidTier:t.invalidTier}}}var St="0.1.97",vt=St!=="dev"?St:void 0;var Ko=3600*1e3,Vo=10080*60*1e3;var Pr={before:0,main:1,teardown:2,after:3};function xt(e){let t=e.split(".")[0];return Pr[t]??1}function kt(e){return e.split(".").map(t=>{let r=Number(t);return Number.isNaN(r)?0:r})}function Or(e){return[...e].sort(([t],[r])=>{let i=xt(t),n=xt(r);if(i!==n)return i-n;let a=kt(t),o=kt(r);for(let s=0;s<Math.max(a.length,o.length);s++){let l=a[s]??-1,u=o[s]??-1;if(l!==u)return l-u}return 0})}function Ir(e){let t=new Set;for(let r of e)if(t.add(r.category),r.category==="hook")for(let i of r.steps)t.add(i.category);return t}function Lr(e,t){let r=e.toLowerCase();return r.includes("before")?"before":r.includes("after")?"after":t}function $e(e,t="main",r,i,n){r===void 0&&(r=!Ir(e).has("test.step")),n||(n=new Map);let a=[];for(let o of e){if(o.category==="fixture"||o.category==="test.attach")continue;if(o.category==="hook"){let l=Lr(o.title,t);a.push(...$e(o.steps,l,r,i,n));continue}if(o.category==="test.step"||r&&(o.category==="expect"||o.category==="pw:api")){let l=n.get(t)??0;n.set(t,l+1);let u=`${t}.${l}`,_={stepId:u,description:o.title,status:o.error?"failure":o.duration===-1?"skipped":"success",duration:o.duration>=0?o.duration:void 0};o.error&&(_.error=o.error.message??o.error.stack),i&&o.location&&i.set(u,o.location),a.push(_),o.steps.length>0&&a.push(...$e(o.steps,u,r,i,n))}}return a}function Cr(e,t){let r=v.isAbsolute(e)?e:v.join(process.cwd(),e),i=v.join(r,"latest");try{if(x.lstatSync(i).isSymbolicLink())x.unlinkSync(i);else{console.warn("[report] 'latest' exists and is not a symlink; skipping update");return}}catch{}try{process.platform==="win32"?x.symlinkSync(v.join(r,t),i,"junction"):x.symlinkSync(t,i,"dir")}catch(n){console.warn(`[report] Could not create 'latest' symlink: ${n instanceof Error?n.message:String(n)}`)}}function Nr(e){let t=new Map;if(!e)return t;let r;try{r=JSON.parse(e)}catch{return t}if(!r?.entries||typeof r.entries!="object")return t;for(let[i,n]of Object.entries(r.entries))n?.action_entity&&t.set(i,n.action_entity);return t}var Me=class{outputFolder;openMode;latestSymlinkDir;collected=[];config;runStartTime;constructor(t={}){this.outputFolder=t.outputFolder||"shiplight-report",this.openMode=t.open||"on-failure",this.latestSymlinkDir=t.latestSymlinkDir}onBegin(t,r){this.config=t,this.runStartTime=new Date().toISOString()}onTestEnd(t,r){this.collected.push({test:t,result:r})}projectOutputDirs(){let t=new Set;for(let r of this.config?.projects??[])r.outputDir&&t.add(r.outputDir);return Array.from(t)}async onEnd(t){if(this.collected.length===0)return;let r=new Map;for(let u of this.collected){let _=u.test.titlePath().join(" > "),b=r.get(_);b||(b=[],r.set(_,b)),b.push(u)}let i=[];for(let[,u]of r.entries()){let _=u[0].test.location.file,b=[],g,d,k;for(let h=0;h<u.length;h++){let{test:m,result:w}=u[h],T=await this.buildReportTest(m,w,_);g=T,d||(d=T.startTime),k=T.endTime,b.push({attemptNumber:h+1,status:w.status,duration:w.duration,steps:T.steps,error:T.error,videoPath:T.videoPath,tracePath:T.tracePath})}let y=b[b.length-1],{test:$}=u[u.length-1],p={title:$.title,baseTitle:g?.baseTitle,file:v.relative(process.cwd(),_),status:y.status,duration:y.duration,steps:y.steps,error:y.error,videoPath:y.videoPath,tracePath:y.tracePath,actionStepsMap:g?.actionStepsMap,tags:g?.tags,baseUrl:g?.baseUrl,skip:g?.skip,slow:g?.slow,timeout:g?.timeout,parameterSetName:g?.parameterSetName,startTime:d,endTime:k,suiteName:g?.suiteName};b.length>1&&(p.retries=b.length-1,p.attempts=b,b.some(m=>m.status==="failed"||m.status==="timedOut")&&y.status==="passed"&&(p.flaky=!0)),i.push(p)}let n={tests:i,totalDuration:t.duration,timestamp:new Date().toISOString(),shiplightVersion:vt,usageSummary:ht(process.cwd(),this.projectOutputDirs()),cacheSummary:_t()?yt().getSummary():void 0,modelTierProvenance:wt(fe())},a=v.isAbsolute(this.outputFolder)?this.outputFolder:v.join(process.cwd(),this.outputFolder);x.mkdirSync(a,{recursive:!0});let o=v.join(a,"screenshots");for(let u=0;u<n.tests.length;u++){let _=n.tests[u],b=_.attempts&&_.attempts.length>0,g=[{obj:_,prefix:b?`test-${u}-attempt-0`:`test-${u}`,screenshotSubDir:`test-${u}`}];if(_.attempts)for(let d=0;d<_.attempts.length;d++)g.push({obj:_.attempts[d],prefix:`test-${u}-attempt-${d+1}`,screenshotSubDir:`test-${u}/attempt-${d}`});for(let{obj:d,prefix:k,screenshotSubDir:y}of g){let $=v.join(o,y),p=!1;for(let h of d.steps)if(h.screenshot&&v.isAbsolute(h.screenshot))try{p||(x.mkdirSync($,{recursive:!0}),p=!0);let m=`${h.stepId.replace(/\./g,"-")}.png`;x.copyFileSync(h.screenshot,v.join($,m)),h.screenshot=`screenshots/${y}/${m}`}catch(m){console.warn(`[reporter] Failed to copy screenshot for ${h.stepId}:`,m)}if(d.videoPath&&v.isAbsolute(d.videoPath)){let h=v.extname(d.videoPath)||".webm",m=`${k}-video${h}`;try{x.copyFileSync(d.videoPath,v.join(a,m)),d.videoPath=m}catch{d.videoPath=void 0}}if(d.tracePath&&v.isAbsolute(d.tracePath)){let h=v.extname(d.tracePath)||".zip",m=`${k}-trace${h}`;try{x.copyFileSync(d.tracePath,v.join(a,m)),d.tracePath=m}catch{d.tracePath=void 0}}}}let s=v.join(a,"report-data.json");x.writeFileSync(s,JSON.stringify(n,null,2),"utf-8");let l=v.join(a,"index.html");if(x.writeFileSync(l,ct({...n,outputDir:a}),"utf-8"),console.log(`
|
|
887
|
+
Shiplight report written to: ${l}`),this.latestSymlinkDir&&Cr(this.latestSymlinkDir,v.basename(a)),this.openMode==="always"||this.openMode==="on-failure"&&t.status!=="passed")try{let u=(await import("open")).default;await u(l)}catch{}}printsToStdio(){return!1}async buildReportTest(t,r,i){let n={title:t.title,file:v.relative(process.cwd(),i),status:r.status,duration:r.duration,steps:[],startTime:new Date(r.startTime).toISOString(),endTime:new Date(r.startTime.getTime()+r.duration).toISOString()};r.errors.length>0&&(n.error=r.errors.map(p=>p.message||p.stack||String(p)).join(`
|
|
888
888
|
|
|
889
|
-
`)),r.stdout.length>0&&(n.stdout=r.stdout.map(p=>typeof p=="string"?p:p.toString()).join("")),r.stderr.length>0&&(n.stderr=r.stderr.map(p=>typeof p=="string"?p:p.toString()).join(""));for(let p of r.attachments)p.name==="video"&&p.path&&(n.videoPath=p.path),p.name==="trace"&&p.path&&(n.tracePath=p.path);let a=r.attachments.find(p=>p.name==="shiplight-results"),o=a?.path?v.dirname(a.path):"",s=null;if(a)try{if(a.body)s=JSON.parse(a.body.toString("utf-8"));else if(a.path){let p=x.readFileSync(a.path,"utf-8");s=JSON.parse(p)}}catch{}let l=r.attachments.find(p=>p.name==="shiplight-new-action-entities");if(l)try{let p=l.body?l.body.toString("utf-8"):l.path?x.readFileSync(l.path,"utf-8"):null;
|
|
890
|
-
`))}catch{h.set(w.file,[])}let M=h.get(w.file);T=M[w.line-1]?.trim();let P=w.line-2,
|
|
891
|
-
`),m.codeStartLine=
|
|
889
|
+
`)),r.stdout.length>0&&(n.stdout=r.stdout.map(p=>typeof p=="string"?p:p.toString()).join("")),r.stderr.length>0&&(n.stderr=r.stderr.map(p=>typeof p=="string"?p:p.toString()).join(""));for(let p of r.attachments)p.name==="video"&&p.path&&(n.videoPath=p.path),p.name==="trace"&&p.path&&(n.tracePath=p.path);let a=r.attachments.find(p=>p.name==="shiplight-results"),o=a?.path?v.dirname(a.path):"",s=null;if(a)try{if(a.body)s=JSON.parse(a.body.toString("utf-8"));else if(a.path){let p=x.readFileSync(a.path,"utf-8");s=JSON.parse(p)}}catch{}let l=r.attachments.find(p=>p.name==="shiplight-new-action-entities");if(l)try{let p=l.body?l.body.toString("utf-8"):l.path?x.readFileSync(l.path,"utf-8"):null;bt(Nr(p))}catch{}let u=r.attachments.find(p=>p.name==="shiplight-ai-actions"),_=[];if(u)try{let p=u.body?u.body.toString("utf-8"):u.path?x.readFileSync(u.path,"utf-8"):null,h=p?JSON.parse(p):null;Array.isArray(h)&&(_=h)}catch{}let b=gt(_),g=i.replace(/\.yaml\.spec\.ts$/,".test.yaml"),d={},k=t.title.match(/^(.*)\s+\[([^\]]+)\]$/),y=k?k[1]:t.title,$=k?k[2]:void 0;if($&&(n.parameterSetName=$),x.existsSync(g))try{let p=x.readFileSync(g,"utf-8"),h=nt(p,g,this.config.rootDir);if(h.suite){let m=h.suite.tests.find(w=>w.name===y);m&&(d=ee(m.testFlow),m.tags?.length&&(n.tags=m.tags),m.skip!==void 0&&(n.skip=m.skip),m.slow&&(n.slow=m.slow),m.timeout!==void 0&&(n.timeout=m.timeout),n.baseTitle=m.name||m.testFlow?.goal),n.suiteName=h.name,h.tags?.length&&(n.suiteTags=h.tags),h.use?.baseURL&&(n.baseUrl=h.use.baseURL)}else h.testFlow&&(d=ee(h.testFlow),n.baseTitle=h.name||h.testFlow?.goal,h.tags?.length&&(n.tags=h.tags),h.use?.baseURL&&(n.baseUrl=h.use.baseURL))}catch{}if(s||Object.keys(d).length>0){let p=new Set([...Object.keys(d),...Object.keys(s||{})]),h=Array.from(p).map(w=>[w,null]),m=Or(h);for(let[w]of m){let T=d[w],S=s?.[w],M=T?.description;if(!M||M==="Action"||M==="Draft"){let O=T?.action_entity;M=O?.action_description||O?.action_data?.kwargs?.description||S?.description||w}let P={stepId:w,description:M,status:S?.status||"pending",duration:S?.duration};if(S?.message){let O=typeof S.message=="string"?S.message:JSON.stringify(S.message,null,2);S.status==="failure"?P.error=O:P.message=O}if(S?.screenshot){let O=S.screenshot,J=v.isAbsolute(O)?O:v.join(o,O);x.existsSync(J)&&(P.screenshot=J)}S?.code&&(P.code=S.code),S?.type&&(P.type=S.type),S?.startTime&&(P.startTime=S.startTime),S?.autoHealed&&(P.autoHealed=S.autoHealed),S?.healedAction&&(P.healedAction=S.healedAction),S?.dismissedModalActions?.length&&(P.dismissedModalActions=S.dismissedModalActions),S?.contextBefore&&(P.contextBefore=S.contextBefore),S?.contextAfter&&(P.contextAfter=S.contextAfter);let z=b.get(w);z&&(P.llmUsage=z),n.steps.push(P)}}if(s===null&&Object.keys(d).length===0&&!i.endsWith(".yaml.spec.ts")){let p=new Map;if(n.steps=$e(r.steps,"main",void 0,p),n.steps.length>0){let h=new Map;n.actionStepsMap=Object.fromEntries(n.steps.map(m=>{let w=p.get(m.stepId),T;if(w?.file){if(!h.has(w.file))try{h.set(w.file,x.readFileSync(w.file,"utf-8").split(`
|
|
890
|
+
`))}catch{h.set(w.file,[])}let M=h.get(w.file);T=M[w.line-1]?.trim();let P=w.line-2,z=w.line,O=[],J=w.line;P>=0&&(O.push(M[P]??""),J=w.line-1),O.push(M[w.line-1]??""),z<M.length&&O.push(M[z]??""),m.code=O.join(`
|
|
891
|
+
`),m.codeStartLine=J,m.codeLine=w.line}let S={description:m.description,...T&&{action_entity:{action_description:m.description,action_data:{action_name:"js_code",args:[],kwargs:{code:T}}}}};return[m.stepId,S]}))}}return Object.keys(d).length>0?n.actionStepsMap=d:s&&n.steps.length>0&&(n.actionStepsMap=Object.fromEntries(n.steps.map(p=>{let h=s[p.stepId],m=h?.type,w={description:p.description,...m&&{action_entity:{action_description:p.description,action_data:{action_name:m==="step"?"js_code":m,args:[],kwargs:m==="step"?{code:h?.code??p.description}:{statement:p.description}}}}};return[p.stepId,w]}))),n}},At=Me;
|