@blazediff/agent 0.1.4 → 0.2.1

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/index.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ import { Page } from 'playwright';
1
2
  import { BoundingBox, InterpretResult } from '@blazediff/core-native';
2
3
 
3
4
  type VerdictLabel = "regression-likely" | "intentional-likely" | "noise-likely" | "ambiguous";
@@ -30,7 +31,7 @@ interface ManifestEntry {
30
31
  id: string;
31
32
  url: string;
32
33
  viewport: Viewport;
33
- auth: null | "required";
34
+ auth: null | string;
34
35
  waitFor: WaitFor[];
35
36
  mask: string[];
36
37
  fullPage?: boolean;
@@ -51,11 +52,16 @@ interface DevServerConfig {
51
52
  cwd?: string;
52
53
  readyTimeoutMs?: number;
53
54
  }
55
+ interface AgentAuthConfig {
56
+ harness: string;
57
+ loginUrl: string;
58
+ }
54
59
  interface AgentConfig {
55
60
  devServer: DevServerConfig | null;
56
61
  framework?: string;
57
62
  packageManager?: "npm" | "pnpm" | "yarn" | "bun";
58
63
  baseUrl?: string;
64
+ auth?: AgentAuthConfig;
59
65
  }
60
66
  interface CaptureOptions {
61
67
  id: string;
@@ -69,7 +75,7 @@ interface CaptureOptions {
69
75
  interface DiscoveredRoute {
70
76
  url: string;
71
77
  source: "next-manifest" | "sitemap" | "crawl";
72
- auth?: "required";
78
+ auth?: string;
73
79
  }
74
80
  interface CheckReport {
75
81
  createdAt: string;
@@ -100,7 +106,10 @@ interface CaptureResult {
100
106
  mode: "baseline" | "actual";
101
107
  bytes: number;
102
108
  }
103
- declare function captureScreenshot(baseUrl: string, opts: CaptureOptions, cwd?: string): Promise<CaptureResult>;
109
+ interface CaptureAuth {
110
+ hook: (page: Page) => Promise<void>;
111
+ }
112
+ declare function captureScreenshot(baseUrl: string, opts: CaptureOptions, cwd?: string, auth?: CaptureAuth): Promise<CaptureResult>;
104
113
 
105
114
  interface BrowsersInstallOptions {
106
115
  check?: boolean;
@@ -119,6 +128,7 @@ interface CaptureRouteInput {
119
128
  viewport?: Viewport;
120
129
  waitFor?: WaitFor[];
121
130
  fullPage?: boolean;
131
+ auth?: null | string;
122
132
  mode?: "baseline" | "actual";
123
133
  }
124
134
  interface RunCapturesOptions {
@@ -308,4 +318,4 @@ declare const paths: (cwd?: string) => {
308
318
  serverPid: string;
309
319
  };
310
320
 
311
- export { type AgentConfig, type ApplyJudgmentsResult, type BrowsersInstallOptions, type BrowsersInstallResult, type CaptureOptions, type CaptureRouteInput, type CaptureRouteResult, type CheckOptions, type CheckReport, type CheckResult, type DevServerConfig, type DiffOptions, type DiffOutcome, type DiscoveredRoute, type Judge, type JudgeBackend, type JudgeInput, type JudgeOutput, type JudgmentRequest, type JudgmentRequestRegion, type Manifest, type ManifestEntry, type RegionSummary, type ResumeMap, type ResumeOptions, type RunCapturesOptions, type RunCapturesReport, type RunEvent, type RunOptions, STABILITY_HOOKS_VERSION, type Verdict, type VerdictAction, type VerdictLabel, type Viewport, type WaitFor, type WaitForSelector, applyJudgments, captureScreenshot, configHash, diffEntry, discover, installBrowsers, loadConfig, loadManifest, paths, resolveBaseUrl, resolveJudge, resumeGraph, runCaptures, runCheck, runGraph, saveConfig, saveManifest, threadIdFor };
321
+ export { type AgentAuthConfig, type AgentConfig, type ApplyJudgmentsResult, type BrowsersInstallOptions, type BrowsersInstallResult, type CaptureOptions, type CaptureRouteInput, type CaptureRouteResult, type CheckOptions, type CheckReport, type CheckResult, type DevServerConfig, type DiffOptions, type DiffOutcome, type DiscoveredRoute, type Judge, type JudgeBackend, type JudgeInput, type JudgeOutput, type JudgmentRequest, type JudgmentRequestRegion, type Manifest, type ManifestEntry, type RegionSummary, type ResumeMap, type ResumeOptions, type RunCapturesOptions, type RunCapturesReport, type RunEvent, type RunOptions, STABILITY_HOOKS_VERSION, type Verdict, type VerdictAction, type VerdictLabel, type Viewport, type WaitFor, type WaitForSelector, applyJudgments, captureScreenshot, configHash, diffEntry, discover, installBrowsers, loadConfig, loadManifest, paths, resolveBaseUrl, resolveJudge, resumeGraph, runCaptures, runCheck, runGraph, saveConfig, saveManifest, threadIdFor };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { Page } from 'playwright';
1
2
  import { BoundingBox, InterpretResult } from '@blazediff/core-native';
2
3
 
3
4
  type VerdictLabel = "regression-likely" | "intentional-likely" | "noise-likely" | "ambiguous";
@@ -30,7 +31,7 @@ interface ManifestEntry {
30
31
  id: string;
31
32
  url: string;
32
33
  viewport: Viewport;
33
- auth: null | "required";
34
+ auth: null | string;
34
35
  waitFor: WaitFor[];
35
36
  mask: string[];
36
37
  fullPage?: boolean;
@@ -51,11 +52,16 @@ interface DevServerConfig {
51
52
  cwd?: string;
52
53
  readyTimeoutMs?: number;
53
54
  }
55
+ interface AgentAuthConfig {
56
+ harness: string;
57
+ loginUrl: string;
58
+ }
54
59
  interface AgentConfig {
55
60
  devServer: DevServerConfig | null;
56
61
  framework?: string;
57
62
  packageManager?: "npm" | "pnpm" | "yarn" | "bun";
58
63
  baseUrl?: string;
64
+ auth?: AgentAuthConfig;
59
65
  }
60
66
  interface CaptureOptions {
61
67
  id: string;
@@ -69,7 +75,7 @@ interface CaptureOptions {
69
75
  interface DiscoveredRoute {
70
76
  url: string;
71
77
  source: "next-manifest" | "sitemap" | "crawl";
72
- auth?: "required";
78
+ auth?: string;
73
79
  }
74
80
  interface CheckReport {
75
81
  createdAt: string;
@@ -100,7 +106,10 @@ interface CaptureResult {
100
106
  mode: "baseline" | "actual";
101
107
  bytes: number;
102
108
  }
103
- declare function captureScreenshot(baseUrl: string, opts: CaptureOptions, cwd?: string): Promise<CaptureResult>;
109
+ interface CaptureAuth {
110
+ hook: (page: Page) => Promise<void>;
111
+ }
112
+ declare function captureScreenshot(baseUrl: string, opts: CaptureOptions, cwd?: string, auth?: CaptureAuth): Promise<CaptureResult>;
104
113
 
105
114
  interface BrowsersInstallOptions {
106
115
  check?: boolean;
@@ -119,6 +128,7 @@ interface CaptureRouteInput {
119
128
  viewport?: Viewport;
120
129
  waitFor?: WaitFor[];
121
130
  fullPage?: boolean;
131
+ auth?: null | string;
122
132
  mode?: "baseline" | "actual";
123
133
  }
124
134
  interface RunCapturesOptions {
@@ -308,4 +318,4 @@ declare const paths: (cwd?: string) => {
308
318
  serverPid: string;
309
319
  };
310
320
 
311
- export { type AgentConfig, type ApplyJudgmentsResult, type BrowsersInstallOptions, type BrowsersInstallResult, type CaptureOptions, type CaptureRouteInput, type CaptureRouteResult, type CheckOptions, type CheckReport, type CheckResult, type DevServerConfig, type DiffOptions, type DiffOutcome, type DiscoveredRoute, type Judge, type JudgeBackend, type JudgeInput, type JudgeOutput, type JudgmentRequest, type JudgmentRequestRegion, type Manifest, type ManifestEntry, type RegionSummary, type ResumeMap, type ResumeOptions, type RunCapturesOptions, type RunCapturesReport, type RunEvent, type RunOptions, STABILITY_HOOKS_VERSION, type Verdict, type VerdictAction, type VerdictLabel, type Viewport, type WaitFor, type WaitForSelector, applyJudgments, captureScreenshot, configHash, diffEntry, discover, installBrowsers, loadConfig, loadManifest, paths, resolveBaseUrl, resolveJudge, resumeGraph, runCaptures, runCheck, runGraph, saveConfig, saveManifest, threadIdFor };
321
+ export { type AgentAuthConfig, type AgentConfig, type ApplyJudgmentsResult, type BrowsersInstallOptions, type BrowsersInstallResult, type CaptureOptions, type CaptureRouteInput, type CaptureRouteResult, type CheckOptions, type CheckReport, type CheckResult, type DevServerConfig, type DiffOptions, type DiffOutcome, type DiscoveredRoute, type Judge, type JudgeBackend, type JudgeInput, type JudgeOutput, type JudgmentRequest, type JudgmentRequestRegion, type Manifest, type ManifestEntry, type RegionSummary, type ResumeMap, type ResumeOptions, type RunCapturesOptions, type RunCapturesReport, type RunEvent, type RunOptions, STABILITY_HOOKS_VERSION, type Verdict, type VerdictAction, type VerdictLabel, type Viewport, type WaitFor, type WaitForSelector, applyJudgments, captureScreenshot, configHash, diffEntry, discover, installBrowsers, loadConfig, loadManifest, paths, resolveBaseUrl, resolveJudge, resumeGraph, runCaptures, runCheck, runGraph, saveConfig, saveManifest, threadIdFor };
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ var playwright = require('playwright');
7
7
  var child_process = require('child_process');
8
8
  var fs = require('fs');
9
9
  var module$1 = require('module');
10
+ var url = require('url');
10
11
  var crypto$1 = require('crypto');
11
12
  var coreNative = require('@blazediff/core-native');
12
13
  var langgraph = require('@langchain/langgraph');
@@ -104,7 +105,7 @@ async function closeBrowser() {
104
105
  function viewportKey(v) {
105
106
  return `${v.width}x${v.height}`;
106
107
  }
107
- async function createStableContext(viewport) {
108
+ async function createStableContext(viewport, baseURL) {
108
109
  const browser = await getBrowser();
109
110
  const context = await browser.newContext({
110
111
  viewport,
@@ -112,7 +113,8 @@ async function createStableContext(viewport) {
112
113
  reducedMotion: "reduce",
113
114
  forcedColors: "none",
114
115
  colorScheme: "light",
115
- bypassCSP: true
116
+ bypassCSP: true,
117
+ baseURL
116
118
  });
117
119
  await context.addInitScript(
118
120
  ({ frozenNow }) => {
@@ -154,23 +156,26 @@ async function createStableContext(viewport) {
154
156
  );
155
157
  return context;
156
158
  }
157
- async function acquireStableContext(viewport) {
159
+ async function acquireStableContext(viewport, options = {}) {
160
+ const usePool = options.pool !== false;
158
161
  const key = viewportKey(viewport);
159
- const pool = contextPool.get(key);
160
- if (pool && pool.length > 0) {
161
- const context2 = pool.pop();
162
- return { context: context2, viewport };
162
+ if (usePool) {
163
+ const pool = contextPool.get(key);
164
+ if (pool && pool.length > 0) {
165
+ const context2 = pool.pop();
166
+ return { context: context2, viewport, disposable: false };
167
+ }
163
168
  }
164
- const context = await createStableContext(viewport);
165
- return { context, viewport };
169
+ const context = await createStableContext(viewport, options.baseURL);
170
+ return { context, viewport, disposable: !usePool };
166
171
  }
167
172
  async function releaseStableContext(handle) {
168
- const key = viewportKey(handle.viewport);
169
- if (!cachedBrowser?.isConnected()) {
173
+ if (handle.disposable || !cachedBrowser?.isConnected()) {
170
174
  await handle.context.close().catch(() => {
171
175
  });
172
176
  return;
173
177
  }
178
+ const key = viewportKey(handle.viewport);
174
179
  const pool = contextPool.get(key);
175
180
  if (pool) {
176
181
  pool.push(handle.context);
@@ -229,14 +234,20 @@ async function applyMaskOverlays(page, masks) {
229
234
  }
230
235
 
231
236
  // src/browser/capture.ts
232
- async function captureScreenshot(baseUrl, opts, cwd = process.cwd()) {
237
+ async function captureScreenshot(baseUrl, opts, cwd = process.cwd(), auth) {
233
238
  const viewport = opts.viewport ?? DEFAULT_VIEWPORT;
234
239
  const waitFor = opts.waitFor ?? DEFAULT_WAIT_FOR;
235
240
  const masks = opts.mask ?? [];
236
241
  const fullPage = opts.fullPage ?? DEFAULT_FULL_PAGE;
237
- const handle = await acquireStableContext(viewport);
242
+ const handle = await acquireStableContext(viewport, {
243
+ pool: !auth,
244
+ baseURL: baseUrl || void 0
245
+ });
238
246
  const page = await openStablePage(handle);
239
247
  try {
248
+ if (auth) {
249
+ await auth.hook(page);
250
+ }
240
251
  const url = new URL(opts.url, baseUrl).toString();
241
252
  await page.goto(url, { waitUntil: "domcontentloaded", timeout: 3e4 });
242
253
  await waitForStability(page, waitFor);
@@ -309,6 +320,112 @@ async function installBrowsers(opts = {}) {
309
320
  const executablePath = await readExecutablePath();
310
321
  return { installed: Boolean(executablePath), executablePath, cliPath };
311
322
  }
323
+
324
+ // src/auth/env.ts
325
+ var LEGACY_REQUIRED = "required";
326
+ var DEFAULT_PERSONA = "default";
327
+ function canonicalPersona(auth) {
328
+ return auth === LEGACY_REQUIRED ? DEFAULT_PERSONA : auth;
329
+ }
330
+ var AuthHarnessError = class extends Error {
331
+ constructor(message, cause) {
332
+ super(message);
333
+ this.cause = cause;
334
+ this.name = "AuthHarnessError";
335
+ }
336
+ };
337
+ var moduleCache = /* @__PURE__ */ new Map();
338
+ async function loadAuthHarness(harnessFile) {
339
+ const absolute = path__default.default.isAbsolute(harnessFile) ? harnessFile : path__default.default.resolve(process.cwd(), harnessFile);
340
+ if (!fs.existsSync(absolute)) {
341
+ throw new AuthHarnessError(
342
+ `auth harness not found at ${absolute}. Run \`blazediff-agent auth init\` to create one.`
343
+ );
344
+ }
345
+ const cached = moduleCache.get(absolute);
346
+ if (cached) return cached;
347
+ const url$1 = url.pathToFileURL(absolute).href;
348
+ const loading = (async () => {
349
+ try {
350
+ const mod = await import(url$1);
351
+ if (typeof mod.login !== "function") {
352
+ throw new AuthHarnessError(
353
+ `auth harness at ${absolute} does not export a \`login\` function`
354
+ );
355
+ }
356
+ return { login: mod.login };
357
+ } catch (err) {
358
+ if (err instanceof AuthHarnessError) throw err;
359
+ throw new AuthHarnessError(
360
+ `failed to load auth harness at ${absolute}: ${err.message}`,
361
+ err
362
+ );
363
+ }
364
+ })();
365
+ moduleCache.set(absolute, loading);
366
+ return loading;
367
+ }
368
+ function loginPathOf(loginUrl) {
369
+ try {
370
+ return new URL(loginUrl, "http://placeholder").pathname;
371
+ } catch {
372
+ return loginUrl;
373
+ }
374
+ }
375
+ async function verifyPostLogin(page, loginUrl) {
376
+ const loginPath = loginPathOf(loginUrl);
377
+ let currentPath;
378
+ try {
379
+ currentPath = new URL(page.url()).pathname;
380
+ } catch {
381
+ currentPath = page.url();
382
+ }
383
+ if (loginPath && currentPath === loginPath) {
384
+ throw new AuthHarnessError(
385
+ `auth harness returned but page is still on the login URL (${currentPath}). Check that the harness submits the form and waits for redirect.`
386
+ );
387
+ }
388
+ await page.locator('input[type="password"]').first().waitFor({ state: "detached", timeout: 2e3 }).catch(() => {
389
+ });
390
+ const passwordInputs = await page.locator('input[type="password"]:visible').count().catch(() => 0);
391
+ if (passwordInputs > 0) {
392
+ throw new AuthHarnessError(
393
+ `auth harness returned but a visible password input is still on the page. The login likely did not complete (wrong credentials, captcha, or selectors out of date).`
394
+ );
395
+ }
396
+ }
397
+
398
+ // src/auth/hook.ts
399
+ var AuthConfigMissingError = class extends Error {
400
+ constructor(message) {
401
+ super(message);
402
+ this.name = "AuthConfigMissingError";
403
+ }
404
+ };
405
+ function buildAuthHook(persona, authConfig, cwd) {
406
+ if (!authConfig) {
407
+ throw new AuthConfigMissingError(
408
+ "auth required but .blazediff/config.json has no `auth` block. Run `blazediff-agent auth init`."
409
+ );
410
+ }
411
+ const harnessFile = path__default.default.isAbsolute(authConfig.harness) ? authConfig.harness : path__default.default.join(cwd, authConfig.harness);
412
+ const canonical = canonicalPersona(persona);
413
+ const loginUrl = authConfig.loginUrl;
414
+ return {
415
+ hook: async (page) => {
416
+ const mod = await loadAuthHarness(harnessFile);
417
+ try {
418
+ await mod.login(page, canonical);
419
+ } catch (err) {
420
+ throw new AuthHarnessError(
421
+ `auth harness threw for persona "${canonical}": ${err.message}`,
422
+ err
423
+ );
424
+ }
425
+ await verifyPostLogin(page, loginUrl);
426
+ }
427
+ };
428
+ }
312
429
  async function loadConfig(cwd = process.cwd()) {
313
430
  const file = paths(cwd).config;
314
431
  if (!fs.existsSync(file)) return null;
@@ -445,10 +562,9 @@ function validateRoute(route, i) {
445
562
  return `route[${i}] missing url`;
446
563
  return null;
447
564
  }
448
- async function loadOrCreateManifest(cwd) {
565
+ async function loadOrCreateManifest(cwd, config) {
449
566
  const existing = await loadManifest(cwd);
450
567
  if (existing) return existing;
451
- const config = await loadConfig(cwd);
452
568
  return emptyManifest(config ? configHash(config) : "sha256:none");
453
569
  }
454
570
  async function runCaptures(opts) {
@@ -471,7 +587,8 @@ async function runCaptures(opts) {
471
587
  valid.push(r);
472
588
  }
473
589
  });
474
- let manifest = writeManifest ? await loadOrCreateManifest(cwd) : null;
590
+ const config = await loadConfig(cwd);
591
+ let manifest = writeManifest ? await loadOrCreateManifest(cwd, config) : null;
475
592
  let manifestUpdates = 0;
476
593
  const slot = new Array(valid.length);
477
594
  const semaphore = new Semaphore(opts.concurrency ?? defaultConcurrency());
@@ -481,6 +598,7 @@ async function runCaptures(opts) {
481
598
  (r, i) => semaphore.run(async () => {
482
599
  const mode = r.mode ?? defaultMode;
483
600
  try {
601
+ const auth = r.auth != null ? buildAuthHook(r.auth, config?.auth, cwd) : void 0;
484
602
  const shot = await captureScreenshot(
485
603
  opts.baseUrl,
486
604
  {
@@ -492,7 +610,8 @@ async function runCaptures(opts) {
492
610
  fullPage: r.fullPage,
493
611
  mode
494
612
  },
495
- cwd
613
+ cwd,
614
+ auth
496
615
  );
497
616
  slot[i] = {
498
617
  id: r.id,
@@ -511,7 +630,8 @@ async function runCaptures(opts) {
511
630
  viewport: r.viewport,
512
631
  mask: r.mask,
513
632
  waitFor: r.waitFor,
514
- fullPage: r.fullPage
633
+ fullPage: r.fullPage,
634
+ auth: r.auth ?? null
515
635
  })
516
636
  );
517
637
  manifestUpdates += 1;
@@ -620,9 +740,9 @@ function extractInternalLinks(base, target, hrefs) {
620
740
  try {
621
741
  const u = new URL(href, target);
622
742
  if (u.origin !== base.origin) continue;
623
- const path18 = u.pathname + u.search;
624
- if (path18.startsWith("/api/")) continue;
625
- out.push(path18);
743
+ const path20 = u.pathname + u.search;
744
+ if (path20.startsWith("/api/")) continue;
745
+ out.push(path20);
626
746
  } catch {
627
747
  }
628
748
  }
@@ -1693,9 +1813,6 @@ function narrowRegion(r) {
1693
1813
  confidence: r.confidence
1694
1814
  };
1695
1815
  }
1696
- function skipResult(entry, message) {
1697
- return { id: entry.id, url: entry.url, status: "pass", message };
1698
- }
1699
1816
  function staleResult(entry) {
1700
1817
  return {
1701
1818
  id: entry.id,
@@ -1704,6 +1821,14 @@ function staleResult(entry) {
1704
1821
  message: "captureHash mismatch: entry was edited without re-capturing"
1705
1822
  };
1706
1823
  }
1824
+ function errorResult(entry, message) {
1825
+ return {
1826
+ id: entry.id,
1827
+ url: entry.url,
1828
+ status: "fail",
1829
+ message
1830
+ };
1831
+ }
1707
1832
  function passResult(entry, baselinePath, actualPath) {
1708
1833
  return {
1709
1834
  id: entry.id,
@@ -1739,6 +1864,14 @@ function failResult(entry, outcome, actualPath, baselinePath, verdict) {
1739
1864
  }
1740
1865
 
1741
1866
  // src/graph/nodes/capture.ts
1867
+ var legacyAuthHinted = false;
1868
+ function maybePrintLegacyHint() {
1869
+ if (legacyAuthHinted) return;
1870
+ legacyAuthHinted = true;
1871
+ process.stderr.write(
1872
+ 'blazediff: manifest entries with auth: "required" are treated as persona "default" \u2014 please migrate.\n'
1873
+ );
1874
+ }
1742
1875
  function makeCaptureNode(semaphore) {
1743
1876
  return async function captureNode(state) {
1744
1877
  const entry = state.entry;
@@ -1746,45 +1879,64 @@ function makeCaptureNode(semaphore) {
1746
1879
  if (!entry || !options) {
1747
1880
  throw new Error("captureNode: entry or options missing");
1748
1881
  }
1749
- if (entry.auth === "required") {
1750
- return {
1751
- captureOutput: {
1752
- id: entry.id,
1753
- skipResult: skipResult(
1754
- entry,
1755
- "skipped: auth required (deferred to v0.2)"
1756
- )
1757
- }
1758
- };
1759
- }
1760
1882
  if (isEntryStale(entry)) {
1761
1883
  return {
1762
1884
  captureOutput: { id: entry.id, skipResult: staleResult(entry) }
1763
1885
  };
1764
1886
  }
1887
+ let auth;
1888
+ if (entry.auth !== null) {
1889
+ if (entry.auth === LEGACY_REQUIRED) maybePrintLegacyHint();
1890
+ try {
1891
+ auth = buildAuthHook(entry.auth, options.auth, options.cwd);
1892
+ } catch (err) {
1893
+ if (err instanceof AuthConfigMissingError) {
1894
+ return {
1895
+ captureOutput: {
1896
+ id: entry.id,
1897
+ skipResult: errorResult(entry, err.message)
1898
+ }
1899
+ };
1900
+ }
1901
+ throw err;
1902
+ }
1903
+ }
1765
1904
  const baselinePath = path__default.default.join(options.baselinesDir, `${entry.id}.png`);
1766
- const capture = await semaphore.run(
1767
- () => captureScreenshot(
1768
- options.baseUrl,
1769
- {
1905
+ try {
1906
+ const capture = await semaphore.run(
1907
+ () => captureScreenshot(
1908
+ options.baseUrl,
1909
+ {
1910
+ id: entry.id,
1911
+ url: entry.url,
1912
+ viewport: entry.viewport,
1913
+ mask: entry.mask,
1914
+ waitFor: entry.waitFor,
1915
+ fullPage: entry.fullPage ?? DEFAULT_FULL_PAGE,
1916
+ mode: "actual"
1917
+ },
1918
+ options.cwd,
1919
+ auth
1920
+ )
1921
+ );
1922
+ return {
1923
+ captureOutput: {
1770
1924
  id: entry.id,
1771
- url: entry.url,
1772
- viewport: entry.viewport,
1773
- mask: entry.mask,
1774
- waitFor: entry.waitFor,
1775
- fullPage: entry.fullPage ?? DEFAULT_FULL_PAGE,
1776
- mode: "actual"
1777
- },
1778
- options.cwd
1779
- )
1780
- );
1781
- return {
1782
- captureOutput: {
1783
- id: entry.id,
1784
- captureOutputPath: capture.outputPath,
1785
- baselinePath
1925
+ captureOutputPath: capture.outputPath,
1926
+ baselinePath
1927
+ }
1928
+ };
1929
+ } catch (err) {
1930
+ if (err instanceof AuthHarnessError) {
1931
+ return {
1932
+ captureOutput: {
1933
+ id: entry.id,
1934
+ skipResult: errorResult(entry, `auth: ${err.message}`)
1935
+ }
1936
+ };
1786
1937
  }
1787
- };
1938
+ throw err;
1939
+ }
1788
1940
  };
1789
1941
  }
1790
1942
 
@@ -2223,6 +2375,7 @@ async function runGraph(opts) {
2223
2375
  if (!opts.resume) {
2224
2376
  await checkpointer.deleteThread(threadId);
2225
2377
  }
2378
+ const config = await loadConfig(cwd);
2226
2379
  const input = opts.resume ? new langgraph.Command({ resume: opts.resume }) : {
2227
2380
  options: {
2228
2381
  baseUrl: opts.baseUrl ?? "",
@@ -2231,7 +2384,8 @@ async function runGraph(opts) {
2231
2384
  concurrency,
2232
2385
  emitDiffPng: opts.emitDiffPng ?? true,
2233
2386
  judge: opts.judge ?? "none",
2234
- baselinesDir
2387
+ baselinesDir,
2388
+ auth: config?.auth
2235
2389
  }
2236
2390
  };
2237
2391
  let collect;