shiplightai 0.1.19 → 0.1.21
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/dist/{agentHelpers-IUFVFV55.js → agentHelpers-2TII7YCW.js} +1 -1
- package/dist/{agentLogin-YX4SQCJ7.js → agentLogin-GDOU6BCP.js} +1 -1
- package/dist/{chunk-XCDECDBJ.js → chunk-2F3YRAA7.js} +13 -13
- package/dist/{chunk-SJ4ND636.js → chunk-32JFHFFG.js} +17 -17
- package/dist/{chunk-M5SWSS6P.js → chunk-JHSENQ4F.js} +5 -5
- package/dist/chunk-JNRJXAJS.js +18 -0
- package/dist/chunk-LPSNOKYP.js +61 -0
- package/dist/{chunk-KVT4XXRU.js → chunk-RTTIJBGI.js} +5 -5
- package/dist/chunk-THVHM4KG.js +11 -0
- package/dist/cjs/debugger-pw.cjs +8 -4
- package/dist/cjs/fixture.cjs +97 -97
- package/dist/cjs/index.cjs +120 -120
- package/dist/cli.js +523 -515
- package/dist/debugger-pw.js +1 -1
- package/dist/{dist-REAH3DVS.js → dist-CXOVVE77.js} +1 -1
- package/dist/dist-SRXGJZ7P.js +3 -0
- package/dist/fixture.js +1 -1
- package/dist/{handler-UXMAYIOA.js → handler-BAP4TGW6.js} +1 -1
- package/dist/index.js +5 -13
- package/dist/{task-QLOM6Q36.js → task-VW6MUEKX.js} +1 -1
- package/dist/testFlow-ZLC5L5GT.js +3 -0
- package/package.json +1 -1
- package/dist/chunk-AZ7CG3SO.js +0 -18
- package/dist/chunk-BWEKM3LZ.js +0 -61
- package/dist/dist-T7XB7SCU.js +0 -3
- package/dist/testFlow-UHBHQTD7.js +0 -3
package/dist/debugger-pw.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "module";
|
|
2
2
|
const require = __createRequire(import.meta.url);
|
|
3
|
-
import"./chunk-CSINHOOD.js";import w from"express";import*as m from"path";import*as h from"fs/promises";import*as y from"os";var g=class{page;agent;sessionId="pw-"+Math.random().toString(36).slice(2,10);abortController=null;constructor(e,t){this.page=e,this.agent=t}async createSession(e){return{sessionId:this.sessionId}}async executeLogin(e){return{status:"success",details:"Handled by Playwright"}}async ensureBrowser(e){return{page:this.page,liveviewUrl:""}}async startDebug(e){return{sessionId:this.sessionId,liveviewUrl:"",browserWsUrl:""}}async executeAction(e,t,s,n){let o=t.action_data||t.action;if(!o)throw new Error("ActionEntity has no action_data");if(console.error(`[pw-sandbox] executeAction stepId=${JSON.stringify(s)} action_name=${JSON.stringify(o.action_name)} locator=${JSON.stringify(t.locator)} kwargs=${JSON.stringify(o.kwargs)}`),o.action_name==="js_code"&&s==="prelude"){if(this.page.url()==="about:blank"){let l=o.kwargs?.code?.match(/PLAYWRIGHT_STARTING_URL \|\| '([^']*)'/)?.[1];l&&await this.page.goto(l,{waitUntil:"domcontentloaded"})}return{status:"success"}}let r=t.action_description||o.action_name;return{status:"success",...await this.agent.step(this.page,async()=>{await this.agent.execAction(o.action_name,this.page,t)},r,s,n?.stmtUid,!!n?.withSelfHealing)}}async runStep(e,t,s,n,o){let r=[],p={},l=this.agent._actionHandler;this.abortController=new AbortController;try{let u=await this.agent.execute(this.page,t,s,!1);return{success:u?.success??!0,actions:r,details:u?.details}}finally{this.abortController=null}}stopRunStep(e){return this.abortController?(this.abortController.abort(),!0):!1}async evaluate(e,t,s){try{let n=await this.agent.evaluate(this.page,t);return{status:"success",conclusion:n?"true":"false",explanation:n?`Condition met: ${t}`:`Condition not met: ${t}`}}catch(n){return{status:"error",conclusion:"unknown",explanation:n.message}}}async generateAction(e,t,s,n){return this.agent.generate(this.page,t,s,n?.usePureVision)}async takeScreenshot(e){let t=await this.page.screenshot(),s=m.join(y.tmpdir(),`shiplight-screenshot-${Date.now()}.png`);return await h.writeFile(s,t),{screenshot:t.toString("base64"),screenshotPath:s}}async initializeCopilot(e,t){}async sendCopilotMessage(e,t,s,n){throw new Error("Copilot not supported in Playwright debug mode")}abortCopilot(e){return!1}getCopilotTestFlow(e){}async terminateSession(e){console.error("[debugger] Playwright session released")}async cleanupAll(){}};async function S(d){let{yamlFilePath:e,port:t,page:s,agent:n}=d,o=new g(s,n),r=w();r.use(w.json({limit:"10mb"})),r.use((c,i,a)=>{if(i.setHeader("Access-Control-Allow-Origin","*"),i.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS"),i.setHeader("Access-Control-Allow-Headers","Content-Type"),c.method==="OPTIONS")return i.sendStatus(204);a()});let{createTestFlowRouter:p}=await import("./testFlow-
|
|
3
|
+
import"./chunk-CSINHOOD.js";import w from"express";import*as m from"path";import*as h from"fs/promises";import*as y from"os";var g=class{page;agent;sessionId="pw-"+Math.random().toString(36).slice(2,10);abortController=null;constructor(e,t){this.page=e,this.agent=t}async createSession(e){return{sessionId:this.sessionId}}async executeLogin(e){return{status:"success",details:"Handled by Playwright"}}async ensureBrowser(e){return{page:this.page,liveviewUrl:""}}async startDebug(e){return{sessionId:this.sessionId,liveviewUrl:"",browserWsUrl:""}}async executeAction(e,t,s,n){let o=t.action_data||t.action;if(!o)throw new Error("ActionEntity has no action_data");if(console.error(`[pw-sandbox] executeAction stepId=${JSON.stringify(s)} action_name=${JSON.stringify(o.action_name)} locator=${JSON.stringify(t.locator)} kwargs=${JSON.stringify(o.kwargs)}`),o.action_name==="js_code"&&s==="prelude"){if(this.page.url()==="about:blank"){let l=o.kwargs?.code?.match(/PLAYWRIGHT_STARTING_URL \|\| '([^']*)'/)?.[1];l&&await this.page.goto(l,{waitUntil:"domcontentloaded"})}return{status:"success"}}let r=t.action_description||o.action_name;return{status:"success",...await this.agent.step(this.page,async()=>{await this.agent.execAction(o.action_name,this.page,t)},r,s,n?.stmtUid,!!n?.withSelfHealing)}}async runStep(e,t,s,n,o){let r=[],p={},l=this.agent._actionHandler;this.abortController=new AbortController;try{let u=await this.agent.execute(this.page,t,s,!1);return{success:u?.success??!0,actions:r,details:u?.details}}finally{this.abortController=null}}stopRunStep(e){return this.abortController?(this.abortController.abort(),!0):!1}async evaluate(e,t,s){try{let n=await this.agent.evaluate(this.page,t);return{status:"success",conclusion:n?"true":"false",explanation:n?`Condition met: ${t}`:`Condition not met: ${t}`}}catch(n){return{status:"error",conclusion:"unknown",explanation:n.message}}}async generateAction(e,t,s,n){return this.agent.generate(this.page,t,s,n?.usePureVision)}async takeScreenshot(e){let t=await this.page.screenshot(),s=m.join(y.tmpdir(),`shiplight-screenshot-${Date.now()}.png`);return await h.writeFile(s,t),{screenshot:t.toString("base64"),screenshotPath:s}}async initializeCopilot(e,t){}async sendCopilotMessage(e,t,s,n){throw new Error("Copilot not supported in Playwright debug mode")}abortCopilot(e){return!1}getCopilotTestFlow(e){}async terminateSession(e){console.error("[debugger] Playwright session released")}async cleanupAll(){}};async function S(d){let{yamlFilePath:e,port:t,page:s,agent:n}=d,o=new g(s,n),r=w();r.use(w.json({limit:"10mb"})),r.use((c,i,a)=>{if(i.setHeader("Access-Control-Allow-Origin","*"),i.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS"),i.setHeader("Access-Control-Allow-Headers","Content-Type"),c.method==="OPTIONS")return i.sendStatus(204);a()});let{createTestFlowRouter:p}=await import("./testFlow-ZLC5L5GT.js"),{createIntRunnerRouter:l}=await import("./intRunner-5A6M6JSJ.js"),{createCopilotRouter:u}=await import("./copilot-7JTVJQXP.js");r.use(p(e)),r.use(l(o)),r.use(u(o));let b=await new Promise((c,i)=>{let a=r.listen(t,"localhost",()=>c(a));a.on("error",i)});return{url:`http://localhost:${t}`,close:async()=>{await o.cleanupAll(),await new Promise((c,i)=>{b.close(a=>a?i(a):c())})}}}export{g as PlaywrightSandboxService,S as startPlaywrightDebugServer};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "module";
|
|
2
2
|
const require = __createRequire(import.meta.url);
|
|
3
|
-
import{a as d,b as e,c as f,d as g,e as h,f as O,g as P,h as Q,i as R,j as S,k as T,l as U,m as Z,n as _,o as $,p as aa,q as ba,r as ca,s as da,t as ea,u as fa}from"./chunk-
|
|
3
|
+
import{a as d,b as e,c as f,d as g,e as h,f as O,g as P,h as Q,i as R,j as S,k as T,l as U,m as Z,n as _,o as $,p as aa,q as ba,r as ca,s as da,t as ea,u as fa}from"./chunk-JHSENQ4F.js";import{b as i,e as K,f as L,g as M,h as N}from"./chunk-32JFHFFG.js";import{C,E as D}from"./chunk-2F3YRAA7.js";import{a as m,b as n,c as o,d as p,g as s,h as t,i as u,j as v,k as w,l as x,m as y,n as z,o as A}from"./chunk-RTTIJBGI.js";import"./chunk-YU3XZJIJ.js";import{g as j,h as k,i as l,k as q,l as r}from"./chunk-USRSZQWN.js";import{a as V,j as W,k as X,l as Y}from"./chunk-LPSNOKYP.js";import{a as E,c as F,d as G,e as H,f as I,g as J}from"./chunk-YHOTGR6H.js";import"./chunk-YDR4P3GA.js";import{a,b,c,i as B}from"./chunk-DJDHFWEV.js";import"./chunk-CSINHOOD.js";export{D as ActionHandler,C as ActionHelper,ca as Agent,$ as AgentServices,aa as AgentStepEventTypes,ba as AgentTaskFailedError,Z as BrowserManager,v as DEFAULT_EVENT_LISTENER_LIMIT,z as DomService,u as EVENT_LISTENER_CANDIDATE_SELECTORS,A as HistoryTreeProcessor,E as INIT_SCRIPT,t as INTERACTION_EVENT_TYPES,s as INTERACTIVE_ROLES,B as LogLevel,W as LoginType,T as MCPToolProvider,i as OpenAIToolProvider,fa as SDK_VERSION,m as ToolRegistry,X as TwoFactorAuthType,Y as VariableStore,ca as WebAgent,a as configureSdk,ea as createAgent,da as createAgentContext,Q as createToolRegistry,R as createToolRegistryWithCapabilities,O as ensureToolsRegistered,M as evaluateStatement,L as executeStep,U as exportMCPTools,y as filterInteractionListeners,K as generateActionStep,r as getActionEntityLocatorInfo,G as getBrowserCdpUrl,S as getCapabilitySummary,q as getFramePath,o as getModel,I as getPageInfo,H as getPageWsUrl,_ as getPlatformFromDeviceName,p as getProviderOptions,b as getSdkConfig,P as getToolRegistry,d as injectUserFunction,x as isInteractionEventType,w as isInteractiveRole,g as loadKnowledgeMappings,f as loadKnowledges,e as loadUserFunctions,c as logger,F as newBrowserContext,h as parseSSEStream,j as pickBestLocator,k as pickBestLocatorForElement,l as pickBestLocators,V as replaceVariables,N as runTask,J as setWindowBounds,n as toolRegistry};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "module";
|
|
2
|
+
const require = __createRequire(import.meta.url);
|
|
3
|
+
import{$,A,Aa,B,Ba,C,Ca,D,Da,E,Ea,F,Fa,G,Ga,H,Ha,I,Ia,J,Ja,K,Ka,L,La,M,Ma,N,Na,O,Oa,P,Pa,Q,Qa,R,Ra,S,Sa,T,Ta,U,Ua,V,Va,W,X,Y,Z,_,a,aa,b,ba,c,ca,d,da,e,ea,f,fa,g,ga,h,ha,i,ia,j,ja,k,ka,l,la,m,ma,n,na,o,oa,p,pa,q,qa,r,ra,s,sa,t,ta,u,ua,v,va,w,wa,x,xa,y,ya,z,za}from"./chunk-JNRJXAJS.js";import"./chunk-CSINHOOD.js";export{u as ADDRESS_BAR_HEIGHT,d as ANDROID_DEVICE_PREFIX,Y as ActionEntitySchema,_ as ActionSchema,Sa as AgentStatus,X as BaseStatementSchema,E as BrowserType,V as ConditionSchema,Ja as ConditionType,U as ConditionTypeSchema,Oa as DEFAULT_ANTHROPIC_MODEL,Ma as DEFAULT_COPILOT_MODEL,D as DEFAULT_DEVICE_NAME,Pa as DEFAULT_GOOGLE_MODEL,Na as DEFAULT_WEBAGENT_MODEL,Ka as DEFAULT_WHILE_LOOP_TIMEOUT_MS,H as DEVICE_CATEGORIES,G as DeviceType,Z as DraftSchema,e as IOS_DEVICE_PREFIX,S as LoginType,C as MIN_WINDOW_HEIGHT,B as MIN_WINDOW_WIDTH,c as NodeJSCodeCommon,F as PLAYWRIGHT_DEVICES,A as RECORD_VIDEO_HEIGHT,z as RECORD_VIDEO_WIDTH,$ as StatementSchema,Ia as StatementType,W as StatementTypeSchema,aa as TestFlowSchema,T as TwoFactorAuthType,L as UI_DEVICE_CATEGORIES,M as UI_DEVICE_CATEGORIES_ELECTRON,t as USER_AGENT,y as VIEWPORT_HEIGHT,x as VIEWPORT_WIDTH,La as VariableStore,w as WINDOW_HEIGHT,v as WINDOW_WIDTH,ya as actionStepsMapToTestFlowSections,va as allowPureVisionAction,ia as applyPatchToYaml,ja as applyPatchToYamlString,wa as collectActionSteps,k as createAndroidDeviceName,Aa as createEmptyStore,l as createIOSDeviceName,Ba as createRunnerStoreEntry,xa as extractActionStepsFromTestFlow,j as extractDeviceIdentifier,fa as extractYamlMetadata,oa as findNextAfterContainer,na as findNextSibling,ma as findNextStatement,ra as findPathBetweenStatements,la as findStatementPathById,J as getAllDeviceNames,ta as getAllReferenceIds,pa as getAllStatementsInOrder,Va as getAndroidDeviceDisplayName,O as getBrowserWindowSize,o as getCompatiblePlatforms,R as getDeviceBrowserType,K as getDeviceByName,Q as getDeviceChannel,N as getDeviceOptions,I as getDevicesByCategory,r as getIOSDeviceDisplayName,a as getLoginConfigPlatform,P as getRecordVideoSize,ka as getStatementContainers,Ga as getStoreSize,f as getTestPlatformFromDeviceName,sa as hasReferenceIds,h as isAndroidDevice,n as isAppPackage,ua as isDynamicAction,qa as isExecutableStatement,i as isIOSDevice,g as isNativeDevice,s as isPhysicalDeviceUDID,p as isPlatformCompatibleWithUrl,Fa as isStoreEmpty,m as isWebUrl,Ha as mergeActionEntitiesIntoTestFlow,Ea as mergeStoreUpdates,Ta as parseAdbDeviceLine,ea as parseYamlArrayItems,b as replaceVariables,Ca as resolveActionEntity,Ra as resolveModelFromEnv,Qa as resolveModels,ca as testFlowToYaml,ba as testFlowToYamlObject,Ua as toAndroidDeviceName,q as toIOSDeviceName,Da as updateStoreEntry,ha as validatePatch,za as validateTestYaml,da as yamlObjectsToString,ga as yamlToTestFlow};
|
package/dist/fixture.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "module";
|
|
2
2
|
const require = __createRequire(import.meta.url);
|
|
3
|
-
import"./chunk-CSINHOOD.js";import*as y from"path";import{test as k,expect as C}from"@playwright/test";import*as l from"fs";import*as n from"path";function h(t){let e=n.resolve(t),r=n.resolve(process.cwd());for(;;){for(let s of["shiplight.config.json","login.config.json"]){let i=n.join(e,s);if(l.existsSync(i)){try{let a=JSON.parse(l.readFileSync(i,"utf-8"));if(a.variables&&typeof a.variables=="object")return{variables:_(a.variables),configPath:i}}catch{}return{variables:[],configPath:i}}}if(e===r)break;let o=n.dirname(e);if(o===e)break;e=o}return{variables:[],configPath:null}}function m(t){if(t.startsWith("$")){let e=t.slice(1),r=process.env[e];return r===void 0&&console.warn(`[Variables] Environment variable ${e} is not set, using literal "${t}"`),r||t}return t}function _(t){let e=[];for(let[r,o]of Object.entries(t))if(typeof o=="string")e.push({key:r,value:m(o),sensitive:!1});else if(o&&typeof o=="object"&&"value"in o){let s=o;e.push({key:r,value:m(String(s.value)),sensitive:s.sensitive===!0})}return e}var f;async function O(){return f||(f=await import("./dist-
|
|
3
|
+
import"./chunk-CSINHOOD.js";import*as y from"path";import{test as k,expect as C}from"@playwright/test";import*as l from"fs";import*as n from"path";function h(t){let e=n.resolve(t),r=n.resolve(process.cwd());for(;;){for(let s of["shiplight.config.json","login.config.json"]){let i=n.join(e,s);if(l.existsSync(i)){try{let a=JSON.parse(l.readFileSync(i,"utf-8"));if(a.variables&&typeof a.variables=="object")return{variables:_(a.variables),configPath:i}}catch{}return{variables:[],configPath:i}}}if(e===r)break;let o=n.dirname(e);if(o===e)break;e=o}return{variables:[],configPath:null}}function m(t){if(t.startsWith("$")){let e=t.slice(1),r=process.env[e];return r===void 0&&console.warn(`[Variables] Environment variable ${e} is not set, using literal "${t}"`),r||t}return t}function _(t){let e=[];for(let[r,o]of Object.entries(t))if(typeof o=="string")e.push({key:r,value:m(o),sensitive:!1});else if(o&&typeof o=="object"&&"value"in o){let s=o;e.push({key:r,value:m(String(s.value)),sensitive:s.sensitive===!0})}return e}var f;async function O(){return f||(f=await import("./dist-CXOVVE77.js"),f)}var S=k.extend({agent:async({},t,e)=>{let{WebAgent:r,createAgentContext:o,configureSdk:s,VariableStore:i}=await O();s({env:{GOOGLE_API_KEY:process.env.GOOGLE_API_KEY??"",ANTHROPIC_API_KEY:process.env.ANTHROPIC_API_KEY??""}});let{resolveModelFromEnv:a}=await import("./dist-SRXGJZ7P.js"),b=a(process.env);if(!b)throw new Error("No AI model configured. Set WEB_AGENT_MODEL, ANTHROPIC_API_KEY, or GOOGLE_API_KEY.");let u=new i,A=e.project.testDir||process.cwd(),d=e.file,E=d?y.dirname(d):A,{variables:c,configPath:P}=h(E);for(let{key:p,value:g,sensitive:v}of c)u.set(p,g,v);if(c.length>0){console.log(`[Variables] Loaded ${c.length} from ${P}:`);for(let{key:p,value:g,sensitive:v}of c)console.log(` ${p} = ${v?"***":g}`)}let w=new r(o({model:b,variableStore:u}));await t(w)}});export{C as expect,S as test};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "module";
|
|
2
2
|
const require = __createRequire(import.meta.url);
|
|
3
|
-
import{D as o,E as r}from"./chunk-
|
|
3
|
+
import{D as o,E as r}from"./chunk-2F3YRAA7.js";import"./chunk-USRSZQWN.js";import"./chunk-DJDHFWEV.js";import"./chunk-CSINHOOD.js";export{o as ActionHandler,r as default};
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "module";
|
|
2
2
|
const require = __createRequire(import.meta.url);
|
|
3
|
-
import{r as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
`);
|
|
7
|
-
`):["// Skipping js_action: missing code"]});function K(e){let t=e.functionName;if(!t)return null;let r={},n=e.parameterNames||[],s=e.parameterValues||e.args||[];if(n.forEach((p,o)=>{o<s.length&&(r[p]=s[o])}),Object.keys(r).length===0)return`await ${t}()`;let a=["page","testContext","request","agentServices"],i=["undefined","null","true","false"],c=Object.entries(r).map(([p,o])=>{let l=String(o);return o==null?"undefined":a.includes(p)&&a.includes(l)||i.includes(l)||/^-?\d+(\.\d+)?$/.test(l)?l:l.startsWith("$")?`agent.agentServices.readVariable('${l.substring(1)}')`:`"${l}"`});return`await ${t}(${c.join(", ")})`}function w(e,t,r,n="main"){let s=[];for(let a=0;a<e.length;a++){let i=e[a],c=`${n}.${a}`,p=Ne(i,t,c,r);p.length>0&&(s.push(...p),a<e.length-1&&s.push(""))}return s}function Ne(e,t,r,n){let s=" ".repeat(t);switch(e.type){case"DRAFT":return Oe(e,t,r,n);case"ACTION":return Ee(e,t,r,n);case"STEP":return Pe(e,t,r,n);case"IF_ELSE":return Le(e,t,r,n);case"WHILE_LOOP":return je(e,t,r,n);default:return[`${s}// Unknown statement type: ${e.type}`]}}function Oe(e,t,r,n){let s=" ".repeat(t),a=e.description?.trim()||"";if(!a)return[`${s}// ${r}: Skipping - no description`];if(n.noAgent)return[`${s}// ${r}: ${d(a)}`,`${s}// DRAFT: ${d(a)} (requires agent - skipped in hook)`];let i=JSON.stringify(a);return[`${s}// ${r}: ${d(a)}`,`${s}// \u26A0 DRAFT: AI-resolved at runtime (~5-10s). Add a locator to make this <1s.`,`${s}page = agent.agentServices.validatePage(page);`,`${s}await agent.run(page, ${i}, '${r}');`]}function Ee(e,t,r,n){let s=" ".repeat(t),a=e.description,i=e.uid,p=n.actionEntityStore?.entries[e.uid]?.action_entity??e.action_entity;if(!p){if(!a)return[`${s}// ${r}: Skipping - no description`];if(n.noAgent)return[`${s}// ${r}: ${d(a)}`,`${s}// DRAFT: ${d(a)} (requires agent - skipped in hook)`];let $=JSON.stringify(a),k=!!e.use_pure_vision;return[`${s}// ${r}: ${d(a)}`,`${s}// \u26A0 DRAFT: AI-resolved at runtime (~5-10s). Add a locator to make this <1s.`,`${s}page = agent.agentServices.validatePage(page);`,`${s}await agent.execute(page, ${$}, '${r}', ${k});`]}let o=e.locator?{...p,locator:e.locator}:p;a&&a!==o.action_description&&(o={...o,action_description:a});let l=o.action_data?.action_name||"",f=o.action_description||"",m=Te(l);if(!m)return[`${s}// ${r}: Unknown action: ${l}`];let g={imports:n.imports},_=m(o,r,g);if(n.noAgent){if(q(o))return[`${s}// ${r}: ${d(f)}`,`${s}// AI action: ${d(f)} (requires agent - skipped in hook)`];let $=Ie(o,l,s,r);return $||[`${s}// ${r}: ${d(f)}`,..._.map(k=>`${s}${k}`)]}if(q(o))return[`${s}// ${r}: ${d(f)}`,`${s}page = agent.agentServices.validatePage(page);`,..._.map($=>`${s}${$}`)];let b=JSON.stringify(f),S=_.map($=>`${s} ${$}`),E=be(o),L=i?`'${i}'`:"undefined";return[`${s}// ${r}: ${d(f)}`,`${s}page = agent.agentServices.validatePage(page);`,`${s}await agent.step(page, async () => {`,...S,`${s}}, ${b}, '${r}', ${L}, ${E});`]}function Pe(e,t,r,n){let s=" ".repeat(t),a=[];e.description&&e.description.trim()&&a.push(`${s}// Step: ${d(e.description)}`);let i=w(e.statements,t,n,r);return a.push(...i),a}function Le(e,t,r,n){let s=" ".repeat(t),a=[];if(a.push(`${s}// ${r}: Conditional check`),e.condition.type==="JS_CODE")a.push(`${s}if (${e.condition.expression}) {`);else{a.push(`${s}// AI Condition: ${d(e.condition.expression)}`);let c=JSON.stringify(e.condition.expression);a.push(`${s}if (await agent.evaluate(page, ${c}, "${r}")) {`)}let i=w(e.then,t+1,n,`${r}.then`);if(a.push(...i),e.else&&e.else.length>0){a.push(`${s}} else {`);let c=w(e.else,t+1,n,`${r}.else`);a.push(...c)}return a.push(`${s}}`),a}function je(e,t,r,n){let s=" ".repeat(t),a=[];a.push(`${s}// ${r}: Loop`);let i=e.timeout_ms??V,c=i/1e3,p=e.timeout_ms?`While loop exceeded timeout of ${c}s`:`While loop exceeded default timeout of ${c}s`,o=`loop_${r.replace(/\./g,"_")}`;if(a.push(`${s}const ${o}_start = Date.now();`),a.push(`${s}const ${o}_timeout = ${i};`),a.push(`${s}const ${o}_check = () => {`),a.push(`${s} if (Date.now() - ${o}_start > ${o}_timeout) {`),a.push(`${s} throw new Error('${p}');`),a.push(`${s} }`),a.push(`${s} return true;`),a.push(`${s}};`),e.condition.type==="JS_CODE")a.push(`${s}while (${o}_check() && (${e.condition.expression})) {`);else{a.push(`${s}// AI Loop Condition: ${d(e.condition.expression)}`);let f=JSON.stringify(e.condition.expression);a.push(`${s}while (${o}_check() && await agent.evaluate(page, ${f}, "${r}")) {`)}let l=w(e.body,t+1,n,`${r}.body`);return a.push(...l),a.push(`${s}}`),a}function Ie(e,t,r,n){let s=e.action_description||"",a=e.action_data?.kwargs||{};switch(t){case"go_to_url":case"open_tab":{let i=a.url||"";return[`${r}// ${n}: ${d(s)}`,`${r}await page.goto(${JSON.stringify(i)}, { waitUntil: 'domcontentloaded' });`]}case"go_back":return[`${r}// ${n}: ${d(s)}`,`${r}await page.goBack();`];case"go_forward":return[`${r}// ${n}: ${d(s)}`,`${r}await page.goForward();`];case"input_text":{let i=a.text||"",c=C(e);return c?[`${r}// ${n}: ${d(s)}`,`${r}await ${c}.fill(${JSON.stringify(i)}, { timeout: ${I} });`]:null}case"select_dropdown_option":{let i=a.text||a.label||"",c=C(e);return c?[`${r}// ${n}: ${d(s)}`,`${r}await ${c}.selectOption({ label: ${JSON.stringify(i)} }, { timeout: ${I} });`]:null}default:return null}}function Ce(e,t){let r=[],n=t?.version||"unknown";r.push(`// @generated by shiplightai v${n}`),r.push(...ee()),r.push(""),t?.use&&Object.keys(t.use).length>0&&(r.push(`test.use(${JSON.stringify(t.use,null,2)});`),r.push(""));let s=new Set,a={imports:s};t?.beforeEach&&t.beforeEach.length>0&&(r.push(...B("beforeEach",t.beforeEach,a)),r.push(""));let i=t?.timeout||t?.skip!==void 0||t?.fail!==void 0||t?.only||t?.slow?{timeout:t.timeout,skip:t.skip,fail:t.fail,only:t.only,slow:t.slow}:void 0;if(t?.parameters&&t.parameters.length>0){let c=t?.testName||e.goal||"Generated test",p=Y(t?.tags);for(let o of t.parameters){let l=Z(e,o.values);r.push(...J(l,`${p}${v(c)} [${v(o.name)}]`,a,0,i)),r.push("")}}else{let c=t?.testName||e.goal||"Generated test",p=Y(t?.tags);r.push(...J(e,`${p}${v(c)}`,a,0,i))}return t?.afterEach&&t.afterEach.length>0&&(r.push(""),r.push(...B("afterEach",t.afterEach,a))),te(r,s),r.join(`
|
|
8
|
-
`)}function Je(e,t){let r=[],n=t?.version||"unknown";r.push(`// @generated by shiplightai v${n}`),r.push(...ee()),r.push(""),t?.use&&Object.keys(t.use).length>0&&(r.push(`test.use(${JSON.stringify(t.use,null,2)});`),r.push(""));let s=new Set,a={imports:s},i=t?.testName||"Test Suite",c=Y(t?.tags),p=e.serial?"test.describe.serial":"test.describe";r.push(`${p}('${c}${v(i)}', () => {`),e.beforeAll&&e.beforeAll.length>0&&(r.push(...j("beforeAll",e.beforeAll,a,1)),r.push("")),e.beforeEach&&e.beforeEach.length>0&&(r.push(...j("beforeEach",e.beforeEach,a,1)),r.push(""));for(let o=0;o<e.tests.length;o++){let l=e.tests[o],f=l.timeout||l.skip!==void 0||l.fail!==void 0||l.only||l.slow?{timeout:l.timeout,skip:l.skip,fail:l.fail,only:l.only,slow:l.slow}:void 0;if(l.parameters&&l.parameters.length>0)for(let m of l.parameters){let g=Z(l.testFlow,m.values);r.push(...J(g,`${v(l.name)} [${v(m.name)}]`,a,1,f)),r.push("")}else r.push(...J(l.testFlow,v(l.name),a,1,f)),(o<e.tests.length-1||e.afterEach||e.afterAll)&&r.push("")}return e.afterEach&&e.afterEach.length>0&&(r.push(...j("afterEach",e.afterEach,a,1)),r.push("")),e.afterAll&&e.afterAll.length>0&&r.push(...j("afterAll",e.afterAll,a,1)),r.push("});"),te(r,s),r.join(`
|
|
9
|
-
`)}function Y(e){return e&&e.length>0?e.map(t=>`@${t}`).join(" ")+" ":""}function J(e,t,r,n=0,s){let a=" ".repeat(n),i=[],c=s?.only?"test.only":"test";i.push(`${a}${c}('${t}', async ({ page, agent }) => {`),s?.skip===!0?i.push(`${a} test.skip();`):typeof s?.skip=="string"&&i.push(`${a} test.skip(true, '${v(s.skip)}');`),s?.fail===!0?i.push(`${a} test.fail();`):typeof s?.fail=="string"&&i.push(`${a} test.fail(true, '${v(s.fail)}');`),s?.slow&&i.push(`${a} test.slow();`),s?.timeout&&i.push(`${a} test.setTimeout(${s.timeout});`);let p=e.teardown&&e.teardown.length>0,o=n+1;if(p){if(i.push(`${a} try {`),e.statements&&e.statements.length>0){i.push(`${a} // Test steps`);let f=w(e.statements,o+1,r);i.push(...f)}i.push(`${a} } finally {`),i.push(`${a} // Teardown`);let l=w(e.teardown,o+1,r,"teardown");i.push(...l),i.push(`${a} }`)}else if(e.statements&&e.statements.length>0){i.push(`${a} // Test steps`);let l=w(e.statements,o,r);i.push(...l)}return i.push(`${a}});`),i}function B(e,t,r){let n=[],s=Q(t);return n.push(`test.${e}(async ({ page, agent }) => {`),n.push(...w(s,1,r,e)),n.push("});"),n}function j(e,t,r,n){let s=" ".repeat(n),a=[],i=Q(t);if(e==="beforeAll"||e==="afterAll"){let p={...r,noAgent:!0};a.push(`${s}test.${e}(async ({ browser }, workerInfo) => {`),a.push(`${s} const page = await browser.newPage({ baseURL: workerInfo.project.use.baseURL });`),a.push(...w(i,n+1,p,e)),a.push(`${s} await page.close();`),a.push(`${s}});`)}else a.push(`${s}test.${e}(async ({ page, agent }) => {`),a.push(...w(i,n+1,r,e)),a.push(`${s}});`);return a}function Q(e){let r=Se({goal:"_hook",statements:e});return P(r).statements}function Z(e,t){let r=G(e);for(let[n,s]of Object.entries(t))r=r.split(`<<${n}>>`).join(String(s));return P(r)}function ee(){return["import { test, expect } from 'shiplightai/fixture';"]}function te(e,t){if(t.size>0){let r=0;for(let s=0;s<e.length;s++)e[s].startsWith("import ")&&(r=s+1);let n=Array.from(t);e.splice(r,0,...n)}}var X=5;function ne(e,t){let r={expandingPaths:new Set([se(t)]),depth:0,referencedPaths:new Set},n={...e};Array.isArray(n.statements)&&(n.statements=x(n.statements,t,r)),Array.isArray(n.teardown)&&(n.teardown=x(n.teardown,t,r));for(let s of["beforeAll","afterAll","beforeEach","afterEach"])Array.isArray(n[s])&&(n[s]=x(n[s],t,r));return{doc:n,referencedTemplatePaths:Array.from(r.referencedPaths)}}function x(e,t,r){let n=[];for(let s of e)if(We(s)){let a=Re(s,t,r);n.push(...a)}else n.push(De(s,t,r));return n}function We(e){return typeof e=="object"&&e!==null&&typeof e.template=="string"}function Re(e,t,r){if(r.depth>=X)throw new Error(`Template expansion exceeded maximum depth of ${X}. Check for deeply nested or circular template references.`);let n=se(Ye(t),e.template);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 s;try{s=He(n,"utf-8")}catch(l){throw new Error(`Failed to read template file: ${n} (referenced from ${t}): ${l.message}`)}let a=z(s);if(!a||typeof a!="object")throw new Error(`Invalid template file: ${n} \u2014 expected a YAML object`);let i=a.params||[],c=e.params||{};for(let l of i)if(!(l in c))throw new Error(`Template ${e.template} requires param "${l}" but it was not provided. Required params: [${i.join(", ")}]`);let p=a.statements;if(!Array.isArray(p))throw new Error(`Template ${e.template} must have a "statements" array`);if(Object.keys(c).length>0){let f=Me(p);for(let[m,g]of Object.entries(c))f=f.split(`<<${m}>>`).join(String(g));p=z(f)}let o={expandingPaths:new Set([...r.expandingPaths,n]),depth:r.depth+1,referencedPaths:r.referencedPaths};return x(p,n,o)}function De(e,t,r){if(typeof e!="object"||e===null)return e;let n={...e};return Array.isArray(n.statements)&&(n.statements=x(n.statements,t,r)),Array.isArray(n.THEN)&&(n.THEN=x(n.THEN,t,r)),Array.isArray(n.ELSE)&&(n.ELSE=x(n.ELSE,t,r)),Array.isArray(n.DO)&&(n.DO=x(n.DO,t,r)),n}function M(e,t){let r=Fe(e),n=r?.name,s=r?.tags,a=r?.use;if(r&&(r.name!==void 0||r.tags!==void 0||r.use!==void 0)&&(delete r.name,delete r.tags,delete r.use),r?.suite){if(r.goal||r.statements)throw new Error('YAML file cannot have both "suite" and top-level "goal"/"statements". Use either suite format or single-test format.');return Ue(r,n,s,a,t)}return Ge(r,n,s,a,t)}function Ge(e,t,r,n,s){let a=e?.beforeEach,i=e?.afterEach,c=ae(e?.parameters),p=e?.timeout,o=e?.skip,l=e?.fail,f=e?.only,m=e?.slow;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&&!e.goal&&t&&(e.goal=t);let g=[];if(s&&e&&typeof e=="object"){let S=ne(e,s);e=S.doc,g=S.referencedTemplatePaths}let _=re(e);return{testFlow:P(_),name:t,tags:r,use:n,beforeEach:a,afterEach:i,parameters:c,timeout:p,skip:o,fail:l,only:f,slow:m,referencedTemplatePaths:g}}function Ue(e,t,r,n,s){let a=e.suite;if(!Array.isArray(a.tests)||a.tests.length===0)throw new Error('Suite must have a non-empty "tests" array.');let i=a.serial,c=a.beforeAll,p=a.afterAll,o=a.beforeEach,l=a.afterEach,f=[],m=a.tests.map(g=>{if(!g.name)throw new Error('Each test in a suite must have a "name" field.');if(!Array.isArray(g.statements)||g.statements.length===0)throw new Error(`Suite test "${g.name}" must have a non-empty "statements" array.`);let _={goal:g.name,statements:g.statements};g.teardown&&(_.teardown=g.teardown);let b=[],S=_;if(s&&typeof _=="object"){let k=ne(_,s);S=k.doc,b=k.referencedTemplatePaths,f.push(...b)}let E=re(S),L=P(E),$=ae(g.parameters);return{testFlow:L,name:g.name,parameters:$,timeout:g.timeout,skip:g.skip,fail:g.fail,only:g.only,slow:g.slow}});return{suite:{serial:i,beforeAll:c,afterAll:p,beforeEach:o,afterEach:l,tests:m},name:t,tags:r,use:n,referencedTemplatePaths:f}}function ae(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 ie(e,t,r){let n=/\btemplate:\s/.test(e),s=/^suite:/m.test(e),a=n||s?null:U(e);if(a&&!a.valid)return{valid:!1,errors:a.errors,warnings:[],stats:a.stats};let i,c,p=[];try{let o=M(e,t);p=o.referencedTemplatePaths;let l={version:r?.version};o.suite?i=Je(o.suite,{...l,testName:o.name,tags:o.tags,use:o.use}):i=Ce(o.testFlow,{...l,testName:o.name,tags:o.tags,use:o.use,beforeEach:o.beforeEach,afterEach:o.afterEach,parameters:o.parameters,timeout:o.timeout,skip:o.skip,fail:o.fail,only:o.only,slow:o.slow});let f=i.split(`
|
|
10
|
-
`).filter(m=>!m.startsWith("import ")).join(`
|
|
11
|
-
`);new Function(f),c=t.replace(/\.test\.yaml$/,".yaml.spec.ts"),qe(Ke(c),{recursive:!0}),Ve(c,i)}catch(o){let l=o.message.includes("Unexpected token")?" This usually means a YAML escaping issue \u2014 in double-quoted strings, use \\\\/ instead of \\/ for regex patterns, or use single quotes / block scalars.":" This may indicate a transpiler bug \u2014 please report it.";return{valid:!1,errors:[`Transpilation failed: ${o.message}.${l}`],warnings:[],stats:a?.stats??{total:0,withLocator:0,coverage:0},referencedTemplatePaths:p}}return{valid:!0,errors:[],warnings:a?.warnings??[],stats:a?.stats??{total:0,withLocator:0,coverage:0},specFile:c,referencedTemplatePaths:p}}var oe={name:"shiplightai",version:"0.1.19",type:"module",description:"Shiplight CLI for running and debugging .test.yaml files",main:"dist/index.js",types:"dist/index.d.ts",bin:{shiplight:"dist/cli.js"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/cjs/index.cjs",default:"./dist/index.js"},"./fixture":{types:"./dist/fixture.d.ts",import:"./dist/fixture.js",require:"./dist/cjs/fixture.cjs",default:"./dist/fixture.js"},"./debugger-pw":{types:"./dist/debugger-pw.d.ts",import:"./dist/debugger-pw.js",require:"./dist/cjs/debugger-pw.cjs",default:"./dist/debugger-pw.js"}},files:["dist","README.md"],publishConfig:{registry:"https://registry.npmjs.org",access:"public"},scripts:{build:"tsup","build:cli":"tsup",clean:"rm -rf dist",dev:"tsup --watch",test:"playwright test",typecheck:"tsc --noEmit"},dependencies:{"@babel/plugin-transform-typescript":"^7.27.0","@babel/preset-env":"^7.26.9","@babel/preset-typescript":"^7.27.0","@anthropic-ai/claude-agent-sdk":"^0.1.72","@modelcontextprotocol/sdk":"^0.5.0",axios:"^1.6.0",dotenv:"^16.0.3",express:"^4.21.0",glob:"^13.0.0",open:"^10.1.0",sharp:"^0.34.5",uuid:"^11.1.0",yaml:"^2.8.0",zod:"^3.22.0","zod-to-json-schema":"^3.24.6"},devDependencies:{"@playwright/test":"1.58.2","@types/express":"^4.17.21","@types/node":"^24.0.0",copilot3:"workspace:*","mcp-tools":"workspace:*","sdk-core":"workspace:*","sdk-internal":"workspace:*","shiplight-tools":"workspace:*","shiplight-types":"workspace:*",tsup:"^8.3.5",typescript:"5.5.4","web-session":"workspace:*"},peerDependencies:{"@playwright/test":"1.58.2"},engines:{node:">=22.0.0"},keywords:["playwright","yaml","testing","automation","ai","shiplight","mcp"],author:"Shiplight",license:"MIT"};var W=oe.version;function ce(e){try{return ze(e).mtimeMs}catch{return 0}}var Qe=`// @generated by shiplightai v${W}`;function Ze(e,t){if(!pe(e)||le(e,"utf-8").split(`
|
|
12
|
-
`,1)[0]!==Qe)return!1;let n=ce(e);for(let s of t)if(ce(s)>n)return!1;return!0}function et(e){let t=process.argv.slice(2),r=[],n=R(e);for(let s of t){if(s.startsWith("-"))continue;let a=s.endsWith(".yaml.spec.ts")?s.replace(/\.yaml\.spec\.ts$/,".test.yaml"):s;if(!a.endsWith(".test.yaml"))continue;let i=R(e,a);pe(i)&&r.push(i.startsWith(n)?i.slice(n.length+1):a)}return r.length>0?r:null}function ue(e){let t=et(e.cwd),r=t??Xe("**/*.test.yaml",{cwd:e.cwd,ignore:["**/node_modules/**"]}),n=[];for(let s of r){let a=R(e.cwd,s),i=a.replace(/\.test\.yaml$/,".yaml.spec.ts"),c=le(a,"utf-8");try{let p=M(c,a);if(Ze(i,[a,...p.referencedTemplatePaths]))continue;let o=ie(c,a,{version:W});if(!o.valid)throw new Error(o.errors.join("; "))}catch(p){console.error(`[shiplight] Failed to transpile ${s}:`,p),n.push({file:s,error:p})}}if(n.length>0){let s=`[shiplight] Transpilation failed for ${n.length} file(s):
|
|
13
|
-
`+n.map(a=>` - ${a.file}`).join(`
|
|
14
|
-
`);if(t)throw new Error(s);console.warn(s+" (skipped)")}}import*as O from"path";import*as de from"fs";import{mkdir as rt}from"fs/promises";import*as H from"fs";import*as N from"path";function D(e){let t=null,r=process.env.SHIPLIGHT_LOGIN_EMAIL,n=process.env.SHIPLIGHT_LOGIN_PASSWORD;return r&&n&&(t={username:r,password:n}),t||(t=tt(e)),t?(process.env.SHIPLIGHT_LOGIN_URL&&(t.loginUrl=process.env.SHIPLIGHT_LOGIN_URL),process.env.SHIPLIGHT_LOGIN_TOTP_SECRET&&(t.totpSecret=process.env.SHIPLIGHT_LOGIN_TOTP_SECRET),t):null}function F(e){if(e.startsWith("$")){let t=e.slice(1);return process.env[t]||e}return e}function tt(e){let t=N.resolve(e),r=N.resolve(process.cwd());for(;;){for(let s of["shiplight.config.json","login.config.json"]){let a=N.join(t,s);if(H.existsSync(a))try{let i=JSON.parse(H.readFileSync(a,"utf-8"));if(i.username&&i.password)return{username:F(i.username),password:F(i.password),loginUrl:i.url?F(i.url):void 0,totpSecret:i.totp_secret?F(i.totp_secret):void 0}}catch{}}if(t===r)break;let n=N.dirname(t);if(n===t)break;t=n}return null}var me="auth.setup.ts",fe=".auth",ge="storage-state.json";async function st(e,t){let r=O.resolve(t),n=O.join(r,fe,ge);if(de.existsSync(n)){console.log("[INFO] Storage state exists, skipping login. Delete",n,"to force re-auth.");return}let s=D(r);if(!s)return;let{WebAgent:a,createAgentContext:i,configureSdk:c,VariableStore:p,LoginType:o,TwoFactorAuthType:l}=await import("./dist-REAH3DVS.js");c({env:{GOOGLE_API_KEY:process.env.GOOGLE_API_KEY??"",ANTHROPIC_API_KEY:process.env.ANTHROPIC_API_KEY??""}});let{resolveModelFromEnv:f}=await import("./dist-T7XB7SCU.js"),m=f(process.env);if(!m)throw new Error("No AI model configured. Set WEB_AGENT_MODEL, ANTHROPIC_API_KEY, or GOOGLE_API_KEY.");let g=new a(i({model:m,variableStore:new p})),{username:_,password:b,loginUrl:S,totpSecret:E}=s,L=S||e.url()||"about:blank";if(!(await g.loginPage(e,{site_url:L,num_verification_exprs:0,account:{type:o.PASSWORD,username:_,password:b,...E&&{two_factor_auth_config:{type:l.TOTP,data:E}}}})).success)throw new Error("Login failed.");let k=O.join(r,fe);await rt(k,{recursive:!0}),await e.context().storageState({path:O.join(k,ge)})}function he(){return`// @generated by shiplightai \u2014 do not edit
|
|
3
|
+
import{r as Y,s as K}from"./chunk-JHSENQ4F.js";import"./chunk-32JFHFFG.js";import"./chunk-2F3YRAA7.js";import"./chunk-RTTIJBGI.js";import"./chunk-YU3XZJIJ.js";import"./chunk-USRSZQWN.js";import{l as W}from"./chunk-LPSNOKYP.js";import"./chunk-YHOTGR6H.js";import"./chunk-YDR4P3GA.js";import{a as U}from"./chunk-DJDHFWEV.js";import{a as I,b as E}from"./chunk-THVHM4KG.js";import"./chunk-JNRJXAJS.js";import"./chunk-CSINHOOD.js";import*as c from"fs";import*as a from"path";import tt from"dotenv";import{globSync as et}from"glob";import{readFileSync as P,statSync as V,existsSync as T}from"fs";import{resolve as S}from"path";import{globSync as q}from"glob";var L={name:"shiplightai",version:"0.1.21",type:"module",description:"Shiplight CLI for running and debugging .test.yaml files",main:"dist/index.js",types:"dist/index.d.ts",bin:{shiplight:"dist/cli.js"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/cjs/index.cjs",default:"./dist/index.js"},"./fixture":{types:"./dist/fixture.d.ts",import:"./dist/fixture.js",require:"./dist/cjs/fixture.cjs",default:"./dist/fixture.js"},"./debugger-pw":{types:"./dist/debugger-pw.d.ts",import:"./dist/debugger-pw.js",require:"./dist/cjs/debugger-pw.cjs",default:"./dist/debugger-pw.js"}},files:["dist","README.md"],publishConfig:{registry:"https://registry.npmjs.org",access:"public"},scripts:{build:"tsup","build:cli":"tsup",clean:"rm -rf dist",dev:"tsup --watch",test:"playwright test",typecheck:"tsc --noEmit"},dependencies:{"@babel/plugin-transform-typescript":"^7.27.0","@babel/preset-env":"^7.26.9","@babel/preset-typescript":"^7.27.0","@anthropic-ai/claude-agent-sdk":"^0.1.72","@modelcontextprotocol/sdk":"^0.5.0",axios:"^1.6.0",dotenv:"^16.0.3",express:"^4.21.0",glob:"^13.0.0",open:"^10.1.0",sharp:"^0.34.5",uuid:"^11.1.0",yaml:"^2.8.0",zod:"^3.22.0","zod-to-json-schema":"^3.24.6"},devDependencies:{"@playwright/test":"1.58.2","@types/express":"^4.17.21","@types/node":"^24.0.0",copilot3:"workspace:*","mcp-tools":"workspace:*","sdk-core":"workspace:*","sdk-internal":"workspace:*","shiplight-tools":"workspace:*","shiplight-types":"workspace:*",tsup:"^8.3.5",typescript:"5.5.4","web-session":"workspace:*"},peerDependencies:{"@playwright/test":"1.58.2"},engines:{node:">=22.0.0"},keywords:["playwright","yaml","testing","automation","ai","shiplight","mcp"],author:"Shiplight",license:"MIT"};var m=L.version;function x(t){try{return V(t).mtimeMs}catch{return 0}}var z=`// @generated by shiplightai v${m}`;function J(t,e){if(!T(t)||P(t,"utf-8").split(`
|
|
4
|
+
`,1)[0]!==z)return!1;let r=x(t);for(let s of e)if(x(s)>r)return!1;return!0}function B(t){let e=process.argv.slice(2),i=[],r=S(t);for(let s of e){if(s.startsWith("-"))continue;let o=s.endsWith(".yaml.spec.ts")?s.replace(/\.yaml\.spec\.ts$/,".test.yaml"):s;if(!o.endsWith(".test.yaml"))continue;let n=S(t,o);T(n)&&i.push(n.startsWith(r)?n.slice(r.length+1):o)}return i.length>0?i:null}function A(t){let e=B(t.cwd),i=e??q("**/*.test.yaml",{cwd:t.cwd,ignore:["**/node_modules/**"]}),r=[];for(let s of i){let o=S(t.cwd,s),n=o.replace(/\.test\.yaml$/,".yaml.spec.ts"),p=P(o,"utf-8");try{let l=I(p,o);if(J(n,[o,...l.referencedTemplatePaths]))continue;let u=E(p,o,{version:m});if(!u.valid)throw new Error(u.errors.join("; "))}catch(l){console.error(`[shiplight] Failed to transpile ${s}:`,l),r.push({file:s,error:l})}}if(r.length>0){let s=`[shiplight] Transpilation failed for ${r.length} file(s):
|
|
5
|
+
`+r.map(o=>` - ${o.file}`).join(`
|
|
6
|
+
`);if(e)throw new Error(s);console.warn(s+" (skipped)")}}import*as g from"path";import*as j from"fs";import{mkdir as X}from"fs/promises";import*as h from"fs";import*as f from"path";function y(t){let e=null,i=process.env.SHIPLIGHT_LOGIN_EMAIL,r=process.env.SHIPLIGHT_LOGIN_PASSWORD;return i&&r&&(e={username:i,password:r}),e||(e=Q(t)),e?(process.env.SHIPLIGHT_LOGIN_URL&&(e.loginUrl=process.env.SHIPLIGHT_LOGIN_URL),process.env.SHIPLIGHT_LOGIN_TOTP_SECRET&&(e.totpSecret=process.env.SHIPLIGHT_LOGIN_TOTP_SECRET),e):null}function d(t){if(t.startsWith("$")){let e=t.slice(1);return process.env[e]||t}return t}function Q(t){let e=f.resolve(t),i=f.resolve(process.cwd());for(;;){for(let s of["shiplight.config.json","login.config.json"]){let o=f.join(e,s);if(h.existsSync(o))try{let n=JSON.parse(h.readFileSync(o,"utf-8"));if(n.username&&n.password)return{username:d(n.username),password:d(n.password),loginUrl:n.url?d(n.url):void 0,totpSecret:n.totp_secret?d(n.totp_secret):void 0}}catch{}}if(e===i)break;let r=f.dirname(e);if(r===e)break;e=r}return null}var k="auth.setup.ts",b=".auth",O="storage-state.json";async function Z(t,e){let i=g.resolve(e),r=g.join(i,b,O);if(j.existsSync(r)){console.log("[INFO] Storage state exists, skipping login. Delete",r,"to force re-auth.");return}let s=y(i);if(!s)return;let{WebAgent:o,createAgentContext:n,configureSdk:p,VariableStore:l,LoginType:u,TwoFactorAuthType:G}=await import("./dist-CXOVVE77.js");p({env:{GOOGLE_API_KEY:process.env.GOOGLE_API_KEY??"",ANTHROPIC_API_KEY:process.env.ANTHROPIC_API_KEY??""}});let{resolveModelFromEnv:H}=await import("./dist-SRXGJZ7P.js"),w=H(process.env);if(!w)throw new Error("No AI model configured. Set WEB_AGENT_MODEL, ANTHROPIC_API_KEY, or GOOGLE_API_KEY.");let N=new o(n({model:w,variableStore:new l})),{username:R,password:D,loginUrl:F,totpSecret:v}=s,M=F||t.url()||"about:blank";if(!(await N.loginPage(t,{site_url:M,num_verification_exprs:0,account:{type:u.PASSWORD,username:R,password:D,...v&&{two_factor_auth_config:{type:G.TOTP,data:v}}}})).success)throw new Error("Login failed.");let _=g.join(i,b);await X(_,{recursive:!0}),await t.context().storageState({path:g.join(_,O)})}function C(){return`// @generated by shiplightai \u2014 do not edit
|
|
15
7
|
import { test as setup } from '@playwright/test';
|
|
16
8
|
import { authSetup } from 'shiplightai';
|
|
17
9
|
|
|
18
10
|
setup('authenticate', async ({ page }) => {
|
|
19
11
|
await authSetup(page, import.meta.dirname);
|
|
20
12
|
});
|
|
21
|
-
`}function
|
|
13
|
+
`}function st(t={}){t.dotenv!==!1&&rt(t.scanDir||process.cwd());let e=t.scanDir||process.cwd();return A({cwd:e}),it(e),t.apiKey&&(process.env.__SHIPLIGHT_API_KEY=t.apiKey),{}}function rt(t){let e=[],i=a.resolve(t),r=a.resolve(process.cwd());for(;;){let s=a.join(i,".env");if(c.existsSync(s)&&e.push(s),i===r)break;let o=a.dirname(i);if(o===i)break;i=o}for(let s of e)tt.config({path:s})}function it(t){let e=et("**/shiplight.config.json",{cwd:t,ignore:["**/node_modules/**"]});for(let i of e){let r=a.resolve(t,i),s=a.dirname(r),o=a.join(s,k),n=!1;try{let p=JSON.parse(c.readFileSync(r,"utf-8"));n=!!(p.username&&p.password)}catch{}if(!n&&process.env.SHIPLIGHT_LOGIN_EMAIL&&process.env.SHIPLIGHT_LOGIN_PASSWORD&&(n=!0),!!n){try{let p=c.statSync(r).mtimeMs;if(c.statSync(o).mtimeMs>p)continue}catch{}c.writeFileSync(o,C())}}}export{W as VariableStore,Y as WebAgent,Z as authSetup,U as configureSdk,K as createAgentContext,y as resolveLoginConfig,st as shiplightConfig};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "module";
|
|
2
2
|
const require = __createRequire(import.meta.url);
|
|
3
|
-
import{b as $,c as N,d as O,f as U,n as M}from"./chunk-
|
|
3
|
+
import{b as $,c as N,d as O,f as U,n as M}from"./chunk-RTTIJBGI.js";import"./chunk-YU3XZJIJ.js";import{l as R}from"./chunk-USRSZQWN.js";import{h as E}from"./chunk-YHOTGR6H.js";import{a as i}from"./chunk-YDR4P3GA.js";import"./chunk-DJDHFWEV.js";import"./chunk-CSINHOOD.js";import{z as b}from"zod";function _(t,o,e){let s=()=>t.stepHistory.length===0?"":`**Recent Steps**:
|
|
4
4
|
${t.stepHistory.slice(-3).map(a=>{let n=`${a.outcome.success?"\u2713":"\u2717"} Step ${a.stepNumber}: ${a.goal}`;if(a.actions.length>1)a.actions.forEach((c,l)=>{let h=c.action_description||"Unknown action";n+=`
|
|
5
5
|
\u2192 Action ${l+1}: ${h}`});else if(a.actions.length===1){let c=a.actions[0]?.action_description||"Unknown action";n+=`
|
|
6
6
|
\u2192 ${c}`}if(!a.outcome.success&&a.outcome.error){let c=a.outcome.error.substring(0,100);n+=`
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "module";
|
|
2
|
+
const require = __createRequire(import.meta.url);
|
|
3
|
+
import{a as d}from"./chunk-THVHM4KG.js";import{ca as c,fa as w,ga as p}from"./chunk-JNRJXAJS.js";import"./chunk-CSINHOOD.js";import{Router as g}from"express";import*as r from"fs/promises";import*as u from"path";import{stringify as b}from"yaml";function m(t){if(!t||t.length===0)return[];let n=b({goal:"_hook",statements:t});return p(n).statements}function y(t){let n=g();return n.get("/api/test-flow",async(l,a)=>{try{let e=await r.readFile(t,"utf-8"),f=w(e),s=d(e,t),i=await r.stat(t);s.suite?a.json({isSuite:!0,suite:{beforeAll:m(s.suite.beforeAll),afterAll:m(s.suite.afterAll),beforeEach:m(s.suite.beforeEach),afterEach:m(s.suite.afterEach),tests:s.suite.tests.map(o=>({name:o.name,testFlow:o.testFlow,skip:o.skip,timeout:o.timeout,fail:o.fail,only:o.only,slow:o.slow}))},metadata:f,name:s.name,tags:s.tags,use:s.use,filePath:t,fileName:u.basename(t),lastModified:i.mtimeMs}):a.json({testFlow:s.testFlow,metadata:f,filePath:t,fileName:u.basename(t),lastModified:i.mtimeMs})}catch(e){if(e.code==="ENOENT")return a.status(404).json({error:`File not found: ${t}`});console.error("[debugger] Error loading test flow:",e),a.status(500).json({error:e.message})}}),n.put("/api/test-flow",async(l,a)=>{try{let{testFlow:e,metadata:f}=l.body;if(!e)return a.status(400).json({error:"testFlow is required"});let s=c(e,f),i=t+".tmp";await r.writeFile(i,s,"utf-8"),await r.rename(i,t);let o=await r.stat(t);a.json({success:!0,lastModified:o.mtimeMs})}catch(e){console.error("[debugger] Error saving test flow:",e),a.status(500).json({error:e.message})}}),n}export{y as createTestFlowRouter};
|
package/package.json
CHANGED
package/dist/chunk-AZ7CG3SO.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { createRequire as __createRequire } from "module";
|
|
2
|
-
const require = __createRequire(import.meta.url);
|
|
3
|
-
var _=e=>{let t=[];switch(e.type){case"STEP":e.statements&&t.push({key:"statements",statements:e.statements});break;case"IF_ELSE":e.then&&t.push({key:"then",statements:e.then}),e.else&&t.push({key:"else",statements:e.else});break;case"WHILE_LOOP":e.body&&t.push({key:"body",statements:e.body});break}return t},y=(e,t,i=void 0,r="root")=>{for(let o=0;o<e.length;o++){let n=e[o],s=n.uid;if(s===t)return{stableId:s,path:[o],statement:n,parent:i,containerKey:r,index:o};let a=_(n);for(let c of a){let u=y(c.statements,t,n,c.key);if(u)return{...u,path:[o,c.key,...u.path]}}}return null},k=(e,t,i)=>{let r=y(e,t);if(!r)return null;let{statement:o,parent:n,containerKey:s,index:a}=r,c=null;switch(o.type){case"DRAFT":case"ACTION":c=E(e,r)||O(e,r);break;case"STEP":if(o.statements&&o.statements.length>0)return o.statements[0];c=E(e,r)||O(e,r);break;case"IF_ELSE":if(i===!0&&o.then&&o.then.length>0)return o.then[0];if(i===!1&&o.else&&o.else.length>0)return o.else[0];c=E(e,r)||O(e,r);break;case"WHILE_LOOP":if(i===!0&&o.body&&o.body.length>0)return o.body[0];c=E(e,r)||O(e,r);break;default:c=E(e,r)||O(e,r);break}if(n&&n.type==="WHILE_LOOP"&&s==="body"){if(!c)return n;let u=y(e,c.uid);if(!u||u.parent!==n)return n}return c},E=(e,t)=>{if(!t.parent)return e[t.index+1]||null;let r=_(t.parent).find(o=>o.key===t.containerKey);return r&&t.index+1<r.statements.length?r.statements[t.index+1]:null},O=(e,t)=>{if(!t.parent)return null;let i=t.parent.uid,r=y(e,i);return r?E(e,r)||O(e,r):null},H=e=>{let t=[],i=r=>{for(let o of r){t.push(o);let n=_(o);for(let s of n)i(s.statements)}};return i(e),t},Ge=e=>{switch(e.type){case"DRAFT":case"ACTION":return!0;case"STEP":return!0;case"IF_ELSE":case"WHILE_LOOP":return!0;default:return!1}},Be=(e,t,i)=>{if(!y(e,t))return null;if(i===null){let a=[],c=t;for(;c!==null&&y(e,c);)if(a.push(c),c=k(e,c)?.uid||null,a.length>1e3)return null;return a}if(!y(e,i))return null;if(t===i)return[];let n=[],s=t;for(;s&&s!==i;){let a=y(e,s);if(!a)break;if(n.push(s),a.statement.type==="IF_ELSE"){let c=He(a.statement,i);c?s=k(e,s,c==="then")?.uid||null:s=k(e,s)?.uid||null}else a.statement.type==="WHILE_LOOP"?Ne(a.statement,i)?s=k(e,s,!0)?.uid||null:s=k(e,s,!1)?.uid||null:s=k(e,s)?.uid||null;if(n.length>1e3)return null}return s===i?n:null},He=(e,t)=>{if(e.type!=="IF_ELSE")return null;let i=e;return i.then&&y(i.then,t)?"then":i.else&&y(i.else,t)?"else":null},Ne=(e,t)=>{if(e.type!=="WHILE_LOOP")return!1;let i=e;return!!(i.body&&y(i.body,t))};function Q(e){for(let t of e){if(t.type==="STEP"&&t.reference_id)return!0;let i=_(t);for(let r of i)if(Q(r.statements))return!0}return!1}function Re(e){let t=new Set;function i(r){for(let o of r){o.type==="STEP"&&o.reference_id&&t.add(o.reference_id);let n=_(o);for(let s of n)i(s.statements)}}return i(e),Array.from(t)}var $e=e=>e.startsWith("ai_")?!0:["js_code","function","assert","verify","wait_for_download_complete","extract_activation_code","extract_email_content"].includes(e),ze=e=>!["js_code","function","assert","ai_assert","verify","ai_extract","ai_wait_until","upload_file","login","extract_activation_code","extract_email_content","ai_step"].includes(e),x=(e,t,i)=>{e.forEach((r,o)=>{let n=`${t}.${o}`;r.type==="DRAFT"?i[n]={description:r.description||"Draft",action_entity:void 0}:r.type==="ACTION"?i[n]={description:r.description||"Action",action_entity:r.action_entity}:r.type==="STEP"&&r.statements?x(r.statements,n,i):r.type==="IF_ELSE"?(i[n]={description:"IF "+(r.condition?.expression||""),action_entity:void 0},r.then&&x(r.then,`${n}.then`,i),r.else&&x(r.else,`${n}.else`,i)):r.type==="WHILE_LOOP"&&(i[n]={description:"WHILE "+(r.condition?.expression||""),action_entity:void 0},r.body&&x(r.body,`${n}.body`,i))})};function Ue(e){if(!e?.statements||!Array.isArray(e.statements))return{};let t={};return x(e.statements,"main",t),e.teardown&&Array.isArray(e.teardown)&&x(e.teardown,"teardown",t),t}function A(e,t,i){let r=e+".",o=t.filter(([h])=>h===e||h.startsWith(r));if(o.length===0)return[];let n=[],s=new Set;for(let[h]of o){let p=h===e?"":h.slice(r.length);if(!p)continue;let d=p.split(".")[0];s.has(d)||s.add(d)}let a=Array.from(s);a.sort((h,p)=>{let d=/^\d+$/.test(h)?parseInt(h,10):-1,m=/^\d+$/.test(p)?parseInt(p,10):-1;return d>=0&&m>=0?d-m:h==="then"&&p==="else"?-1:h==="else"&&p==="then"||h==="body"?1:p==="body"?-1:h.localeCompare(p)});function c(h){return i[h]}function u(h){let p=h.match(/^(IF|WHILE)\s+([\s\S]+)$/);return{type:"JS_CODE",expression:(p?p[2].trim():h)||"true"}}for(let h of a){let p=e?`${e}.${h}`:h,d=c(p),m=d?.description??"",w=p;if(h==="then"){let f=`${e}.then`,P=`${e}.else`,S=A(f,t,i),v=A(P,t,i),B=c(e),Fe=B?u(B.description):{type:"JS_CODE",expression:"true"};n.push({uid:e,type:"IF_ELSE",condition:Fe,then:S,...v.length>0?{else:v}:{}});continue}if(h==="else")continue;if(h==="body"){let f=`${e}.body`,P=A(f,t,i),S=c(e),v=S?u(S.description):{type:"JS_CODE",expression:"true"};n.push({uid:e,type:"WHILE_LOOP",condition:v,body:P});continue}let g=`${e}.${h}`,I=t.some(([f])=>f.startsWith(g+".then.")||f===g+".then"),$=t.some(([f])=>f.startsWith(g+".else.")||f===g+".else"),Ce=t.some(([f])=>f.startsWith(g+".body.")||f===g+".body"),Ke=t.filter(([f])=>{if(!f.startsWith(g+"."))return!1;let S=f.slice(g.length+1).split(".")[0];return/^\d+$/.test(S)&&S!=="then"&&S!=="else"&&S!=="body"});if(I||$){let f=g+".then",P=g+".else",S=A(f,t,i),v=A(P,t,i),B=d?u(m):{type:"JS_CODE",expression:"true"};n.push({uid:p,type:"IF_ELSE",condition:B,then:S,...v.length>0?{else:v}:{}})}else if(Ce){let f=g+".body",P=A(f,t,i),S=d?u(m):{type:"JS_CODE",expression:"true"};n.push({uid:p,type:"WHILE_LOOP",condition:S,body:P})}else if(Ke.length>0){let f=A(g,t,i);n.push({uid:p,type:"STEP",description:m||"Group",statements:f})}else n.push({uid:p,type:"ACTION",description:m||"Action",action_entity:d?.action_entity})}return n}function Ve(e){let t=Object.entries(e),i=r=>{let o=r+".";return t.some(([s])=>s===r||s.startsWith(o))?A(r,t,e):[]};return{before:i("before"),main:i("main"),teardown:i("teardown"),after:i("after")}}import{z as l}from"zod";var ee=l.enum(["JS_CODE","AI_MODE"]),z=l.object({type:ee,expression:l.string()}),te=l.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),D=l.object({uid:l.string(),type:te}),ie=l.object({action_data:l.object({action_name:l.string(),kwargs:l.record(l.any()).optional(),args:l.array(l.any()).optional()}),action_description:l.string().optional(),url:l.string().optional(),xpath:l.string().nullable().optional(),locator:l.string().nullable().optional(),css_selector:l.string().nullable().optional(),unique_selector:l.string().nullable().optional(),element_index:l.number().nullable().optional(),frame_path:l.array(l.any()).optional(),artifacts:l.record(l.any()).optional(),feedback:l.string().optional(),original_browser_use_action:l.any().optional()}).passthrough(),re=D.extend({type:l.literal("DRAFT"),description:l.string()}),oe=D.extend({type:l.literal("ACTION"),description:l.string(),action_entity:ie.optional(),locator:l.string().optional(),use_pure_vision:l.boolean().optional()}),L=l.lazy(()=>l.union([re,oe,D.extend({type:l.literal("STEP"),description:l.string().optional().default(""),statements:l.array(L),reference_id:l.number().optional()}),D.extend({type:l.literal("IF_ELSE"),description:l.string().optional(),condition:z,then:l.array(L),else:l.array(L).optional()}),D.extend({type:l.literal("WHILE_LOOP"),description:l.string().optional(),condition:z,body:l.array(L),timeout_ms:l.number().optional()})])),U=l.object({version:l.string().optional(),goal:l.string(),url:l.string().optional(),final_feedback:l.string().optional(),completed:l.boolean().optional(),success:l.boolean().optional(),statements:l.array(L),teardown:l.array(L).optional(),last_modified_at:l.string().optional()});import{stringify as V,parse as X,parseAllDocuments as Xe}from"yaml";import{v4 as b}from"uuid";function ae(e,t){let i={...t?.test_case_id!==void 0?{test_case_id:t.test_case_id}:{},...t?.name?{name:t.name}:{},goal:e.goal,url:e.url,statements:e.statements.map(W)};return e.final_feedback&&(i.final_feedback=e.final_feedback),e.teardown&&e.teardown.length>0&&(i.teardown=e.teardown.map(W)),i}var Y={lineWidth:120,defaultKeyType:"PLAIN",defaultStringType:"PLAIN"};function Ye(e,t){return V(ae(e,t),Y)}function je(e){return e.map(t=>V(t,Y)).join(`---
|
|
4
|
-
`)}function W(e){switch(e.type){case"DRAFT":return Je(e);case"ACTION":return qe(e);case"STEP":return Ze(e);case"IF_ELSE":return Qe(e);case"WHILE_LOOP":return et(e)}}function Je(e){return{desc:e.description}}function qe(e){let t=e.action_entity?.action_data?.action_name??e.action_entity?.action?.action_name,i=e.action_entity?.action_data?.kwargs??e.action_entity?.action?.kwargs;if(t==="verify"){let a=i?.statement;if(typeof a=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let c=i?.code;return typeof c=="string"?{VERIFY:a,js:c}:{VERIFY:a}}}if(t==="go_to_url"){let a=i?.url;if(typeof a=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let c={URL:a};return i?.new_tab===!0&&(c.new_tab=!0),typeof i?.timeout_seconds=="number"&&(c.timeout_seconds=i.timeout_seconds),c}}if(t==="js_action"){let a=i?.code;if(typeof a=="string"&&e.description)return{desc:e.description,js:a}}if(t==="js_code"){let a=i?.code;if(typeof a=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath)return{CODE:a}}if(!e.action_entity)return{desc:e.description};let r=e.action_entity.action_data??e.action_entity.action;if(!r)return{desc:e.description};let o={desc:e.description,action:r.action_name},n=e.locator??e.action_entity.locator;n&&(o.locator=n);let s=e.action_entity.xpath;if(s&&(o.xpath=s),e.use_pure_vision&&(o.use_pure_vision=!0),r.kwargs&&Object.keys(r.kwargs).length>0)for(let[a,c]of Object.entries(r.kwargs))o[a]=c;return r.args&&r.args.length>0&&(o.args=r.args),o}function Ze(e){let t={STEP:e.description,statements:e.statements.map(W)};return e.reference_id!==void 0&&(t.reference_id=e.reference_id),t}function Qe(e){let t={IF:se(e.condition),THEN:e.then.map(W)};return e.else&&e.else.length>0&&(t.ELSE=e.else.map(W)),t}function et(e){let t={WHILE:se(e.condition),DO:e.body.map(W)};return e.timeout_ms!==void 0&&(t.timeout_ms=e.timeout_ms),t}function se(e){return e.type==="JS_CODE"?`js:${e.expression}`:e.expression}function tt(e){let t=Xe(e),i;if(t.length>1||t.length===1&&!Array.isArray(t[0]?.toJSON()))i=t.map((r,o)=>r.errors.length>0?{__parseError:`Document ${o+1}: ${r.errors[0].message}`}:r.toJSON());else{let r;try{r=X(e)}catch(o){throw new Error(`Invalid YAML: ${o instanceof Error?o.message:String(o)}`)}if(!Array.isArray(r))throw new Error("Expected a YAML array or multi-document YAML (separated by ---)");i=r}return i.map((r,o)=>{try{if(r&&typeof r=="object"&&"__parseError"in r)return{error:r.__parseError};if(!r||typeof r!="object")return{error:`Item ${o+1}: expected an object`};let n=r,s=typeof n.name=="string"&&n.name.trim()||void 0,a=typeof n.goal=="string"?n.goal.trim():"";if(!a)return{error:`Item ${o+1}: missing "goal" field`};if(Array.isArray(n.statements))try{let c=V(n,Y),u=K(c);return{name:s,goal:u.goal,testFlow:u}}catch{}return{name:s,goal:a}}catch(n){return{error:`Item ${o+1}: ${n instanceof Error?n.message:String(n)}`}}})}function it(e){try{let t=X(e);if(!t||typeof t!="object")return{};let i={};return typeof t.test_case_id=="number"&&Number.isFinite(t.test_case_id)&&(i.test_case_id=t.test_case_id),typeof t.name=="string"&&t.name.trim()&&(i.name=t.name.trim()),i}catch{return{}}}var ne=1024*1024;function K(e){if(e.length>ne)throw new Error(`YAML input too large (${e.length} bytes, max ${ne})`);let t=X(e);if(!t||typeof t!="object")throw new Error("Invalid YAML: expected an object at root level");let i={version:"1.3.0",goal:t.goal,url:t.url,statements:C(t.statements??[])};t.final_feedback&&(i.final_feedback=t.final_feedback),t.teardown&&Array.isArray(t.teardown)&&(i.teardown=C(t.teardown));let r=U.safeParse(i);if(!r.success)throw new Error(`Invalid TestFlow after YAML conversion: ${JSON.stringify(r.error.errors)}`);return r.data}function C(e){if(!Array.isArray(e))throw new Error("Expected an array of statements");return e.map(rt)}function rt(e){if(typeof e=="string")throw new Error(`Plain string statements are not supported. Use "desc: ${e}" instead.`);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 nt(t);if("STEP"in t)return at(t);if("VERIFY"in t){let i=t.VERIFY,r={statement:typeof i=="string"?i:String(i)};return typeof t.js=="string"&&(r.code=t.js),{uid:b(),type:"ACTION",description:`Verify: ${i}`,action_entity:{action_description:`Verify: ${i}`,action_data:{action_name:"verify",kwargs:r}}}}if("URL"in t){let i=t.URL,r=t.new_tab===!0?!0:void 0,o=typeof t.timeout_seconds=="number"?t.timeout_seconds:void 0,n={url:typeof i=="string"?i:String(i)};return r&&(n.new_tab=!0),o!==void 0&&(n.timeout_seconds=o),{uid:b(),type:"ACTION",description:`Navigate to ${i}`,action_entity:{action_description:`Navigate to ${i}`,action_data:{action_name:"go_to_url",kwargs:n}}}}if("CODE"in t){let i=t.CODE;return{uid:b(),type:"ACTION",description:"Code block",action_entity:{action_description:"Code block",action_data:{action_name:"js_code",kwargs:{code:typeof i=="string"?i:String(i)}}}}}if("js"in t&&"desc"in t&&!("VERIFY"in t)){let i=t.js,r=typeof t.desc=="string"?t.desc:"";return{uid:b(),type:"ACTION",description:r,action_entity:{action_description:r,action_data:{action_name:"js_action",kwargs:{code:typeof i=="string"?i:String(i)}}}}}if("action"in t)return ct(t);if("desc"in t&&typeof t.desc=="string")return{uid:b(),type:"DRAFT",description:t.desc};throw new Error(`Cannot infer statement type from object: ${JSON.stringify(t)}`)}function ce(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=ce(e.IF),i=e.THEN;if(!Array.isArray(i))throw new Error("IF_ELSE requires a THEN array");let r={uid:b(),type:"IF_ELSE",condition:t,then:C(i)};return"ELSE"in e&&Array.isArray(e.ELSE)&&(r.else=C(e.ELSE)),r}function nt(e){let t=ce(e.WHILE),i=e.DO;if(!Array.isArray(i))throw new Error("WHILE_LOOP requires a DO array");let r={uid:b(),type:"WHILE_LOOP",condition:t,body:C(i)};return typeof e.timeout_ms=="number"&&(r.timeout_ms=e.timeout_ms),r}function at(e){let t=typeof e.STEP=="string"?e.STEP:"";if(!Array.isArray(e.statements))throw new Error("STEP requires a statements array");let i={uid:b(),type:"STEP",description:t,statements:C(e.statements)};return typeof e.reference_id=="number"&&(i.reference_id=e.reference_id),i}var st=new Set(["action","desc","locator","xpath","use_pure_vision"]);function ct(e){let t=typeof e.action=="string"?e.action:String(e.action),i=typeof e.desc=="string"?e.desc:"",r=typeof e.locator=="string"?e.locator:void 0,o=typeof e.xpath=="string"?e.xpath:void 0,n=typeof e.use_pure_vision=="boolean"?e.use_pure_vision:void 0,s={};for(let[u,h]of Object.entries(e))st.has(u)||(s[u]=h);let a={action_description:i,action_data:{action_name:t,kwargs:Object.keys(s).length>0?s:{}}};r&&(a.locator=r),o&&(a.xpath=o);let c={uid:b(),type:"ACTION",description:i,action_entity:a};return n&&(c.use_pure_vision=!0),c}var lt=.5;function ht(e){try{return new Function(`return async function() { ${e} }`),null}catch(t){return t.message}}function le(e){try{return new Function(`return async function() { return (${e}) }`),null}catch(t){return t.message}}function ut(e,t){let i=t?.coverageThreshold??lt,r=[],o=[],n;try{n=K(e)}catch(d){return{valid:!1,errors:[`Invalid YAML: ${d.message}`],warnings:[],stats:{total:0,withLocator:0,coverage:0}}}n.goal||r.push('Missing required field: "goal"'),n.statements?.length||r.push('Missing required field: "statements"');let s=[...H(n.statements??[]),...n.teardown?H(n.teardown):[]],a=0,c=0;for(let d of s)if(!(d.type!=="DRAFT"&&d.type!=="ACTION"||(d.description?.toLowerCase()??"").startsWith("verify:"))){if(d.type==="ACTION"){let g=d.action_entity?.action_data?.action_name??"";if(g==="verify"||g==="ai_assert"||g==="done")continue}if(a++,d.type==="ACTION"){let w=d;if((w.action_entity?.action_data?.action_name??"")==="js_action"){let I=w.action_entity?.action_data?.kwargs?.code??"";/page\.(getBy|locator\(|frameLocator\()/.test(I)&&c++}else(w.action_entity?.locator||w.action_entity?.xpath)&&c++}}let u="Hint: in YAML double-quoted strings, backslashes are escape characters \u2014 use \\\\/ instead of \\/ for regex, or use single quotes.";for(let d of s){if(d.type==="ACTION"){let m=d,w=m.action_entity?.action_data?.action_name??"";if(w==="js_code"||w==="js_action"||w==="verify"||w==="ai_assert"){let g=m.action_entity?.action_data?.kwargs?.code;if(typeof g=="string"){let I=ht(g);if(I){let $=m.description||w;r.push(`Invalid JS in "${$}": ${I}. ${u}`)}}}}if(d.type==="IF_ELSE"){let m=d;if(m.condition.type==="JS_CODE"){let w=le(m.condition.expression);w&&r.push(`Invalid JS in IF condition "${m.condition.expression}": ${w}. ${u}`)}}if(d.type==="WHILE_LOOP"){let m=d;if(m.condition.type==="JS_CODE"){let w=le(m.condition.expression);w&&r.push(`Invalid JS in WHILE condition "${m.condition.expression}": ${w}. ${u}`)}}}let h=a>0?c/a:0,p=Math.round(h*100);return a>0&&h<i&&o.push(`Low locator coverage: ${c}/${a} statements (${p}%) have locators. Tests with locators replay ~10x faster. Use MCP tools (act, get_locator) to enrich your test flow.`),{valid:r.length===0,errors:r,warnings:o,stats:{total:a,withLocator:c,coverage:p}}}function dt(){return{version:"1.0",entries:{}}}function pt(e,t){return{action_entity:e,updated_at:new Date().toISOString(),updated_by:{source:"runner",test_run_id:t}}}function ft(e,t){let i=t?.entries[e.uid],r=i?.action_entity??e.action_entity;return e.locator&&r?{...r,locator:e.locator}:i?i.action_entity:e.action_entity?e.action_entity:null}function mt(e,t,i,r){return e.entries[t]={action_entity:i,updated_at:new Date().toISOString(),updated_by:r},e}function gt(e,t){let i=e??{version:"1.0",entries:{}};for(let[r,o]of t)i.entries[r]=o;return i}function wt(e){return e?Object.keys(e.entries).length===0:!0}function St(e){return e?Object.keys(e.entries).length:0}function yt(e,t){if(!t||Object.keys(t.entries).length===0)return e;let i=j(e.statements,t),r=e.teardown?j(e.teardown,t):void 0;return{...e,statements:i,teardown:r}}function j(e,t){return e.map(i=>Mt(i,t))}function Mt(e,t){if(e.type==="ACTION"){let o=e,n=t.entries[o.uid];return n?{...o,action_entity:n.action_entity}:o}let i=_(e);if(i.length===0)return e;let r={};for(let o of i)r[o.key]=j(o.statements,t);return{...e,...r}}import{parse as Tt,stringify as bt}from"yaml";function he(e,t){let i=[];t.version!=="1.0"&&i.push(`Unsupported patch version: ${t.version}`),(!Array.isArray(t.operations)||t.operations.length===0)&&i.push("Patch must have at least one operation");for(let r=0;r<t.operations.length;r++){let o=t.operations[r],n=`operations[${r}]`;switch(o.reason||i.push(`${n}: missing reason`),o.op){case"remove":{(typeof o.index!="number"||o.index<0||o.index>=e.length)&&i.push(`${n}: index ${o.index} out of bounds (0..${e.length-1})`);break}case"modify":{(typeof o.index!="number"||o.index<0||o.index>=e.length)&&i.push(`${n}: index ${o.index} out of bounds (0..${e.length-1})`),(o.statement===void 0||o.statement===null)&&i.push(`${n}: missing statement`);break}case"insert":{(typeof o.index!="number"||o.index<0||o.index>=e.length)&&i.push(`${n}: index ${o.index} out of bounds (0..${e.length-1})`),o.position!=="before"&&o.position!=="after"&&i.push(`${n}: position must be 'before' or 'after'`),(o.statement===void 0||o.statement===null)&&i.push(`${n}: missing statement`);break}default:i.push(`${n}: unknown operation type "${o.op}"`)}}return{valid:i.length===0,errors:i}}function ue(e,t){let i=he(e,t);if(!i.valid)throw new Error(`Invalid patch: ${i.errors.join("; ")}`);let r=[...e],o=t.operations.map((a,c)=>({...a,originalOrder:c})),n={remove:0,modify:1,insert:2},s=[...o].sort((a,c)=>a.index!==c.index?c.index-a.index:n[a.op]-n[c.op]);for(let a of s)switch(a.op){case"remove":r.splice(a.index,1);break;case"modify":r[a.index]=a.statement;break;case"insert":a.position==="before"?r.splice(a.index,0,a.statement):r.splice(a.index+1,0,a.statement);break}return r}function Pt(e,t){let i=Tt(e);if(!i||typeof i!="object")throw new Error("Invalid YAML: expected an object at root level");let r=i.statements;if(!Array.isArray(r))throw new Error('YAML must have a "statements" array');let o=ue(r,t);i.statements=o;let n=bt(i,{lineWidth:120,defaultKeyType:"PLAIN",defaultStringType:"PLAIN"});return K(n),{modifiedYaml:n,modifiedStatements:o}}var de=(e=>(e.DRAFT="DRAFT",e.STEP="STEP",e.ACTION="ACTION",e.IF_ELSE="IF_ELSE",e.WHILE_LOOP="WHILE_LOOP",e))(de||{}),pe=(e=>(e.JS_CODE="JS_CODE",e.AI_MODE="AI_MODE",e))(pe||{}),At=18e4;var M="android:",T="ios:";function _t(e){return e?e.startsWith(M)?"android":e.startsWith(T)?"ios":"web":"web"}function vt(e){return e?e.startsWith(M)||e.startsWith(T):!1}function kt(e){return!!e&&e.startsWith(M)}function Et(e){return!!e&&e.startsWith(T)}function Ot(e){return e.startsWith(M)?e.slice(M.length):e.startsWith(T)?e.slice(T.length):e}function xt(e){return`${M}${e}`}function Lt(e){return`${T}${e}`}function J(e){return e?e.startsWith("http://")||e.startsWith("https://"):!1}function It(e){return e?!J(e):!1}function fe(e){return e?J(e)?["web"]:["android","ios"]:["web","android","ios"]}function Dt(e,t){if(!t)return!0;let i=fe(t);return e==="desktop"||e==="mobile"?i.includes("web"):i.includes(e)}function Wt(e){return e.startsWith(T)?e:`${T}${e}`}function Ct(e){let t=e.iosVersion?` (iOS ${e.iosVersion})`:"";return e.deviceType==="simulator"?`${e.name}${t} - Simulator`:`${e.name}${t}`}function Kt(e){return!!(/^[0-9a-fA-F]{40}$/.test(e)||/^[0-9a-fA-F]{8}-[0-9a-fA-F]{16}$/.test(e))}var me="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36",q=112,ge=1920,we=1080,Se=1920,ye=1080-q,Me=1280,Te=720,be=500,Pe=500,F="Desktop Chrome",Ae=(e=>(e.Chromium="chromium",e.Firefox="firefox",e.Webkit="webkit",e))(Ae||{}),N={"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"}},_e=(e=>(e.Desktop="desktop",e.Mobile="mobile",e))(_e||{}),ve={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"]},G=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),ve[e].map(r=>N[r]).filter(r=>r.defaultBrowserType&&i.includes(r.defaultBrowserType))},Ft=()=>Object.keys(N),R=e=>N[e],Gt={desktop:{label:"Desktop",type:"desktop",devices:G("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:G("mobile")}},Bt={desktop:{label:"Desktop",type:"desktop",devices:G("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:G("mobile",!0)}},Z=(e,t=!1)=>{let i={userAgent:me,viewport:{width:Se,height:ye},isMobile:!1,hasTouch:!1};if(!e||e===F)return i;let r=R(e);if(!r)return i;let{width:o,height:n}=r.viewport,s=Math.max(be/o,1),a=Math.max(Pe/n,1),c=Math.max(s,a),u={width:Math.round(o*c),height:Math.round(n*c)};return{userAgent:r.userAgent,viewport:t?u:r.viewport,isMobile:r.isMobile,hasTouch:r.hasTouch}},Ht=e=>{let t={width:ge,height:we};if(!e||e===F)return t;let i=Z(e);return i.viewport?{width:i.viewport.width,height:i.viewport.height+q}:t},Nt=e=>{let t={width:Me,height:Te};if(!e||e===F)return t;let i=Z(e);return i.viewport?{width:i.viewport.width,height:i.viewport.height}:t},Rt=e=>!e||e===F?void 0:R(e)?.channel,$t=e=>!e||e===F?"chromium":R(e)?.defaultBrowserType??"chromium";var ke=(e=>(e.PASSWORD="password",e.OAUTH2="oauth2",e.SSO="sso",e.API="api",e))(ke||{}),Ee=(e=>(e.SMS="sms",e.EMAIL="email",e.TOTP="totp",e))(Ee||{});function zt(e,t){if(!e||typeof e!="string")return e;let i=t instanceof Map?Object.fromEntries(t):t,r=n=>{let s=n.startsWith("$")?n.slice(1):n,a=i[s]??i[`$${s}`];return a!=null?String(a):void 0},o=e;return o=o.replace(/\{\{\s*\$?([^}]+?)\s*\}\}/g,(n,s)=>{let a=r(s.trim());return a!==void 0?a:n}),o=o.replace(/<secret>\$?([\w-]+)<\/secret>/g,(n,s)=>{let a=r(s);return a!==void 0?a:n}),o=o.replace(/\$\{([^}]+)\}/g,(n,s)=>{let a=r(s.trim());return a!==void 0?a:n}),o=o.replace(/\$([a-zA-Z_]\w*)/g,(n,s)=>{let a=r(s);return a!==void 0?a:n}),o}var Ut=class{version;goal;url;constructor(e,t){this.version=e,this.goal=t.goal,this.url=t.url}generatePrelude(){let e=`// version ${this.version}
|
|
5
|
-
`,t=this.goal,i=this.url;e+=`// Navigate to the specified URL
|
|
6
|
-
const targetUrl = process.env.PLAYWRIGHT_STARTING_URL || '${i}';
|
|
7
|
-
if (targetUrl !== null) {
|
|
8
|
-
await page.goto(targetUrl, { waitUntil: 'domcontentloaded' });
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// wait for page to load and give it a chance to stabilize
|
|
12
|
-
await page.waitForLoadState('load', { timeout: 15000 });
|
|
13
|
-
await page.waitForTimeout(2000);
|
|
14
|
-
|
|
15
|
-
`,e+=` // Goal:
|
|
16
|
-
`;let r=t.trim().split(`
|
|
17
|
-
`);for(let o of r)e+=` // ${o}
|
|
18
|
-
`;return e}generatePostlude(){return""}};var Vt=[/iphone/i,/ipad/i,/android/i,/pixel/i,/galaxy/i,/mobile/i,/nexus/i,/blackberry/i,/kindle/i];function Xt(e){if(!e)return"desktop";for(let t of Vt)if(t.test(e))return"mobile";return"desktop"}var Yt=class Oe{data={};sensitive=new Set;get(t){return this.data[t]}set(t,i,r=!1){this.data[t]=i,r?this.sensitive.add(t):this.sensitive.has(t)&&this.sensitive.delete(t)}getAll(){return{...this.data}}isSensitive(t){return this.sensitive.has(t)}getAllSensitiveKeys(){return new Set(this.sensitive)}delete(t){return this.sensitive.delete(t),delete this.data[t]}clear(){this.data={},this.sensitive.clear()}has(t){return t in this.data}get size(){return Object.keys(this.data).length}merge(t){for(let[i,r]of Object.entries(t.getAll()))this.set(i,r,t.isSensitive(i))}toJSON(){return{data:{...this.data},sensitiveKeys:Array.from(this.sensitive)}}static fromJSON(t){let i=new Oe;if(t.data){let r=new Set(t.sensitiveKeys||[]);for(let[o,n]of Object.entries(t.data))i.set(o,n,r.has(o))}return i}};var xe="claude-sonnet-4-6",Le="gemini-2.5-pro",Ie="claude-haiku-4-5",De="gemini-2.5-pro";function jt(e){return{copilot:e?.models?.copilot||xe,webagent:e?.models?.webagent||Le}}function Jt(e){if(e){if(e.WEB_AGENT_MODEL)return e.WEB_AGENT_MODEL;if(e.ANTHROPIC_API_KEY)return Ie;if(e.GOOGLE_API_KEY)return De}}var We=(e=>(e.INITIALIZING="initializing",e.READY="ready",e.PROCESSING="processing",e.STOPPING="stopping",e.WAITING_USER="waiting_user",e.COMPLETED="completed",e.FAILED="failed",e))(We||{});function qt(e){let t=e.trim();if(!t||t.startsWith("List of devices"))return null;let i=t.split(/\s+/);if(i.length<2)return null;let r=i[0],o=i[1],n="usb";return r.startsWith("emulator-")?n="emulator":r.includes(":")&&(n="wifi"),{id:r,state:o,connectionType:n}}function Zt(e){return e.startsWith(M)?e:`${M}${e}`}function Qt(e){return e.model?`${e.model} (${e.id})`:e.connectionType==="emulator"?`Android Emulator (${e.id})`:e.id}export{_ as a,y as b,k as c,E as d,O as e,H as f,Ge as g,Be as h,Q as i,Re as j,$e as k,ze as l,x as m,Ue as n,Ve as o,ee as p,z as q,te as r,D as s,ie as t,re as u,oe as v,L as w,U as x,ae as y,Ye as z,je as A,tt as B,it as C,K as D,ut as E,dt as F,pt as G,ft as H,mt as I,gt as J,wt as K,St as L,yt as M,he as N,ue as O,Pt as P,de as Q,pe as R,At as S,M as T,T as U,_t as V,vt as W,kt as X,Et as Y,Ot as Z,xt as _,Lt as $,J as aa,It as ba,fe as ca,Dt as da,Wt as ea,Ct as fa,Kt as ga,me as ha,q as ia,ge as ja,we as ka,Se as la,ye as ma,Me as na,Te as oa,be as pa,Pe as qa,F as ra,Ae as sa,N as ta,_e as ua,ve as va,G as wa,Ft as xa,R as ya,Gt as za,Bt as Aa,Z as Ba,Ht as Ca,Nt as Da,Rt as Ea,$t as Fa,ke as Ga,Ee as Ha,zt as Ia,Ut as Ja,Xt as Ka,Yt as La,xe as Ma,Le as Na,Ie as Oa,De as Pa,jt as Qa,Jt as Ra,We as Sa,qt as Ta,Zt as Ua,Qt as Va};
|
package/dist/chunk-BWEKM3LZ.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { createRequire as __createRequire } from "module";
|
|
2
|
-
const require = __createRequire(import.meta.url);
|
|
3
|
-
import{h as f}from"./chunk-YHOTGR6H.js";import{a as s}from"./chunk-YDR4P3GA.js";import{h as k}from"./chunk-DJDHFWEV.js";import{z as i}from"zod";import"yaml";import"uuid";import"yaml";var G="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36",A=112,B=1920,W=1080,O=1920,C=1080-A,F=1280,H=720,E=500,z=500,m="Desktop Chrome",N=(e=>(e.Chromium="chromium",e.Firefox="firefox",e.Webkit="webkit",e))(N||{}),y={"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"}},_={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"]},b=(e,o=!1)=>{let a=["chromium"];return o&&a.push("webkit"),_[e].map(t=>y[t]).filter(t=>t.defaultBrowserType&&a.includes(t.defaultBrowserType))},S=e=>y[e],ee={desktop:{label:"Desktop",type:"desktop",devices:b("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:b("mobile")}},ie={desktop:{label:"Desktop",type:"desktop",devices:b("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:b("mobile",!0)}},x=(e,o=!1)=>{let a={userAgent:G,viewport:{width:O,height:C},isMobile:!1,hasTouch:!1};if(!e||e===m)return a;let t=S(e);if(!t)return a;let{width:l,height:n}=t.viewport,h=Math.max(E/l,1),r=Math.max(z/n,1),d=Math.max(h,r),c={width:Math.round(l*d),height:Math.round(n*d)};return{userAgent:t.userAgent,viewport:o?c:t.viewport,isMobile:t.isMobile,hasTouch:t.hasTouch}},oe=e=>{let o={width:B,height:W};if(!e||e===m)return o;let a=x(e);return a.viewport?{width:a.viewport.width,height:a.viewport.height+A}:o},te=e=>{let o={width:F,height:H};if(!e||e===m)return o;let a=x(e);return a.viewport?{width:a.viewport.width,height:a.viewport.height}:o},ae=e=>!e||e===m?void 0:S(e)?.channel,re=e=>!e||e===m?"chromium":S(e)?.defaultBrowserType??"chromium",X=(e=>(e.PASSWORD="password",e.OAUTH2="oauth2",e.SSO="sso",e.API="api",e))(X||{}),D=(e=>(e.SMS="sms",e.EMAIL="email",e.TOTP="totp",e))(D||{});function le(e,o){if(!e||typeof e!="string")return e;let a=o instanceof Map?Object.fromEntries(o):o,t=n=>{let h=n.startsWith("$")?n.slice(1):n,r=a[h]??a[`$${h}`];return r!=null?String(r):void 0},l=e;return l=l.replace(/\{\{\s*\$?([^}]+?)\s*\}\}/g,(n,h)=>{let r=t(h.trim());return r!==void 0?r:n}),l=l.replace(/<secret>\$?([\w-]+)<\/secret>/g,(n,h)=>{let r=t(h);return r!==void 0?r:n}),l=l.replace(/\$\{([^}]+)\}/g,(n,h)=>{let r=t(h.trim());return r!==void 0?r:n}),l=l.replace(/\$([a-zA-Z_]\w*)/g,(n,h)=>{let r=t(h);return r!==void 0?r:n}),l}var he=class K{constructor(){k(this,"data",{}),k(this,"sensitive",new Set)}get(o){return this.data[o]}set(o,a,t=!1){this.data[o]=a,t?this.sensitive.add(o):this.sensitive.has(o)&&this.sensitive.delete(o)}getAll(){return{...this.data}}isSensitive(o){return this.sensitive.has(o)}getAllSensitiveKeys(){return new Set(this.sensitive)}delete(o){return this.sensitive.delete(o),delete this.data[o]}clear(){this.data={},this.sensitive.clear()}has(o){return o in this.data}get size(){return Object.keys(this.data).length}merge(o){for(let[a,t]of Object.entries(o.getAll()))this.set(a,t,o.isSensitive(a))}toJSON(){return{data:{...this.data},sensitiveKeys:Array.from(this.sensitive)}}static fromJSON(o){let a=new K;if(o.data){let t=new Set(o.sensitiveKeys||[]);for(let[l,n]of Object.entries(o.data))a.set(l,n,t.has(l))}return a}},U=i.enum(["JS_CODE","AI_MODE"]),v=i.object({type:U,expression:i.string()}),I=i.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),M=i.object({uid:i.string(),type:I}),V=i.object({action_data:i.object({action_name:i.string(),kwargs:i.record(i.any()).optional(),args:i.array(i.any()).optional()}),action_description:i.string().optional(),url:i.string().optional(),xpath:i.string().nullable().optional(),locator:i.string().nullable().optional(),css_selector:i.string().nullable().optional(),unique_selector:i.string().nullable().optional(),element_index:i.number().nullable().optional(),frame_path:i.array(i.any()).optional(),artifacts:i.record(i.any()).optional(),feedback:i.string().optional(),original_browser_use_action:i.any().optional()}).passthrough(),$=M.extend({type:i.literal("DRAFT"),description:i.string()}),R=M.extend({type:i.literal("ACTION"),description:i.string(),action_entity:V.optional(),locator:i.string().optional(),use_pure_vision:i.boolean().optional()}),p=i.lazy(()=>i.union([$,R,M.extend({type:i.literal("STEP"),description:i.string().optional().default(""),statements:i.array(p),reference_id:i.number().optional()}),M.extend({type:i.literal("IF_ELSE"),description:i.string().optional(),condition:v,then:i.array(p),else:i.array(p).optional()}),M.extend({type:i.literal("WHILE_LOOP"),description:i.string().optional(),condition:v,body:i.array(p),timeout_ms:i.number().optional()})])),se=i.object({version:i.string().optional(),goal:i.string(),url:i.string().optional(),final_feedback:i.string().optional(),completed:i.boolean().optional(),success:i.boolean().optional(),statements:i.array(p),teardown:i.array(p).optional(),last_modified_at:i.string().optional()}),Me=1024*1024;var j=5e3,J=1e4;async function L(e,o){let a=Object.getPrototypeOf(async()=>{}).constructor,t=`
|
|
4
|
-
return await (${o});
|
|
5
|
-
`;return await new a("page",t)(e)}async function T(e,o,a){let t=[],l=[];for(let n of o){let h=!1;try{let r=`page.${n}`;s.log(`Checking element existence: ${r}`),t.push(`Checking element existence: ${r}`);try{await L(e,`${r}.waitFor({ state: 'attached', timeout: ${j} })`),s.log(`Element is attached: ${r}`),t.push(`Element is attached: ${r}`),h=!0}catch{await L(e,`${r}.count()`)>0?(s.log(`Element found (snapshot): ${r}`),t.push(`Element found (snapshot): ${r}`),h=!0):(s.log(`Element not found: ${r}`),t.push(`Element not found: ${r}`),h=!1)}}catch(r){s.log(`Error checking element: ${r.message}`),t.push(`Error checking element: ${r.message}`),h=!1}if(l.push(h),!h&&a)break}return{successResults:l,logs:t}}async function Z(e,o,a=!0){let{successResults:t,logs:l}=await T(e,o,a);return{success:t.length===o.length&&t.every(n=>n),logs:l}}async function fe(e,o){if(!o||o.length===0)return s.log("No validation expressions provided, cannot validate login"),!1;s.log(`Validating login with ${o.length} expression(s)`);let{success:a,logs:t}=await Z(e,o,!0);return a?s.log("All validation expressions passed"):s.log(`Validation failed: ${t.join(", ")}`),a}async function Q(e,o){let a=e.context().browser();if(!a)throw new Error("Cannot create unsigned-in context: browser not available");let t=await a.newContext(),l=await t.newPage();return await l.goto(o),await f(l,J),{context:t,page:l,close:async()=>{await l.close(),await t.close()}}}async function q(e,o,a,t,l,n){let h=`
|
|
6
|
-
Based on the current page status, generate ${l} Playwright locators in JavaScript code that can
|
|
7
|
-
be used by a program to verify the page is signed in.
|
|
8
|
-
Each expression should yield a locator object that can be used for waiting and checking visibility.
|
|
9
|
-
`;o&&(h+=`
|
|
10
|
-
For your comparison, the DOM elements of the UNSIGNED IN page are:
|
|
11
|
-
"""
|
|
12
|
-
${o}
|
|
13
|
-
"""
|
|
14
|
-
`),h+=`
|
|
15
|
-
Output the code in a code block with \`\`\`javascript\`\`\` at the beginning and \`\`\` at the end.
|
|
16
|
-
|
|
17
|
-
Here is an example of the right format:
|
|
18
|
-
\`\`\`javascript
|
|
19
|
-
getByRole("button", { name: "Logout" }).first()
|
|
20
|
-
\`\`\`
|
|
21
|
-
|
|
22
|
-
User name, id, email etc are great choices as a part of locators if they present.
|
|
23
|
-
They tend to be strong and stable indicators of signed in status.
|
|
24
|
-
|
|
25
|
-
Don't use locators that may change with page content, such as:
|
|
26
|
-
- time of day
|
|
27
|
-
- location
|
|
28
|
-
- language
|
|
29
|
-
- timezone
|
|
30
|
-
- device
|
|
31
|
-
- browser
|
|
32
|
-
- operating system
|
|
33
|
-
- numbers
|
|
34
|
-
- and other dynamic values
|
|
35
|
-
|
|
36
|
-
It is a good idea to add 'first()' to the locator to make it more stable for locators
|
|
37
|
-
that can result in multiple results.
|
|
38
|
-
`,a&&(h+=`
|
|
39
|
-
Previously generated expressions and their results:
|
|
40
|
-
"""
|
|
41
|
-
${a}
|
|
42
|
-
"""
|
|
43
|
-
Avoid regenerating these failed ones, but can reuse the successful ones.`),t&&(h+=`
|
|
44
|
-
${t}
|
|
45
|
-
`),h+=`
|
|
46
|
-
Remember, you must have the javascript code block in your final response.
|
|
47
|
-
`,s.log("Agent generating validation locators"),s.log(`Prompt:
|
|
48
|
-
${h}`);let r=await n(e,h);if(!r.success)throw new Error(r.details||"Agent failed to generate verification code");let d=(r.details||"").match(/```javascript\n(.*)\n```/s);if(!d)throw new Error("Agent failed to generate verification code: no javascript code block found");return d[1].split(`
|
|
49
|
-
`).map(c=>c.trim()).filter(c=>c.length>0).map(c=>(c.startsWith("page.")&&(c=c.slice(5)),c))}async function ve(e,o,a,t,l){let n=null;try{n=await Q(e,o);let h=await l(n.page),r=3,d="";for(let c=0;c<r;c++)try{let u=await q(e,h,d||null,a.verification_hint??null,a.num_verification_exprs??1,t);s.log(`Generated validation locators: ${JSON.stringify(u)}`);{let{successResults:w,logs:g}=await T(e,u,!1);if(d+=`Test results on a SIGNED IN page. EXPECT ALL PASS:
|
|
50
|
-
${g.join(`
|
|
51
|
-
`)}
|
|
52
|
-
|
|
53
|
-
`,!w.every(P=>P)){s.log(`Locator validation on signed-in page failed. Results: ${JSON.stringify(w)}`),s.log(`Validation logs:
|
|
54
|
-
${g.join(`
|
|
55
|
-
`)}`);continue}}{s.log("Validating locators in unsigned-in context, EXPECT ALL TO FAIL");let{successResults:w,logs:g}=await T(n.page,u,!1);if(d+=`Test results on an UNSIGNED IN page. EXPECT ALL FAIL:
|
|
56
|
-
${g.join(`
|
|
57
|
-
`)}
|
|
58
|
-
|
|
59
|
-
`,w.some(P=>P)){s.log(`Locator validation on unsigned-in page failed (some passed when should fail). Results: ${JSON.stringify(w)}`),s.log(`Validation logs:
|
|
60
|
-
${g.join(`
|
|
61
|
-
`)}`);continue}}return s.log("Generated validation locators passed dual validation"),u}catch(u){s.log(`Failed to generate validation expressions (attempt ${c+1}/${r}): ${u.message}`)}return s.log("Failed to generate valid locators after max retries"),null}finally{n&&await n.close()}}export{m as a,N as b,S as c,x as d,oe as e,te as f,ae as g,re as h,X as i,D as j,le as k,he as l,T as m,Z as n,fe as o,Q as p,q,ve as r};
|
package/dist/dist-T7XB7SCU.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire as __createRequire } from "module";
|
|
2
|
-
const require = __createRequire(import.meta.url);
|
|
3
|
-
import{$,A,Aa,B,Ba,C,Ca,D,Da,E,Ea,F,Fa,G,Ga,H,Ha,I,Ia,J,Ja,K,Ka,L,La,M,Ma,N,Na,O,Oa,P,Pa,Q,Qa,R,Ra,S,Sa,T,Ta,U,Ua,V,Va,W,X,Y,Z,_,a,aa,b,ba,c,ca,d,da,e,ea,f,fa,g,ga,h,ha,i,ia,j,ja,k,ka,l,la,m,ma,n,na,o,oa,p,pa,q,qa,r,ra,s,sa,t,ta,u,ua,v,va,w,wa,x,xa,y,ya,z,za}from"./chunk-AZ7CG3SO.js";import"./chunk-CSINHOOD.js";export{ia as ADDRESS_BAR_HEIGHT,T as ANDROID_DEVICE_PREFIX,t as ActionEntitySchema,v as ActionSchema,Sa as AgentStatus,s as BaseStatementSchema,sa as BrowserType,q as ConditionSchema,R as ConditionType,p as ConditionTypeSchema,Oa as DEFAULT_ANTHROPIC_MODEL,Ma as DEFAULT_COPILOT_MODEL,ra as DEFAULT_DEVICE_NAME,Pa as DEFAULT_GOOGLE_MODEL,Na as DEFAULT_WEBAGENT_MODEL,S as DEFAULT_WHILE_LOOP_TIMEOUT_MS,va as DEVICE_CATEGORIES,ua as DeviceType,u as DraftSchema,U as IOS_DEVICE_PREFIX,Ga as LoginType,qa as MIN_WINDOW_HEIGHT,pa as MIN_WINDOW_WIDTH,Ja as NodeJSCodeCommon,ta as PLAYWRIGHT_DEVICES,oa as RECORD_VIDEO_HEIGHT,na as RECORD_VIDEO_WIDTH,w as StatementSchema,Q as StatementType,r as StatementTypeSchema,x as TestFlowSchema,Ha as TwoFactorAuthType,za as UI_DEVICE_CATEGORIES,Aa as UI_DEVICE_CATEGORIES_ELECTRON,ha as USER_AGENT,ma as VIEWPORT_HEIGHT,la as VIEWPORT_WIDTH,La as VariableStore,ka as WINDOW_HEIGHT,ja as WINDOW_WIDTH,o as actionStepsMapToTestFlowSections,l as allowPureVisionAction,O as applyPatchToYaml,P as applyPatchToYamlString,m as collectActionSteps,_ as createAndroidDeviceName,F as createEmptyStore,$ as createIOSDeviceName,G as createRunnerStoreEntry,n as extractActionStepsFromTestFlow,Z as extractDeviceIdentifier,C as extractYamlMetadata,e as findNextAfterContainer,d as findNextSibling,c as findNextStatement,h as findPathBetweenStatements,b as findStatementPathById,xa as getAllDeviceNames,j as getAllReferenceIds,f as getAllStatementsInOrder,Va as getAndroidDeviceDisplayName,Ca as getBrowserWindowSize,ca as getCompatiblePlatforms,Fa as getDeviceBrowserType,ya as getDeviceByName,Ea as getDeviceChannel,Ba as getDeviceOptions,wa as getDevicesByCategory,fa as getIOSDeviceDisplayName,Ka as getLoginConfigPlatform,Da as getRecordVideoSize,a as getStatementContainers,L as getStoreSize,V as getTestPlatformFromDeviceName,i as hasReferenceIds,X as isAndroidDevice,ba as isAppPackage,k as isDynamicAction,g as isExecutableStatement,Y as isIOSDevice,W as isNativeDevice,ga as isPhysicalDeviceUDID,da as isPlatformCompatibleWithUrl,K as isStoreEmpty,aa as isWebUrl,M as mergeActionEntitiesIntoTestFlow,J as mergeStoreUpdates,Ta as parseAdbDeviceLine,B as parseYamlArrayItems,Ia as replaceVariables,H as resolveActionEntity,Ra as resolveModelFromEnv,Qa as resolveModels,z as testFlowToYaml,y as testFlowToYamlObject,Ua as toAndroidDeviceName,ea as toIOSDeviceName,I as updateStoreEntry,N as validatePatch,E as validateTestYaml,A as yamlObjectsToString,D as yamlToTestFlow};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire as __createRequire } from "module";
|
|
2
|
-
const require = __createRequire(import.meta.url);
|
|
3
|
-
import{C as u,D as m,z as c}from"./chunk-AZ7CG3SO.js";import"./chunk-CSINHOOD.js";import{Router as g}from"express";import*as o from"fs/promises";import*as w from"path";function j(r){let a=g();return a.get("/api/test-flow",async(f,s)=>{try{let t=await o.readFile(r,"utf-8"),n=m(t),i=u(t),e=await o.stat(r);s.json({testFlow:n,metadata:i,filePath:r,fileName:w.basename(r),lastModified:e.mtimeMs})}catch(t){if(t.code==="ENOENT")return s.status(404).json({error:`File not found: ${r}`});console.error("[debugger] Error loading test flow:",t),s.status(500).json({error:t.message})}}),a.put("/api/test-flow",async(f,s)=>{try{let{testFlow:t,metadata:n}=f.body;if(!t)return s.status(400).json({error:"testFlow is required"});let i=c(t,n),e=r+".tmp";await o.writeFile(e,i,"utf-8"),await o.rename(e,r);let d=await o.stat(r);s.json({success:!0,lastModified:d.mtimeMs})}catch(t){console.error("[debugger] Error saving test flow:",t),s.status(500).json({error:t.message})}}),a}export{j as createTestFlowRouter};
|