@blazediff/agent 0.0.1 → 0.1.0

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
@@ -127,6 +127,7 @@ interface RunCapturesOptions {
127
127
  mode?: "baseline" | "actual";
128
128
  writeManifest?: boolean;
129
129
  cwd?: string;
130
+ concurrency?: number;
130
131
  }
131
132
  interface CaptureRouteResult {
132
133
  id: string;
@@ -146,6 +147,37 @@ interface RunCapturesReport {
146
147
  }
147
148
  declare function runCaptures(opts: RunCapturesOptions): Promise<RunCapturesReport>;
148
149
 
150
+ declare function loadConfig(cwd?: string): Promise<AgentConfig | null>;
151
+ declare function saveConfig(config: AgentConfig, cwd?: string): Promise<void>;
152
+ declare function configHash(config: AgentConfig): string;
153
+ declare function resolveBaseUrl(config: AgentConfig | null, override?: string): string;
154
+
155
+ interface DiffOptions {
156
+ threshold?: number;
157
+ antialiasing?: boolean;
158
+ emitDiffPng?: boolean;
159
+ }
160
+ interface DiffOutcome {
161
+ id: string;
162
+ baselinePath: string;
163
+ actualPath: string;
164
+ diffPath?: string;
165
+ match: boolean;
166
+ reason?: "pixel-diff" | "layout-diff" | "file-not-exists";
167
+ diffCount?: number;
168
+ diffPercentage?: number;
169
+ interpretation?: InterpretResult;
170
+ }
171
+ declare function diffEntry(id: string, baselinePath: string, actualPath: string, opts?: DiffOptions, cwd?: string): Promise<DiffOutcome>;
172
+
173
+ interface DiscoverOptions {
174
+ baseUrl: string;
175
+ cwd?: string;
176
+ maxRoutes?: number;
177
+ skipCrawl?: boolean;
178
+ }
179
+ declare function discover(opts: DiscoverOptions): Promise<DiscoveredRoute[]>;
180
+
149
181
  interface JudgeInput {
150
182
  entry: ManifestEntry;
151
183
  baselinePath: string;
@@ -178,7 +210,12 @@ interface ApplyJudgmentsResult {
178
210
  missing: string[];
179
211
  invalid: string[];
180
212
  }
181
- declare function applyJudgments(cwd?: string): Promise<ApplyJudgmentsResult>;
213
+ interface ApplyJudgmentsOptions {
214
+ cwd?: string;
215
+ onEvent?: (event: RunEvent) => void;
216
+ junitPath?: string;
217
+ }
218
+ declare function applyJudgments(opts?: ApplyJudgmentsOptions | string): Promise<ApplyJudgmentsResult>;
182
219
 
183
220
  interface JudgmentRequest {
184
221
  id: string;
@@ -209,58 +246,50 @@ interface JudgmentRequest {
209
246
 
210
247
  declare function resolveJudge(backend: JudgeBackend): Judge;
211
248
 
212
- interface CheckOptions {
213
- baseUrl: string;
214
- cwd?: string;
215
- threshold?: number;
216
- concurrency?: number;
217
- emitDiffPng?: boolean;
218
- junitPath?: string;
219
- judge?: JudgeBackend;
220
- }
221
- declare function runCheck(opts: CheckOptions): Promise<CheckReport>;
222
-
223
- declare function loadConfig(cwd?: string): Promise<AgentConfig | null>;
224
- declare function saveConfig(config: AgentConfig, cwd?: string): Promise<void>;
225
- declare function configHash(config: AgentConfig): string;
226
- declare function resolveBaseUrl(config: AgentConfig | null, override?: string): string;
227
-
228
- interface DiffOptions {
229
- threshold?: number;
230
- antialiasing?: boolean;
231
- emitDiffPng?: boolean;
232
- }
233
- interface DiffOutcome {
234
- id: string;
235
- baselinePath: string;
236
- actualPath: string;
237
- diffPath?: string;
238
- match: boolean;
239
- reason?: "pixel-diff" | "layout-diff" | "file-not-exists";
240
- diffCount?: number;
241
- diffPercentage?: number;
242
- interpretation?: InterpretResult;
243
- }
244
- declare function diffEntry(id: string, baselinePath: string, actualPath: string, opts?: DiffOptions, cwd?: string): Promise<DiffOutcome>;
245
-
246
- interface DiscoverOptions {
247
- baseUrl: string;
248
- cwd?: string;
249
- maxRoutes?: number;
250
- skipCrawl?: boolean;
249
+ interface JudgmentInterrupt {
250
+ kind: "host-judgment-required";
251
+ entryId: string;
252
+ url: string;
253
+ requestPath: string;
254
+ signature: string;
255
+ pendingResult: CheckResult;
251
256
  }
252
- declare function discover(opts: DiscoverOptions): Promise<DiscoveredRoute[]>;
253
257
 
258
+ type ResumeMap = Record<string, Verdict>;
259
+ type RunEvent = {
260
+ type: "result";
261
+ result: CheckResult;
262
+ } | {
263
+ type: "interrupt";
264
+ interrupt: JudgmentInterrupt;
265
+ } | {
266
+ type: "report";
267
+ report: CheckReport;
268
+ };
254
269
  interface RunOptions {
255
- baseUrl: string;
270
+ baseUrl?: string;
256
271
  cwd?: string;
257
272
  threshold?: number;
258
273
  concurrency?: number;
259
274
  emitDiffPng?: boolean;
260
275
  junitPath?: string;
261
276
  judge?: JudgeBackend;
277
+ threadId?: string;
278
+ onEvent?: (event: RunEvent) => void;
279
+ resume?: ResumeMap;
262
280
  }
281
+ type CheckOptions = RunOptions;
282
+ declare function threadIdFor(cwd: string): string;
263
283
  declare function runGraph(opts: RunOptions): Promise<CheckReport>;
284
+ interface ResumeOptions {
285
+ cwd?: string;
286
+ verdicts: ResumeMap;
287
+ threadId?: string;
288
+ onEvent?: (event: RunEvent) => void;
289
+ junitPath?: string;
290
+ }
291
+ declare function resumeGraph(opts: ResumeOptions): Promise<CheckReport>;
292
+ declare function runCheck(opts: CheckOptions): Promise<CheckReport>;
264
293
 
265
294
  declare function loadManifest(cwd?: string): Promise<Manifest | null>;
266
295
  declare function saveManifest(manifest: Manifest, cwd?: string): Promise<void>;
@@ -272,10 +301,11 @@ declare const paths: (cwd?: string) => {
272
301
  baselines: string;
273
302
  actual: string;
274
303
  judgments: string;
304
+ checkpoints: string;
275
305
  summary: string;
276
306
  gitignore: string;
277
307
  serverLog: string;
278
308
  serverPid: string;
279
309
  };
280
310
 
281
- export { type AgentConfig, type ApplyJudgmentsResult, type BrowsersInstallOptions, type BrowsersInstallResult, type CaptureOptions, type CaptureRouteInput, type CaptureRouteResult, 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 RunCapturesOptions, type RunCapturesReport, 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, runCaptures, runCheck, runGraph, saveConfig, saveManifest };
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 };
package/dist/index.d.ts CHANGED
@@ -127,6 +127,7 @@ interface RunCapturesOptions {
127
127
  mode?: "baseline" | "actual";
128
128
  writeManifest?: boolean;
129
129
  cwd?: string;
130
+ concurrency?: number;
130
131
  }
131
132
  interface CaptureRouteResult {
132
133
  id: string;
@@ -146,6 +147,37 @@ interface RunCapturesReport {
146
147
  }
147
148
  declare function runCaptures(opts: RunCapturesOptions): Promise<RunCapturesReport>;
148
149
 
150
+ declare function loadConfig(cwd?: string): Promise<AgentConfig | null>;
151
+ declare function saveConfig(config: AgentConfig, cwd?: string): Promise<void>;
152
+ declare function configHash(config: AgentConfig): string;
153
+ declare function resolveBaseUrl(config: AgentConfig | null, override?: string): string;
154
+
155
+ interface DiffOptions {
156
+ threshold?: number;
157
+ antialiasing?: boolean;
158
+ emitDiffPng?: boolean;
159
+ }
160
+ interface DiffOutcome {
161
+ id: string;
162
+ baselinePath: string;
163
+ actualPath: string;
164
+ diffPath?: string;
165
+ match: boolean;
166
+ reason?: "pixel-diff" | "layout-diff" | "file-not-exists";
167
+ diffCount?: number;
168
+ diffPercentage?: number;
169
+ interpretation?: InterpretResult;
170
+ }
171
+ declare function diffEntry(id: string, baselinePath: string, actualPath: string, opts?: DiffOptions, cwd?: string): Promise<DiffOutcome>;
172
+
173
+ interface DiscoverOptions {
174
+ baseUrl: string;
175
+ cwd?: string;
176
+ maxRoutes?: number;
177
+ skipCrawl?: boolean;
178
+ }
179
+ declare function discover(opts: DiscoverOptions): Promise<DiscoveredRoute[]>;
180
+
149
181
  interface JudgeInput {
150
182
  entry: ManifestEntry;
151
183
  baselinePath: string;
@@ -178,7 +210,12 @@ interface ApplyJudgmentsResult {
178
210
  missing: string[];
179
211
  invalid: string[];
180
212
  }
181
- declare function applyJudgments(cwd?: string): Promise<ApplyJudgmentsResult>;
213
+ interface ApplyJudgmentsOptions {
214
+ cwd?: string;
215
+ onEvent?: (event: RunEvent) => void;
216
+ junitPath?: string;
217
+ }
218
+ declare function applyJudgments(opts?: ApplyJudgmentsOptions | string): Promise<ApplyJudgmentsResult>;
182
219
 
183
220
  interface JudgmentRequest {
184
221
  id: string;
@@ -209,58 +246,50 @@ interface JudgmentRequest {
209
246
 
210
247
  declare function resolveJudge(backend: JudgeBackend): Judge;
211
248
 
212
- interface CheckOptions {
213
- baseUrl: string;
214
- cwd?: string;
215
- threshold?: number;
216
- concurrency?: number;
217
- emitDiffPng?: boolean;
218
- junitPath?: string;
219
- judge?: JudgeBackend;
220
- }
221
- declare function runCheck(opts: CheckOptions): Promise<CheckReport>;
222
-
223
- declare function loadConfig(cwd?: string): Promise<AgentConfig | null>;
224
- declare function saveConfig(config: AgentConfig, cwd?: string): Promise<void>;
225
- declare function configHash(config: AgentConfig): string;
226
- declare function resolveBaseUrl(config: AgentConfig | null, override?: string): string;
227
-
228
- interface DiffOptions {
229
- threshold?: number;
230
- antialiasing?: boolean;
231
- emitDiffPng?: boolean;
232
- }
233
- interface DiffOutcome {
234
- id: string;
235
- baselinePath: string;
236
- actualPath: string;
237
- diffPath?: string;
238
- match: boolean;
239
- reason?: "pixel-diff" | "layout-diff" | "file-not-exists";
240
- diffCount?: number;
241
- diffPercentage?: number;
242
- interpretation?: InterpretResult;
243
- }
244
- declare function diffEntry(id: string, baselinePath: string, actualPath: string, opts?: DiffOptions, cwd?: string): Promise<DiffOutcome>;
245
-
246
- interface DiscoverOptions {
247
- baseUrl: string;
248
- cwd?: string;
249
- maxRoutes?: number;
250
- skipCrawl?: boolean;
249
+ interface JudgmentInterrupt {
250
+ kind: "host-judgment-required";
251
+ entryId: string;
252
+ url: string;
253
+ requestPath: string;
254
+ signature: string;
255
+ pendingResult: CheckResult;
251
256
  }
252
- declare function discover(opts: DiscoverOptions): Promise<DiscoveredRoute[]>;
253
257
 
258
+ type ResumeMap = Record<string, Verdict>;
259
+ type RunEvent = {
260
+ type: "result";
261
+ result: CheckResult;
262
+ } | {
263
+ type: "interrupt";
264
+ interrupt: JudgmentInterrupt;
265
+ } | {
266
+ type: "report";
267
+ report: CheckReport;
268
+ };
254
269
  interface RunOptions {
255
- baseUrl: string;
270
+ baseUrl?: string;
256
271
  cwd?: string;
257
272
  threshold?: number;
258
273
  concurrency?: number;
259
274
  emitDiffPng?: boolean;
260
275
  junitPath?: string;
261
276
  judge?: JudgeBackend;
277
+ threadId?: string;
278
+ onEvent?: (event: RunEvent) => void;
279
+ resume?: ResumeMap;
262
280
  }
281
+ type CheckOptions = RunOptions;
282
+ declare function threadIdFor(cwd: string): string;
263
283
  declare function runGraph(opts: RunOptions): Promise<CheckReport>;
284
+ interface ResumeOptions {
285
+ cwd?: string;
286
+ verdicts: ResumeMap;
287
+ threadId?: string;
288
+ onEvent?: (event: RunEvent) => void;
289
+ junitPath?: string;
290
+ }
291
+ declare function resumeGraph(opts: ResumeOptions): Promise<CheckReport>;
292
+ declare function runCheck(opts: CheckOptions): Promise<CheckReport>;
264
293
 
265
294
  declare function loadManifest(cwd?: string): Promise<Manifest | null>;
266
295
  declare function saveManifest(manifest: Manifest, cwd?: string): Promise<void>;
@@ -272,10 +301,11 @@ declare const paths: (cwd?: string) => {
272
301
  baselines: string;
273
302
  actual: string;
274
303
  judgments: string;
304
+ checkpoints: string;
275
305
  summary: string;
276
306
  gitignore: string;
277
307
  serverLog: string;
278
308
  serverPid: string;
279
309
  };
280
310
 
281
- export { type AgentConfig, type ApplyJudgmentsResult, type BrowsersInstallOptions, type BrowsersInstallResult, type CaptureOptions, type CaptureRouteInput, type CaptureRouteResult, 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 RunCapturesOptions, type RunCapturesReport, 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, runCaptures, runCheck, runGraph, saveConfig, saveManifest };
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 };