agentiqa 0.4.4 → 0.4.5

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 (2) hide show
  1. package/dist/cli.js +1 -1
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1314,7 +1314,7 @@ Start an Android emulator or iOS simulator, then try again.
1314
1314
  `),2}else e="web",At("Using web target (default)");if(e==="web"&&!t.url)return process.stderr.write(`Error: --url is required for web testing
1315
1315
 
1316
1316
  Usage: agentiqa explore "prompt" --url http://localhost:3000
1317
- `),2;if(t.dryRun)return await bR(e,r,s);e==="web"?await rg():await ng();let n=null,o,a=t.package||t.bundleId,i=null,c=!1,l=async()=>{c||(c=!0,At("Interrupted \u2014 cleaning up..."),i&&o&&await as(o,i).catch(()=>{}),n&&await n.shutdown().catch(()=>{}),process.exit(130))};process.on("SIGINT",l),process.on("SIGTERM",l);try{let u;t.engine?(o=t.engine,At(`Using engine at ${o}`)):(u=(await qn()).geminiKey,n=await _a(Fn({geminiKey:u}),6e4,"Engine startup"),o=n.url);let g=gR(t.credentials),f=e==="android"||e==="ios",p=Nr(),h={engineSessionKind:"agent",platform:"cli",maxIterationsPerTurn:300,...t.autoApprove?{autoApprove:!0}:{},parallelChildren:!f,...t.url?{initialUrl:t.url}:{},...g?.length?{credentials:g}:{},...p?.token?{userToken:p.token}:{},...f?{mobileConfig:{platform:e,deviceMode:e==="ios"?"simulator":"connected",...r?{deviceId:r}:{},...a?{appIdentifier:a}:{}}}:{}};At(`Creating ${e} session...`);let{sessionId:d}=await _a(pa(o,h),3e4,"Session creation");i=d,At(`Session created: ${d}`);let y=Date.now();Gt("test_started",{target_domain:Lr(t.url)??a??null,source_tool:jr(t.url),client_surface:"cli",mode:"explore",target:e},{sessionId:d});let v=0,w=0,b=0,I=[],S=!t.noArtifacts,k=null;S&&(k=yR(d));let _=ma(o,d),E=t.json??!1,M=(t.autoApprove??!1)||!process.stdin.isTTY,N=null,ie=null,Y=null,j=mg({prompt:t.prompt,feature:t.feature,test_hints:t.hints,known_issues:t.knownIssues});if(await ol(o,d,j),At("Agent is exploring the app..."),await _a(new Promise((F,$)=>{let X=new dR(_);X.on("error",ce=>$(ce)),X.on("close",()=>F()),X.on("message",async ce=>{let ee;try{ee=JSON.parse(ce.toString())}catch{return}if(ee.type==="action:progress"){I.push(ee),v++;let G=ee.toolName||ee.name||"";if(G==="report_issue"){w++;let J=ee.action?.actionArgs||{};At(`Found issue: ${J.title||"untitled"}`)}else{let J=Math.round((Date.now()-y)/1e3),C=ee.action?.actionName||G||"exploring",P=ee.action?.intent,de=P?`${C} \u2014 ${P}`:C;At(`${de} (${v} actions, ${J}s)`)}}else if(ee.type==="message:added"){I.push(ee),S&&k&&ee.screenshotBase64&&(b++,vR(k,b,ee.screenshotBase64));let G=ee.message;if(G?.actionName==="present_checkpoint"&&G?.actionArgs){let J=G.actionArgs,C=cg(J,E),P=await dg({checkpoint:J,isNonInteractive:M,rendered:C,writeOutput:de=>process.stderr.write(de),log:At,prompt:()=>ll(`${mR}Press Enter to approve, or type a message: ${hR}`),promptCredentials:fR,sendMessage:async de=>ol(o,d,de),sendCredentials:async de=>og(o,d,de),closeStream:()=>X.close()});if(P.kind==="stop_findings"){N="findings";return}if(P.kind==="fail_non_interactive"){ie=P.reason,N="non_interactive_checkpoint";return}}}else ee.type==="session:stopped"||ee.type==="session:error"?(I.push(ee),ee.type==="session:error"&&(Y=ee.error||JSON.stringify(ee),At(`Session error: ${Y}`)),X.close()):ee.type==="session:status-changed"&&ee.status==="stopped"&&(I.push(ee),X.close())})}),pR,"Agent exploration"),Y)throw await as(o,d).catch(()=>{}),i=null,new Error(Y);if(N==="non_interactive_checkpoint")return Gt("test_run_abandoned",{reason:ie??"interactive_checkpoint_required",target_domain:Lr(t.url)??a??null,source_tool:jr(t.url),client_surface:"cli",mode:"explore",target:e},{sessionId:d}),await as(o,d).catch(()=>{}),i=null,2;let H=pg(I,y),ne={...H,target:e,device:r||null,...k?{artifactsDir:k,screenshotCount:b}:{}};return At(`Done \u2014 ${H.actionsTaken} actions, ${H.issues.length} issues in ${H.durationSeconds}s`),k&&At(`Artifacts saved to ${k} (${b} screenshots)`),process.stdout.write(JSON.stringify(ne,null,2)+`
1317
+ `),2;if(t.dryRun)return await bR(e,r,s);e==="web"?await rg():await ng();let n=null,o,a=t.package||t.bundleId,i=null,c=!1,l=async()=>{c||(c=!0,At("Interrupted \u2014 cleaning up..."),i&&o&&await as(o,i).catch(()=>{}),n&&await n.shutdown().catch(()=>{}),process.exit(130))};process.on("SIGINT",l),process.on("SIGTERM",l);try{let u;t.engine?(o=t.engine,At(`Using engine at ${o}`)):(u=(await qn()).geminiKey,n=await _a(Fn({geminiKey:u}),6e4,"Engine startup"),o=n.url);let g=gR(t.credentials),f=e==="android"||e==="ios",p=Nr(),h={engineSessionKind:"agent",platform:"cli",maxIterationsPerTurn:300,...t.autoApprove?{autoApprove:!0}:{},parallelChildren:!f,...t.url?{initialUrl:t.url}:{},...g?.length?{credentials:g}:{},...p?.token?{userToken:p.token}:{},...f?{mobileConfig:{platform:e,deviceMode:e==="ios"?"simulator":"connected",...r?{deviceId:r}:{},...a?{appIdentifier:a}:{}}}:{}};At(`Creating ${e} session...`);let{sessionId:d}=await _a(pa(o,h),3e4,"Session creation");i=d,At(`Session created: ${d}`);let y=Date.now();Gt("test_started",{target_domain:Lr(t.url)??a??null,source_tool:jr(t.url),client_surface:"cli",mode:"explore",target:e},{sessionId:d});let v=0,w=0,b=0,I=[],S=!t.noArtifacts,k=null;S&&(k=yR(d));let _=ma(o,d),E=t.json??!1,M=(t.autoApprove??!1)||!process.stdin.isTTY,N=null,ie=null,Y=null,j=mg({prompt:t.prompt,feature:t.feature,test_hints:t.hints,known_issues:t.knownIssues});if(await ol(o,d,j),At("Agent is exploring the app..."),await _a(new Promise((F,$)=>{let X=new dR(_);X.on("error",ce=>$(ce)),X.on("close",()=>F()),X.on("message",async ce=>{let ee;try{ee=JSON.parse(ce.toString())}catch{return}if(ee.type==="action:progress"){I.push(ee);let G=ee.action?.status||ee.status||"";if(G==="completed"||G==="draining")return;v++;let J=ee.toolName||ee.name||"";if(J==="report_issue"){w++;let C=ee.action?.actionArgs||{};At(`Found issue: ${C.title||"untitled"}`)}else{let C=Math.round((Date.now()-y)/1e3),P=ee.action?.actionName||J||"exploring",de=ee.action?.intent,D=de?`${P} \u2014 ${de}`:P;At(`${D} (${v} actions, ${C}s)`)}}else if(ee.type==="message:added"){I.push(ee),S&&k&&ee.screenshotBase64&&(b++,vR(k,b,ee.screenshotBase64));let G=ee.message;if(G?.actionName==="present_checkpoint"&&G?.actionArgs){let J=G.actionArgs,C=cg(J,E),P=await dg({checkpoint:J,isNonInteractive:M,rendered:C,writeOutput:de=>process.stderr.write(de),log:At,prompt:()=>ll(`${mR}Press Enter to approve, or type a message: ${hR}`),promptCredentials:fR,sendMessage:async de=>ol(o,d,de),sendCredentials:async de=>og(o,d,de),closeStream:()=>X.close()});if(P.kind==="stop_findings"){N="findings";return}if(P.kind==="fail_non_interactive"){ie=P.reason,N="non_interactive_checkpoint";return}}}else ee.type==="session:stopped"||ee.type==="session:error"?(I.push(ee),ee.type==="session:error"&&(Y=ee.error||JSON.stringify(ee),At(`Session error: ${Y}`)),X.close()):ee.type==="session:status-changed"&&ee.status==="stopped"&&(I.push(ee),X.close())})}),pR,"Agent exploration"),Y)throw await as(o,d).catch(()=>{}),i=null,new Error(Y);if(N==="non_interactive_checkpoint")return Gt("test_run_abandoned",{reason:ie??"interactive_checkpoint_required",target_domain:Lr(t.url)??a??null,source_tool:jr(t.url),client_surface:"cli",mode:"explore",target:e},{sessionId:d}),await as(o,d).catch(()=>{}),i=null,2;let H=pg(I,y),ne={...H,target:e,device:r||null,...k?{artifactsDir:k,screenshotCount:b}:{}};return At(`Done \u2014 ${H.actionsTaken} actions, ${H.issues.length} issues in ${H.durationSeconds}s`),k&&At(`Artifacts saved to ${k} (${b} screenshots)`),process.stdout.write(JSON.stringify(ne,null,2)+`
1318
1318
  `),Gt("test_completed",{duration_sec:H.durationSeconds,outcome:"completed",findings_count:H.issues.length,target_domain:Lr(t.url)??a??null,source_tool:jr(t.url),client_surface:"cli",mode:"explore",target:e},{sessionId:d}),await as(o,d).catch(()=>{}),i=null,0}catch(u){return Gt("test_run_abandoned",{reason:u?.message??"unknown_error",target_domain:Lr(t.url)??a??null,source_tool:jr(t.url),client_surface:"cli",mode:"explore",target:e},i?{sessionId:i}:{}),process.stderr.write(`Error: ${u.message}
1319
1319
  `),1}finally{process.removeListener("SIGINT",l),process.removeListener("SIGTERM",l),n&&await n.shutdown().catch(()=>{})}}async function bR(t,e,r){let s=!1;try{let{geminiKey:o}=await qn(),a=await _a(Fn({geminiKey:o}),6e4,"Engine startup");s=(await fetch(`${a.url}/health`)).ok,await a.shutdown()}catch{s=!1}let n={dryRun:!0,target:t,device:r?{id:r.id,name:r.name}:e?{id:e,name:e}:null,engineHealthy:s,ready:s&&!!t};return process.stdout.write(JSON.stringify(n,null,2)+`
1320
1320
  `),0}import{readFileSync as _R}from"fs";function Yt(t){process.stderr.write(`[agentiqa] ${t}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentiqa",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "AI-powered testing for web and mobile apps",
5
5
  "type": "module",
6
6
  "bin": "dist/cli.js",