@opensteer/engine-playwright 0.8.1 → 0.8.3

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
@@ -378,6 +378,27 @@ interface BrowserCapabilities {
378
378
  };
379
379
  }
380
380
 
381
+ interface PostLoadTrackerSnapshot {
382
+ readonly lastTrackedNetworkActivityAt: number;
383
+ readonly trackedPendingFetches: number;
384
+ readonly trackedPendingXhrs: number;
385
+ }
386
+
387
+ interface ActionBoundarySnapshot {
388
+ readonly pageRef: PageRef;
389
+ readonly documentRef: DocumentRef;
390
+ readonly url?: string;
391
+ readonly tracker?: PostLoadTrackerSnapshot;
392
+ }
393
+ type ActionBoundarySettleTrigger = "dom-action" | "navigation";
394
+ type ActionBoundaryTimedOutPhase = "bootstrap";
395
+ interface ActionBoundaryOutcome {
396
+ readonly trigger: ActionBoundarySettleTrigger;
397
+ readonly crossDocument: boolean;
398
+ readonly bootstrapSettled: boolean;
399
+ readonly timedOutPhase?: ActionBoundaryTimedOutPhase;
400
+ }
401
+
381
402
  type ConsoleLevel = "debug" | "log" | "info" | "warn" | "error" | "trace";
382
403
  interface StepEventBase {
383
404
  readonly eventId: string;
@@ -675,6 +696,9 @@ interface BrowserExecutor {
675
696
  }
676
697
  interface BrowserInspector {
677
698
  readonly capabilities: Readonly<BrowserCapabilities>;
699
+ drainEvents(input: {
700
+ readonly pageRef: PageRef;
701
+ }): Promise<readonly StepEvent[]>;
678
702
  listPages(input: {
679
703
  readonly sessionRef: SessionRef;
680
704
  }): Promise<readonly PageInfo[]>;
@@ -695,12 +719,22 @@ interface BrowserInspector {
695
719
  readonly frameRef?: FrameRef;
696
720
  readonly documentRef?: DocumentRef;
697
721
  }): Promise<DomSnapshot>;
722
+ getActionBoundarySnapshot(input: {
723
+ readonly pageRef: PageRef;
724
+ }): Promise<ActionBoundarySnapshot>;
698
725
  waitForVisualStability(input: {
699
726
  readonly pageRef: PageRef;
700
727
  readonly timeoutMs?: number;
701
728
  readonly settleMs?: number;
702
729
  readonly scope?: VisualStabilityScope;
703
730
  }): Promise<void>;
731
+ waitForPostLoadQuiet(input: {
732
+ readonly pageRef: PageRef;
733
+ readonly timeoutMs?: number;
734
+ readonly quietMs?: number;
735
+ readonly captureWindowMs?: number;
736
+ readonly signal?: AbortSignal;
737
+ }): Promise<void>;
704
738
  readText(input: NodeLocator): Promise<string | null>;
705
739
  readAttributes(input: NodeLocator): Promise<readonly {
706
740
  readonly name: string;
@@ -814,11 +848,12 @@ interface NormalizedComputerScreenshotOptions {
814
848
  }
815
849
  interface ComputerUseBridgeInput {
816
850
  readonly pageRef: PageRef;
851
+ readonly snapshot?: ActionBoundarySnapshot;
817
852
  readonly action: OpensteerComputerAction;
818
853
  readonly screenshot: NormalizedComputerScreenshotOptions;
819
854
  readonly signal: AbortSignal;
820
855
  remainingMs(): number | undefined;
821
- policySettle(pageRef: PageRef): Promise<void>;
856
+ policySettle(pageRef: PageRef, trigger: ActionBoundarySettleTrigger): Promise<void>;
822
857
  }
823
858
  interface ComputerUseBridgeOutput {
824
859
  readonly pageRef: PageRef;
@@ -826,6 +861,7 @@ interface ComputerUseBridgeOutput {
826
861
  readonly viewport: ViewportMetrics;
827
862
  readonly events: readonly StepEvent[];
828
863
  readonly timing: OpensteerComputerExecuteTiming;
864
+ readonly boundary?: ActionBoundaryOutcome;
829
865
  }
830
866
  interface ComputerUseBridge {
831
867
  execute(input: ComputerUseBridgeInput): Promise<ComputerUseBridgeOutput>;
@@ -886,9 +922,10 @@ interface DomActionKeyPressInput {
886
922
  }
887
923
  interface DomActionSettleOptions {
888
924
  readonly operation: "dom.click" | "dom.hover" | "dom.input" | "dom.scroll";
925
+ readonly snapshot?: ActionBoundarySnapshot;
889
926
  readonly signal: AbortSignal;
890
927
  remainingMs(): number | undefined;
891
- policySettle(pageRef: PageRef): Promise<void>;
928
+ policySettle(pageRef: PageRef, trigger: ActionBoundarySettleTrigger): Promise<void>;
892
929
  }
893
930
  type DomPointerHitRelation = "self" | "descendant" | "ancestor" | "same-owner" | "outside" | "unknown";
894
931
  interface DomPointerHitAssessment {
@@ -910,7 +947,7 @@ interface DomActionBridge {
910
947
  scrollNodeIntoView(locator: NodeLocator, options?: DomActionScrollOptions): Promise<void>;
911
948
  focusNode(locator: NodeLocator): Promise<void>;
912
949
  pressKey(locator: NodeLocator, input: DomActionKeyPressInput): Promise<void>;
913
- finalizeDomAction(pageRef: PageRef, options: DomActionSettleOptions): Promise<void>;
950
+ finalizeDomAction(pageRef: PageRef, options: DomActionSettleOptions): Promise<ActionBoundaryOutcome>;
914
951
  }
915
952
 
916
953
  interface PlaywrightChromiumLaunchOptions {
@@ -978,6 +1015,7 @@ declare class PlaywrightBrowserCoreEngine implements BrowserCoreEngine {
978
1015
  private readonly pageByPlaywrightPage;
979
1016
  private readonly pendingPopupOpeners;
980
1017
  private readonly preassignedPopupPageRefs;
1018
+ private readonly actionSettler;
981
1019
  private pageCounter;
982
1020
  private frameCounter;
983
1021
  private documentCounter;
@@ -1082,6 +1120,9 @@ declare class PlaywrightBrowserCoreEngine implements BrowserCoreEngine {
1082
1120
  listPages(input: {
1083
1121
  readonly sessionRef: SessionRef;
1084
1122
  }): Promise<readonly PageInfo[]>;
1123
+ drainEvents(input: {
1124
+ readonly pageRef: PageRef;
1125
+ }): Promise<readonly StepEvent[]>;
1085
1126
  listFrames(input: {
1086
1127
  readonly pageRef: PageRef;
1087
1128
  }): Promise<readonly FrameInfo[]>;
@@ -1099,12 +1140,22 @@ declare class PlaywrightBrowserCoreEngine implements BrowserCoreEngine {
1099
1140
  readonly frameRef?: FrameRef;
1100
1141
  readonly documentRef?: DocumentRef;
1101
1142
  }): Promise<DomSnapshot>;
1143
+ getActionBoundarySnapshot(input: {
1144
+ readonly pageRef: PageRef;
1145
+ }): Promise<ActionBoundarySnapshot>;
1102
1146
  waitForVisualStability(input: {
1103
1147
  readonly pageRef: PageRef;
1104
1148
  readonly timeoutMs?: number;
1105
1149
  readonly settleMs?: number;
1106
1150
  readonly scope?: "main-frame" | "visible-frames";
1107
1151
  }): Promise<void>;
1152
+ waitForPostLoadQuiet(input: {
1153
+ readonly pageRef: PageRef;
1154
+ readonly timeoutMs?: number;
1155
+ readonly quietMs?: number;
1156
+ readonly captureWindowMs?: number;
1157
+ readonly signal?: AbortSignal;
1158
+ }): Promise<void>;
1108
1159
  readText(input: NodeLocator): Promise<string | null>;
1109
1160
  readAttributes(input: NodeLocator): Promise<readonly {
1110
1161
  readonly name: string;
@@ -1155,14 +1206,15 @@ declare class PlaywrightBrowserCoreEngine implements BrowserCoreEngine {
1155
1206
  private handleFrameNavigated;
1156
1207
  private handleNavigatedWithinDocument;
1157
1208
  private handleDocumentUpdated;
1209
+ private handlePageDomContentLoaded;
1158
1210
  private syncFrameTree;
1159
1211
  private refreshFrameBindings;
1160
1212
  private bindPlaywrightFrames;
1161
- private handleConsole;
1213
+ private handleRuntimeConsole;
1162
1214
  private handleDialog;
1163
1215
  private handleDownload;
1164
1216
  private handleFileChooserOpened;
1165
- private handlePageError;
1217
+ private handleRuntimeException;
1166
1218
  private handleUnexpectedPageClose;
1167
1219
  private handleNetworkRequestWillBeSent;
1168
1220
  private handlePlaywrightRequest;
@@ -1205,6 +1257,8 @@ declare class PlaywrightBrowserCoreEngine implements BrowserCoreEngine {
1205
1257
  private throwBackgroundError;
1206
1258
  private createEvent;
1207
1259
  private queueEvent;
1260
+ private installRuntimeEventRecorder;
1261
+ private drainInstrumentedRuntimeEvents;
1208
1262
  private drainQueuedEvents;
1209
1263
  private createStepResult;
1210
1264
  private withModifiers;
package/dist/index.d.ts CHANGED
@@ -378,6 +378,27 @@ interface BrowserCapabilities {
378
378
  };
379
379
  }
380
380
 
381
+ interface PostLoadTrackerSnapshot {
382
+ readonly lastTrackedNetworkActivityAt: number;
383
+ readonly trackedPendingFetches: number;
384
+ readonly trackedPendingXhrs: number;
385
+ }
386
+
387
+ interface ActionBoundarySnapshot {
388
+ readonly pageRef: PageRef;
389
+ readonly documentRef: DocumentRef;
390
+ readonly url?: string;
391
+ readonly tracker?: PostLoadTrackerSnapshot;
392
+ }
393
+ type ActionBoundarySettleTrigger = "dom-action" | "navigation";
394
+ type ActionBoundaryTimedOutPhase = "bootstrap";
395
+ interface ActionBoundaryOutcome {
396
+ readonly trigger: ActionBoundarySettleTrigger;
397
+ readonly crossDocument: boolean;
398
+ readonly bootstrapSettled: boolean;
399
+ readonly timedOutPhase?: ActionBoundaryTimedOutPhase;
400
+ }
401
+
381
402
  type ConsoleLevel = "debug" | "log" | "info" | "warn" | "error" | "trace";
382
403
  interface StepEventBase {
383
404
  readonly eventId: string;
@@ -675,6 +696,9 @@ interface BrowserExecutor {
675
696
  }
676
697
  interface BrowserInspector {
677
698
  readonly capabilities: Readonly<BrowserCapabilities>;
699
+ drainEvents(input: {
700
+ readonly pageRef: PageRef;
701
+ }): Promise<readonly StepEvent[]>;
678
702
  listPages(input: {
679
703
  readonly sessionRef: SessionRef;
680
704
  }): Promise<readonly PageInfo[]>;
@@ -695,12 +719,22 @@ interface BrowserInspector {
695
719
  readonly frameRef?: FrameRef;
696
720
  readonly documentRef?: DocumentRef;
697
721
  }): Promise<DomSnapshot>;
722
+ getActionBoundarySnapshot(input: {
723
+ readonly pageRef: PageRef;
724
+ }): Promise<ActionBoundarySnapshot>;
698
725
  waitForVisualStability(input: {
699
726
  readonly pageRef: PageRef;
700
727
  readonly timeoutMs?: number;
701
728
  readonly settleMs?: number;
702
729
  readonly scope?: VisualStabilityScope;
703
730
  }): Promise<void>;
731
+ waitForPostLoadQuiet(input: {
732
+ readonly pageRef: PageRef;
733
+ readonly timeoutMs?: number;
734
+ readonly quietMs?: number;
735
+ readonly captureWindowMs?: number;
736
+ readonly signal?: AbortSignal;
737
+ }): Promise<void>;
704
738
  readText(input: NodeLocator): Promise<string | null>;
705
739
  readAttributes(input: NodeLocator): Promise<readonly {
706
740
  readonly name: string;
@@ -814,11 +848,12 @@ interface NormalizedComputerScreenshotOptions {
814
848
  }
815
849
  interface ComputerUseBridgeInput {
816
850
  readonly pageRef: PageRef;
851
+ readonly snapshot?: ActionBoundarySnapshot;
817
852
  readonly action: OpensteerComputerAction;
818
853
  readonly screenshot: NormalizedComputerScreenshotOptions;
819
854
  readonly signal: AbortSignal;
820
855
  remainingMs(): number | undefined;
821
- policySettle(pageRef: PageRef): Promise<void>;
856
+ policySettle(pageRef: PageRef, trigger: ActionBoundarySettleTrigger): Promise<void>;
822
857
  }
823
858
  interface ComputerUseBridgeOutput {
824
859
  readonly pageRef: PageRef;
@@ -826,6 +861,7 @@ interface ComputerUseBridgeOutput {
826
861
  readonly viewport: ViewportMetrics;
827
862
  readonly events: readonly StepEvent[];
828
863
  readonly timing: OpensteerComputerExecuteTiming;
864
+ readonly boundary?: ActionBoundaryOutcome;
829
865
  }
830
866
  interface ComputerUseBridge {
831
867
  execute(input: ComputerUseBridgeInput): Promise<ComputerUseBridgeOutput>;
@@ -886,9 +922,10 @@ interface DomActionKeyPressInput {
886
922
  }
887
923
  interface DomActionSettleOptions {
888
924
  readonly operation: "dom.click" | "dom.hover" | "dom.input" | "dom.scroll";
925
+ readonly snapshot?: ActionBoundarySnapshot;
889
926
  readonly signal: AbortSignal;
890
927
  remainingMs(): number | undefined;
891
- policySettle(pageRef: PageRef): Promise<void>;
928
+ policySettle(pageRef: PageRef, trigger: ActionBoundarySettleTrigger): Promise<void>;
892
929
  }
893
930
  type DomPointerHitRelation = "self" | "descendant" | "ancestor" | "same-owner" | "outside" | "unknown";
894
931
  interface DomPointerHitAssessment {
@@ -910,7 +947,7 @@ interface DomActionBridge {
910
947
  scrollNodeIntoView(locator: NodeLocator, options?: DomActionScrollOptions): Promise<void>;
911
948
  focusNode(locator: NodeLocator): Promise<void>;
912
949
  pressKey(locator: NodeLocator, input: DomActionKeyPressInput): Promise<void>;
913
- finalizeDomAction(pageRef: PageRef, options: DomActionSettleOptions): Promise<void>;
950
+ finalizeDomAction(pageRef: PageRef, options: DomActionSettleOptions): Promise<ActionBoundaryOutcome>;
914
951
  }
915
952
 
916
953
  interface PlaywrightChromiumLaunchOptions {
@@ -978,6 +1015,7 @@ declare class PlaywrightBrowserCoreEngine implements BrowserCoreEngine {
978
1015
  private readonly pageByPlaywrightPage;
979
1016
  private readonly pendingPopupOpeners;
980
1017
  private readonly preassignedPopupPageRefs;
1018
+ private readonly actionSettler;
981
1019
  private pageCounter;
982
1020
  private frameCounter;
983
1021
  private documentCounter;
@@ -1082,6 +1120,9 @@ declare class PlaywrightBrowserCoreEngine implements BrowserCoreEngine {
1082
1120
  listPages(input: {
1083
1121
  readonly sessionRef: SessionRef;
1084
1122
  }): Promise<readonly PageInfo[]>;
1123
+ drainEvents(input: {
1124
+ readonly pageRef: PageRef;
1125
+ }): Promise<readonly StepEvent[]>;
1085
1126
  listFrames(input: {
1086
1127
  readonly pageRef: PageRef;
1087
1128
  }): Promise<readonly FrameInfo[]>;
@@ -1099,12 +1140,22 @@ declare class PlaywrightBrowserCoreEngine implements BrowserCoreEngine {
1099
1140
  readonly frameRef?: FrameRef;
1100
1141
  readonly documentRef?: DocumentRef;
1101
1142
  }): Promise<DomSnapshot>;
1143
+ getActionBoundarySnapshot(input: {
1144
+ readonly pageRef: PageRef;
1145
+ }): Promise<ActionBoundarySnapshot>;
1102
1146
  waitForVisualStability(input: {
1103
1147
  readonly pageRef: PageRef;
1104
1148
  readonly timeoutMs?: number;
1105
1149
  readonly settleMs?: number;
1106
1150
  readonly scope?: "main-frame" | "visible-frames";
1107
1151
  }): Promise<void>;
1152
+ waitForPostLoadQuiet(input: {
1153
+ readonly pageRef: PageRef;
1154
+ readonly timeoutMs?: number;
1155
+ readonly quietMs?: number;
1156
+ readonly captureWindowMs?: number;
1157
+ readonly signal?: AbortSignal;
1158
+ }): Promise<void>;
1108
1159
  readText(input: NodeLocator): Promise<string | null>;
1109
1160
  readAttributes(input: NodeLocator): Promise<readonly {
1110
1161
  readonly name: string;
@@ -1155,14 +1206,15 @@ declare class PlaywrightBrowserCoreEngine implements BrowserCoreEngine {
1155
1206
  private handleFrameNavigated;
1156
1207
  private handleNavigatedWithinDocument;
1157
1208
  private handleDocumentUpdated;
1209
+ private handlePageDomContentLoaded;
1158
1210
  private syncFrameTree;
1159
1211
  private refreshFrameBindings;
1160
1212
  private bindPlaywrightFrames;
1161
- private handleConsole;
1213
+ private handleRuntimeConsole;
1162
1214
  private handleDialog;
1163
1215
  private handleDownload;
1164
1216
  private handleFileChooserOpened;
1165
- private handlePageError;
1217
+ private handleRuntimeException;
1166
1218
  private handleUnexpectedPageClose;
1167
1219
  private handleNetworkRequestWillBeSent;
1168
1220
  private handlePlaywrightRequest;
@@ -1205,6 +1257,8 @@ declare class PlaywrightBrowserCoreEngine implements BrowserCoreEngine {
1205
1257
  private throwBackgroundError;
1206
1258
  private createEvent;
1207
1259
  private queueEvent;
1260
+ private installRuntimeEventRecorder;
1261
+ private drainInstrumentedRuntimeEvents;
1208
1262
  private drainQueuedEvents;
1209
1263
  private createStepResult;
1210
1264
  private withModifiers;