browser-pilot 0.0.11 → 0.0.12

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,6 +1,6 @@
1
1
  export { BatchExecutor, ValidationError, ValidationResult, addBatchToPage, validateSteps } from './actions.cjs';
2
- import { R as RequestPattern, a as RequestHandler, C as CaptureResult } from './types-GWuQJs_e.cjs';
3
- export { k as ActionOptions, l as ActionResult, A as ActionType, d as AudioChunk, e as AudioInput, f as AudioInputState, g as AudioOutput, B as BatchOptions, b as BatchResult, h as CaptureOptions, a3 as ClearCookiesOptions, m as ConsoleHandler, n as ConsoleMessage, o as ConsoleMessageType, Y as ContinueRequestOptions, a4 as Cookie, p as CustomSelectConfig, a5 as DeleteCookieOptions, O as DeviceDescriptor, Q as DeviceName, D as Dialog, q as DialogHandler, r as DialogType, s as Download, E as ElementInfo, t as ElementNotFoundError, u as EmulationState, v as ErrorHandler, Z as FailRequestOptions, F as FileInput, w as FillOptions, _ as FulfillRequestOptions, G as GeolocationOptions, I as InteractiveElement, $ as InterceptedRequest, N as NavigationError, x as NetworkIdleOptions, y as Page, z as PageError, H as PageSnapshot, P as PlayOptions, a0 as RequestActions, a1 as ResourceType, i as RoundTripOptions, j as RoundTripResult, a2 as RouteOptions, a6 as SetCookieOptions, J as SnapshotNode, S as Step, c as StepResult, K as SubmitOptions, T as TimeoutError, L as TypeOptions, U as UserAgentMetadata, M as UserAgentOptions, V as ViewportOptions, W as WaitForOptions, a7 as WaitOptions, a8 as WaitResult, a9 as WaitState, X as devices, aa as waitForAnyElement, ab as waitForElement, ac as waitForNavigation, ad as waitForNetworkIdle } from './types-GWuQJs_e.cjs';
2
+ import { R as RequestPattern, a as RequestHandler, C as CaptureResult } from './types-BOPu0OQZ.cjs';
3
+ export { k as ActionOptions, l as ActionResult, A as ActionType, d as AudioChunk, e as AudioInput, f as AudioInputState, g as AudioOutput, B as BatchOptions, b as BatchResult, h as CaptureOptions, a3 as ClearCookiesOptions, m as ConsoleHandler, n as ConsoleMessage, o as ConsoleMessageType, Y as ContinueRequestOptions, a4 as Cookie, p as CustomSelectConfig, a5 as DeleteCookieOptions, O as DeviceDescriptor, Q as DeviceName, D as Dialog, q as DialogHandler, r as DialogType, s as Download, E as ElementInfo, t as ElementNotFoundError, u as EmulationState, v as ErrorHandler, Z as FailRequestOptions, F as FileInput, w as FillOptions, _ as FulfillRequestOptions, G as GeolocationOptions, I as InteractiveElement, $ as InterceptedRequest, N as NavigationError, x as NetworkIdleOptions, y as Page, z as PageError, H as PageSnapshot, P as PlayOptions, a0 as RequestActions, a1 as ResourceType, i as RoundTripOptions, j as RoundTripResult, a2 as RouteOptions, a6 as SetCookieOptions, J as SnapshotNode, S as Step, c as StepResult, K as SubmitOptions, T as TimeoutError, L as TypeOptions, U as UserAgentMetadata, M as UserAgentOptions, V as ViewportOptions, W as WaitForOptions, a7 as WaitOptions, a8 as WaitResult, a9 as WaitState, X as devices, aa as waitForAnyElement, ab as waitForElement, ac as waitForNavigation, ad as waitForNetworkIdle } from './types-BOPu0OQZ.cjs';
4
4
  import { C as CDPClient } from './client-7Nqka5MV.cjs';
5
5
  export { a as CDPClientOptions, c as createCDPClient } from './client-7Nqka5MV.cjs';
6
6
  export { Browser, BrowserOptions, PageOptions, connect } from './browser.cjs';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { BatchExecutor, ValidationError, ValidationResult, addBatchToPage, validateSteps } from './actions.js';
2
- import { R as RequestPattern, a as RequestHandler, C as CaptureResult } from './types-DtGF3yGl.js';
3
- export { k as ActionOptions, l as ActionResult, A as ActionType, d as AudioChunk, e as AudioInput, f as AudioInputState, g as AudioOutput, B as BatchOptions, b as BatchResult, h as CaptureOptions, a3 as ClearCookiesOptions, m as ConsoleHandler, n as ConsoleMessage, o as ConsoleMessageType, Y as ContinueRequestOptions, a4 as Cookie, p as CustomSelectConfig, a5 as DeleteCookieOptions, O as DeviceDescriptor, Q as DeviceName, D as Dialog, q as DialogHandler, r as DialogType, s as Download, E as ElementInfo, t as ElementNotFoundError, u as EmulationState, v as ErrorHandler, Z as FailRequestOptions, F as FileInput, w as FillOptions, _ as FulfillRequestOptions, G as GeolocationOptions, I as InteractiveElement, $ as InterceptedRequest, N as NavigationError, x as NetworkIdleOptions, y as Page, z as PageError, H as PageSnapshot, P as PlayOptions, a0 as RequestActions, a1 as ResourceType, i as RoundTripOptions, j as RoundTripResult, a2 as RouteOptions, a6 as SetCookieOptions, J as SnapshotNode, S as Step, c as StepResult, K as SubmitOptions, T as TimeoutError, L as TypeOptions, U as UserAgentMetadata, M as UserAgentOptions, V as ViewportOptions, W as WaitForOptions, a7 as WaitOptions, a8 as WaitResult, a9 as WaitState, X as devices, aa as waitForAnyElement, ab as waitForElement, ac as waitForNavigation, ad as waitForNetworkIdle } from './types-DtGF3yGl.js';
2
+ import { R as RequestPattern, a as RequestHandler, C as CaptureResult } from './types-j23Iqo2L.js';
3
+ export { k as ActionOptions, l as ActionResult, A as ActionType, d as AudioChunk, e as AudioInput, f as AudioInputState, g as AudioOutput, B as BatchOptions, b as BatchResult, h as CaptureOptions, a3 as ClearCookiesOptions, m as ConsoleHandler, n as ConsoleMessage, o as ConsoleMessageType, Y as ContinueRequestOptions, a4 as Cookie, p as CustomSelectConfig, a5 as DeleteCookieOptions, O as DeviceDescriptor, Q as DeviceName, D as Dialog, q as DialogHandler, r as DialogType, s as Download, E as ElementInfo, t as ElementNotFoundError, u as EmulationState, v as ErrorHandler, Z as FailRequestOptions, F as FileInput, w as FillOptions, _ as FulfillRequestOptions, G as GeolocationOptions, I as InteractiveElement, $ as InterceptedRequest, N as NavigationError, x as NetworkIdleOptions, y as Page, z as PageError, H as PageSnapshot, P as PlayOptions, a0 as RequestActions, a1 as ResourceType, i as RoundTripOptions, j as RoundTripResult, a2 as RouteOptions, a6 as SetCookieOptions, J as SnapshotNode, S as Step, c as StepResult, K as SubmitOptions, T as TimeoutError, L as TypeOptions, U as UserAgentMetadata, M as UserAgentOptions, V as ViewportOptions, W as WaitForOptions, a7 as WaitOptions, a8 as WaitResult, a9 as WaitState, X as devices, aa as waitForAnyElement, ab as waitForElement, ac as waitForNavigation, ad as waitForNetworkIdle } from './types-j23Iqo2L.js';
4
4
  import { C as CDPClient } from './client-7Nqka5MV.js';
5
5
  export { a as CDPClientOptions, c as createCDPClient } from './client-7Nqka5MV.js';
6
6
  export { Browser, BrowserOptions, PageOptions, connect } from './browser.js';
package/dist/index.mjs CHANGED
@@ -16,11 +16,10 @@ import {
16
16
  waitForElement,
17
17
  waitForNavigation,
18
18
  waitForNetworkIdle
19
- } from "./chunk-JHAF52FA.mjs";
19
+ } from "./chunk-RUWAXHDX.mjs";
20
20
  import {
21
- CDPError,
22
21
  createCDPClient
23
- } from "./chunk-BCOZUKWS.mjs";
22
+ } from "./chunk-4MBSALQL.mjs";
24
23
  import {
25
24
  BrowserBaseProvider,
26
25
  BrowserlessProvider,
@@ -36,7 +35,10 @@ import {
36
35
  TimeoutError,
37
36
  addBatchToPage,
38
37
  validateSteps
39
- } from "./chunk-FAUNIZR7.mjs";
38
+ } from "./chunk-NLIARNEE.mjs";
39
+ import {
40
+ CDPError
41
+ } from "./chunk-JXAUPHZM.mjs";
40
42
 
41
43
  // src/audio/flags.ts
42
44
  function getAudioChromeFlags(options) {
@@ -224,7 +224,9 @@ interface WaitResult {
224
224
  waitedMs: number;
225
225
  }
226
226
  /**
227
- * Wait for an element to reach a specific state
227
+ * Wait for an element to reach a specific state.
228
+ * Uses fast-fail: if the element is not found on a static page (no DOM mutations),
229
+ * returns early instead of polling for the full timeout.
228
230
  */
229
231
  declare function waitForElement(cdp: CDPClient, selector: string, options?: WaitOptions): Promise<WaitResult>;
230
232
  /**
@@ -278,6 +280,8 @@ interface FillOptions extends ActionOptions {
278
280
  interface TypeOptions extends ActionOptions {
279
281
  /** Delay between keystrokes in ms */
280
282
  delay?: number;
283
+ /** Blur the element after typing */
284
+ blur?: boolean;
281
285
  }
282
286
  interface SubmitOptions extends ActionOptions {
283
287
  /** How to submit: 'enter' | 'click' | 'enter+click' */
@@ -705,6 +709,8 @@ declare class Page {
705
709
  private frameExecutionContexts;
706
710
  /** Current frame's execution context ID (null = main frame default) */
707
711
  private currentFrameContextId;
712
+ /** Frame selector if context acquisition failed (cross-origin/sandboxed) */
713
+ private brokenFrame;
708
714
  /** Last matched selector from findElement (for selectorUsed tracking) */
709
715
  private _lastMatchedSelector;
710
716
  /** Last snapshot for stale ref recovery */
@@ -809,9 +815,15 @@ declare class Page {
809
815
  */
810
816
  submit(selector: string | string[], options?: SubmitOptions): Promise<boolean>;
811
817
  /**
812
- * Press a key
818
+ * Press a key, optionally with modifier keys held down
819
+ */
820
+ press(key: string, options?: {
821
+ modifiers?: Array<'Control' | 'Shift' | 'Alt' | 'Meta'>;
822
+ }): Promise<void>;
823
+ /**
824
+ * Execute a keyboard shortcut (e.g. "Control+a", "Meta+Shift+z")
813
825
  */
814
- press(key: string): Promise<void>;
826
+ shortcut(combo: string): Promise<void>;
815
827
  /**
816
828
  * Focus an element
817
829
  */
@@ -1095,9 +1107,13 @@ declare class Page {
1095
1107
  */
1096
1108
  private evaluateInFrame;
1097
1109
  /**
1098
- * Scroll an element into view
1110
+ * Scroll an element into view, with fallback to center-scroll if clipped by fixed headers
1099
1111
  */
1100
1112
  private scrollIntoView;
1113
+ /**
1114
+ * Check if element is within the visible viewport
1115
+ */
1116
+ private isInViewport;
1101
1117
  /**
1102
1118
  * Get element box model (position and dimensions)
1103
1119
  */
@@ -1115,6 +1131,7 @@ declare class Page {
1115
1131
  private resolveObjectId;
1116
1132
  private dispatchKeyDefinition;
1117
1133
  private dispatchKey;
1134
+ private dispatchKeyWithModifiers;
1118
1135
  /**
1119
1136
  * Audio input controller (fake microphone).
1120
1137
  * Lazy-initialized on first access.
@@ -1150,13 +1167,22 @@ declare class Page {
1150
1167
  * ```
1151
1168
  */
1152
1169
  audioRoundTrip(options: RoundTripOptions): Promise<RoundTripResult>;
1170
+ /**
1171
+ * Wait for a DOM mutation in the current frame (used for detecting client-side form handling)
1172
+ */
1173
+ private waitForDOMMutation;
1174
+ /**
1175
+ * Wait for a frame execution context via Runtime.executionContextCreated event
1176
+ */
1177
+ private waitForFrameContext;
1153
1178
  }
1154
1179
 
1155
1180
  /**
1156
1181
  * Action/Step types for batch execution
1157
1182
  */
1158
1183
 
1159
- type ActionType = 'goto' | 'click' | 'fill' | 'type' | 'select' | 'check' | 'uncheck' | 'submit' | 'press' | 'focus' | 'hover' | 'scroll' | 'wait' | 'snapshot' | 'screenshot' | 'evaluate' | 'text' | 'switchFrame' | 'switchToMain';
1184
+ type FailureReason = 'missing' | 'hidden' | 'covered' | 'disabled' | 'readonly' | 'detached' | 'replaced' | 'notEditable' | 'timeout' | 'navigation' | 'cdpError' | 'unknown';
1185
+ type ActionType = 'goto' | 'click' | 'fill' | 'type' | 'select' | 'check' | 'uncheck' | 'submit' | 'press' | 'shortcut' | 'focus' | 'hover' | 'scroll' | 'wait' | 'snapshot' | 'screenshot' | 'evaluate' | 'text' | 'switchFrame' | 'switchToMain' | 'assertVisible' | 'assertExists' | 'assertText' | 'assertUrl' | 'assertValue';
1160
1186
  interface Step {
1161
1187
  /** Action type */
1162
1188
  action: ActionType;
@@ -1168,6 +1194,10 @@ interface Step {
1168
1194
  value?: string | string[];
1169
1195
  /** Key for press action */
1170
1196
  key?: string;
1197
+ /** Key combo for shortcut action (e.g. "Control+a", "Meta+Shift+z") */
1198
+ combo?: string;
1199
+ /** Modifier keys for press action */
1200
+ modifiers?: Array<'Control' | 'Shift' | 'Alt' | 'Meta'>;
1171
1201
  /** What to wait for (wait action) */
1172
1202
  waitFor?: 'visible' | 'hidden' | 'attached' | 'detached' | 'navigation' | 'networkIdle';
1173
1203
  /** Step-specific timeout override (ms) */
@@ -1199,6 +1229,12 @@ interface Step {
1199
1229
  format?: 'png' | 'jpeg' | 'webp';
1200
1230
  quality?: number;
1201
1231
  fullPage?: boolean;
1232
+ /** Expected value for assertion steps (substring match for assertText, exact for assertValue/assertUrl) */
1233
+ expect?: string;
1234
+ /** Retry count for assertion or action steps (default: 0 = no retry) */
1235
+ retry?: number;
1236
+ /** Delay between retries in ms (default: 500) */
1237
+ retryDelay?: number;
1202
1238
  }
1203
1239
  interface BatchOptions {
1204
1240
  /** Default timeout for all steps (ms) */
@@ -1232,6 +1268,16 @@ interface StepResult {
1232
1268
  text?: string;
1233
1269
  /** Failure hints when element not found */
1234
1270
  hints?: FailureHint[];
1271
+ /** Structured failure classification */
1272
+ failureReason?: FailureReason;
1273
+ /** Element covering the target (when failureReason is 'covered') */
1274
+ coveringElement?: {
1275
+ tag: string;
1276
+ id?: string;
1277
+ className?: string;
1278
+ };
1279
+ /** AI-friendly suggestion for what to try next */
1280
+ suggestion?: string;
1235
1281
  }
1236
1282
  interface BatchResult {
1237
1283
  /** Whether all steps succeeded */
@@ -1244,4 +1290,4 @@ interface BatchResult {
1244
1290
  totalDurationMs: number;
1245
1291
  }
1246
1292
 
1247
- export { type InterceptedRequest 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 PageSnapshot as H, type InteractiveElement as I, type SnapshotNode as J, type SubmitOptions as K, type TypeOptions as L, type UserAgentOptions as M, NavigationError as N, type DeviceDescriptor as O, type PlayOptions as P, type DeviceName as Q, type RequestPattern as R, type Step as S, TimeoutError as T, type UserAgentMetadata as U, type ViewportOptions as V, type WaitForOptions as W, devices as X, type ContinueRequestOptions as Y, type FailRequestOptions as Z, type FulfillRequestOptions as _, type RequestHandler as a, type RequestActions as a0, type ResourceType as a1, type RouteOptions as a2, type ClearCookiesOptions as a3, type Cookie as a4, type DeleteCookieOptions as a5, type SetCookieOptions as a6, type WaitOptions as a7, type WaitResult as a8, type WaitState as a9, waitForAnyElement as aa, waitForElement as ab, waitForNavigation as ac, waitForNetworkIdle as ad, type FailureHint as ae, type BatchResult as b, type StepResult as c, type AudioChunk as d, AudioInput as e, type AudioInputState as f, AudioOutput as g, type CaptureOptions as h, type RoundTripOptions as i, type RoundTripResult as j, type ActionOptions as k, type ActionResult as l, type ConsoleHandler as m, type ConsoleMessage as n, type ConsoleMessageType as o, type CustomSelectConfig as p, type DialogHandler as q, type DialogType as r, type Download as s, ElementNotFoundError as t, type EmulationState as u, type ErrorHandler as v, type FillOptions as w, type NetworkIdleOptions as x, Page as y, type PageError as z };
1293
+ export { type InterceptedRequest 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 PageSnapshot as H, type InteractiveElement as I, type SnapshotNode as J, type SubmitOptions as K, type TypeOptions as L, type UserAgentOptions as M, NavigationError as N, type DeviceDescriptor as O, type PlayOptions as P, type DeviceName as Q, type RequestPattern as R, type Step as S, TimeoutError as T, type UserAgentMetadata as U, type ViewportOptions as V, type WaitForOptions as W, devices as X, type ContinueRequestOptions as Y, type FailRequestOptions as Z, type FulfillRequestOptions as _, type RequestHandler as a, type RequestActions as a0, type ResourceType as a1, type RouteOptions as a2, type ClearCookiesOptions as a3, type Cookie as a4, type DeleteCookieOptions as a5, type SetCookieOptions as a6, type WaitOptions as a7, type WaitResult as a8, type WaitState as a9, waitForAnyElement as aa, waitForElement as ab, waitForNavigation as ac, waitForNetworkIdle as ad, type FailureHint as ae, type FailureReason as af, type BatchResult as b, type StepResult as c, type AudioChunk as d, AudioInput as e, type AudioInputState as f, AudioOutput as g, type CaptureOptions as h, type RoundTripOptions as i, type RoundTripResult as j, type ActionOptions as k, type ActionResult as l, type ConsoleHandler as m, type ConsoleMessage as n, type ConsoleMessageType as o, type CustomSelectConfig as p, type DialogHandler as q, type DialogType as r, type Download as s, ElementNotFoundError as t, type EmulationState as u, type ErrorHandler as v, type FillOptions as w, type NetworkIdleOptions as x, Page as y, type PageError as z };
@@ -224,7 +224,9 @@ interface WaitResult {
224
224
  waitedMs: number;
225
225
  }
226
226
  /**
227
- * Wait for an element to reach a specific state
227
+ * Wait for an element to reach a specific state.
228
+ * Uses fast-fail: if the element is not found on a static page (no DOM mutations),
229
+ * returns early instead of polling for the full timeout.
228
230
  */
229
231
  declare function waitForElement(cdp: CDPClient, selector: string, options?: WaitOptions): Promise<WaitResult>;
230
232
  /**
@@ -278,6 +280,8 @@ interface FillOptions extends ActionOptions {
278
280
  interface TypeOptions extends ActionOptions {
279
281
  /** Delay between keystrokes in ms */
280
282
  delay?: number;
283
+ /** Blur the element after typing */
284
+ blur?: boolean;
281
285
  }
282
286
  interface SubmitOptions extends ActionOptions {
283
287
  /** How to submit: 'enter' | 'click' | 'enter+click' */
@@ -705,6 +709,8 @@ declare class Page {
705
709
  private frameExecutionContexts;
706
710
  /** Current frame's execution context ID (null = main frame default) */
707
711
  private currentFrameContextId;
712
+ /** Frame selector if context acquisition failed (cross-origin/sandboxed) */
713
+ private brokenFrame;
708
714
  /** Last matched selector from findElement (for selectorUsed tracking) */
709
715
  private _lastMatchedSelector;
710
716
  /** Last snapshot for stale ref recovery */
@@ -809,9 +815,15 @@ declare class Page {
809
815
  */
810
816
  submit(selector: string | string[], options?: SubmitOptions): Promise<boolean>;
811
817
  /**
812
- * Press a key
818
+ * Press a key, optionally with modifier keys held down
819
+ */
820
+ press(key: string, options?: {
821
+ modifiers?: Array<'Control' | 'Shift' | 'Alt' | 'Meta'>;
822
+ }): Promise<void>;
823
+ /**
824
+ * Execute a keyboard shortcut (e.g. "Control+a", "Meta+Shift+z")
813
825
  */
814
- press(key: string): Promise<void>;
826
+ shortcut(combo: string): Promise<void>;
815
827
  /**
816
828
  * Focus an element
817
829
  */
@@ -1095,9 +1107,13 @@ declare class Page {
1095
1107
  */
1096
1108
  private evaluateInFrame;
1097
1109
  /**
1098
- * Scroll an element into view
1110
+ * Scroll an element into view, with fallback to center-scroll if clipped by fixed headers
1099
1111
  */
1100
1112
  private scrollIntoView;
1113
+ /**
1114
+ * Check if element is within the visible viewport
1115
+ */
1116
+ private isInViewport;
1101
1117
  /**
1102
1118
  * Get element box model (position and dimensions)
1103
1119
  */
@@ -1115,6 +1131,7 @@ declare class Page {
1115
1131
  private resolveObjectId;
1116
1132
  private dispatchKeyDefinition;
1117
1133
  private dispatchKey;
1134
+ private dispatchKeyWithModifiers;
1118
1135
  /**
1119
1136
  * Audio input controller (fake microphone).
1120
1137
  * Lazy-initialized on first access.
@@ -1150,13 +1167,22 @@ declare class Page {
1150
1167
  * ```
1151
1168
  */
1152
1169
  audioRoundTrip(options: RoundTripOptions): Promise<RoundTripResult>;
1170
+ /**
1171
+ * Wait for a DOM mutation in the current frame (used for detecting client-side form handling)
1172
+ */
1173
+ private waitForDOMMutation;
1174
+ /**
1175
+ * Wait for a frame execution context via Runtime.executionContextCreated event
1176
+ */
1177
+ private waitForFrameContext;
1153
1178
  }
1154
1179
 
1155
1180
  /**
1156
1181
  * Action/Step types for batch execution
1157
1182
  */
1158
1183
 
1159
- type ActionType = 'goto' | 'click' | 'fill' | 'type' | 'select' | 'check' | 'uncheck' | 'submit' | 'press' | 'focus' | 'hover' | 'scroll' | 'wait' | 'snapshot' | 'screenshot' | 'evaluate' | 'text' | 'switchFrame' | 'switchToMain';
1184
+ type FailureReason = 'missing' | 'hidden' | 'covered' | 'disabled' | 'readonly' | 'detached' | 'replaced' | 'notEditable' | 'timeout' | 'navigation' | 'cdpError' | 'unknown';
1185
+ type ActionType = 'goto' | 'click' | 'fill' | 'type' | 'select' | 'check' | 'uncheck' | 'submit' | 'press' | 'shortcut' | 'focus' | 'hover' | 'scroll' | 'wait' | 'snapshot' | 'screenshot' | 'evaluate' | 'text' | 'switchFrame' | 'switchToMain' | 'assertVisible' | 'assertExists' | 'assertText' | 'assertUrl' | 'assertValue';
1160
1186
  interface Step {
1161
1187
  /** Action type */
1162
1188
  action: ActionType;
@@ -1168,6 +1194,10 @@ interface Step {
1168
1194
  value?: string | string[];
1169
1195
  /** Key for press action */
1170
1196
  key?: string;
1197
+ /** Key combo for shortcut action (e.g. "Control+a", "Meta+Shift+z") */
1198
+ combo?: string;
1199
+ /** Modifier keys for press action */
1200
+ modifiers?: Array<'Control' | 'Shift' | 'Alt' | 'Meta'>;
1171
1201
  /** What to wait for (wait action) */
1172
1202
  waitFor?: 'visible' | 'hidden' | 'attached' | 'detached' | 'navigation' | 'networkIdle';
1173
1203
  /** Step-specific timeout override (ms) */
@@ -1199,6 +1229,12 @@ interface Step {
1199
1229
  format?: 'png' | 'jpeg' | 'webp';
1200
1230
  quality?: number;
1201
1231
  fullPage?: boolean;
1232
+ /** Expected value for assertion steps (substring match for assertText, exact for assertValue/assertUrl) */
1233
+ expect?: string;
1234
+ /** Retry count for assertion or action steps (default: 0 = no retry) */
1235
+ retry?: number;
1236
+ /** Delay between retries in ms (default: 500) */
1237
+ retryDelay?: number;
1202
1238
  }
1203
1239
  interface BatchOptions {
1204
1240
  /** Default timeout for all steps (ms) */
@@ -1232,6 +1268,16 @@ interface StepResult {
1232
1268
  text?: string;
1233
1269
  /** Failure hints when element not found */
1234
1270
  hints?: FailureHint[];
1271
+ /** Structured failure classification */
1272
+ failureReason?: FailureReason;
1273
+ /** Element covering the target (when failureReason is 'covered') */
1274
+ coveringElement?: {
1275
+ tag: string;
1276
+ id?: string;
1277
+ className?: string;
1278
+ };
1279
+ /** AI-friendly suggestion for what to try next */
1280
+ suggestion?: string;
1235
1281
  }
1236
1282
  interface BatchResult {
1237
1283
  /** Whether all steps succeeded */
@@ -1244,4 +1290,4 @@ interface BatchResult {
1244
1290
  totalDurationMs: number;
1245
1291
  }
1246
1292
 
1247
- export { type InterceptedRequest 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 PageSnapshot as H, type InteractiveElement as I, type SnapshotNode as J, type SubmitOptions as K, type TypeOptions as L, type UserAgentOptions as M, NavigationError as N, type DeviceDescriptor as O, type PlayOptions as P, type DeviceName as Q, type RequestPattern as R, type Step as S, TimeoutError as T, type UserAgentMetadata as U, type ViewportOptions as V, type WaitForOptions as W, devices as X, type ContinueRequestOptions as Y, type FailRequestOptions as Z, type FulfillRequestOptions as _, type RequestHandler as a, type RequestActions as a0, type ResourceType as a1, type RouteOptions as a2, type ClearCookiesOptions as a3, type Cookie as a4, type DeleteCookieOptions as a5, type SetCookieOptions as a6, type WaitOptions as a7, type WaitResult as a8, type WaitState as a9, waitForAnyElement as aa, waitForElement as ab, waitForNavigation as ac, waitForNetworkIdle as ad, type FailureHint as ae, type BatchResult as b, type StepResult as c, type AudioChunk as d, AudioInput as e, type AudioInputState as f, AudioOutput as g, type CaptureOptions as h, type RoundTripOptions as i, type RoundTripResult as j, type ActionOptions as k, type ActionResult as l, type ConsoleHandler as m, type ConsoleMessage as n, type ConsoleMessageType as o, type CustomSelectConfig as p, type DialogHandler as q, type DialogType as r, type Download as s, ElementNotFoundError as t, type EmulationState as u, type ErrorHandler as v, type FillOptions as w, type NetworkIdleOptions as x, Page as y, type PageError as z };
1293
+ export { type InterceptedRequest 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 PageSnapshot as H, type InteractiveElement as I, type SnapshotNode as J, type SubmitOptions as K, type TypeOptions as L, type UserAgentOptions as M, NavigationError as N, type DeviceDescriptor as O, type PlayOptions as P, type DeviceName as Q, type RequestPattern as R, type Step as S, TimeoutError as T, type UserAgentMetadata as U, type ViewportOptions as V, type WaitForOptions as W, devices as X, type ContinueRequestOptions as Y, type FailRequestOptions as Z, type FulfillRequestOptions as _, type RequestHandler as a, type RequestActions as a0, type ResourceType as a1, type RouteOptions as a2, type ClearCookiesOptions as a3, type Cookie as a4, type DeleteCookieOptions as a5, type SetCookieOptions as a6, type WaitOptions as a7, type WaitResult as a8, type WaitState as a9, waitForAnyElement as aa, waitForElement as ab, waitForNavigation as ac, waitForNetworkIdle as ad, type FailureHint as ae, type FailureReason as af, type BatchResult as b, type StepResult as c, type AudioChunk as d, AudioInput as e, type AudioInputState as f, AudioOutput as g, type CaptureOptions as h, type RoundTripOptions as i, type RoundTripResult as j, type ActionOptions as k, type ActionResult as l, type ConsoleHandler as m, type ConsoleMessage as n, type ConsoleMessageType as o, type CustomSelectConfig as p, type DialogHandler as q, type DialogType as r, type Download as s, ElementNotFoundError as t, type EmulationState as u, type ErrorHandler as v, type FillOptions as w, type NetworkIdleOptions as x, Page as y, type PageError as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser-pilot",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "Lightweight CDP-based browser automation for Node.js, Bun, and Cloudflare Workers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -57,8 +57,10 @@
57
57
  "typecheck": "tsc --noEmit",
58
58
  "lint": "biome check .",
59
59
  "lint:fix": "biome check --write .",
60
+ "lint:type": "oxlint --type-aware --tsconfig ./tsconfig.json src/",
60
61
  "format": "biome format --write .",
61
- "check": "bun run typecheck && bun run lint",
62
+ "check": "bun run typecheck && bun run lint && bun run lint:type",
63
+ "check:quiet": "bash scripts/check.sh",
62
64
  "prepublishOnly": "bun run build",
63
65
  "bp": "bun ./src/cli/index.ts",
64
66
  "dev:bp": "bun ./src/cli/index.ts",
@@ -69,6 +71,8 @@
69
71
  "@biomejs/biome": "^2.3.10",
70
72
  "@types/bun": "latest",
71
73
  "chrome-launcher": "^1.2.1",
74
+ "oxlint": "^1.51.0",
75
+ "oxlint-tsgolint": "^0.16.0",
72
76
  "tsup": "^8.0.0"
73
77
  },
74
78
  "peerDependencies": {