shiplightai 0.1.21 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/agentHelpers-ZM2YPYUG.js +3 -0
  2. package/dist/agentLogin-TVTERJCC.js +3 -0
  3. package/dist/chunk-47OHTDHW.js +18 -0
  4. package/dist/chunk-4MP3EHVU.js +11 -0
  5. package/dist/{chunk-32JFHFFG.js → chunk-AEEQXF3N.js} +29 -29
  6. package/dist/chunk-C6BVAOFE.js +3 -0
  7. package/dist/{chunk-RTTIJBGI.js → chunk-CSHDULY4.js} +28 -28
  8. package/dist/chunk-EEEG4LZX.js +3 -0
  9. package/dist/chunk-HJNJZWUA.js +5 -0
  10. package/dist/chunk-ID5JNGPZ.js +18 -0
  11. package/dist/{chunk-YHOTGR6H.js → chunk-J4TZ3OFZ.js} +1 -1
  12. package/dist/chunk-JQ2K2XJ4.js +61 -0
  13. package/dist/chunk-L5JSAS2D.js +3 -0
  14. package/dist/{chunk-YDR4P3GA.js → chunk-NLZ3YJX4.js} +1 -1
  15. package/dist/{chunk-JHSENQ4F.js → chunk-SFCNGCFT.js} +27 -27
  16. package/dist/{chunk-2F3YRAA7.js → chunk-VLVDPV2E.js} +13 -13
  17. package/dist/cjs/debugger-pw.cjs +7 -7
  18. package/dist/cjs/fixture.cjs +162 -147
  19. package/dist/cjs/index.cjs +229 -309
  20. package/dist/cjs/reporter.cjs +725 -0
  21. package/dist/cli.js +2107 -939
  22. package/dist/config-BUSI76YU.js +3 -0
  23. package/dist/debugger-pw.d.ts +5 -0
  24. package/dist/debugger-pw.js +1 -1
  25. package/dist/dist-3HGFS7M3-T7FMZHX4.js +3 -0
  26. package/dist/dist-K7NWI5BS.js +3 -0
  27. package/dist/dist-SIZHXBHX.js +3 -0
  28. package/dist/fixture.js +1 -1
  29. package/dist/handler-J6CCKSPE.js +3 -0
  30. package/dist/index.d.ts +1 -48
  31. package/dist/index.js +4 -11
  32. package/dist/{intRunner-5A6M6JSJ.js → intRunner-ZYEEZ6MK.js} +1 -1
  33. package/dist/reporter.d.ts +28 -0
  34. package/dist/reporter.js +723 -0
  35. package/dist/task-EDC5BGTS.js +192 -0
  36. package/dist/testFlow-HYGLHAP6.js +3 -0
  37. package/package.json +8 -1
  38. package/dist/agentHelpers-2TII7YCW.js +0 -3
  39. package/dist/agentLogin-GDOU6BCP.js +0 -3
  40. package/dist/chunk-DJDHFWEV.js +0 -3
  41. package/dist/chunk-JNRJXAJS.js +0 -18
  42. package/dist/chunk-LPSNOKYP.js +0 -61
  43. package/dist/chunk-THVHM4KG.js +0 -11
  44. package/dist/chunk-USRSZQWN.js +0 -5
  45. package/dist/dist-CXOVVE77.js +0 -3
  46. package/dist/dist-SRXGJZ7P.js +0 -3
  47. package/dist/handler-BAP4TGW6.js +0 -3
  48. package/dist/task-VW6MUEKX.js +0 -192
  49. package/dist/testFlow-ZLC5L5GT.js +0 -3
@@ -0,0 +1,3 @@
1
+ import { createRequire as __createRequire } from "module";
2
+ const require = __createRequire(import.meta.url);
3
+ import{a as o,b as r,c as t}from"./chunk-C6BVAOFE.js";import"./chunk-L5JSAS2D.js";import"./chunk-CSINHOOD.js";export{r as configureSdk,o as default,t as getSdkConfig};
@@ -23,6 +23,7 @@ interface RunStepResult {
23
23
  details?: string;
24
24
  }
25
25
  interface SandboxService {
26
+ getCdpEndpoint(): string | null;
26
27
  createSession(config?: {
27
28
  startingUrl?: string;
28
29
  }): Promise<{
@@ -81,6 +82,9 @@ declare class PlaywrightSandboxService implements SandboxService {
81
82
  private sessionId;
82
83
  private abortController;
83
84
  constructor(page: Page, agent: WebAgent);
85
+ private cdpEndpoint;
86
+ setCdpEndpoint(url: string): void;
87
+ getCdpEndpoint(): string | null;
84
88
  createSession(_config?: {
85
89
  startingUrl?: string;
86
90
  }): Promise<{
@@ -131,6 +135,7 @@ declare class PlaywrightSandboxService implements SandboxService {
131
135
  interface PlaywrightDebugOptions {
132
136
  yamlFilePath: string;
133
137
  port: number;
138
+ cdpPort?: number;
134
139
  page: Page;
135
140
  agent: WebAgent;
136
141
  }
@@ -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-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};
3
+ import"./chunk-CSINHOOD.js";import y from"express";import*as h from"path";import*as m from"fs/promises";import*as w from"os";var u=class{page;agent;sessionId="pw-"+Math.random().toString(36).slice(2,10);abortController=null;constructor(e,t){this.page=e,this.agent=t}cdpEndpoint=null;setCdpEndpoint(e){this.cdpEndpoint=e}getCdpEndpoint(){if(this.cdpEndpoint)return this.cdpEndpoint;let e=this.page.context().browser();if(!e)return null;let t=e.wsEndpoint?.();return typeof t=="string"?t:null}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 r=t.action_data||t.action;if(!r)throw new Error("ActionEntity has no action_data");if(console.error(`[pw-sandbox] executeAction stepId=${JSON.stringify(s)} action_name=${JSON.stringify(r.action_name)} locator=${JSON.stringify(t.locator)} kwargs=${JSON.stringify(r.kwargs)}`),r.action_name==="js_code"&&s==="prelude"){if(this.page.url()==="about:blank"){let g=r.kwargs?.code?.match(/PLAYWRIGHT_STARTING_URL \|\| '([^']*)'/)?.[1];g&&await this.page.goto(g,{waitUntil:"domcontentloaded"})}return{status:"success"}}let i=t.action_description||r.action_name;return{status:"success",...await this.agent.step(this.page,async()=>{await this.agent.execAction(r.action_name,this.page,t)},i,s,n?.stmtUid,!!n?.withSelfHealing)}}async runStep(e,t,s,n,r){let i=[],a={},g=this.agent._actionHandler;this.abortController=new AbortController;try{let p=await this.agent.execute(this.page,t,s,!1);return{success:p?.success??!0,actions:i,details:p?.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=h.join(w.tmpdir(),`shiplight-screenshot-${Date.now()}.png`);return await m.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 v(d){let{yamlFilePath:e,port:t,cdpPort:s,page:n,agent:r}=d,i=new u(n,r);if(s)try{let l=await fetch(`http://localhost:${s}/json/version`);if(l.ok){let o=await l.json();o.webSocketDebuggerUrl&&(i.setCdpEndpoint(o.webSocketDebuggerUrl),console.error(`[debugger] CDP endpoint: ${o.webSocketDebuggerUrl}`))}}catch{console.error(`[debugger] Could not fetch CDP endpoint from port ${s}`)}let a=y();a.use(y.json({limit:"10mb"})),a.use((l,o,c)=>{if(o.setHeader("Access-Control-Allow-Origin","*"),o.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS"),o.setHeader("Access-Control-Allow-Headers","Content-Type"),l.method==="OPTIONS")return o.sendStatus(204);c()});let{createTestFlowRouter:g}=await import("./testFlow-HYGLHAP6.js"),{createIntRunnerRouter:p}=await import("./intRunner-ZYEEZ6MK.js"),{createCopilotRouter:b}=await import("./copilot-7JTVJQXP.js");a.use(g(e)),a.use(p(i)),a.use(b(i));let f=await new Promise((l,o)=>{let c=a.listen(t,"localhost",()=>l(c));c.on("error",o)});return{url:`http://localhost:${t}`,close:async()=>{await i.cleanupAll(),await new Promise((l,o)=>{f.close(c=>c?o(c):l())})}}}export{u as PlaywrightSandboxService,v as startPlaywrightDebugServer};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __createRequire } from "module";
2
+ const require = __createRequire(import.meta.url);
3
+ import{$,A as R,Aa as Ra,B as h,Ba as ha,C as P,Ca as Pa,D as W,Da as Wa,E as F,Ea as Fa,F as L,Fa as La,G as H,Ga as Ha,H as f,Ha as fa,I as G,Ia as Ga,J as V,Ja as Va,K as w,Ka as wa,L as U,La as Ua,M,Ma,N as b,Na as ba,O as B,Oa as Ba,P as u,Pa as ua,Q as Y,Qa as Ya,R as x,Ra as xa,S as z,Sa as za,T as j,Ta as ja,U as X,Ua as Xa,V as k,Va as ka,W as J,Wa as Ja,X as q,Xa as qa,Y as K,Ya as Ka,Z as Q,_ as Z,a,aa,b as e,ba as ea,c as s,ca as sa,d as t,da as ta,e as i,ea as ia,f as o,fa as oa,g as r,ga as ra,h as n,ha as na,i as c,ia as ca,j as E,ja as Ea,k as m,ka as ma,l as D,la as Da,m as T,ma as Ta,n as l,na as la,o as S,oa as Sa,p as I,pa as Ia,q as _,qa as _a,r as A,ra as Aa,s as p,sa as pa,t as O,ta as Oa,u as d,ua as da,v as y,va as ya,w as g,wa as ga,x as v,xa as va,y as C,ya as Ca,z as N,za as Na}from"./chunk-ID5JNGPZ.js";import"./chunk-L5JSAS2D.js";import"./chunk-CSINHOOD.js";export{d as ADDRESS_BAR_HEIGHT,t as ANDROID_DEVICE_PREFIX,K as ActionEntitySchema,Z as ActionSchema,ka as AgentStatus,q as BaseStatementSchema,F as BrowserType,k as ConditionSchema,Ma as ConditionType,X as ConditionTypeSchema,xa as DEFAULT_ANTHROPIC_MODEL,ua as DEFAULT_COPILOT_MODEL,W as DEFAULT_DEVICE_NAME,za as DEFAULT_GOOGLE_MODEL,Ya as DEFAULT_WEBAGENT_MODEL,ba as DEFAULT_WHILE_LOOP_TIMEOUT_MS,f as DEVICE_CATEGORIES,H as DeviceType,Q as DraftSchema,i as IOS_DEVICE_PREFIX,z as LoginType,P as MIN_WINDOW_HEIGHT,h as MIN_WINDOW_WIDTH,s as NodeJSCodeCommon,L as PLAYWRIGHT_DEVICES,R as RECORD_VIDEO_HEIGHT,N as RECORD_VIDEO_WIDTH,$ as StatementSchema,Ua as StatementType,J as StatementTypeSchema,sa as TestFlowSchema,aa as TestGroupEntrySchema,ea as TestGroupSchema,j as TwoFactorAuthType,U as UI_DEVICE_CATEGORIES,M as UI_DEVICE_CATEGORIES_ELECTRON,O as USER_AGENT,C as VIEWPORT_HEIGHT,v as VIEWPORT_WIDTH,Ba as VariableStore,g as WINDOW_HEIGHT,y as WINDOW_WIDTH,ha as actionStepsMapToTestFlowSections,Ca as allowPureVisionAction,Da as applyPatchToYaml,Ta as applyPatchToYamlString,Na as collectActionSteps,m as createAndroidDeviceName,Wa as createEmptyStore,D as createIOSDeviceName,Fa as createRunnerStoreEntry,Ra as extractActionStepsFromTestFlow,E as extractDeviceIdentifier,ca as extractYamlMetadata,Aa as findNextAfterContainer,_a as findNextSibling,Ia as findNextStatement,da as findPathBetweenStatements,Sa as findStatementPathById,V as getAllDeviceNames,ga as getAllReferenceIds,pa as getAllStatementsInOrder,Ka as getAndroidDeviceDisplayName,B as getBrowserWindowSize,S as getCompatiblePlatforms,x as getDeviceBrowserType,w as getDeviceByName,Y as getDeviceChannel,b as getDeviceOptions,G as getDevicesByCategory,A as getIOSDeviceDisplayName,a as getLoginConfigPlatform,u as getRecordVideoSize,la as getStatementContainers,Va as getStoreSize,o as getTestPlatformFromDeviceName,ya as hasReferenceIds,n as isAndroidDevice,l as isAppPackage,va as isDynamicAction,Oa as isExecutableStatement,c as isIOSDevice,r as isNativeDevice,p as isPhysicalDeviceUDID,I as isPlatformCompatibleWithUrl,Ga as isStoreEmpty,T as isWebUrl,wa as mergeActionEntitiesIntoTestFlow,fa as mergeStoreUpdates,Ja as parseAdbDeviceLine,na as parseYamlArrayItems,e as replaceVariables,La as resolveActionEntity,Xa as resolveModelFromEnv,ja as resolveModels,oa as suiteToYaml,ia as testFlowToYaml,ta as testFlowToYamlObject,qa as toAndroidDeviceName,_ as toIOSDeviceName,Ha as updateStoreEntry,ma as validatePatch,Pa as validateTestYaml,ra as yamlObjectsToString,Ea as yamlToTestFlow};
@@ -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,Wa,X,Xa,Y,Ya,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-47OHTDHW.js";import"./chunk-CSINHOOD.js";export{u as ADDRESS_BAR_HEIGHT,d as ANDROID_DEVICE_PREFIX,Y as ActionEntitySchema,_ as ActionSchema,Va as AgentStatus,X as BaseStatementSchema,E as BrowserType,V as ConditionSchema,Ma as ConditionType,U as ConditionTypeSchema,Ra as DEFAULT_ANTHROPIC_MODEL,Pa as DEFAULT_COPILOT_MODEL,D as DEFAULT_DEVICE_NAME,Sa as DEFAULT_GOOGLE_MODEL,Qa as DEFAULT_WEBAGENT_MODEL,Na 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,La as StatementType,W as StatementTypeSchema,ca as TestFlowSchema,aa as TestGroupEntrySchema,ba as TestGroupSchema,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,Oa as VariableStore,w as WINDOW_HEIGHT,v as WINDOW_WIDTH,Ba as actionStepsMapToTestFlowSections,ya as allowPureVisionAction,la as applyPatchToYaml,ma as applyPatchToYamlString,za as collectActionSteps,k as createAndroidDeviceName,Da as createEmptyStore,l as createIOSDeviceName,Ea as createRunnerStoreEntry,Aa as extractActionStepsFromTestFlow,j as extractDeviceIdentifier,ia as extractYamlMetadata,ra as findNextAfterContainer,qa as findNextSibling,pa as findNextStatement,ua as findPathBetweenStatements,oa as findStatementPathById,J as getAllDeviceNames,wa as getAllReferenceIds,sa as getAllStatementsInOrder,Ya 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,na as getStatementContainers,Ja as getStoreSize,f as getTestPlatformFromDeviceName,va as hasReferenceIds,h as isAndroidDevice,n as isAppPackage,xa as isDynamicAction,ta as isExecutableStatement,i as isIOSDevice,g as isNativeDevice,s as isPhysicalDeviceUDID,p as isPlatformCompatibleWithUrl,Ia as isStoreEmpty,m as isWebUrl,Ka as mergeActionEntitiesIntoTestFlow,Ha as mergeStoreUpdates,Wa as parseAdbDeviceLine,ha as parseYamlArrayItems,b as replaceVariables,Fa as resolveActionEntity,Ua as resolveModelFromEnv,Ta as resolveModels,fa as suiteToYaml,ea as testFlowToYaml,da as testFlowToYamlObject,Xa as toAndroidDeviceName,q as toIOSDeviceName,Ga as updateStoreEntry,ka as validatePatch,Ca as validateTestYaml,ga as yamlObjectsToString,ja as yamlToTestFlow};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __createRequire } from "module";
2
+ const require = __createRequire(import.meta.url);
3
+ import{a,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,v as ga,w as ha}from"./chunk-SFCNGCFT.js";import"./chunk-JQ2K2XJ4.js";import{Oa as Y,S as W,T as X,b as V}from"./chunk-ID5JNGPZ.js";import{b as i,e as K,f as L,g as M,h as N}from"./chunk-AEEQXF3N.js";import{C,E as D}from"./chunk-VLVDPV2E.js";import{a as E,c as F,d as G,e as H,f as I,g as J}from"./chunk-J4TZ3OFZ.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-CSHDULY4.js";import"./chunk-NLZ3YJX4.js";import"./chunk-YU3XZJIJ.js";import{g as j,h as k,i as l,k as q,l as r}from"./chunk-HJNJZWUA.js";import{a as d}from"./chunk-EEEG4LZX.js";import{b,c,d as B}from"./chunk-C6BVAOFE.js";import"./chunk-L5JSAS2D.js";import"./chunk-CSINHOOD.js";export{D as ActionHandler,C as ActionHelper,ea as Agent,ca 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,ha as SDK_VERSION,m as ToolRegistry,X as TwoFactorAuthType,Y as VariableStore,da as WebAgent,ga as agentLogin,b as configureSdk,fa as createAgent,$ 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,c as getSdkConfig,P as getToolRegistry,e as injectUserFunction,x as isInteractionEventType,w as isInteractiveRole,h as loadKnowledgeMappings,g as loadKnowledges,f as loadUserFunctions,d as logger,F as newBrowserContext,a as parseSSEStream,j as pickBestLocator,k as pickBestLocatorForElement,l as pickBestLocators,V as replaceVariables,N as runTask,J as setWindowBounds,n as toolRegistry};
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-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};
3
+ import"./chunk-CSINHOOD.js";import*as a from"path";import{test as A,expect as y}from"@playwright/test";var o;async function E(){return o||(o=await import("./dist-SIZHXBHX.js"),o)}var I=A.extend({agent:async({},l,s)=>{let{WebAgent:u,createAgentContext:f,configureSdk:d,VariableStore:g}=await E();d({env:{GOOGLE_API_KEY:process.env.GOOGLE_API_KEY??"",ANTHROPIC_API_KEY:process.env.ANTHROPIC_API_KEY??""}});let{resolveModelFromEnv:m}=await import("./dist-K7NWI5BS.js"),n=m(process.env);if(!n)throw new Error("No AI model configured. Set WEB_AGENT_MODEL, ANTHROPIC_API_KEY, or GOOGLE_API_KEY.");let r=new g,i=s.project.use?.variables;if(i)for(let[e,t]of Object.entries(i))typeof t=="string"?r.set(e,t,!1):t&&typeof t=="object"&&"value"in t&&r.set(e,t.value,t.sensitive===!0);let c=f({model:n,variableStore:r,autoDisableModal:!0}),v=process.env.SHIPLIGHT_MAGIC==="1"?a.join(s.outputDir,"artifacts"):void 0;c.stepTracking={results:{},artifactsDir:v};let p=new u(c);await l(p);try{let e=s.outputDir;await p.writeExecutionResults(e);let t=a.join(e,"test-results.json");await(await import("fs/promises")).stat(t).catch(()=>null)&&await s.attach("shiplight-results",{path:t,contentType:"application/json"})}catch(e){console.error("[Shiplight] Failed to attach step results:",e)}}});export{y as expect,I as test};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __createRequire } from "module";
2
+ const require = __createRequire(import.meta.url);
3
+ import{D as o,E as r}from"./chunk-VLVDPV2E.js";import"./chunk-HJNJZWUA.js";import"./chunk-EEEG4LZX.js";import"./chunk-C6BVAOFE.js";import"./chunk-L5JSAS2D.js";import"./chunk-CSINHOOD.js";export{o as ActionHandler,r as default};
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { Page } from '@playwright/test';
2
1
  export { VariableStore } from './VariableStore.js';
3
2
  export { WebAgent } from './agent/webAgent.js';
4
3
  export { createAgentContext } from './core/agentContext.js';
@@ -38,50 +37,4 @@ interface ShiplightOptions {
38
37
  */
39
38
  declare function shiplightConfig(options?: ShiplightOptions): Record<string, unknown>;
40
39
 
41
- /**
42
- * Shared login credential resolution.
43
- *
44
- * Used by both the debug server and Playwright global-setup.
45
- *
46
- * Priority:
47
- * 1. Env vars (SHIPLIGHT_LOGIN_EMAIL + SHIPLIGHT_LOGIN_PASSWORD)
48
- * 2. shiplight.config.json (walk up from startDir)
49
- */
50
- interface LoginConfig {
51
- username: string;
52
- password: string;
53
- loginUrl?: string;
54
- totpSecret?: string;
55
- }
56
- /**
57
- * Resolve login credentials from env vars or config file.
58
- *
59
- * Priority for credentials (username/password):
60
- * 1. Env vars: SHIPLIGHT_LOGIN_EMAIL + SHIPLIGHT_LOGIN_PASSWORD
61
- * 2. Config file: shiplight.config.json (walk up from startDir)
62
- *
63
- * SHIPLIGHT_LOGIN_URL and SHIPLIGHT_LOGIN_TOTP_SECRET always override
64
- * the config file values when set, regardless of credential source.
65
- *
66
- * @param startDir Directory to start walking up from when searching for shiplight.config.json
67
- */
68
- declare function resolveLoginConfig(startDir: string): LoginConfig | null;
69
-
70
- /**
71
- * Auth setup — login and save storage state.
72
- *
73
- * Called from the generated `auth.setup.ts` shell. Resolves credentials
74
- * from shiplight.config.json, performs AI-driven login, and saves the
75
- * browser session to `<configDir>/.auth/storage-state.json`.
76
- */
77
-
78
- /**
79
- * Authenticate using credentials from shiplight.config.json and
80
- * save the storage state for Playwright to reuse.
81
- *
82
- * @param page — Playwright page from the setup fixture
83
- * @param configDir — directory containing shiplight.config.json (typically `import.meta.dirname`)
84
- */
85
- declare function authSetup(page: Page, configDir: string): Promise<void>;
86
-
87
- export { type LoginConfig, type ShiplightOptions, authSetup, resolveLoginConfig, shiplightConfig };
40
+ export { type ShiplightOptions, shiplightConfig };
package/dist/index.js CHANGED
@@ -1,13 +1,6 @@
1
1
  import { createRequire as __createRequire } from "module";
2
2
  const require = __createRequire(import.meta.url);
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
7
- import { test as setup } from '@playwright/test';
8
- import { authSetup } from 'shiplightai';
9
-
10
- setup('authenticate', async ({ page }) => {
11
- await authSetup(page, import.meta.dirname);
12
- });
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};
3
+ import{o as w,s as R}from"./chunk-SFCNGCFT.js";import"./chunk-JQ2K2XJ4.js";import{Oa as I}from"./chunk-ID5JNGPZ.js";import"./chunk-AEEQXF3N.js";import"./chunk-VLVDPV2E.js";import"./chunk-J4TZ3OFZ.js";import"./chunk-CSHDULY4.js";import"./chunk-NLZ3YJX4.js";import"./chunk-YU3XZJIJ.js";import"./chunk-HJNJZWUA.js";import"./chunk-EEEG4LZX.js";import{b as v}from"./chunk-C6BVAOFE.js";import"./chunk-L5JSAS2D.js";import{a as g,b as h}from"./chunk-4MP3EHVU.js";import"./chunk-47OHTDHW.js";import"./chunk-CSINHOOD.js";import*as S from"fs";import*as o from"path";import H from"dotenv";import{readFileSync as u,statSync as E,existsSync as y}from"fs";import{resolve as p}from"path";import{globSync as A}from"glob";var c="0.1.22";function d(t){try{return E(t).mtimeMs}catch{return 0}}var T=`// @generated by shiplightai v${c}`;function b(t,s){if(!y(t)||u(t,"utf-8").split(`
4
+ `,1)[0]!==T)return!1;let i=d(t);for(let e of s)if(d(e)>i)return!1;return!0}function x(t){let s=process.argv.slice(2),n=[],i=p(t);for(let e of s){if(e.startsWith("-"))continue;let r=e.endsWith(".yaml.spec.ts")?e.replace(/\.yaml\.spec\.ts$/,".test.yaml"):e;if(!r.endsWith(".test.yaml"))continue;let l=p(t,r);y(l)&&n.push(l.startsWith(i)?l.slice(i.length+1):r)}return n.length>0?n:null}function _(t){let s=x(t.cwd),n=s??A("**/*.test.yaml",{cwd:t.cwd,ignore:["**/node_modules/**"]}),i=[];for(let e of n){let r=p(t.cwd,e),l=r.replace(/\.test\.yaml$/,".yaml.spec.ts"),f=u(r,"utf-8");try{let a=g(f,r);if(b(l,[r,...a.referencedTemplatePaths]))continue;let m=h(f,r,{version:c});if(!m.valid)throw new Error(m.errors.join("; "))}catch(a){console.error(`[shiplight] Failed to transpile ${e}:`,a),i.push({file:e,error:a})}}if(i.length>0){let e=`[shiplight] Transpilation failed for ${i.length} file(s):
5
+ `+i.map(r=>` - ${r.file}`).join(`
6
+ `);if(s)throw new Error(e);console.warn(e+" (skipped)")}}function O(t={}){t.dotenv!==!1&&P(t.scanDir||process.cwd());let s=t.scanDir||process.cwd();return _({cwd:s}),t.apiKey&&(process.env.__SHIPLIGHT_API_KEY=t.apiKey),{reporter:[["list"],["shiplightai/reporter",{outputFolder:"shiplight-report",open:"never"}]]}}function P(t){let s=[],n=o.resolve(t),i=o.resolve(process.cwd());for(;;){let e=o.join(n,".env");if(S.existsSync(e)&&s.push(e),n===i)break;let r=o.dirname(n);if(r===n)break;n=r}for(let e of s)H.config({path:e})}export{I as VariableStore,R as WebAgent,v as configureSdk,w as createAgentContext,O as shiplightConfig};
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __createRequire } from "module";
2
2
  const require = __createRequire(import.meta.url);
3
- import"./chunk-CSINHOOD.js";import{Router as g}from"express";function p(o){let r=g();return r.post("/api/int-runner/create-session",async(t,e)=>{try{let s=t.body.startingUrl||t.body.testFlow?.url||t.body.urlOverride,n=await o.createSession({startingUrl:s});e.json({status:"success",sessionId:n.sessionId,searchParams:""})}catch(s){console.error("[debugger] create-session error:",s),e.status(500).json({status:"error",message:s.message})}}),r.post("/api/int-runner/login",async(t,e)=>{try{let{session:s}=t.body;if(!s?.sessionId)return e.status(400).json({status:"error",message:"Missing session"});let n=await o.executeLogin(s.sessionId);e.json(n)}catch(s){console.error("[debugger] login error:",s),e.status(500).json({status:"error",details:s.message})}}),r.post("/api/int-runner/liveview-url",async(t,e)=>{let{session:s}=t.body;if(!s?.sessionId)return e.status(400).json({status:"error",message:"Missing session"});e.json({liveviewUrl:"",browserWsUrl:""})}),r.post("/api/int-runner/end-debug",async(t,e)=>{let{session:s}=t.body;if(!s?.sessionId)return e.status(400).json({status:"error",message:"Missing session"});e.json({status:"success"})}),r.post("/api/int-runner/start-debug",async(t,e)=>{try{let{session:s}=t.body;if(!s?.sessionId)return e.status(400).json({status:"error",message:"Missing session"});let n=await o.startDebug(s.sessionId);e.json({status:"success",...n})}catch(s){console.error("[debugger] start-debug error:",s),e.status(500).json({status:"error",message:s.message})}}),r.post("/api/int-runner/execute-action",async(t,e)=>{try{let{session:s,actionEntity:n,stepId:c,withSelfHealing:i,stmtUid:u,executionHistory:a}=t.body;if(!s?.sessionId||!n)return e.status(400).json({status:"error",message:"Missing session or actionEntity"});let d=await o.executeAction(s.sessionId,n,c,{withSelfHealing:i,stmtUid:u,executionHistory:a});e.json(d)}catch(s){console.error("[debugger] execute-action error:",s),e.status(500).json({status:"error",details:s.message})}}),r.post("/api/int-runner/run-step",async(t,e)=>{let{session:s,statement:n,stepId:c,executionHistory:i}=t.body;if(!s?.sessionId||!n)return e.status(400).json({success:!1,message:"Session and statement required"});e.setHeader("Content-Type","text/event-stream"),e.setHeader("Cache-Control","no-cache"),e.setHeader("Connection","keep-alive"),e.flushHeaders();let u=a=>{e.write(`data: ${JSON.stringify(a)}
3
+ import"./chunk-CSINHOOD.js";import{Router as g}from"express";function p(o){let r=g();return r.get("/api/browser-cdp",async(t,e)=>{let s=o.getCdpEndpoint();if(!s&&typeof o.fetchCdpEndpoint=="function"&&(s=await o.fetchCdpEndpoint()),!s)return e.status(404).json({error:"No browser running. Start a debug session first."});e.json({cdpUrl:s})}),r.post("/api/int-runner/create-session",async(t,e)=>{try{let s=t.body.startingUrl||t.body.testFlow?.url||t.body.urlOverride,n=await o.createSession({startingUrl:s});e.json({status:"success",sessionId:n.sessionId,searchParams:""})}catch(s){console.error("[debugger] create-session error:",s),e.status(500).json({status:"error",message:s.message})}}),r.post("/api/int-runner/login",async(t,e)=>{try{let{session:s}=t.body;if(!s?.sessionId)return e.status(400).json({status:"error",message:"Missing session"});let n=await o.executeLogin(s.sessionId);e.json(n)}catch(s){console.error("[debugger] login error:",s),e.status(500).json({status:"error",details:s.message})}}),r.post("/api/int-runner/liveview-url",async(t,e)=>{let{session:s}=t.body;if(!s?.sessionId)return e.status(400).json({status:"error",message:"Missing session"});e.json({liveviewUrl:"",browserWsUrl:""})}),r.post("/api/int-runner/end-debug",async(t,e)=>{let{session:s}=t.body;if(!s?.sessionId)return e.status(400).json({status:"error",message:"Missing session"});e.json({status:"success"})}),r.post("/api/int-runner/start-debug",async(t,e)=>{try{let{session:s}=t.body;if(!s?.sessionId)return e.status(400).json({status:"error",message:"Missing session"});let n=await o.startDebug(s.sessionId);e.json({status:"success",...n})}catch(s){console.error("[debugger] start-debug error:",s),e.status(500).json({status:"error",message:s.message})}}),r.post("/api/int-runner/execute-action",async(t,e)=>{try{let{session:s,actionEntity:n,stepId:c,withSelfHealing:i,stmtUid:u,executionHistory:a}=t.body;if(!s?.sessionId||!n)return e.status(400).json({status:"error",message:"Missing session or actionEntity"});let d=await o.executeAction(s.sessionId,n,c,{withSelfHealing:i,stmtUid:u,executionHistory:a});e.json(d)}catch(s){console.error("[debugger] execute-action error:",s),e.status(500).json({status:"error",details:s.message})}}),r.post("/api/int-runner/run-step",async(t,e)=>{let{session:s,statement:n,stepId:c,executionHistory:i}=t.body;if(!s?.sessionId||!n)return e.status(400).json({success:!1,message:"Session and statement required"});e.setHeader("Content-Type","text/event-stream"),e.setHeader("Cache-Control","no-cache"),e.setHeader("Connection","keep-alive"),e.flushHeaders();let u=a=>{e.write(`data: ${JSON.stringify(a)}
4
4
 
5
5
  `)};try{await o.runStep(s.sessionId,n,c,u,i)}catch(a){u({type:"error",data:{message:a.message}})}finally{e.end()}}),r.post("/api/int-runner/execute-step",async(t,e)=>{let{session:s,statement:n,stepId:c,executionHistory:i,maxSteps:u}=t.body;if(!s?.sessionId||!n)return e.status(400).json({success:!1,message:"Session and statement required"});e.setHeader("Content-Type","text/event-stream"),e.setHeader("Cache-Control","no-cache"),e.setHeader("Connection","keep-alive"),e.flushHeaders();let a=d=>{e.write(`data: ${JSON.stringify(d)}
6
6
 
@@ -0,0 +1,28 @@
1
+ import { Reporter, FullConfig, Suite, TestCase, TestResult, FullResult } from '@playwright/test/reporter';
2
+
3
+ /**
4
+ * Shiplight Playwright Reporter
5
+ *
6
+ * Custom reporter that reads test-results.json from Playwright attachments,
7
+ * maps stepIds back to YAML statements, and generates an HTML report
8
+ * showing YAML-level step info instead of transpiled code.
9
+ */
10
+
11
+ interface ShiplightReporterOptions {
12
+ outputFolder?: string;
13
+ open?: 'always' | 'never' | 'on-failure';
14
+ }
15
+ declare class ShiplightReporter implements Reporter {
16
+ private outputFolder;
17
+ private openMode;
18
+ private collected;
19
+ private config;
20
+ constructor(options?: ShiplightReporterOptions);
21
+ onBegin(config: FullConfig, _suite: Suite): void;
22
+ onTestEnd(test: TestCase, result: TestResult): void;
23
+ onEnd(result: FullResult): Promise<void>;
24
+ printsToStdio(): boolean;
25
+ private buildReportTest;
26
+ }
27
+
28
+ export { ShiplightReporter as default };