File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ export class StagehandPage {
55
55
private _history : Array < HistoryEntry > = [ ] ;
56
56
57
57
public get history ( ) : ReadonlyArray < HistoryEntry > {
58
- return this . _history ;
58
+ return Object . freeze ( [ ... this . _history ] ) ;
59
59
}
60
60
61
61
constructor (
@@ -457,9 +457,14 @@ export class StagehandPage {
457
457
}
458
458
}
459
459
460
- private addToHistory (
460
+ public addToHistory (
461
461
method : HistoryEntry [ "method" ] ,
462
- parameters : unknown ,
462
+ parameters :
463
+ | ActOptions
464
+ | ExtractOptions < z . AnyZodObject >
465
+ | ObserveOptions
466
+ | { url : string ; options : GotoOptions }
467
+ | string ,
463
468
result ?: unknown ,
464
469
) : void {
465
470
this . _history . push ( {
@@ -543,13 +548,15 @@ export class StagehandPage {
543
548
} ,
544
549
} ) ;
545
550
546
- // `useVision` is no longer passed to the handler
547
- return this . actHandler . observeAct (
551
+ const result = await this . actHandler . observeAct (
548
552
actionOrOptions ,
549
553
this . observeHandler ,
550
554
llmClient ,
551
555
requestId ,
552
556
) ;
557
+
558
+ this . addToHistory ( "act" , actionOrOptions , result ) ;
559
+ return result ;
553
560
} catch ( err : unknown ) {
554
561
if ( err instanceof StagehandError || err instanceof StagehandAPIError ) {
555
562
throw err ;
You can’t perform that action at this time.
0 commit comments