()
| 279 | } |
| 280 | |
| 281 | async function main(): Promise<void> { |
| 282 | cli.header("Simple Benchmark: Screenshots vs WebMCP Tools\nAgent SDK Version"); |
| 283 | |
| 284 | cli.section("STARTING DEV SERVER"); |
| 285 | try { |
| 286 | await startDevServer(); |
| 287 | } catch (err) { |
| 288 | cli.error(`Failed to start dev server: ${err}`); |
| 289 | process.exit(1); |
| 290 | } |
| 291 | |
| 292 | cli.info(`Task: ${TASK}`); |
| 293 | cli.info(`Runs per approach: ${NUM_RUNS}`); |
| 294 | cli.info("Using Claude Agent SDK for realistic agentic behavior"); |
| 295 | cli.info("Screenshot approach: WebMCP tools blocked"); |
| 296 | cli.info("WebMCP approach: All tools available, prefers semantic tools"); |
| 297 | |
| 298 | const screenshotResults: BenchmarkResult[] = []; |
| 299 | const webmcpResults: BenchmarkResult[] = []; |
| 300 | |
| 301 | for (let i = 0; i < NUM_RUNS; i++) { |
| 302 | cli.section(`RUN ${i + 1}/${NUM_RUNS}`); |
| 303 | |
| 304 | cli.info("Running Screenshot approach..."); |
| 305 | const screenshotResult = await runScreenshotBenchmark(); |
| 306 | screenshotResults.push(screenshotResult); |
| 307 | if (screenshotResult.success) { |
| 308 | cli.success( |
| 309 | `Completed: ${screenshotResult.inputTokens.toLocaleString()} in / ${screenshotResult.outputTokens.toLocaleString()} out, $${screenshotResult.totalCostUsd.toFixed(4)}` |
| 310 | ); |
| 311 | } else { |
| 312 | cli.error("Failed"); |
| 313 | } |
| 314 | |
| 315 | cli.info("Running WebMCP approach..."); |
| 316 | const webmcpResult = await runWebMCPBenchmark(); |
| 317 | webmcpResults.push(webmcpResult); |
| 318 | if (webmcpResult.success) { |
| 319 | cli.success( |
| 320 | `Completed: ${webmcpResult.inputTokens.toLocaleString()} in / ${webmcpResult.outputTokens.toLocaleString()} out, $${webmcpResult.totalCostUsd.toFixed(4)}` |
| 321 | ); |
| 322 | } else { |
| 323 | cli.error("Failed"); |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | const screenshotAgg = aggregateBenchmarkResults("Screenshot", screenshotResults); |
| 328 | const webmcpAgg = aggregateBenchmarkResults("WebMCP", webmcpResults); |
| 329 | |
| 330 | cli.section("SCREENSHOT APPROACH RESULTS"); |
| 331 | printAgentApproachResults(screenshotAgg); |
| 332 | |
| 333 | cli.section("WEBMCP APPROACH RESULTS"); |
| 334 | printAgentApproachResults(webmcpAgg); |
| 335 | |
| 336 | printAgentComparisonResults(screenshotAgg, webmcpAgg, "FINAL COMPARISON"); |
| 337 | printAgentCostAnalysis(screenshotAgg, webmcpAgg); |
| 338 |
no test coverage detected