browser-pilot 0.0.16 → 0.0.17

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.cts CHANGED
@@ -1,9 +1,9 @@
1
- export { BatchExecutor, ValidationError, ValidationResult, addBatchToPage, validateSteps } from './actions.cjs';
2
- import { R as RequestPattern, a as RequestHandler, C as CaptureResult } from './types-BflRmiDz.cjs';
3
- export { l as ActionOptions, m as ActionResult, A as ActionType, e as AudioChunk, f as AudioInput, g as AudioInputState, h as AudioOutput, B as BatchOptions, b as BatchResult, i as CaptureOptions, a7 as ClearCookiesOptions, n as ConsoleHandler, o as ConsoleMessage, p as ConsoleMessageType, a0 as ContinueRequestOptions, a8 as Cookie, q as CustomSelectConfig, a9 as DeleteCookieOptions, Z as DeviceDescriptor, _ as DeviceName, D as Dialog, r as DialogHandler, s as DialogType, t as Download, E as ElementInfo, u as ElementNotFoundError, v as EmulationState, w as ErrorHandler, a1 as FailRequestOptions, F as FileInput, x as FillOptions, y as FormField, z as FormOption, a2 as FulfillRequestOptions, G as GeolocationOptions, I as InteractiveElement, a3 as InterceptedRequest, N as NavigationError, H as NetworkIdleOptions, J as Page, K as PageError, L as PageSnapshot, P as PlayOptions, c as RecordOptions, a4 as RequestActions, a5 as ResourceType, j as RoundTripOptions, k as RoundTripResult, a6 as RouteOptions, aa as SetCookieOptions, M as SnapshotNode, O as SnapshotOptions, S as Step, d as StepResult, Q as SubmitOptions, T as TimeoutError, U as TypeOptions, V as UserAgentMetadata, W as UserAgentOptions, X as ViewportOptions, Y as WaitForOptions, ab as WaitOptions, ac as WaitResult, ad as WaitState, $ as devices, ae as waitForAnyElement, af as waitForElement, ag as waitForNavigation, ah as waitForNetworkIdle } from './types-BflRmiDz.cjs';
1
+ export { BatchExecutor, CombinatorResult, NetworkResponseTracker, ValidationError, ValidationResult, addBatchToPage, captureStateSignature, conditionAll, conditionAny, conditionNot, conditionRace, evaluateCondition, evaluateOutcome, validateSteps } from './actions.cjs';
2
+ import { R as RequestPattern, a as RequestHandler, C as CaptureResult, B as BatchResult } from './types-Yuybzq53.cjs';
3
+ export { m as ActionOptions, n as ActionResult, A as ActionType, f as AudioChunk, g as AudioInput, h as AudioInputState, i as AudioOutput, b as BatchOptions, j as CaptureOptions, ak as ClearCookiesOptions, c as Condition, o as ConsoleHandler, p as ConsoleMessage, q as ConsoleMessageType, ad as ContinueRequestOptions, al as Cookie, r as CustomSelectConfig, am as DeleteCookieOptions, D as DeltaChange, t as DeltaResult, aa as DeviceDescriptor, ab as DeviceName, u as Dialog, v as DialogHandler, w as DialogType, x as Download, E as ElementInfo, y as ElementNotFoundError, z as EmulationState, F as ErrorHandler, ae as FailRequestOptions, I as FileInput, J as FillOptions, K as FormField, L as FormOption, af as FulfillRequestOptions, N as GeolocationOptions, Q as InteractiveElement, ag as InterceptedRequest, T as KeyValuePair, M as MatchedCondition, U as NavigationError, V as NetworkIdleOptions, O as OutcomeStatus, W as Page, X as PageError, Y as PageSnapshot, Z as PageState, P as PlayOptions, d as RecordOptions, ah as RequestActions, ai as ResourceType, _ as ReviewResult, k as RoundTripOptions, l as RoundTripResult, aj as RouteOptions, an as SetCookieOptions, $ as SnapshotNode, a0 as SnapshotOptions, S as Step, e as StepResult, a1 as SubmitOptions, a2 as SummaryCard, a3 as TableData, a4 as TimeoutError, a5 as TypeOptions, a6 as UserAgentMetadata, a7 as UserAgentOptions, a8 as ViewportOptions, a9 as WaitForOptions, ao as WaitOptions, ap as WaitResult, aq as WaitState, s as computeDelta, ac as devices, G as extractPageState, H as extractReview, ar as waitForAnyElement, as as waitForElement, at as waitForNavigation, au as waitForNetworkIdle } from './types-Yuybzq53.cjs';
4
4
  import { C as CDPClient } from './client-B5QBRgIy.cjs';
5
5
  export { a as CDPClientOptions, c as createCDPClient } from './client-B5QBRgIy.cjs';
6
- export { Browser, BrowserOptions, PageOptions, connect } from './browser.cjs';
6
+ export { Browser, BrowserOptions, ComboboxConfig, ComboboxResult, OverlayInfo, PageOptions, PinRecoveryResult, SemanticFingerprint, SubmitAndVerifyOptions, SubmitAndVerifyResult, TargetFingerprint, UploadConfig, UploadResult, buildFingerprintMap, chooseOption, connect, createFingerprint, createTargetFingerprint, detectOverlay, fingerprintKey, fingerprintSimilarity, recoverPinnedTarget, recoverStaleRef, submitAndVerify, uploadFiles } from './browser.cjs';
7
7
  export { CDPError } from './cdp.cjs';
8
8
  export { BrowserBaseProvider, BrowserlessProvider, GenericProvider, createProvider, discoverTargets, getBrowserWebSocketUrl } from './providers.cjs';
9
9
  export { B as BrowserEndpointResolutionError, d as ChromeChannel, b as ConnectOptions, C as CreateSessionOptions, P as Provider, a as ProviderSession, R as ResolvedBrowserEndpoint, g as ResolvedBrowserSource, c as buildLocalBrowserScanTargets, f as discoverLocalBrowsers, p as parseDevToolsActivePortFile, r as resolveBrowserEndpoint, h as resolveChromeUserDataDirs } from './types-DeVSWhXj.cjs';
@@ -290,4 +290,55 @@ declare function enableTracing(options?: Partial<Omit<TracerOptions, 'enabled'>>
290
290
  */
291
291
  declare function disableTracing(): void;
292
292
 
293
- export { type AudioFlagOptions, CDPClient, CaptureResult, RequestHandler, RequestInterceptor, RequestPattern, type TraceCategory, type TraceEvent, type TraceLevel, Tracer, type TracerOptions, type TranscribeOptions, type TranscribeResult, bufferToBase64, calculateRMS, disableTracing, enableTracing, generateSilence, generateTone, getAudioChromeFlags, getTracer, grantAudioPermissions, isTranscriptionAvailable, parseWavHeader, pcmToWav, transcribe };
293
+ /**
294
+ * Workflow summary — business-readable execution evidence
295
+ */
296
+
297
+ interface WorkflowStepSummary {
298
+ /** Step number (1-based) */
299
+ step: number;
300
+ /** Human-readable description */
301
+ description: string;
302
+ /** Whether this step succeeded */
303
+ success: boolean;
304
+ /** Duration in ms */
305
+ durationMs: number;
306
+ /** Outcome status if conditions were evaluated */
307
+ outcomeStatus?: string;
308
+ /** Summary of matched conditions */
309
+ outcomeEvidence?: string[];
310
+ /** Whether safe to retry */
311
+ retrySafe?: boolean;
312
+ /** Error if failed */
313
+ error?: string;
314
+ /** Suggestion for next action */
315
+ suggestion?: string;
316
+ }
317
+ interface WorkflowSummary {
318
+ /** Whether the entire workflow succeeded */
319
+ success: boolean;
320
+ /** Total steps */
321
+ totalSteps: number;
322
+ /** Steps that succeeded */
323
+ succeededSteps: number;
324
+ /** Steps that failed */
325
+ failedSteps: number;
326
+ /** Total duration */
327
+ totalDurationMs: number;
328
+ /** Per-step summaries */
329
+ steps: WorkflowStepSummary[];
330
+ /** Overall verdict */
331
+ verdict: string;
332
+ /** Retry safety of the entire workflow */
333
+ workflowRetrySafe: boolean;
334
+ }
335
+ /**
336
+ * Build a workflow summary from a batch result
337
+ */
338
+ declare function buildWorkflowSummary(result: BatchResult): WorkflowSummary;
339
+ /**
340
+ * Format a workflow summary as a compact text report
341
+ */
342
+ declare function formatWorkflowSummary(summary: WorkflowSummary): string;
343
+
344
+ export { type AudioFlagOptions, BatchResult, CDPClient, CaptureResult, RequestHandler, RequestInterceptor, RequestPattern, type TraceCategory, type TraceEvent, type TraceLevel, Tracer, type TracerOptions, type TranscribeOptions, type TranscribeResult, type WorkflowStepSummary, type WorkflowSummary, bufferToBase64, buildWorkflowSummary, calculateRMS, disableTracing, enableTracing, formatWorkflowSummary, generateSilence, generateTone, getAudioChromeFlags, getTracer, grantAudioPermissions, isTranscriptionAvailable, parseWavHeader, pcmToWav, transcribe };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export { BatchExecutor, ValidationError, ValidationResult, addBatchToPage, validateSteps } from './actions.js';
2
- import { R as RequestPattern, a as RequestHandler, C as CaptureResult } from './types-BzM-IfsL.js';
3
- export { l as ActionOptions, m as ActionResult, A as ActionType, e as AudioChunk, f as AudioInput, g as AudioInputState, h as AudioOutput, B as BatchOptions, b as BatchResult, i as CaptureOptions, a7 as ClearCookiesOptions, n as ConsoleHandler, o as ConsoleMessage, p as ConsoleMessageType, a0 as ContinueRequestOptions, a8 as Cookie, q as CustomSelectConfig, a9 as DeleteCookieOptions, Z as DeviceDescriptor, _ as DeviceName, D as Dialog, r as DialogHandler, s as DialogType, t as Download, E as ElementInfo, u as ElementNotFoundError, v as EmulationState, w as ErrorHandler, a1 as FailRequestOptions, F as FileInput, x as FillOptions, y as FormField, z as FormOption, a2 as FulfillRequestOptions, G as GeolocationOptions, I as InteractiveElement, a3 as InterceptedRequest, N as NavigationError, H as NetworkIdleOptions, J as Page, K as PageError, L as PageSnapshot, P as PlayOptions, c as RecordOptions, a4 as RequestActions, a5 as ResourceType, j as RoundTripOptions, k as RoundTripResult, a6 as RouteOptions, aa as SetCookieOptions, M as SnapshotNode, O as SnapshotOptions, S as Step, d as StepResult, Q as SubmitOptions, T as TimeoutError, U as TypeOptions, V as UserAgentMetadata, W as UserAgentOptions, X as ViewportOptions, Y as WaitForOptions, ab as WaitOptions, ac as WaitResult, ad as WaitState, $ as devices, ae as waitForAnyElement, af as waitForElement, ag as waitForNavigation, ah as waitForNetworkIdle } from './types-BzM-IfsL.js';
1
+ export { BatchExecutor, CombinatorResult, NetworkResponseTracker, ValidationError, ValidationResult, addBatchToPage, captureStateSignature, conditionAll, conditionAny, conditionNot, conditionRace, evaluateCondition, evaluateOutcome, validateSteps } from './actions.js';
2
+ import { R as RequestPattern, a as RequestHandler, C as CaptureResult, B as BatchResult } from './types-B_v62K7C.js';
3
+ export { m as ActionOptions, n as ActionResult, A as ActionType, f as AudioChunk, g as AudioInput, h as AudioInputState, i as AudioOutput, b as BatchOptions, j as CaptureOptions, ak as ClearCookiesOptions, c as Condition, o as ConsoleHandler, p as ConsoleMessage, q as ConsoleMessageType, ad as ContinueRequestOptions, al as Cookie, r as CustomSelectConfig, am as DeleteCookieOptions, D as DeltaChange, t as DeltaResult, aa as DeviceDescriptor, ab as DeviceName, u as Dialog, v as DialogHandler, w as DialogType, x as Download, E as ElementInfo, y as ElementNotFoundError, z as EmulationState, F as ErrorHandler, ae as FailRequestOptions, I as FileInput, J as FillOptions, K as FormField, L as FormOption, af as FulfillRequestOptions, N as GeolocationOptions, Q as InteractiveElement, ag as InterceptedRequest, T as KeyValuePair, M as MatchedCondition, U as NavigationError, V as NetworkIdleOptions, O as OutcomeStatus, W as Page, X as PageError, Y as PageSnapshot, Z as PageState, P as PlayOptions, d as RecordOptions, ah as RequestActions, ai as ResourceType, _ as ReviewResult, k as RoundTripOptions, l as RoundTripResult, aj as RouteOptions, an as SetCookieOptions, $ as SnapshotNode, a0 as SnapshotOptions, S as Step, e as StepResult, a1 as SubmitOptions, a2 as SummaryCard, a3 as TableData, a4 as TimeoutError, a5 as TypeOptions, a6 as UserAgentMetadata, a7 as UserAgentOptions, a8 as ViewportOptions, a9 as WaitForOptions, ao as WaitOptions, ap as WaitResult, aq as WaitState, s as computeDelta, ac as devices, G as extractPageState, H as extractReview, ar as waitForAnyElement, as as waitForElement, at as waitForNavigation, au as waitForNetworkIdle } from './types-B_v62K7C.js';
4
4
  import { C as CDPClient } from './client-B5QBRgIy.js';
5
5
  export { a as CDPClientOptions, c as createCDPClient } from './client-B5QBRgIy.js';
6
- export { Browser, BrowserOptions, PageOptions, connect } from './browser.js';
6
+ export { Browser, BrowserOptions, ComboboxConfig, ComboboxResult, OverlayInfo, PageOptions, PinRecoveryResult, SemanticFingerprint, SubmitAndVerifyOptions, SubmitAndVerifyResult, TargetFingerprint, UploadConfig, UploadResult, buildFingerprintMap, chooseOption, connect, createFingerprint, createTargetFingerprint, detectOverlay, fingerprintKey, fingerprintSimilarity, recoverPinnedTarget, recoverStaleRef, submitAndVerify, uploadFiles } from './browser.js';
7
7
  export { CDPError } from './cdp.js';
8
8
  export { BrowserBaseProvider, BrowserlessProvider, GenericProvider, createProvider, discoverTargets, getBrowserWebSocketUrl } from './providers.js';
9
9
  export { B as BrowserEndpointResolutionError, d as ChromeChannel, b as ConnectOptions, C as CreateSessionOptions, P as Provider, a as ProviderSession, R as ResolvedBrowserEndpoint, g as ResolvedBrowserSource, c as buildLocalBrowserScanTargets, f as discoverLocalBrowsers, p as parseDevToolsActivePortFile, r as resolveBrowserEndpoint, h as resolveChromeUserDataDirs } from './types-DeVSWhXj.js';
@@ -290,4 +290,55 @@ declare function enableTracing(options?: Partial<Omit<TracerOptions, 'enabled'>>
290
290
  */
291
291
  declare function disableTracing(): void;
292
292
 
293
- export { type AudioFlagOptions, CDPClient, CaptureResult, RequestHandler, RequestInterceptor, RequestPattern, type TraceCategory, type TraceEvent, type TraceLevel, Tracer, type TracerOptions, type TranscribeOptions, type TranscribeResult, bufferToBase64, calculateRMS, disableTracing, enableTracing, generateSilence, generateTone, getAudioChromeFlags, getTracer, grantAudioPermissions, isTranscriptionAvailable, parseWavHeader, pcmToWav, transcribe };
293
+ /**
294
+ * Workflow summary — business-readable execution evidence
295
+ */
296
+
297
+ interface WorkflowStepSummary {
298
+ /** Step number (1-based) */
299
+ step: number;
300
+ /** Human-readable description */
301
+ description: string;
302
+ /** Whether this step succeeded */
303
+ success: boolean;
304
+ /** Duration in ms */
305
+ durationMs: number;
306
+ /** Outcome status if conditions were evaluated */
307
+ outcomeStatus?: string;
308
+ /** Summary of matched conditions */
309
+ outcomeEvidence?: string[];
310
+ /** Whether safe to retry */
311
+ retrySafe?: boolean;
312
+ /** Error if failed */
313
+ error?: string;
314
+ /** Suggestion for next action */
315
+ suggestion?: string;
316
+ }
317
+ interface WorkflowSummary {
318
+ /** Whether the entire workflow succeeded */
319
+ success: boolean;
320
+ /** Total steps */
321
+ totalSteps: number;
322
+ /** Steps that succeeded */
323
+ succeededSteps: number;
324
+ /** Steps that failed */
325
+ failedSteps: number;
326
+ /** Total duration */
327
+ totalDurationMs: number;
328
+ /** Per-step summaries */
329
+ steps: WorkflowStepSummary[];
330
+ /** Overall verdict */
331
+ verdict: string;
332
+ /** Retry safety of the entire workflow */
333
+ workflowRetrySafe: boolean;
334
+ }
335
+ /**
336
+ * Build a workflow summary from a batch result
337
+ */
338
+ declare function buildWorkflowSummary(result: BatchResult): WorkflowSummary;
339
+ /**
340
+ * Format a workflow summary as a compact text report
341
+ */
342
+ declare function formatWorkflowSummary(summary: WorkflowSummary): string;
343
+
344
+ export { type AudioFlagOptions, BatchResult, CDPClient, CaptureResult, RequestHandler, RequestInterceptor, RequestPattern, type TraceCategory, type TraceEvent, type TraceLevel, Tracer, type TracerOptions, type TranscribeOptions, type TranscribeResult, type WorkflowStepSummary, type WorkflowSummary, bufferToBase64, buildWorkflowSummary, calculateRMS, disableTracing, enableTracing, formatWorkflowSummary, generateSilence, generateTone, getAudioChromeFlags, getTracer, grantAudioPermissions, isTranscriptionAvailable, parseWavHeader, pcmToWav, transcribe };
package/dist/index.mjs CHANGED
@@ -5,18 +5,30 @@ import {
5
5
  Page,
6
6
  RequestInterceptor,
7
7
  bufferToBase64,
8
+ buildFingerprintMap,
8
9
  calculateRMS,
10
+ computeDelta,
9
11
  connect,
12
+ createFingerprint,
13
+ createTargetFingerprint,
14
+ detectOverlay,
15
+ extractPageState,
16
+ extractReview,
17
+ fingerprintKey,
18
+ fingerprintSimilarity,
10
19
  generateSilence,
11
20
  generateTone,
12
21
  grantAudioPermissions,
13
22
  parseWavHeader,
14
23
  pcmToWav,
24
+ recoverPinnedTarget,
25
+ recoverStaleRef,
26
+ submitAndVerify,
15
27
  waitForAnyElement,
16
28
  waitForElement,
17
29
  waitForNavigation,
18
30
  waitForNetworkIdle
19
- } from "./chunk-NNEHWWHL.mjs";
31
+ } from "./chunk-FEEGNSHB.mjs";
20
32
  import {
21
33
  BrowserBaseProvider,
22
34
  BrowserEndpointResolutionError,
@@ -38,13 +50,27 @@ import {
38
50
  BatchExecutor,
39
51
  ElementNotFoundError,
40
52
  NavigationError,
53
+ NetworkResponseTracker,
41
54
  TimeoutError,
42
55
  addBatchToPage,
56
+ captureStateSignature,
57
+ conditionAll,
58
+ conditionAny,
59
+ conditionNot,
60
+ conditionRace,
61
+ evaluateCondition,
62
+ evaluateOutcome,
43
63
  validateSteps
44
- } from "./chunk-V3VLBQAM.mjs";
64
+ } from "./chunk-ZDODXEBD.mjs";
45
65
  import {
46
66
  CDPError
47
67
  } from "./chunk-JXAUPHZM.mjs";
68
+ import {
69
+ chooseOption
70
+ } from "./chunk-MIJ7UIKB.mjs";
71
+ import {
72
+ uploadFiles
73
+ } from "./chunk-OIHU7OFY.mjs";
48
74
 
49
75
  // src/audio/flags.ts
50
76
  function getAudioChromeFlags(options) {
@@ -376,6 +402,143 @@ function disableTracing() {
376
402
  globalTracer.disable();
377
403
  }
378
404
  }
405
+
406
+ // src/trace/workflow-summary.ts
407
+ function describeStep(result) {
408
+ const action = result.action;
409
+ const selector = result.selectorUsed ?? (Array.isArray(result.selector) ? result.selector[0] : result.selector);
410
+ switch (action) {
411
+ case "goto":
412
+ return "Navigate to page";
413
+ case "click":
414
+ return `Click ${selector ? `"${selector}"` : "element"}`;
415
+ case "fill":
416
+ return `Fill ${selector ? `"${selector}"` : "field"}`;
417
+ case "type":
418
+ return `Type into ${selector ? `"${selector}"` : "field"}`;
419
+ case "select":
420
+ return `Select option in ${selector ? `"${selector}"` : "dropdown"}`;
421
+ case "submit":
422
+ return `Submit ${selector ? `"${selector}"` : "form"}`;
423
+ case "check":
424
+ return `Check ${selector ? `"${selector}"` : "checkbox"}`;
425
+ case "uncheck":
426
+ return `Uncheck ${selector ? `"${selector}"` : "checkbox"}`;
427
+ case "press":
428
+ return "Press key";
429
+ case "shortcut":
430
+ return "Keyboard shortcut";
431
+ case "hover":
432
+ return `Hover over ${selector ? `"${selector}"` : "element"}`;
433
+ case "scroll":
434
+ return `Scroll ${selector ? `"${selector}"` : "page"}`;
435
+ case "wait":
436
+ return `Wait for ${selector ? `"${selector}"` : "condition"}`;
437
+ case "snapshot":
438
+ return "Capture accessibility snapshot";
439
+ case "screenshot":
440
+ return "Take screenshot";
441
+ case "forms":
442
+ return "Enumerate form fields";
443
+ case "evaluate":
444
+ return "Execute JavaScript";
445
+ case "text":
446
+ return "Extract text content";
447
+ case "review":
448
+ return "Extract page review";
449
+ case "delta":
450
+ return "Capture page delta";
451
+ default:
452
+ return `${action}${selector ? ` "${selector}"` : ""}`;
453
+ }
454
+ }
455
+ function summarizeConditions(conditions) {
456
+ return conditions.filter((c) => c.detail).map((c) => {
457
+ const status = c.matched ? "\u2713" : "\u2717";
458
+ return `${status} ${c.detail}`;
459
+ });
460
+ }
461
+ function buildWorkflowSummary(result) {
462
+ const steps = result.steps.map((s) => {
463
+ const step = {
464
+ step: s.index + 1,
465
+ description: describeStep(s),
466
+ success: s.success,
467
+ durationMs: s.durationMs
468
+ };
469
+ if (s.outcomeStatus) {
470
+ step.outcomeStatus = s.outcomeStatus;
471
+ step.retrySafe = s.retrySafe;
472
+ }
473
+ if (s.matchedConditions && s.matchedConditions.length > 0) {
474
+ step.outcomeEvidence = summarizeConditions(s.matchedConditions);
475
+ }
476
+ if (s.error) step.error = s.error;
477
+ if (s.suggestion) step.suggestion = s.suggestion;
478
+ return step;
479
+ });
480
+ const succeededSteps = steps.filter((s) => s.success).length;
481
+ const failedSteps = steps.filter((s) => !s.success).length;
482
+ const hasUnsafeStep = steps.some(
483
+ (s) => s.retrySafe === false || s.outcomeStatus === "unsafe_to_retry"
484
+ );
485
+ const workflowRetrySafe = !hasUnsafeStep;
486
+ let verdict;
487
+ if (result.success) {
488
+ verdict = `Workflow completed successfully (${succeededSteps}/${steps.length} steps)`;
489
+ } else if (result.stoppedAtIndex !== void 0) {
490
+ const failedStep = steps[result.stoppedAtIndex];
491
+ verdict = `Workflow stopped at step ${result.stoppedAtIndex + 1}: ${failedStep?.description ?? "unknown"}`;
492
+ if (failedStep?.outcomeStatus) {
493
+ verdict += ` (outcome: ${failedStep.outcomeStatus})`;
494
+ }
495
+ } else {
496
+ verdict = `Workflow completed with ${failedSteps} failure(s)`;
497
+ }
498
+ return {
499
+ success: result.success,
500
+ totalSteps: steps.length,
501
+ succeededSteps,
502
+ failedSteps,
503
+ totalDurationMs: result.totalDurationMs,
504
+ steps,
505
+ verdict,
506
+ workflowRetrySafe
507
+ };
508
+ }
509
+ function formatWorkflowSummary(summary) {
510
+ const lines = [];
511
+ lines.push(`## Workflow ${summary.success ? "Succeeded" : "Failed"}`);
512
+ lines.push(`${summary.verdict}`);
513
+ lines.push(
514
+ `Duration: ${summary.totalDurationMs}ms | Steps: ${summary.succeededSteps}/${summary.totalSteps} passed`
515
+ );
516
+ if (!summary.workflowRetrySafe) {
517
+ lines.push("\u26A0 Contains unsafe-to-retry steps");
518
+ }
519
+ lines.push("");
520
+ for (const step of summary.steps) {
521
+ const icon = step.success ? "\u2713" : "\u2717";
522
+ lines.push(`${icon} Step ${step.step}: ${step.description} (${step.durationMs}ms)`);
523
+ if (step.outcomeStatus) {
524
+ lines.push(
525
+ ` Outcome: ${step.outcomeStatus}${step.retrySafe === false ? " (unsafe to retry)" : ""}`
526
+ );
527
+ }
528
+ if (step.outcomeEvidence) {
529
+ for (const evidence of step.outcomeEvidence) {
530
+ lines.push(` ${evidence}`);
531
+ }
532
+ }
533
+ if (step.error) {
534
+ lines.push(` Error: ${step.error}`);
535
+ }
536
+ if (step.suggestion) {
537
+ lines.push(` \u2192 ${step.suggestion}`);
538
+ }
539
+ }
540
+ return lines.join("\n");
541
+ }
379
542
  export {
380
543
  AudioInput,
381
544
  AudioOutput,
@@ -388,22 +551,42 @@ export {
388
551
  ElementNotFoundError,
389
552
  GenericProvider,
390
553
  NavigationError,
554
+ NetworkResponseTracker,
391
555
  Page,
392
556
  RequestInterceptor,
393
557
  TimeoutError,
394
558
  Tracer,
395
559
  addBatchToPage,
396
560
  bufferToBase64,
561
+ buildFingerprintMap,
397
562
  buildLocalBrowserScanTargets,
563
+ buildWorkflowSummary,
398
564
  calculateRMS,
565
+ captureStateSignature,
566
+ chooseOption,
567
+ computeDelta,
568
+ conditionAll,
569
+ conditionAny,
570
+ conditionNot,
571
+ conditionRace,
399
572
  connect,
400
573
  createCDPClient,
574
+ createFingerprint,
401
575
  createProvider,
576
+ createTargetFingerprint,
577
+ detectOverlay,
402
578
  devices,
403
579
  disableTracing,
404
580
  discoverLocalBrowsers,
405
581
  discoverTargets,
406
582
  enableTracing,
583
+ evaluateCondition,
584
+ evaluateOutcome,
585
+ extractPageState,
586
+ extractReview,
587
+ fingerprintKey,
588
+ fingerprintSimilarity,
589
+ formatWorkflowSummary,
407
590
  generateSilence,
408
591
  generateTone,
409
592
  getAudioChromeFlags,
@@ -414,9 +597,13 @@ export {
414
597
  parseDevToolsActivePortFile,
415
598
  parseWavHeader,
416
599
  pcmToWav,
600
+ recoverPinnedTarget,
601
+ recoverStaleRef,
417
602
  resolveBrowserEndpoint,
418
603
  resolveChromeUserDataDirs,
604
+ submitAndVerify,
419
605
  transcribe,
606
+ uploadFiles,
420
607
  validateSteps,
421
608
  waitForAnyElement,
422
609
  waitForElement,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Page
3
- } from "./chunk-6GBYX7C2.mjs";
3
+ } from "./chunk-MRY3HRFJ.mjs";
4
4
  import "./chunk-DTVRFXKI.mjs";
5
5
  export {
6
6
  Page
@@ -718,6 +718,88 @@ interface ClearCookiesOptions {
718
718
  domain?: string;
719
719
  }
720
720
 
721
+ /**
722
+ * Delta extraction — compares page state before/after actions
723
+ */
724
+
725
+ interface PageState {
726
+ url: string;
727
+ title: string;
728
+ headings: string[];
729
+ formFields: Array<{
730
+ label?: string;
731
+ name?: string;
732
+ id?: string;
733
+ value: unknown;
734
+ type: string;
735
+ }>;
736
+ buttons: Array<{
737
+ text: string;
738
+ disabled: boolean;
739
+ ref?: string;
740
+ }>;
741
+ alerts: string[];
742
+ visibleText: string;
743
+ }
744
+ interface DeltaChange {
745
+ kind: 'url' | 'title' | 'heading_added' | 'heading_removed' | 'field_changed' | 'button_changed' | 'alert_added' | 'alert_removed' | 'text_changed';
746
+ before?: string;
747
+ after?: string;
748
+ detail?: string;
749
+ }
750
+ interface DeltaResult {
751
+ changes: DeltaChange[];
752
+ before: PageState;
753
+ after: PageState;
754
+ hasChanges: boolean;
755
+ }
756
+ /**
757
+ * Extract a lightweight page state from snapshot + forms data.
758
+ * Used for delta comparison.
759
+ */
760
+ declare function extractPageState(url: string, title: string, snapshot: PageSnapshot, forms: FormField[], pageText: string): PageState;
761
+ /**
762
+ * Compute delta between two page states
763
+ */
764
+ declare function computeDelta(before: PageState, after: PageState): DeltaResult;
765
+
766
+ /**
767
+ * Review surface extraction — structured business state from current page
768
+ */
769
+
770
+ interface KeyValuePair {
771
+ key: string;
772
+ value: string;
773
+ }
774
+ interface SummaryCard {
775
+ heading?: string;
776
+ items: KeyValuePair[];
777
+ }
778
+ interface TableData {
779
+ headers: string[];
780
+ rows: string[][];
781
+ }
782
+ interface ReviewResult {
783
+ url: string;
784
+ title: string;
785
+ headings: string[];
786
+ forms: Array<{
787
+ label?: string;
788
+ value: unknown;
789
+ type: string;
790
+ disabled: boolean;
791
+ }>;
792
+ alerts: string[];
793
+ summaryCards: SummaryCard[];
794
+ tables: TableData[];
795
+ keyValues: KeyValuePair[];
796
+ statusLabels: string[];
797
+ }
798
+ /**
799
+ * Extract review surface from page state
800
+ */
801
+ declare function extractReview(url: string, title: string, snapshot: PageSnapshot, forms: FormField[], pageText: string): ReviewResult;
802
+
721
803
  /**
722
804
  * Page class - provides high-level browser automation API
723
805
  */
@@ -970,6 +1052,22 @@ declare class Page {
970
1052
  * Import a ref map previously captured from a snapshot.
971
1053
  */
972
1054
  importRefMap(refMap: Record<string, number>): void;
1055
+ /**
1056
+ * Capture current page state for delta comparison.
1057
+ * Call before an action, then call delta() again after and use computeDelta().
1058
+ */
1059
+ captureState(): Promise<PageState>;
1060
+ /**
1061
+ * Compute what changed between two page states.
1062
+ * If no arguments: captures current state and returns it (for use as "before").
1063
+ * If one argument (before state): captures current state and computes delta.
1064
+ */
1065
+ delta(before?: PageState): Promise<DeltaResult | PageState>;
1066
+ /**
1067
+ * Extract structured review surface from the current page.
1068
+ * Returns headings, form values, alerts, key-value pairs, tables, and status labels.
1069
+ */
1070
+ review(): Promise<ReviewResult>;
973
1071
  /**
974
1072
  * Execute a batch of steps
975
1073
  */
@@ -1247,7 +1345,37 @@ declare class Page {
1247
1345
  */
1248
1346
 
1249
1347
  type FailureReason = 'missing' | 'hidden' | 'covered' | 'disabled' | 'readonly' | 'detached' | 'replaced' | 'notEditable' | 'timeout' | 'navigation' | 'cdpError' | 'unknown';
1250
- type ActionType = 'goto' | 'click' | 'fill' | 'type' | 'select' | 'check' | 'uncheck' | 'submit' | 'press' | 'shortcut' | 'focus' | 'hover' | 'scroll' | 'wait' | 'snapshot' | 'forms' | 'screenshot' | 'evaluate' | 'text' | 'newTab' | 'closeTab' | 'switchFrame' | 'switchToMain' | 'assertVisible' | 'assertExists' | 'assertText' | 'assertUrl' | 'assertValue' | 'waitForWsMessage' | 'assertNoConsoleErrors' | 'assertTextChanged' | 'assertPermission' | 'assertMediaTrackLive';
1348
+ type OutcomeStatus = 'success' | 'failed' | 'ambiguous' | 'unsafe_to_retry';
1349
+ type Condition = {
1350
+ kind: 'urlMatches';
1351
+ pattern: string;
1352
+ } | {
1353
+ kind: 'elementVisible';
1354
+ selector: string | string[];
1355
+ } | {
1356
+ kind: 'elementHidden';
1357
+ selector: string | string[];
1358
+ } | {
1359
+ kind: 'textAppears';
1360
+ selector?: string | string[];
1361
+ text: string;
1362
+ } | {
1363
+ kind: 'textChanges';
1364
+ selector?: string | string[];
1365
+ to?: string;
1366
+ } | {
1367
+ kind: 'networkResponse';
1368
+ urlPattern: string;
1369
+ status?: number;
1370
+ } | {
1371
+ kind: 'stateSignatureChanges';
1372
+ };
1373
+ interface MatchedCondition {
1374
+ condition: Condition;
1375
+ matched: boolean;
1376
+ detail?: string;
1377
+ }
1378
+ type ActionType = 'goto' | 'click' | 'fill' | 'type' | 'select' | 'check' | 'uncheck' | 'submit' | 'press' | 'shortcut' | 'focus' | 'hover' | 'scroll' | 'wait' | 'snapshot' | 'forms' | 'screenshot' | 'evaluate' | 'text' | 'newTab' | 'closeTab' | 'switchFrame' | 'switchToMain' | 'assertVisible' | 'assertExists' | 'assertText' | 'assertUrl' | 'assertValue' | 'waitForWsMessage' | 'assertNoConsoleErrors' | 'assertTextChanged' | 'assertPermission' | 'assertMediaTrackLive' | 'delta' | 'review' | 'chooseOption' | 'upload';
1251
1379
  interface Step {
1252
1380
  /** Action type */
1253
1381
  action: ActionType;
@@ -1314,8 +1442,18 @@ interface Step {
1314
1442
  state?: string;
1315
1443
  /** Media track kind */
1316
1444
  kind?: 'audio' | 'video';
1445
+ /** File paths for upload action */
1446
+ files?: string[];
1317
1447
  /** Assertion observation window in milliseconds */
1318
1448
  windowMs?: number;
1449
+ /** Conditions where ANY matching means success */
1450
+ expectAny?: Condition[];
1451
+ /** Conditions where ALL must match for success */
1452
+ expectAll?: Condition[];
1453
+ /** Conditions that indicate failure (checked before success conditions) */
1454
+ failIf?: Condition[];
1455
+ /** Mark step as dangerous - never auto-retry after ambiguous outcome */
1456
+ dangerous?: boolean;
1319
1457
  }
1320
1458
  interface RecordOptions {
1321
1459
  /** Base directory for screenshots and recording.json. */
@@ -1391,6 +1529,12 @@ interface StepResult {
1391
1529
  };
1392
1530
  /** Path to screenshot file captured after this step (when recording enabled) */
1393
1531
  screenshotPath?: string;
1532
+ /** Outcome classification when conditions were specified */
1533
+ outcomeStatus?: OutcomeStatus;
1534
+ /** Which conditions matched during evaluation */
1535
+ matchedConditions?: MatchedCondition[];
1536
+ /** Whether it's safe to retry this step */
1537
+ retrySafe?: boolean;
1394
1538
  }
1395
1539
  interface BatchResult {
1396
1540
  /** Whether all steps succeeded */
@@ -1405,4 +1549,4 @@ interface BatchResult {
1405
1549
  recordingManifest?: string;
1406
1550
  }
1407
1551
 
1408
- export { devices as $, type ActionType as A, type BatchOptions as B, type CaptureResult as C, type Dialog as D, type ElementInfo as E, type FileInput as F, type GeolocationOptions as G, type NetworkIdleOptions as H, type InteractiveElement as I, Page as J, type PageError as K, type PageSnapshot as L, type SnapshotNode as M, NavigationError as N, type SnapshotOptions as O, type PlayOptions as P, type SubmitOptions as Q, type RequestPattern as R, type Step as S, TimeoutError as T, type TypeOptions as U, type UserAgentMetadata as V, type UserAgentOptions as W, type ViewportOptions as X, type WaitForOptions as Y, type DeviceDescriptor as Z, type DeviceName as _, type RequestHandler as a, type ContinueRequestOptions as a0, type FailRequestOptions as a1, type FulfillRequestOptions as a2, type InterceptedRequest as a3, type RequestActions as a4, type ResourceType as a5, type RouteOptions as a6, type ClearCookiesOptions as a7, type Cookie as a8, type DeleteCookieOptions as a9, type SetCookieOptions as aa, type WaitOptions as ab, type WaitResult as ac, type WaitState as ad, waitForAnyElement as ae, waitForElement as af, waitForNavigation as ag, waitForNetworkIdle as ah, type FailureHint as ai, type FailureReason as aj, type BatchResult as b, type RecordOptions as c, type StepResult as d, type AudioChunk as e, AudioInput as f, type AudioInputState as g, AudioOutput as h, type CaptureOptions as i, type RoundTripOptions as j, type RoundTripResult as k, type ActionOptions as l, type ActionResult as m, type ConsoleHandler as n, type ConsoleMessage as o, type ConsoleMessageType as p, type CustomSelectConfig as q, type DialogHandler as r, type DialogType as s, type Download as t, ElementNotFoundError as u, type EmulationState as v, type ErrorHandler as w, type FillOptions as x, type FormField as y, type FormOption as z };
1552
+ export { type SnapshotNode as $, type ActionType as A, type BatchResult as B, type CaptureResult as C, type DeltaChange as D, type ElementInfo as E, type ErrorHandler as F, extractPageState as G, extractReview as H, type FileInput as I, type FillOptions as J, type FormField as K, type FormOption as L, type MatchedCondition as M, type GeolocationOptions as N, type OutcomeStatus as O, type PlayOptions as P, type InteractiveElement as Q, type RequestPattern as R, type Step as S, type KeyValuePair as T, NavigationError as U, type NetworkIdleOptions as V, Page as W, type PageError as X, type PageSnapshot as Y, type PageState as Z, type ReviewResult as _, type RequestHandler as a, type SnapshotOptions as a0, type SubmitOptions as a1, type SummaryCard as a2, type TableData as a3, TimeoutError as a4, type TypeOptions as a5, type UserAgentMetadata as a6, type UserAgentOptions as a7, type ViewportOptions as a8, type WaitForOptions as a9, type DeviceDescriptor as aa, type DeviceName as ab, devices as ac, type ContinueRequestOptions as ad, type FailRequestOptions as ae, type FulfillRequestOptions as af, type InterceptedRequest as ag, type RequestActions as ah, type ResourceType as ai, type RouteOptions as aj, type ClearCookiesOptions as ak, type Cookie as al, type DeleteCookieOptions as am, type SetCookieOptions as an, type WaitOptions as ao, type WaitResult as ap, type WaitState as aq, waitForAnyElement as ar, waitForElement as as, waitForNavigation as at, waitForNetworkIdle as au, type FailureHint as av, type FailureReason as aw, type BatchOptions as b, type Condition as c, type RecordOptions as d, type StepResult as e, type AudioChunk as f, AudioInput as g, type AudioInputState as h, AudioOutput as i, type CaptureOptions as j, type RoundTripOptions as k, type RoundTripResult as l, type ActionOptions as m, type ActionResult as n, type ConsoleHandler as o, type ConsoleMessage as p, type ConsoleMessageType as q, type CustomSelectConfig as r, computeDelta as s, type DeltaResult as t, type Dialog as u, type DialogHandler as v, type DialogType as w, type Download as x, ElementNotFoundError as y, type EmulationState as z };