shiplightai 0.1.89 → 0.1.91
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/cjs/debugger-manager.cjs +4 -3
- package/dist/cjs/debugger-pw.cjs +75 -73
- package/dist/cjs/fixture.cjs +138 -136
- package/dist/cjs/index.cjs +95 -93
- package/dist/cjs/reporter.cjs +42 -42
- package/dist/cli.js +91 -90
- package/dist/debugger-manager.js +4 -3
- package/dist/debugger-pw.d.ts +10 -1
- package/dist/debugger-pw.js +75 -73
- package/dist/fixture.js +138 -136
- package/dist/index.js +67 -65
- package/dist/reporter.js +42 -42
- package/dist/static-embedded/assets/{index-CMdPZNG2.js → index-CzL8SI3t.js} +2 -2
- package/dist/static-embedded/assets/{index-Bcj9zYt-.js → index-Dm1PmCd3.js} +34 -7
- package/dist/static-embedded/index.html +1 -1
- package/package.json +1 -1
package/dist/debugger-manager.js
CHANGED
|
@@ -3,7 +3,7 @@ import { test } from 'shiplightai/fixture';
|
|
|
3
3
|
${`
|
|
4
4
|
test.use(${JSON.stringify(r)});
|
|
5
5
|
`}
|
|
6
|
-
test('__shiplight_debug__', async ({ page, agent }) => {
|
|
6
|
+
test('__shiplight_debug__', async ({ page, agent, testContext }) => {
|
|
7
7
|
// Disable timeout \u2014 debugger runs until user stops it
|
|
8
8
|
test.setTimeout(0);
|
|
9
9
|
|
|
@@ -14,6 +14,7 @@ test('__shiplight_debug__', async ({ page, agent }) => {
|
|
|
14
14
|
port: ${s},
|
|
15
15
|
page,
|
|
16
16
|
agent,
|
|
17
|
+
testContext,
|
|
17
18
|
projectRoot: ${JSON.stringify(n??null)},
|
|
18
19
|
});
|
|
19
20
|
|
|
@@ -22,7 +23,7 @@ test('__shiplight_debug__', async ({ page, agent }) => {
|
|
|
22
23
|
// Keep alive until the server is closed externally (Ctrl+C kills the process)
|
|
23
24
|
await new Promise(() => {});
|
|
24
25
|
});
|
|
25
|
-
`}async function U(l){let{createServer:s}=await import("net");for(let e=l;e<l+20;e++)if(await new Promise(r=>{let t=s();t.once("error",()=>r(!1)),t.once("listening",()=>{t.close(()=>r(!0))}),t.listen(e,"127.0.0.1")}))return e;throw new Error(`No available port found in range ${l}-${l+19}`)}async function _(l){let{yamlFilePath:s,configPath:e,tempSuffix:n="",headed:r}=l,t=h.dirname(e),i=await U(16174),o;if(!w.existsSync(s))throw new Error(`Please select a test file before starting the debug session. File not found: ${s}`);try{let u=A(w.readFileSync(s,"utf-8"));u?.use&&typeof u.use=="object"&&!Array.isArray(u.use)&&(o=u.use),u?.base_url&&!o?.baseURL&&(o={...o,baseURL:u.base_url})}catch(u){console.error("[debugger] Could not parse YAML for `use` block:",u)}let d=h.dirname(h.resolve(s)),a=n?`-${n}`:"",c=h.join(d,`.__shiplight_debug__${a}.yaml.spec.ts`),m=M(s,i,o,t);w.writeFileSync(c,m);let P=L(c),g=["playwright","test",h.relative(t,c).replace(/\\/g,"/"),...r?["--headed"]:[]],p=D("npx",g,{stdio:["ignore","pipe","pipe"],shell:!0,cwd:t,env:{...process.env,PWDEBUG:"console",OMNITERM_BROWSER_REGISTRY_URL:""}});p.stdout?.on("data",u=>{process.stderr.write(u)}),p.stderr?.on("data",u=>{process.stderr.write(u)});let f=()=>{p.killed||p.kill("SIGTERM")};process.on("SIGTERM",f),process.on("SIGINT",f),process.on("exit",f),p.on("close",u=>{process.removeListener("SIGTERM",f),process.removeListener("SIGINT",f),process.removeListener("exit",f),P(),u!==0&&u!==null&&console.error(`[debugger] Playwright process exited with code ${u}`)}),console.error("[debugger] Waiting for Playwright sandbox to start...");let b=["127.0.0.1","::1"];async function T(u){try{let S=u.includes(":")?`[${u}]`:u,I=await fetch(`http://${S}:${i}/api/test-flow`);if(I.ok){try{await I.text()}catch{}return!0}}catch{}return!1}let v=null;for(let u=0;u<180;u++){if(p.exitCode!==null)throw P(),new Error(`Playwright process exited with code ${p.exitCode} before sandbox was ready`);for(let S of b)if(await T(S)){v=S;break}if(v){console.error(`[debugger] Playwright sandbox ready on ${v}:${i}`);break}if(u===179)throw f(),P(),new Error("Timed out waiting for Playwright sandbox to start (180s)");await new Promise(S=>setTimeout(S,1e3))}if(!v)throw f(),P(),new Error("Sandbox poll finished without a reachable host");return{port:i,host:v,pid:p.pid??0,cleanup:async()=>{f(),P()}}}var H=1e4,R=class{sessions=new Map;byYamlPath=new Map;options;spawner;headed;constructor(s={}){this.options=s,this.spawner=s.spawner??_,this.headed=s.headed??!1}log(s){this.options.onLog?this.options.onLog(s):console.error(s)}resetToIdle(s,e){s.session.innerPort=0,s.session.innerHost="127.0.0.1",s.session.pid=0,s.session.status="idle",s.session.exitInfo=e,s.cleanup=async()=>{},s.readyPromise=Promise.resolve(),this.notifyStateChange(s.session)}notifyStateChange(s){try{this.options.onSessionStateChange?.({...s})}catch(e){this.log(`[manager] onSessionStateChange listener threw: ${e.message}`)}}openSession(s){let e=y.resolve(s),n=this.byYamlPath.get(e);if(n){let a=this.sessions.get(n);if(a&&a.session.status!=="ended")return{...a.session};this.byYamlPath.delete(e)}if(!B.existsSync(e))throw new Error(`YAML file not found: ${e}`);if(!x(y.dirname(e)))throw new Error(`No Playwright config found for ${e} (searched parents for playwright.config.{ts,js,mjs}).`);let t=`dbg-${F().slice(0,8)}`,i=new Date().toISOString(),o={sessionId:t,yamlPath:e,innerPort:0,innerHost:"127.0.0.1",pid:0,startedAt:i,status:"idle",exitInfo:null},d={session:o,cleanup:async()=>{},readyPromise:Promise.resolve()};return this.sessions.set(t,d),this.byYamlPath.set(e,t),this.notifyStateChange(o),this.log(`[manager] session ${t} created (idle) for ${y.basename(e)}`),{...o}}async startSandbox(s){let e=this.sessions.get(s);if(!e)throw new Error(`No session ${s} to start sandbox for`);if(e.session.status==="running"||e.session.status==="starting"){e.readyPromise&&await e.readyPromise;return}if(e.session.status==="ended")throw new Error(`Session ${s} has ended`);let n=e.session.yamlPath,r=x(y.dirname(n));if(!r)throw new Error(`No Playwright config found for ${n} (searched parents for playwright.config.{ts,js,mjs}).`);e.session.status="starting",this.notifyStateChange(e.session);let t=(async()=>{let i=H+18e4,o,d=new Promise((c,m)=>{o=setTimeout(()=>m(new Error(`Timed out after ${i/1e3}s waiting for inner playwright to register on a port.`)),i)}),a;try{a=await Promise.race([this.spawner({yamlFilePath:n,configPath:r,tempSuffix:s,headed:this.headed}),d])}finally{o&&clearTimeout(o)}e.session.innerPort=a.port,e.session.innerHost=a.host,e.session.pid=a.pid,e.session.status="running",e.cleanup=a.cleanup,e.livenessTimer=this.startLivenessProbe(s,c=>{(e.session.status==="running"||e.session.status==="starting")&&this.resetToIdle(e,c)}),this.notifyStateChange(e.session),this.log(`[manager] session ${s} running on ${e.session.innerHost}:${e.session.innerPort} (yaml=${y.basename(n)})`)})();e.readyPromise=t;try{await t}catch(i){throw this.resetToIdle(e,i.message),i}}async stopSandbox(s){let e=this.sessions.get(s);if(e&&e.session.status!=="idle"&&e.session.status!=="ended"){this.log(`[manager] stopSandbox ${s}`),e.livenessTimer&&(clearInterval(e.livenessTimer),e.livenessTimer=void 0);try{await e.cleanup()}catch(n){this.log(`[manager] stopSandbox ${s} cleanup error: ${n.message}`)}this.resetToIdle(e,null)}}startLivenessProbe(s,e){let t=0,i=setInterval(()=>{let o=this.sessions.get(s);if(!o||o.session.status==="ended"||o.session.status==="idle"){clearInterval(i);return}let d=!1;try{process.kill(o.session.pid,0),d=!0}catch(a){a?.code!=="ESRCH"&&(d=!0)}d?t=0:(t+=1,t>=3&&(clearInterval(i),e("process-exited")))},3e3);return i.unref(),i}async closeSession(s){let e=this.sessions.get(s);if(e){this.log(`[manager] closeSession ${s} (status=${e.session.status})`),this.sessions.delete(s),this.byYamlPath.get(e.session.yamlPath)===s&&this.byYamlPath.delete(e.session.yamlPath),e.livenessTimer&&(clearInterval(e.livenessTimer),e.livenessTimer=void 0),e.session.status!=="ended"&&(e.session.status="ended",e.session.exitInfo="SIGTERM",this.notifyStateChange(e.session));try{await e.cleanup()}catch(n){this.log(`[manager] closeSession ${s} cleanup error: ${n.message}`)}}}async restartInner(s){let e=this.sessions.get(s);if(!e)throw new Error(`No session ${s} to restart`);if(e.restartInProgress)throw new Error(`Restart already in progress for session ${s}`);let n=e.session.yamlPath,r=x(y.dirname(n));if(!r)throw new Error(`No Playwright config found for ${n} (searched parents for playwright.config.{ts,js,mjs}).`);e.restartInProgress=!0;try{e.livenessTimer&&(clearInterval(e.livenessTimer),e.livenessTimer=void 0);try{await e.cleanup()}catch(a){this.log(`[manager] restartInner ${s} old cleanup error: ${a.message}`)}e.session.status="starting",e.session.innerPort=0,e.session.pid=0,this.notifyStateChange(e.session);let t=H+18e4,i,o=new Promise((a,c)=>{i=setTimeout(()=>c(new Error(`Timed out after ${t/1e3}s waiting for inner playwright to respawn.`)),t)}),d;try{d=await Promise.race([this.spawner({yamlFilePath:n,configPath:r,tempSuffix:s,headed:this.headed}),o])}catch(a){throw this.resetToIdle(e,a.message),a}finally{i&&clearTimeout(i)}e.session.innerPort=d.port,e.session.innerHost=d.host,e.session.pid=d.pid,e.session.status="running",e.cleanup=d.cleanup,e.livenessTimer=this.startLivenessProbe(s,a=>{(e.session.status==="running"||e.session.status==="starting")&&this.resetToIdle(e,a)}),this.notifyStateChange(e.session),this.log(`[manager] session ${s} restarted on ${e.session.innerHost}:${e.session.innerPort} (yaml=${y.basename(n)})`)}finally{e.restartInProgress=!1}}listSessions(){return Array.from(this.sessions.values()).map(s=>({...s.session}))}getSession(s){let e=this.sessions.get(s);return e?{...e.session}:void 0}httpProxyFor(s,e={}){let{liveviewUrlBuilder:n}=e;return async(r,t,i)=>{let o=this.sessions.get(s);if(!o){t.status(404).json({status:"error",message:"Session not found"});return}if(o.session.status==="ended"){t.status(410).json({status:"error",message:"Session has ended",exitInfo:o.session.exitInfo});return}if(o.session.status==="idle"){t.status(503).json({status:"error",message:"Sandbox not started"});return}let d=`${r.method} ${r.path}`;if(d==="POST /api/int-runner/create-session"){let c=await
|
|
26
|
+
`}async function U(l){let{createServer:s}=await import("net");for(let e=l;e<l+20;e++)if(await new Promise(r=>{let t=s();t.once("error",()=>r(!1)),t.once("listening",()=>{t.close(()=>r(!0))}),t.listen(e,"127.0.0.1")}))return e;throw new Error(`No available port found in range ${l}-${l+19}`)}async function _(l){let{yamlFilePath:s,configPath:e,tempSuffix:n="",headed:r}=l,t=h.dirname(e),i=await U(16174),o;if(!w.existsSync(s))throw new Error(`Please select a test file before starting the debug session. File not found: ${s}`);try{let u=A(w.readFileSync(s,"utf-8"));u?.use&&typeof u.use=="object"&&!Array.isArray(u.use)&&(o=u.use),u?.base_url&&!o?.baseURL&&(o={...o,baseURL:u.base_url})}catch(u){console.error("[debugger] Could not parse YAML for `use` block:",u)}let d=h.dirname(h.resolve(s)),a=n?`-${n}`:"",c=h.join(d,`.__shiplight_debug__${a}.yaml.spec.ts`),m=M(s,i,o,t);w.writeFileSync(c,m);let P=L(c),g=["playwright","test",h.relative(t,c).replace(/\\/g,"/"),...r?["--headed"]:[]],p=D("npx",g,{stdio:["ignore","pipe","pipe"],shell:!0,cwd:t,env:{...process.env,PWDEBUG:"console",OMNITERM_BROWSER_REGISTRY_URL:""}});p.stdout?.on("data",u=>{process.stderr.write(u)}),p.stderr?.on("data",u=>{process.stderr.write(u)});let f=()=>{p.killed||p.kill("SIGTERM")};process.on("SIGTERM",f),process.on("SIGINT",f),process.on("exit",f),p.on("close",u=>{process.removeListener("SIGTERM",f),process.removeListener("SIGINT",f),process.removeListener("exit",f),P(),u!==0&&u!==null&&console.error(`[debugger] Playwright process exited with code ${u}`)}),console.error("[debugger] Waiting for Playwright sandbox to start...");let b=["127.0.0.1","::1"];async function T(u){try{let S=u.includes(":")?`[${u}]`:u,I=await fetch(`http://${S}:${i}/api/test-flow`);if(I.ok){try{await I.text()}catch{}return!0}}catch{}return!1}let v=null;for(let u=0;u<180;u++){if(p.exitCode!==null)throw P(),new Error(`Playwright process exited with code ${p.exitCode} before sandbox was ready`);for(let S of b)if(await T(S)){v=S;break}if(v){console.error(`[debugger] Playwright sandbox ready on ${v}:${i}`);break}if(u===179)throw f(),P(),new Error("Timed out waiting for Playwright sandbox to start (180s)");await new Promise(S=>setTimeout(S,1e3))}if(!v)throw f(),P(),new Error("Sandbox poll finished without a reachable host");return{port:i,host:v,pid:p.pid??0,cleanup:async()=>{f(),P()}}}var H=1e4,R=class{sessions=new Map;byYamlPath=new Map;options;spawner;headed;constructor(s={}){this.options=s,this.spawner=s.spawner??_,this.headed=s.headed??!1}log(s){this.options.onLog?this.options.onLog(s):console.error(s)}resetToIdle(s,e){s.session.innerPort=0,s.session.innerHost="127.0.0.1",s.session.pid=0,s.session.status="idle",s.session.exitInfo=e,s.cleanup=async()=>{},s.readyPromise=Promise.resolve(),this.notifyStateChange(s.session)}notifyStateChange(s){try{this.options.onSessionStateChange?.({...s})}catch(e){this.log(`[manager] onSessionStateChange listener threw: ${e.message}`)}}openSession(s){let e=y.resolve(s),n=this.byYamlPath.get(e);if(n){let a=this.sessions.get(n);if(a&&a.session.status!=="ended")return{...a.session};this.byYamlPath.delete(e)}if(!B.existsSync(e))throw new Error(`YAML file not found: ${e}`);if(!x(y.dirname(e)))throw new Error(`No Playwright config found for ${e} (searched parents for playwright.config.{ts,js,mjs}).`);let t=`dbg-${F().slice(0,8)}`,i=new Date().toISOString(),o={sessionId:t,yamlPath:e,innerPort:0,innerHost:"127.0.0.1",pid:0,startedAt:i,status:"idle",exitInfo:null},d={session:o,cleanup:async()=>{},readyPromise:Promise.resolve()};return this.sessions.set(t,d),this.byYamlPath.set(e,t),this.notifyStateChange(o),this.log(`[manager] session ${t} created (idle) for ${y.basename(e)}`),{...o}}async startSandbox(s){let e=this.sessions.get(s);if(!e)throw new Error(`No session ${s} to start sandbox for`);if(e.session.status==="running"||e.session.status==="starting"){e.readyPromise&&await e.readyPromise;return}if(e.session.status==="ended")throw new Error(`Session ${s} has ended`);let n=e.session.yamlPath,r=x(y.dirname(n));if(!r)throw new Error(`No Playwright config found for ${n} (searched parents for playwright.config.{ts,js,mjs}).`);e.session.status="starting",this.notifyStateChange(e.session);let t=(async()=>{let i=H+18e4,o,d=new Promise((c,m)=>{o=setTimeout(()=>m(new Error(`Timed out after ${i/1e3}s waiting for inner playwright to register on a port.`)),i)}),a;try{a=await Promise.race([this.spawner({yamlFilePath:n,configPath:r,tempSuffix:s,headed:this.headed}),d])}finally{o&&clearTimeout(o)}e.session.innerPort=a.port,e.session.innerHost=a.host,e.session.pid=a.pid,e.session.status="running",e.cleanup=a.cleanup,e.livenessTimer=this.startLivenessProbe(s,c=>{(e.session.status==="running"||e.session.status==="starting")&&this.resetToIdle(e,c)}),this.notifyStateChange(e.session),this.log(`[manager] session ${s} running on ${e.session.innerHost}:${e.session.innerPort} (yaml=${y.basename(n)})`)})();e.readyPromise=t;try{await t}catch(i){throw this.resetToIdle(e,i.message),i}}async stopSandbox(s){let e=this.sessions.get(s);if(e&&e.session.status!=="idle"&&e.session.status!=="ended"){this.log(`[manager] stopSandbox ${s}`),e.livenessTimer&&(clearInterval(e.livenessTimer),e.livenessTimer=void 0);try{await e.cleanup()}catch(n){this.log(`[manager] stopSandbox ${s} cleanup error: ${n.message}`)}this.resetToIdle(e,null)}}startLivenessProbe(s,e){let t=0,i=setInterval(()=>{let o=this.sessions.get(s);if(!o||o.session.status==="ended"||o.session.status==="idle"){clearInterval(i);return}let d=!1;try{process.kill(o.session.pid,0),d=!0}catch(a){a?.code!=="ESRCH"&&(d=!0)}d?t=0:(t+=1,t>=3&&(clearInterval(i),e("process-exited")))},3e3);return i.unref(),i}async closeSession(s){let e=this.sessions.get(s);if(e){this.log(`[manager] closeSession ${s} (status=${e.session.status})`),this.sessions.delete(s),this.byYamlPath.get(e.session.yamlPath)===s&&this.byYamlPath.delete(e.session.yamlPath),e.livenessTimer&&(clearInterval(e.livenessTimer),e.livenessTimer=void 0),e.session.status!=="ended"&&(e.session.status="ended",e.session.exitInfo="SIGTERM",this.notifyStateChange(e.session));try{await e.cleanup()}catch(n){this.log(`[manager] closeSession ${s} cleanup error: ${n.message}`)}}}async restartInner(s){let e=this.sessions.get(s);if(!e)throw new Error(`No session ${s} to restart`);if(e.restartInProgress)throw new Error(`Restart already in progress for session ${s}`);let n=e.session.yamlPath,r=x(y.dirname(n));if(!r)throw new Error(`No Playwright config found for ${n} (searched parents for playwright.config.{ts,js,mjs}).`);e.restartInProgress=!0;try{e.livenessTimer&&(clearInterval(e.livenessTimer),e.livenessTimer=void 0);try{await e.cleanup()}catch(a){this.log(`[manager] restartInner ${s} old cleanup error: ${a.message}`)}e.session.status="starting",e.session.innerPort=0,e.session.pid=0,this.notifyStateChange(e.session);let t=H+18e4,i,o=new Promise((a,c)=>{i=setTimeout(()=>c(new Error(`Timed out after ${t/1e3}s waiting for inner playwright to respawn.`)),t)}),d;try{d=await Promise.race([this.spawner({yamlFilePath:n,configPath:r,tempSuffix:s,headed:this.headed}),o])}catch(a){throw this.resetToIdle(e,a.message),a}finally{i&&clearTimeout(i)}e.session.innerPort=d.port,e.session.innerHost=d.host,e.session.pid=d.pid,e.session.status="running",e.cleanup=d.cleanup,e.livenessTimer=this.startLivenessProbe(s,a=>{(e.session.status==="running"||e.session.status==="starting")&&this.resetToIdle(e,a)}),this.notifyStateChange(e.session),this.log(`[manager] session ${s} restarted on ${e.session.innerHost}:${e.session.innerPort} (yaml=${y.basename(n)})`)}finally{e.restartInProgress=!1}}listSessions(){return Array.from(this.sessions.values()).map(s=>({...s.session}))}getSession(s){let e=this.sessions.get(s);return e?{...e.session}:void 0}httpProxyFor(s,e={}){let{liveviewUrlBuilder:n}=e;return async(r,t,i)=>{let o=this.sessions.get(s);if(!o){t.status(404).json({status:"error",message:"Session not found"});return}if(o.session.status==="ended"){t.status(410).json({status:"error",message:"Session has ended",exitInfo:o.session.exitInfo});return}if(o.session.status==="idle"){t.status(503).json({status:"error",message:"Sandbox not started"});return}let d=`${r.method} ${r.path}`;if(d==="POST /api/int-runner/create-session"){let c=await C(r),m={};if(c.length)try{m=JSON.parse(c.toString("utf-8"))}catch{t.status(400).json({status:"error",message:"Invalid JSON body"});return}m.testFilePath=o.session.yamlPath,await N(r,t,o.session.innerHost,o.session.innerPort,Buffer.from(JSON.stringify(m),"utf-8"),"application/json");return}if(d==="POST /api/int-runner/terminate-session"){try{await this.stopSandbox(s),t.json({status:"success",details:"Sandbox stopped"})}catch(c){t.status(500).json({status:"error",message:c.message})}return}if(d==="POST /api/int-runner/liveview-url"){let c=n?.(r)??"";t.json({liveviewUrl:c,browserWsUrl:""});return}let a=await C(r);await N(r,t,o.session.innerHost,o.session.innerPort,a,r.headers["content-type"])}}wsUpgradeFor(s){return async(e,n,r,t)=>{let i=this.sessions.get(s);if(!i){E(n,`HTTP/1.1 404 Not Found\r
|
|
26
27
|
\r
|
|
27
28
|
`);return}if(i.session.status==="ended"){E(n,`HTTP/1.1 410 Gone\r
|
|
28
29
|
\r
|
|
@@ -32,4 +33,4 @@ Host: ${P}:${m}\r
|
|
|
32
33
|
`)}p+=`\r
|
|
33
34
|
`,g.write(p),r.length&&g.write(r),g.pipe(n),n.pipe(g)}),g.on("error",()=>{(!("destroyed"in n)||!n.destroyed)&&n.destroy()}),n.on("error",()=>{g.destroyed||g.destroy()}),n.on("close",()=>{g.destroyed||g.destroy()})}catch(o){this.log(`[manager] WS upgrade for ${s} failed: ${o.message}`),E(n,`HTTP/1.1 502 Bad Gateway\r
|
|
34
35
|
\r
|
|
35
|
-
`)}}}async shutdown(){let s=Array.from(this.sessions.keys());await Promise.allSettled(s.map(e=>this.closeSession(e)))}};function
|
|
36
|
+
`)}}}async shutdown(){let s=Array.from(this.sessions.keys());await Promise.allSettled(s.map(e=>this.closeSession(e)))}};function C(l){return new Promise((s,e)=>{if(l.body&&typeof l.body=="object")try{s(Buffer.from(JSON.stringify(l.body),"utf-8"));return}catch{}if(l.readableEnded){s(Buffer.alloc(0));return}let n=[];l.on("data",r=>n.push(r)),l.on("end",()=>s(Buffer.concat(n))),l.on("error",e)})}function N(l,s,e,n,r,t){return new Promise(i=>{let o=Array.isArray(t)?t[0]:t,d=j.request({hostname:e,port:n,path:l.originalUrl,method:l.method,headers:{"content-type":o||"application/json","content-length":String(r.length)},timeout:3e5},a=>{s.writeHead(a.statusCode??502,a.headers),a.on("data",c=>s.write(c)),a.on("end",()=>{s.end(),i()}),a.on("error",()=>{s.writableEnded||s.end(),i()})});d.on("error",a=>{s.headersSent?s.writableEnded||s.end():s.status(502).json({status:"error",message:"Inner server unavailable: "+a.message}),i()}),d.end(r)})}function E(l,s){try{(!("destroyed"in l)||!l.destroyed)&&(l.write(s),l.destroy())}catch{}}export{R as DebuggerManager};
|
package/dist/debugger-pw.d.ts
CHANGED
|
@@ -3,6 +3,12 @@ import { WebAgent } from './agent/webAgent.js';
|
|
|
3
3
|
import { ActionEntity } from './test-flow/actionEntity.js';
|
|
4
4
|
import { ActionGenerationResponse } from './interactive-run.js';
|
|
5
5
|
import { AgentStepEvent } from 'sdk-internal';
|
|
6
|
+
import { TestContext } from './fixture.js';
|
|
7
|
+
import '@playwright/test';
|
|
8
|
+
import './VariableStore.js';
|
|
9
|
+
import './index.js';
|
|
10
|
+
import './core/agentContext.js';
|
|
11
|
+
import './config.js';
|
|
6
12
|
|
|
7
13
|
/**
|
|
8
14
|
* SandboxService Interface
|
|
@@ -92,6 +98,7 @@ interface SandboxService {
|
|
|
92
98
|
declare class PlaywrightSandboxService implements SandboxService {
|
|
93
99
|
private page;
|
|
94
100
|
private agent;
|
|
101
|
+
private testContext?;
|
|
95
102
|
private testDir;
|
|
96
103
|
private projectRoot?;
|
|
97
104
|
private sessionId;
|
|
@@ -101,7 +108,7 @@ declare class PlaywrightSandboxService implements SandboxService {
|
|
|
101
108
|
private screenshotHistory;
|
|
102
109
|
private yamlFilePath?;
|
|
103
110
|
private artifactsDir?;
|
|
104
|
-
constructor(page: Page, agent: WebAgent, fixturesDir?: string, projectRoot?: string);
|
|
111
|
+
constructor(page: Page, agent: WebAgent, fixturesDir?: string, projectRoot?: string, testContext?: TestContext);
|
|
105
112
|
private cdpEndpoint;
|
|
106
113
|
setCdpEndpoint(url: string): void;
|
|
107
114
|
getCdpEndpoint(): string | null;
|
|
@@ -174,6 +181,8 @@ interface PlaywrightDebugOptions {
|
|
|
174
181
|
port: number;
|
|
175
182
|
page: Page;
|
|
176
183
|
agent: WebAgent;
|
|
184
|
+
/** Proxy-backed test context from the `testContext` fixture, shared with `agent`'s VariableStore. */
|
|
185
|
+
testContext: TestContext;
|
|
177
186
|
/** Directory containing playwright.config.ts — used to resolve the fixtures dir. */
|
|
178
187
|
projectRoot?: string;
|
|
179
188
|
}
|