@browserbasehq/orca 3.0.6-alpha-1 → 3.0.8-google-cua

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.
Files changed (4) hide show
  1. package/README.md +6 -6
  2. package/dist/index.d.ts +1936 -178
  3. package/dist/index.js +5238 -2268
  4. package/package.json +7 -6
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { EventEmitter } from 'events';
1
2
  import { ZodTypeAny, z, ZodObject, ZodRawShape, ZodError } from 'zod';
2
3
  import * as z3 from 'zod/v3';
3
4
  import { ClientOptions as ClientOptions$2 } from '@anthropic-ai/sdk';
@@ -5,8 +6,9 @@ import { GoogleVertexProviderSettings as GoogleVertexProviderSettings$1 } from '
5
6
  import { LanguageModelV2 } from '@ai-sdk/provider';
6
7
  import { ClientOptions as ClientOptions$1 } from 'openai';
7
8
  import { Client, ClientOptions as ClientOptions$3 } from '@modelcontextprotocol/sdk/client/index.js';
8
- import { ToolSet, ModelMessage, PrepareStepFunction, GenerateTextOnStepFinishCallback, StreamTextOnStepFinishCallback, StreamTextOnErrorCallback, StreamTextOnChunkCallback, StreamTextOnFinishCallback, StepResult, StreamTextResult, wrapLanguageModel, generateObject, generateText, streamText, streamObject, experimental_generateImage, embed, embedMany, experimental_transcribe, experimental_generateSpeech } from 'ai';
9
- export { ModelMessage } from 'ai';
9
+ import * as ai from 'ai';
10
+ import { ToolSet, ModelMessage, PrepareStepFunction, GenerateTextOnStepFinishCallback, StreamTextOnStepFinishCallback, StreamTextOnErrorCallback, StreamTextOnChunkCallback, StreamTextOnFinishCallback, StepResult, StreamTextResult, wrapLanguageModel, generateObject, generateText, streamText, streamObject, experimental_generateImage, embed, embedMany, experimental_transcribe, experimental_generateSpeech, InferUITools } from 'ai';
11
+ export { ModelMessage, Tool, tool } from 'ai';
10
12
  import { Page as Page$1 } from 'playwright-core';
11
13
  export { Page as PlaywrightPage } from 'playwright-core';
12
14
  import { Page as Page$2 } from 'puppeteer-core';
@@ -15,7 +17,7 @@ import { Page as Page$3 } from 'patchright-core';
15
17
  export { Page as PatchrightPage } from 'patchright-core';
16
18
  import { Protocol } from 'devtools-protocol';
17
19
  import { Buffer as Buffer$1 } from 'buffer';
18
- import Browserbase from '@browserbasehq/sdk';
20
+ import { z as z$1 } from 'zod/v4';
19
21
  import { ChatCompletion } from 'openai/resources';
20
22
  import { ToolSet as ToolSet$1 } from 'ai/dist';
21
23
  import { Schema } from '@google/genai';
@@ -516,6 +518,1344 @@ declare class ConsoleMessage {
516
518
  toString(): string;
517
519
  }
518
520
 
521
+ interface SerializableResponse {
522
+ requestId: string;
523
+ frameId?: string;
524
+ loaderId?: string;
525
+ response: Protocol.Network.Response;
526
+ fromServiceWorkerFlag?: boolean;
527
+ finishedSettled?: boolean;
528
+ extraInfoHeaders?: Protocol.Network.Headers | null;
529
+ extraInfoHeadersText?: string;
530
+ }
531
+
532
+ /**
533
+ * Represents a path through a Zod schema from the root object down to a
534
+ * particular field. The `segments` array describes the chain of keys/indices.
535
+ *
536
+ * - **String** segments indicate object property names.
537
+ * - **Number** segments indicate array indices.
538
+ *
539
+ * For example, `["users", 0, "homepage"]` might describe reaching
540
+ * the `homepage` field in `schema.users[0].homepage`.
541
+ */
542
+ interface ZodPathSegments {
543
+ /**
544
+ * The ordered list of keys/indices leading from the schema root
545
+ * to the targeted field.
546
+ */
547
+ segments: Array<string | number>;
548
+ }
549
+ type InitScriptSource<Arg> = string | {
550
+ path?: string;
551
+ content?: string;
552
+ } | ((arg: Arg) => unknown);
553
+
554
+ type EvaluateOptions = {
555
+ /** The question to ask about the task state */
556
+ question: string;
557
+ /** The answer to the question */
558
+ answer?: string;
559
+ /** Whether to take a screenshot of the task state, or array of screenshots to evaluate */
560
+ screenshot?: boolean | Buffer[];
561
+ /** Custom system prompt for the evaluator */
562
+ systemPrompt?: string;
563
+ /** Delay in milliseconds before taking the screenshot @default 250 */
564
+ screenshotDelayMs?: number;
565
+ /** The agent's reasoning/thought process for completing the task */
566
+ agentReasoning?: string;
567
+ };
568
+ type BatchAskOptions = {
569
+ /** Array of questions with optional answers */
570
+ questions: Array<{
571
+ question: string;
572
+ answer?: string;
573
+ }>;
574
+ /** Whether to take a screenshot of the task state */
575
+ screenshot?: boolean;
576
+ /** Custom system prompt for the evaluator */
577
+ systemPrompt?: string;
578
+ /** Delay in milliseconds before taking the screenshot @default 1000 */
579
+ screenshotDelayMs?: number;
580
+ };
581
+ /**
582
+ * Result of an evaluation
583
+ */
584
+ interface EvaluationResult {
585
+ /**
586
+ * The evaluation result ('YES', 'NO', or 'INVALID' if parsing failed or value was unexpected)
587
+ */
588
+ evaluation: "YES" | "NO" | "INVALID";
589
+ /**
590
+ * The reasoning behind the evaluation
591
+ */
592
+ reasoning: string;
593
+ }
594
+
595
+ /**
596
+ * Centralized Zod schemas for Stagehand Server API
597
+ *
598
+ * Naming conventions:
599
+ * - `*RequestSchema` - Request body schemas (zod4), `*Request` is the inferred type
600
+ * - `*ResultSchema` - Inner response data (unwrapped), `*Result` is the inferred type
601
+ * - `*ResponseSchema` - Full response with success wrapper: { success: true, data: *Result }, `*Response` is the inferred type
602
+ *
603
+ * All TypeScript types are inferred from the Zod4 *Schemas using z.infer<>
604
+ */
605
+
606
+ /** Browser launch options for local browsers */
607
+ declare const LocalBrowserLaunchOptionsSchema: z$1.ZodObject<{
608
+ args: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
609
+ executablePath: z$1.ZodOptional<z$1.ZodString>;
610
+ userDataDir: z$1.ZodOptional<z$1.ZodString>;
611
+ preserveUserDataDir: z$1.ZodOptional<z$1.ZodBoolean>;
612
+ headless: z$1.ZodOptional<z$1.ZodBoolean>;
613
+ devtools: z$1.ZodOptional<z$1.ZodBoolean>;
614
+ chromiumSandbox: z$1.ZodOptional<z$1.ZodBoolean>;
615
+ ignoreDefaultArgs: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodBoolean, z$1.ZodArray<z$1.ZodString>]>>;
616
+ proxy: z$1.ZodOptional<z$1.ZodObject<{
617
+ server: z$1.ZodString;
618
+ bypass: z$1.ZodOptional<z$1.ZodString>;
619
+ username: z$1.ZodOptional<z$1.ZodString>;
620
+ password: z$1.ZodOptional<z$1.ZodString>;
621
+ }, z$1.core.$strip>>;
622
+ locale: z$1.ZodOptional<z$1.ZodString>;
623
+ viewport: z$1.ZodOptional<z$1.ZodObject<{
624
+ width: z$1.ZodNumber;
625
+ height: z$1.ZodNumber;
626
+ }, z$1.core.$strip>>;
627
+ deviceScaleFactor: z$1.ZodOptional<z$1.ZodNumber>;
628
+ hasTouch: z$1.ZodOptional<z$1.ZodBoolean>;
629
+ ignoreHTTPSErrors: z$1.ZodOptional<z$1.ZodBoolean>;
630
+ cdpUrl: z$1.ZodOptional<z$1.ZodString>;
631
+ connectTimeoutMs: z$1.ZodOptional<z$1.ZodNumber>;
632
+ downloadsPath: z$1.ZodOptional<z$1.ZodString>;
633
+ acceptDownloads: z$1.ZodOptional<z$1.ZodBoolean>;
634
+ }, z$1.core.$strict>;
635
+ /** Simple model name string */
636
+ declare const ModelNameSchema: z$1.ZodString;
637
+ /** Detailed model configuration object */
638
+ declare const ModelConfigObjectSchema: z$1.ZodObject<{
639
+ provider: z$1.ZodOptional<z$1.ZodEnum<{
640
+ openai: "openai";
641
+ anthropic: "anthropic";
642
+ google: "google";
643
+ microsoft: "microsoft";
644
+ }>>;
645
+ modelName: z$1.ZodString;
646
+ apiKey: z$1.ZodOptional<z$1.ZodString>;
647
+ baseURL: z$1.ZodOptional<z$1.ZodString>;
648
+ }, z$1.core.$strip>;
649
+ /** Model configuration - string model name or detailed config */
650
+ declare const ModelConfigSchema: z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodObject<{
651
+ provider: z$1.ZodOptional<z$1.ZodEnum<{
652
+ openai: "openai";
653
+ anthropic: "anthropic";
654
+ google: "google";
655
+ microsoft: "microsoft";
656
+ }>>;
657
+ modelName: z$1.ZodString;
658
+ apiKey: z$1.ZodOptional<z$1.ZodString>;
659
+ baseURL: z$1.ZodOptional<z$1.ZodString>;
660
+ }, z$1.core.$strip>]>;
661
+ /** Action object returned by observe and used by act */
662
+ declare const ActionSchema: z$1.ZodObject<{
663
+ selector: z$1.ZodString;
664
+ description: z$1.ZodString;
665
+ backendNodeId: z$1.ZodOptional<z$1.ZodNumber>;
666
+ method: z$1.ZodOptional<z$1.ZodString>;
667
+ arguments: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
668
+ }, z$1.core.$strip>;
669
+ /** Session ID path parameter */
670
+ declare const SessionIdParamsSchema: z$1.ZodObject<{
671
+ id: z$1.ZodString;
672
+ }, z$1.core.$strict>;
673
+ /** Browser configuration for session start */
674
+ declare const BrowserConfigSchema: z$1.ZodObject<{
675
+ type: z$1.ZodOptional<z$1.ZodEnum<{
676
+ local: "local";
677
+ browserbase: "browserbase";
678
+ }>>;
679
+ cdpUrl: z$1.ZodOptional<z$1.ZodString>;
680
+ launchOptions: z$1.ZodOptional<z$1.ZodObject<{
681
+ args: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
682
+ executablePath: z$1.ZodOptional<z$1.ZodString>;
683
+ userDataDir: z$1.ZodOptional<z$1.ZodString>;
684
+ preserveUserDataDir: z$1.ZodOptional<z$1.ZodBoolean>;
685
+ headless: z$1.ZodOptional<z$1.ZodBoolean>;
686
+ devtools: z$1.ZodOptional<z$1.ZodBoolean>;
687
+ chromiumSandbox: z$1.ZodOptional<z$1.ZodBoolean>;
688
+ ignoreDefaultArgs: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodBoolean, z$1.ZodArray<z$1.ZodString>]>>;
689
+ proxy: z$1.ZodOptional<z$1.ZodObject<{
690
+ server: z$1.ZodString;
691
+ bypass: z$1.ZodOptional<z$1.ZodString>;
692
+ username: z$1.ZodOptional<z$1.ZodString>;
693
+ password: z$1.ZodOptional<z$1.ZodString>;
694
+ }, z$1.core.$strip>>;
695
+ locale: z$1.ZodOptional<z$1.ZodString>;
696
+ viewport: z$1.ZodOptional<z$1.ZodObject<{
697
+ width: z$1.ZodNumber;
698
+ height: z$1.ZodNumber;
699
+ }, z$1.core.$strip>>;
700
+ deviceScaleFactor: z$1.ZodOptional<z$1.ZodNumber>;
701
+ hasTouch: z$1.ZodOptional<z$1.ZodBoolean>;
702
+ ignoreHTTPSErrors: z$1.ZodOptional<z$1.ZodBoolean>;
703
+ cdpUrl: z$1.ZodOptional<z$1.ZodString>;
704
+ connectTimeoutMs: z$1.ZodOptional<z$1.ZodNumber>;
705
+ downloadsPath: z$1.ZodOptional<z$1.ZodString>;
706
+ acceptDownloads: z$1.ZodOptional<z$1.ZodBoolean>;
707
+ }, z$1.core.$strict>>;
708
+ }, z$1.core.$strip>;
709
+ /** Operational headers for all session requests (auth handled via security schemes) */
710
+ declare const SessionHeadersSchema: z$1.ZodObject<{
711
+ "x-stream-response": z$1.ZodOptional<z$1.ZodEnum<{
712
+ true: "true";
713
+ false: "false";
714
+ }>>;
715
+ "x-language": z$1.ZodOptional<z$1.ZodEnum<{
716
+ typescript: "typescript";
717
+ python: "python";
718
+ playground: "playground";
719
+ }>>;
720
+ "x-sdk-version": z$1.ZodOptional<z$1.ZodString>;
721
+ "x-sent-at": z$1.ZodOptional<z$1.ZodString>;
722
+ }, z$1.core.$strip>;
723
+ /** Standard error response */
724
+ declare const ErrorResponseSchema: z$1.ZodObject<{
725
+ success: z$1.ZodLiteral<false>;
726
+ error: z$1.ZodString;
727
+ code: z$1.ZodOptional<z$1.ZodString>;
728
+ }, z$1.core.$strict>;
729
+ /** Browserbase viewport configuration */
730
+ declare const BrowserbaseViewportSchema: z$1.ZodObject<{
731
+ width: z$1.ZodOptional<z$1.ZodNumber>;
732
+ height: z$1.ZodOptional<z$1.ZodNumber>;
733
+ }, z$1.core.$strip>;
734
+ /** Browserbase fingerprint screen configuration */
735
+ declare const BrowserbaseFingerprintScreenSchema: z$1.ZodObject<{
736
+ maxHeight: z$1.ZodOptional<z$1.ZodNumber>;
737
+ maxWidth: z$1.ZodOptional<z$1.ZodNumber>;
738
+ minHeight: z$1.ZodOptional<z$1.ZodNumber>;
739
+ minWidth: z$1.ZodOptional<z$1.ZodNumber>;
740
+ }, z$1.core.$strip>;
741
+ /** Browserbase fingerprint configuration for stealth mode */
742
+ declare const BrowserbaseFingerprintSchema: z$1.ZodObject<{
743
+ browsers: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
744
+ chrome: "chrome";
745
+ edge: "edge";
746
+ firefox: "firefox";
747
+ safari: "safari";
748
+ }>>>;
749
+ devices: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
750
+ desktop: "desktop";
751
+ mobile: "mobile";
752
+ }>>>;
753
+ httpVersion: z$1.ZodOptional<z$1.ZodEnum<{
754
+ 1: "1";
755
+ 2: "2";
756
+ }>>;
757
+ locales: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
758
+ operatingSystems: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
759
+ android: "android";
760
+ ios: "ios";
761
+ linux: "linux";
762
+ macos: "macos";
763
+ windows: "windows";
764
+ }>>>;
765
+ screen: z$1.ZodOptional<z$1.ZodObject<{
766
+ maxHeight: z$1.ZodOptional<z$1.ZodNumber>;
767
+ maxWidth: z$1.ZodOptional<z$1.ZodNumber>;
768
+ minHeight: z$1.ZodOptional<z$1.ZodNumber>;
769
+ minWidth: z$1.ZodOptional<z$1.ZodNumber>;
770
+ }, z$1.core.$strip>>;
771
+ }, z$1.core.$strip>;
772
+ /** Browserbase context configuration for session persistence */
773
+ declare const BrowserbaseContextSchema: z$1.ZodObject<{
774
+ id: z$1.ZodString;
775
+ persist: z$1.ZodOptional<z$1.ZodBoolean>;
776
+ }, z$1.core.$strip>;
777
+ /** Browserbase browser settings for session creation */
778
+ declare const BrowserbaseBrowserSettingsSchema: z$1.ZodObject<{
779
+ advancedStealth: z$1.ZodOptional<z$1.ZodBoolean>;
780
+ blockAds: z$1.ZodOptional<z$1.ZodBoolean>;
781
+ context: z$1.ZodOptional<z$1.ZodObject<{
782
+ id: z$1.ZodString;
783
+ persist: z$1.ZodOptional<z$1.ZodBoolean>;
784
+ }, z$1.core.$strip>>;
785
+ extensionId: z$1.ZodOptional<z$1.ZodString>;
786
+ fingerprint: z$1.ZodOptional<z$1.ZodObject<{
787
+ browsers: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
788
+ chrome: "chrome";
789
+ edge: "edge";
790
+ firefox: "firefox";
791
+ safari: "safari";
792
+ }>>>;
793
+ devices: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
794
+ desktop: "desktop";
795
+ mobile: "mobile";
796
+ }>>>;
797
+ httpVersion: z$1.ZodOptional<z$1.ZodEnum<{
798
+ 1: "1";
799
+ 2: "2";
800
+ }>>;
801
+ locales: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
802
+ operatingSystems: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
803
+ android: "android";
804
+ ios: "ios";
805
+ linux: "linux";
806
+ macos: "macos";
807
+ windows: "windows";
808
+ }>>>;
809
+ screen: z$1.ZodOptional<z$1.ZodObject<{
810
+ maxHeight: z$1.ZodOptional<z$1.ZodNumber>;
811
+ maxWidth: z$1.ZodOptional<z$1.ZodNumber>;
812
+ minHeight: z$1.ZodOptional<z$1.ZodNumber>;
813
+ minWidth: z$1.ZodOptional<z$1.ZodNumber>;
814
+ }, z$1.core.$strip>>;
815
+ }, z$1.core.$strip>>;
816
+ logSession: z$1.ZodOptional<z$1.ZodBoolean>;
817
+ recordSession: z$1.ZodOptional<z$1.ZodBoolean>;
818
+ solveCaptchas: z$1.ZodOptional<z$1.ZodBoolean>;
819
+ viewport: z$1.ZodOptional<z$1.ZodObject<{
820
+ width: z$1.ZodOptional<z$1.ZodNumber>;
821
+ height: z$1.ZodOptional<z$1.ZodNumber>;
822
+ }, z$1.core.$strip>>;
823
+ }, z$1.core.$strip>;
824
+ /** Browserbase managed proxy geolocation configuration */
825
+ declare const BrowserbaseProxyGeolocationSchema: z$1.ZodObject<{
826
+ country: z$1.ZodString;
827
+ city: z$1.ZodOptional<z$1.ZodString>;
828
+ state: z$1.ZodOptional<z$1.ZodString>;
829
+ }, z$1.core.$strip>;
830
+ /** Browserbase managed proxy configuration */
831
+ declare const BrowserbaseProxyConfigSchema: z$1.ZodObject<{
832
+ type: z$1.ZodLiteral<"browserbase">;
833
+ domainPattern: z$1.ZodOptional<z$1.ZodString>;
834
+ geolocation: z$1.ZodOptional<z$1.ZodObject<{
835
+ country: z$1.ZodString;
836
+ city: z$1.ZodOptional<z$1.ZodString>;
837
+ state: z$1.ZodOptional<z$1.ZodString>;
838
+ }, z$1.core.$strip>>;
839
+ }, z$1.core.$strip>;
840
+ /** External proxy configuration */
841
+ declare const ExternalProxyConfigSchema: z$1.ZodObject<{
842
+ type: z$1.ZodLiteral<"external">;
843
+ server: z$1.ZodString;
844
+ domainPattern: z$1.ZodOptional<z$1.ZodString>;
845
+ username: z$1.ZodOptional<z$1.ZodString>;
846
+ password: z$1.ZodOptional<z$1.ZodString>;
847
+ }, z$1.core.$strip>;
848
+ /** Union of proxy configuration types */
849
+ declare const ProxyConfigSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
850
+ type: z$1.ZodLiteral<"browserbase">;
851
+ domainPattern: z$1.ZodOptional<z$1.ZodString>;
852
+ geolocation: z$1.ZodOptional<z$1.ZodObject<{
853
+ country: z$1.ZodString;
854
+ city: z$1.ZodOptional<z$1.ZodString>;
855
+ state: z$1.ZodOptional<z$1.ZodString>;
856
+ }, z$1.core.$strip>>;
857
+ }, z$1.core.$strip>, z$1.ZodObject<{
858
+ type: z$1.ZodLiteral<"external">;
859
+ server: z$1.ZodString;
860
+ domainPattern: z$1.ZodOptional<z$1.ZodString>;
861
+ username: z$1.ZodOptional<z$1.ZodString>;
862
+ password: z$1.ZodOptional<z$1.ZodString>;
863
+ }, z$1.core.$strip>], "type">;
864
+ /** Browserbase session creation parameters */
865
+ declare const BrowserbaseSessionCreateParamsSchema: z$1.ZodObject<{
866
+ projectId: z$1.ZodOptional<z$1.ZodString>;
867
+ browserSettings: z$1.ZodOptional<z$1.ZodObject<{
868
+ advancedStealth: z$1.ZodOptional<z$1.ZodBoolean>;
869
+ blockAds: z$1.ZodOptional<z$1.ZodBoolean>;
870
+ context: z$1.ZodOptional<z$1.ZodObject<{
871
+ id: z$1.ZodString;
872
+ persist: z$1.ZodOptional<z$1.ZodBoolean>;
873
+ }, z$1.core.$strip>>;
874
+ extensionId: z$1.ZodOptional<z$1.ZodString>;
875
+ fingerprint: z$1.ZodOptional<z$1.ZodObject<{
876
+ browsers: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
877
+ chrome: "chrome";
878
+ edge: "edge";
879
+ firefox: "firefox";
880
+ safari: "safari";
881
+ }>>>;
882
+ devices: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
883
+ desktop: "desktop";
884
+ mobile: "mobile";
885
+ }>>>;
886
+ httpVersion: z$1.ZodOptional<z$1.ZodEnum<{
887
+ 1: "1";
888
+ 2: "2";
889
+ }>>;
890
+ locales: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
891
+ operatingSystems: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
892
+ android: "android";
893
+ ios: "ios";
894
+ linux: "linux";
895
+ macos: "macos";
896
+ windows: "windows";
897
+ }>>>;
898
+ screen: z$1.ZodOptional<z$1.ZodObject<{
899
+ maxHeight: z$1.ZodOptional<z$1.ZodNumber>;
900
+ maxWidth: z$1.ZodOptional<z$1.ZodNumber>;
901
+ minHeight: z$1.ZodOptional<z$1.ZodNumber>;
902
+ minWidth: z$1.ZodOptional<z$1.ZodNumber>;
903
+ }, z$1.core.$strip>>;
904
+ }, z$1.core.$strip>>;
905
+ logSession: z$1.ZodOptional<z$1.ZodBoolean>;
906
+ recordSession: z$1.ZodOptional<z$1.ZodBoolean>;
907
+ solveCaptchas: z$1.ZodOptional<z$1.ZodBoolean>;
908
+ viewport: z$1.ZodOptional<z$1.ZodObject<{
909
+ width: z$1.ZodOptional<z$1.ZodNumber>;
910
+ height: z$1.ZodOptional<z$1.ZodNumber>;
911
+ }, z$1.core.$strip>>;
912
+ }, z$1.core.$strip>>;
913
+ extensionId: z$1.ZodOptional<z$1.ZodString>;
914
+ keepAlive: z$1.ZodOptional<z$1.ZodBoolean>;
915
+ proxies: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodBoolean, z$1.ZodArray<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
916
+ type: z$1.ZodLiteral<"browserbase">;
917
+ domainPattern: z$1.ZodOptional<z$1.ZodString>;
918
+ geolocation: z$1.ZodOptional<z$1.ZodObject<{
919
+ country: z$1.ZodString;
920
+ city: z$1.ZodOptional<z$1.ZodString>;
921
+ state: z$1.ZodOptional<z$1.ZodString>;
922
+ }, z$1.core.$strip>>;
923
+ }, z$1.core.$strip>, z$1.ZodObject<{
924
+ type: z$1.ZodLiteral<"external">;
925
+ server: z$1.ZodString;
926
+ domainPattern: z$1.ZodOptional<z$1.ZodString>;
927
+ username: z$1.ZodOptional<z$1.ZodString>;
928
+ password: z$1.ZodOptional<z$1.ZodString>;
929
+ }, z$1.core.$strip>], "type">>]>>;
930
+ region: z$1.ZodOptional<z$1.ZodEnum<{
931
+ "us-west-2": "us-west-2";
932
+ "us-east-1": "us-east-1";
933
+ "eu-central-1": "eu-central-1";
934
+ "ap-southeast-1": "ap-southeast-1";
935
+ }>>;
936
+ timeout: z$1.ZodOptional<z$1.ZodNumber>;
937
+ userMetadata: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
938
+ }, z$1.core.$strip>;
939
+ declare const SessionStartRequestSchema: z$1.ZodObject<{
940
+ modelName: z$1.ZodString;
941
+ domSettleTimeoutMs: z$1.ZodOptional<z$1.ZodNumber>;
942
+ verbose: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodLiteral<0>, z$1.ZodLiteral<1>, z$1.ZodLiteral<2>]>>;
943
+ systemPrompt: z$1.ZodOptional<z$1.ZodString>;
944
+ browserbaseSessionCreateParams: z$1.ZodOptional<z$1.ZodObject<{
945
+ projectId: z$1.ZodOptional<z$1.ZodString>;
946
+ browserSettings: z$1.ZodOptional<z$1.ZodObject<{
947
+ advancedStealth: z$1.ZodOptional<z$1.ZodBoolean>;
948
+ blockAds: z$1.ZodOptional<z$1.ZodBoolean>;
949
+ context: z$1.ZodOptional<z$1.ZodObject<{
950
+ id: z$1.ZodString;
951
+ persist: z$1.ZodOptional<z$1.ZodBoolean>;
952
+ }, z$1.core.$strip>>;
953
+ extensionId: z$1.ZodOptional<z$1.ZodString>;
954
+ fingerprint: z$1.ZodOptional<z$1.ZodObject<{
955
+ browsers: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
956
+ chrome: "chrome";
957
+ edge: "edge";
958
+ firefox: "firefox";
959
+ safari: "safari";
960
+ }>>>;
961
+ devices: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
962
+ desktop: "desktop";
963
+ mobile: "mobile";
964
+ }>>>;
965
+ httpVersion: z$1.ZodOptional<z$1.ZodEnum<{
966
+ 1: "1";
967
+ 2: "2";
968
+ }>>;
969
+ locales: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
970
+ operatingSystems: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<{
971
+ android: "android";
972
+ ios: "ios";
973
+ linux: "linux";
974
+ macos: "macos";
975
+ windows: "windows";
976
+ }>>>;
977
+ screen: z$1.ZodOptional<z$1.ZodObject<{
978
+ maxHeight: z$1.ZodOptional<z$1.ZodNumber>;
979
+ maxWidth: z$1.ZodOptional<z$1.ZodNumber>;
980
+ minHeight: z$1.ZodOptional<z$1.ZodNumber>;
981
+ minWidth: z$1.ZodOptional<z$1.ZodNumber>;
982
+ }, z$1.core.$strip>>;
983
+ }, z$1.core.$strip>>;
984
+ logSession: z$1.ZodOptional<z$1.ZodBoolean>;
985
+ recordSession: z$1.ZodOptional<z$1.ZodBoolean>;
986
+ solveCaptchas: z$1.ZodOptional<z$1.ZodBoolean>;
987
+ viewport: z$1.ZodOptional<z$1.ZodObject<{
988
+ width: z$1.ZodOptional<z$1.ZodNumber>;
989
+ height: z$1.ZodOptional<z$1.ZodNumber>;
990
+ }, z$1.core.$strip>>;
991
+ }, z$1.core.$strip>>;
992
+ extensionId: z$1.ZodOptional<z$1.ZodString>;
993
+ keepAlive: z$1.ZodOptional<z$1.ZodBoolean>;
994
+ proxies: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodBoolean, z$1.ZodArray<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
995
+ type: z$1.ZodLiteral<"browserbase">;
996
+ domainPattern: z$1.ZodOptional<z$1.ZodString>;
997
+ geolocation: z$1.ZodOptional<z$1.ZodObject<{
998
+ country: z$1.ZodString;
999
+ city: z$1.ZodOptional<z$1.ZodString>;
1000
+ state: z$1.ZodOptional<z$1.ZodString>;
1001
+ }, z$1.core.$strip>>;
1002
+ }, z$1.core.$strip>, z$1.ZodObject<{
1003
+ type: z$1.ZodLiteral<"external">;
1004
+ server: z$1.ZodString;
1005
+ domainPattern: z$1.ZodOptional<z$1.ZodString>;
1006
+ username: z$1.ZodOptional<z$1.ZodString>;
1007
+ password: z$1.ZodOptional<z$1.ZodString>;
1008
+ }, z$1.core.$strip>], "type">>]>>;
1009
+ region: z$1.ZodOptional<z$1.ZodEnum<{
1010
+ "us-west-2": "us-west-2";
1011
+ "us-east-1": "us-east-1";
1012
+ "eu-central-1": "eu-central-1";
1013
+ "ap-southeast-1": "ap-southeast-1";
1014
+ }>>;
1015
+ timeout: z$1.ZodOptional<z$1.ZodNumber>;
1016
+ userMetadata: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
1017
+ }, z$1.core.$strip>>;
1018
+ browser: z$1.ZodOptional<z$1.ZodObject<{
1019
+ type: z$1.ZodOptional<z$1.ZodEnum<{
1020
+ local: "local";
1021
+ browserbase: "browserbase";
1022
+ }>>;
1023
+ cdpUrl: z$1.ZodOptional<z$1.ZodString>;
1024
+ launchOptions: z$1.ZodOptional<z$1.ZodObject<{
1025
+ args: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1026
+ executablePath: z$1.ZodOptional<z$1.ZodString>;
1027
+ userDataDir: z$1.ZodOptional<z$1.ZodString>;
1028
+ preserveUserDataDir: z$1.ZodOptional<z$1.ZodBoolean>;
1029
+ headless: z$1.ZodOptional<z$1.ZodBoolean>;
1030
+ devtools: z$1.ZodOptional<z$1.ZodBoolean>;
1031
+ chromiumSandbox: z$1.ZodOptional<z$1.ZodBoolean>;
1032
+ ignoreDefaultArgs: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodBoolean, z$1.ZodArray<z$1.ZodString>]>>;
1033
+ proxy: z$1.ZodOptional<z$1.ZodObject<{
1034
+ server: z$1.ZodString;
1035
+ bypass: z$1.ZodOptional<z$1.ZodString>;
1036
+ username: z$1.ZodOptional<z$1.ZodString>;
1037
+ password: z$1.ZodOptional<z$1.ZodString>;
1038
+ }, z$1.core.$strip>>;
1039
+ locale: z$1.ZodOptional<z$1.ZodString>;
1040
+ viewport: z$1.ZodOptional<z$1.ZodObject<{
1041
+ width: z$1.ZodNumber;
1042
+ height: z$1.ZodNumber;
1043
+ }, z$1.core.$strip>>;
1044
+ deviceScaleFactor: z$1.ZodOptional<z$1.ZodNumber>;
1045
+ hasTouch: z$1.ZodOptional<z$1.ZodBoolean>;
1046
+ ignoreHTTPSErrors: z$1.ZodOptional<z$1.ZodBoolean>;
1047
+ cdpUrl: z$1.ZodOptional<z$1.ZodString>;
1048
+ connectTimeoutMs: z$1.ZodOptional<z$1.ZodNumber>;
1049
+ downloadsPath: z$1.ZodOptional<z$1.ZodString>;
1050
+ acceptDownloads: z$1.ZodOptional<z$1.ZodBoolean>;
1051
+ }, z$1.core.$strict>>;
1052
+ }, z$1.core.$strip>>;
1053
+ selfHeal: z$1.ZodOptional<z$1.ZodBoolean>;
1054
+ browserbaseSessionID: z$1.ZodOptional<z$1.ZodString>;
1055
+ experimental: z$1.ZodOptional<z$1.ZodBoolean>;
1056
+ waitForCaptchaSolves: z$1.ZodOptional<z$1.ZodBoolean>;
1057
+ actTimeoutMs: z$1.ZodOptional<z$1.ZodNumber>;
1058
+ }, z$1.core.$strip>;
1059
+ declare const SessionStartResultSchema: z$1.ZodObject<{
1060
+ sessionId: z$1.ZodString;
1061
+ cdpUrl: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1062
+ available: z$1.ZodBoolean;
1063
+ }, z$1.core.$strip>;
1064
+ declare const SessionStartResponseSchema: z$1.ZodObject<{
1065
+ success: z$1.ZodBoolean;
1066
+ data: z$1.ZodObject<{
1067
+ sessionId: z$1.ZodString;
1068
+ cdpUrl: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1069
+ available: z$1.ZodBoolean;
1070
+ }, z$1.core.$strip>;
1071
+ }, z$1.core.$strip>;
1072
+ /** Session end request - empty JSON object (required). */
1073
+ declare const SessionEndRequestSchema: z$1.ZodObject<{
1074
+ _forceBody: z$1.ZodOptional<z$1.ZodUndefined>;
1075
+ }, z$1.core.$strict>;
1076
+ declare const SessionEndResultSchema: z$1.ZodObject<{}, z$1.core.$strict>;
1077
+ /** Session end response - just success flag, no data wrapper */
1078
+ declare const SessionEndResponseSchema: z$1.ZodObject<{
1079
+ success: z$1.ZodBoolean;
1080
+ }, z$1.core.$strict>;
1081
+ declare const ActOptionsSchema: z$1.ZodOptional<z$1.ZodObject<{
1082
+ model: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodObject<{
1083
+ provider: z$1.ZodOptional<z$1.ZodEnum<{
1084
+ openai: "openai";
1085
+ anthropic: "anthropic";
1086
+ google: "google";
1087
+ microsoft: "microsoft";
1088
+ }>>;
1089
+ modelName: z$1.ZodString;
1090
+ apiKey: z$1.ZodOptional<z$1.ZodString>;
1091
+ baseURL: z$1.ZodOptional<z$1.ZodString>;
1092
+ }, z$1.core.$strip>]>>;
1093
+ variables: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
1094
+ timeout: z$1.ZodOptional<z$1.ZodNumber>;
1095
+ }, z$1.core.$strip>>;
1096
+ declare const ActRequestSchema: z$1.ZodObject<{
1097
+ input: z$1.ZodUnion<[z$1.ZodString, z$1.ZodObject<{
1098
+ selector: z$1.ZodString;
1099
+ description: z$1.ZodString;
1100
+ backendNodeId: z$1.ZodOptional<z$1.ZodNumber>;
1101
+ method: z$1.ZodOptional<z$1.ZodString>;
1102
+ arguments: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1103
+ }, z$1.core.$strip>]>;
1104
+ options: z$1.ZodOptional<z$1.ZodObject<{
1105
+ model: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodObject<{
1106
+ provider: z$1.ZodOptional<z$1.ZodEnum<{
1107
+ openai: "openai";
1108
+ anthropic: "anthropic";
1109
+ google: "google";
1110
+ microsoft: "microsoft";
1111
+ }>>;
1112
+ modelName: z$1.ZodString;
1113
+ apiKey: z$1.ZodOptional<z$1.ZodString>;
1114
+ baseURL: z$1.ZodOptional<z$1.ZodString>;
1115
+ }, z$1.core.$strip>]>>;
1116
+ variables: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
1117
+ timeout: z$1.ZodOptional<z$1.ZodNumber>;
1118
+ }, z$1.core.$strip>>;
1119
+ frameId: z$1.ZodOptional<z$1.ZodString>;
1120
+ streamResponse: z$1.ZodOptional<z$1.ZodBoolean>;
1121
+ }, z$1.core.$strip>;
1122
+ /** Inner act result data */
1123
+ declare const ActResultDataSchema: z$1.ZodObject<{
1124
+ success: z$1.ZodBoolean;
1125
+ message: z$1.ZodString;
1126
+ actionDescription: z$1.ZodString;
1127
+ actions: z$1.ZodArray<z$1.ZodObject<{
1128
+ selector: z$1.ZodString;
1129
+ description: z$1.ZodString;
1130
+ backendNodeId: z$1.ZodOptional<z$1.ZodNumber>;
1131
+ method: z$1.ZodOptional<z$1.ZodString>;
1132
+ arguments: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1133
+ }, z$1.core.$strip>>;
1134
+ }, z$1.core.$strip>;
1135
+ declare const ActResultSchema: z$1.ZodObject<{
1136
+ result: z$1.ZodObject<{
1137
+ success: z$1.ZodBoolean;
1138
+ message: z$1.ZodString;
1139
+ actionDescription: z$1.ZodString;
1140
+ actions: z$1.ZodArray<z$1.ZodObject<{
1141
+ selector: z$1.ZodString;
1142
+ description: z$1.ZodString;
1143
+ backendNodeId: z$1.ZodOptional<z$1.ZodNumber>;
1144
+ method: z$1.ZodOptional<z$1.ZodString>;
1145
+ arguments: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1146
+ }, z$1.core.$strip>>;
1147
+ }, z$1.core.$strip>;
1148
+ actionId: z$1.ZodOptional<z$1.ZodString>;
1149
+ }, z$1.core.$strip>;
1150
+ declare const ActResponseSchema: z$1.ZodObject<{
1151
+ success: z$1.ZodBoolean;
1152
+ data: z$1.ZodObject<{
1153
+ result: z$1.ZodObject<{
1154
+ success: z$1.ZodBoolean;
1155
+ message: z$1.ZodString;
1156
+ actionDescription: z$1.ZodString;
1157
+ actions: z$1.ZodArray<z$1.ZodObject<{
1158
+ selector: z$1.ZodString;
1159
+ description: z$1.ZodString;
1160
+ backendNodeId: z$1.ZodOptional<z$1.ZodNumber>;
1161
+ method: z$1.ZodOptional<z$1.ZodString>;
1162
+ arguments: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1163
+ }, z$1.core.$strip>>;
1164
+ }, z$1.core.$strip>;
1165
+ actionId: z$1.ZodOptional<z$1.ZodString>;
1166
+ }, z$1.core.$strip>;
1167
+ }, z$1.core.$strip>;
1168
+ declare const ExtractOptionsSchema: z$1.ZodOptional<z$1.ZodObject<{
1169
+ model: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodObject<{
1170
+ provider: z$1.ZodOptional<z$1.ZodEnum<{
1171
+ openai: "openai";
1172
+ anthropic: "anthropic";
1173
+ google: "google";
1174
+ microsoft: "microsoft";
1175
+ }>>;
1176
+ modelName: z$1.ZodString;
1177
+ apiKey: z$1.ZodOptional<z$1.ZodString>;
1178
+ baseURL: z$1.ZodOptional<z$1.ZodString>;
1179
+ }, z$1.core.$strip>]>>;
1180
+ timeout: z$1.ZodOptional<z$1.ZodNumber>;
1181
+ selector: z$1.ZodOptional<z$1.ZodString>;
1182
+ }, z$1.core.$strip>>;
1183
+ declare const ExtractRequestSchema: z$1.ZodObject<{
1184
+ instruction: z$1.ZodOptional<z$1.ZodString>;
1185
+ schema: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
1186
+ options: z$1.ZodOptional<z$1.ZodObject<{
1187
+ model: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodObject<{
1188
+ provider: z$1.ZodOptional<z$1.ZodEnum<{
1189
+ openai: "openai";
1190
+ anthropic: "anthropic";
1191
+ google: "google";
1192
+ microsoft: "microsoft";
1193
+ }>>;
1194
+ modelName: z$1.ZodString;
1195
+ apiKey: z$1.ZodOptional<z$1.ZodString>;
1196
+ baseURL: z$1.ZodOptional<z$1.ZodString>;
1197
+ }, z$1.core.$strip>]>>;
1198
+ timeout: z$1.ZodOptional<z$1.ZodNumber>;
1199
+ selector: z$1.ZodOptional<z$1.ZodString>;
1200
+ }, z$1.core.$strip>>;
1201
+ frameId: z$1.ZodOptional<z$1.ZodString>;
1202
+ streamResponse: z$1.ZodOptional<z$1.ZodBoolean>;
1203
+ }, z$1.core.$strip>;
1204
+ declare const ExtractResultSchema: z$1.ZodObject<{
1205
+ result: z$1.ZodUnknown;
1206
+ actionId: z$1.ZodOptional<z$1.ZodString>;
1207
+ }, z$1.core.$strip>;
1208
+ declare const ExtractResponseSchema: z$1.ZodObject<{
1209
+ success: z$1.ZodBoolean;
1210
+ data: z$1.ZodObject<{
1211
+ result: z$1.ZodUnknown;
1212
+ actionId: z$1.ZodOptional<z$1.ZodString>;
1213
+ }, z$1.core.$strip>;
1214
+ }, z$1.core.$strip>;
1215
+ declare const ObserveOptionsSchema: z$1.ZodOptional<z$1.ZodObject<{
1216
+ model: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodObject<{
1217
+ provider: z$1.ZodOptional<z$1.ZodEnum<{
1218
+ openai: "openai";
1219
+ anthropic: "anthropic";
1220
+ google: "google";
1221
+ microsoft: "microsoft";
1222
+ }>>;
1223
+ modelName: z$1.ZodString;
1224
+ apiKey: z$1.ZodOptional<z$1.ZodString>;
1225
+ baseURL: z$1.ZodOptional<z$1.ZodString>;
1226
+ }, z$1.core.$strip>]>>;
1227
+ timeout: z$1.ZodOptional<z$1.ZodNumber>;
1228
+ selector: z$1.ZodOptional<z$1.ZodString>;
1229
+ }, z$1.core.$strip>>;
1230
+ declare const ObserveRequestSchema: z$1.ZodObject<{
1231
+ instruction: z$1.ZodOptional<z$1.ZodString>;
1232
+ options: z$1.ZodOptional<z$1.ZodObject<{
1233
+ model: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodObject<{
1234
+ provider: z$1.ZodOptional<z$1.ZodEnum<{
1235
+ openai: "openai";
1236
+ anthropic: "anthropic";
1237
+ google: "google";
1238
+ microsoft: "microsoft";
1239
+ }>>;
1240
+ modelName: z$1.ZodString;
1241
+ apiKey: z$1.ZodOptional<z$1.ZodString>;
1242
+ baseURL: z$1.ZodOptional<z$1.ZodString>;
1243
+ }, z$1.core.$strip>]>>;
1244
+ timeout: z$1.ZodOptional<z$1.ZodNumber>;
1245
+ selector: z$1.ZodOptional<z$1.ZodString>;
1246
+ }, z$1.core.$strip>>;
1247
+ frameId: z$1.ZodOptional<z$1.ZodString>;
1248
+ streamResponse: z$1.ZodOptional<z$1.ZodBoolean>;
1249
+ }, z$1.core.$strip>;
1250
+ declare const ObserveResultSchema: z$1.ZodObject<{
1251
+ result: z$1.ZodArray<z$1.ZodObject<{
1252
+ selector: z$1.ZodString;
1253
+ description: z$1.ZodString;
1254
+ backendNodeId: z$1.ZodOptional<z$1.ZodNumber>;
1255
+ method: z$1.ZodOptional<z$1.ZodString>;
1256
+ arguments: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1257
+ }, z$1.core.$strip>>;
1258
+ actionId: z$1.ZodOptional<z$1.ZodString>;
1259
+ }, z$1.core.$strip>;
1260
+ declare const ObserveResponseSchema: z$1.ZodObject<{
1261
+ success: z$1.ZodBoolean;
1262
+ data: z$1.ZodObject<{
1263
+ result: z$1.ZodArray<z$1.ZodObject<{
1264
+ selector: z$1.ZodString;
1265
+ description: z$1.ZodString;
1266
+ backendNodeId: z$1.ZodOptional<z$1.ZodNumber>;
1267
+ method: z$1.ZodOptional<z$1.ZodString>;
1268
+ arguments: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1269
+ }, z$1.core.$strip>>;
1270
+ actionId: z$1.ZodOptional<z$1.ZodString>;
1271
+ }, z$1.core.$strip>;
1272
+ }, z$1.core.$strip>;
1273
+ declare const AgentConfigSchema: z$1.ZodObject<{
1274
+ provider: z$1.ZodOptional<z$1.ZodEnum<{
1275
+ openai: "openai";
1276
+ anthropic: "anthropic";
1277
+ google: "google";
1278
+ microsoft: "microsoft";
1279
+ }>>;
1280
+ model: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodObject<{
1281
+ provider: z$1.ZodOptional<z$1.ZodEnum<{
1282
+ openai: "openai";
1283
+ anthropic: "anthropic";
1284
+ google: "google";
1285
+ microsoft: "microsoft";
1286
+ }>>;
1287
+ modelName: z$1.ZodString;
1288
+ apiKey: z$1.ZodOptional<z$1.ZodString>;
1289
+ baseURL: z$1.ZodOptional<z$1.ZodString>;
1290
+ }, z$1.core.$strip>]>>;
1291
+ systemPrompt: z$1.ZodOptional<z$1.ZodString>;
1292
+ cua: z$1.ZodOptional<z$1.ZodBoolean>;
1293
+ }, z$1.core.$strip>;
1294
+ /** Action taken by the agent during execution */
1295
+ declare const AgentActionSchema: z$1.ZodObject<{
1296
+ type: z$1.ZodString;
1297
+ reasoning: z$1.ZodOptional<z$1.ZodString>;
1298
+ taskCompleted: z$1.ZodOptional<z$1.ZodBoolean>;
1299
+ action: z$1.ZodOptional<z$1.ZodString>;
1300
+ timeMs: z$1.ZodOptional<z$1.ZodNumber>;
1301
+ pageText: z$1.ZodOptional<z$1.ZodString>;
1302
+ pageUrl: z$1.ZodOptional<z$1.ZodString>;
1303
+ instruction: z$1.ZodOptional<z$1.ZodString>;
1304
+ }, z$1.core.$loose>;
1305
+ /** Token usage statistics for agent execution */
1306
+ declare const AgentUsageSchema: z$1.ZodObject<{
1307
+ input_tokens: z$1.ZodNumber;
1308
+ output_tokens: z$1.ZodNumber;
1309
+ reasoning_tokens: z$1.ZodOptional<z$1.ZodNumber>;
1310
+ cached_input_tokens: z$1.ZodOptional<z$1.ZodNumber>;
1311
+ inference_time_ms: z$1.ZodNumber;
1312
+ }, z$1.core.$strip>;
1313
+ /** Result data from agent execution */
1314
+ declare const AgentResultDataSchema: z$1.ZodObject<{
1315
+ success: z$1.ZodBoolean;
1316
+ message: z$1.ZodString;
1317
+ actions: z$1.ZodArray<z$1.ZodObject<{
1318
+ type: z$1.ZodString;
1319
+ reasoning: z$1.ZodOptional<z$1.ZodString>;
1320
+ taskCompleted: z$1.ZodOptional<z$1.ZodBoolean>;
1321
+ action: z$1.ZodOptional<z$1.ZodString>;
1322
+ timeMs: z$1.ZodOptional<z$1.ZodNumber>;
1323
+ pageText: z$1.ZodOptional<z$1.ZodString>;
1324
+ pageUrl: z$1.ZodOptional<z$1.ZodString>;
1325
+ instruction: z$1.ZodOptional<z$1.ZodString>;
1326
+ }, z$1.core.$loose>>;
1327
+ completed: z$1.ZodBoolean;
1328
+ metadata: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
1329
+ usage: z$1.ZodOptional<z$1.ZodObject<{
1330
+ input_tokens: z$1.ZodNumber;
1331
+ output_tokens: z$1.ZodNumber;
1332
+ reasoning_tokens: z$1.ZodOptional<z$1.ZodNumber>;
1333
+ cached_input_tokens: z$1.ZodOptional<z$1.ZodNumber>;
1334
+ inference_time_ms: z$1.ZodNumber;
1335
+ }, z$1.core.$strip>>;
1336
+ }, z$1.core.$strip>;
1337
+ declare const AgentExecuteOptionsSchema: z$1.ZodObject<{
1338
+ instruction: z$1.ZodString;
1339
+ maxSteps: z$1.ZodOptional<z$1.ZodNumber>;
1340
+ highlightCursor: z$1.ZodOptional<z$1.ZodBoolean>;
1341
+ }, z$1.core.$strip>;
1342
+ declare const AgentExecuteRequestSchema: z$1.ZodObject<{
1343
+ agentConfig: z$1.ZodObject<{
1344
+ provider: z$1.ZodOptional<z$1.ZodEnum<{
1345
+ openai: "openai";
1346
+ anthropic: "anthropic";
1347
+ google: "google";
1348
+ microsoft: "microsoft";
1349
+ }>>;
1350
+ model: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodObject<{
1351
+ provider: z$1.ZodOptional<z$1.ZodEnum<{
1352
+ openai: "openai";
1353
+ anthropic: "anthropic";
1354
+ google: "google";
1355
+ microsoft: "microsoft";
1356
+ }>>;
1357
+ modelName: z$1.ZodString;
1358
+ apiKey: z$1.ZodOptional<z$1.ZodString>;
1359
+ baseURL: z$1.ZodOptional<z$1.ZodString>;
1360
+ }, z$1.core.$strip>]>>;
1361
+ systemPrompt: z$1.ZodOptional<z$1.ZodString>;
1362
+ cua: z$1.ZodOptional<z$1.ZodBoolean>;
1363
+ }, z$1.core.$strip>;
1364
+ executeOptions: z$1.ZodObject<{
1365
+ instruction: z$1.ZodString;
1366
+ maxSteps: z$1.ZodOptional<z$1.ZodNumber>;
1367
+ highlightCursor: z$1.ZodOptional<z$1.ZodBoolean>;
1368
+ }, z$1.core.$strip>;
1369
+ frameId: z$1.ZodOptional<z$1.ZodString>;
1370
+ streamResponse: z$1.ZodOptional<z$1.ZodBoolean>;
1371
+ }, z$1.core.$strip>;
1372
+ declare const AgentExecuteResultSchema: z$1.ZodObject<{
1373
+ result: z$1.ZodObject<{
1374
+ success: z$1.ZodBoolean;
1375
+ message: z$1.ZodString;
1376
+ actions: z$1.ZodArray<z$1.ZodObject<{
1377
+ type: z$1.ZodString;
1378
+ reasoning: z$1.ZodOptional<z$1.ZodString>;
1379
+ taskCompleted: z$1.ZodOptional<z$1.ZodBoolean>;
1380
+ action: z$1.ZodOptional<z$1.ZodString>;
1381
+ timeMs: z$1.ZodOptional<z$1.ZodNumber>;
1382
+ pageText: z$1.ZodOptional<z$1.ZodString>;
1383
+ pageUrl: z$1.ZodOptional<z$1.ZodString>;
1384
+ instruction: z$1.ZodOptional<z$1.ZodString>;
1385
+ }, z$1.core.$loose>>;
1386
+ completed: z$1.ZodBoolean;
1387
+ metadata: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
1388
+ usage: z$1.ZodOptional<z$1.ZodObject<{
1389
+ input_tokens: z$1.ZodNumber;
1390
+ output_tokens: z$1.ZodNumber;
1391
+ reasoning_tokens: z$1.ZodOptional<z$1.ZodNumber>;
1392
+ cached_input_tokens: z$1.ZodOptional<z$1.ZodNumber>;
1393
+ inference_time_ms: z$1.ZodNumber;
1394
+ }, z$1.core.$strip>>;
1395
+ }, z$1.core.$strip>;
1396
+ }, z$1.core.$strip>;
1397
+ declare const AgentExecuteResponseSchema: z$1.ZodObject<{
1398
+ success: z$1.ZodBoolean;
1399
+ data: z$1.ZodObject<{
1400
+ result: z$1.ZodObject<{
1401
+ success: z$1.ZodBoolean;
1402
+ message: z$1.ZodString;
1403
+ actions: z$1.ZodArray<z$1.ZodObject<{
1404
+ type: z$1.ZodString;
1405
+ reasoning: z$1.ZodOptional<z$1.ZodString>;
1406
+ taskCompleted: z$1.ZodOptional<z$1.ZodBoolean>;
1407
+ action: z$1.ZodOptional<z$1.ZodString>;
1408
+ timeMs: z$1.ZodOptional<z$1.ZodNumber>;
1409
+ pageText: z$1.ZodOptional<z$1.ZodString>;
1410
+ pageUrl: z$1.ZodOptional<z$1.ZodString>;
1411
+ instruction: z$1.ZodOptional<z$1.ZodString>;
1412
+ }, z$1.core.$loose>>;
1413
+ completed: z$1.ZodBoolean;
1414
+ metadata: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
1415
+ usage: z$1.ZodOptional<z$1.ZodObject<{
1416
+ input_tokens: z$1.ZodNumber;
1417
+ output_tokens: z$1.ZodNumber;
1418
+ reasoning_tokens: z$1.ZodOptional<z$1.ZodNumber>;
1419
+ cached_input_tokens: z$1.ZodOptional<z$1.ZodNumber>;
1420
+ inference_time_ms: z$1.ZodNumber;
1421
+ }, z$1.core.$strip>>;
1422
+ }, z$1.core.$strip>;
1423
+ }, z$1.core.$strip>;
1424
+ }, z$1.core.$strip>;
1425
+ declare const NavigateOptionsSchema: z$1.ZodOptional<z$1.ZodObject<{
1426
+ referer: z$1.ZodOptional<z$1.ZodString>;
1427
+ timeout: z$1.ZodOptional<z$1.ZodNumber>;
1428
+ waitUntil: z$1.ZodOptional<z$1.ZodEnum<{
1429
+ load: "load";
1430
+ domcontentloaded: "domcontentloaded";
1431
+ networkidle: "networkidle";
1432
+ }>>;
1433
+ }, z$1.core.$strip>>;
1434
+ declare const NavigateRequestSchema: z$1.ZodObject<{
1435
+ url: z$1.ZodString;
1436
+ options: z$1.ZodOptional<z$1.ZodObject<{
1437
+ referer: z$1.ZodOptional<z$1.ZodString>;
1438
+ timeout: z$1.ZodOptional<z$1.ZodNumber>;
1439
+ waitUntil: z$1.ZodOptional<z$1.ZodEnum<{
1440
+ load: "load";
1441
+ domcontentloaded: "domcontentloaded";
1442
+ networkidle: "networkidle";
1443
+ }>>;
1444
+ }, z$1.core.$strip>>;
1445
+ frameId: z$1.ZodOptional<z$1.ZodString>;
1446
+ streamResponse: z$1.ZodOptional<z$1.ZodBoolean>;
1447
+ }, z$1.core.$strip>;
1448
+ declare const NavigateResultSchema: z$1.ZodObject<{
1449
+ result: z$1.ZodNullable<z$1.ZodUnknown>;
1450
+ actionId: z$1.ZodOptional<z$1.ZodString>;
1451
+ }, z$1.core.$strip>;
1452
+ declare const NavigateResponseSchema: z$1.ZodObject<{
1453
+ success: z$1.ZodBoolean;
1454
+ data: z$1.ZodObject<{
1455
+ result: z$1.ZodNullable<z$1.ZodUnknown>;
1456
+ actionId: z$1.ZodOptional<z$1.ZodString>;
1457
+ }, z$1.core.$strip>;
1458
+ }, z$1.core.$strip>;
1459
+ /** Token usage for a single action */
1460
+ declare const TokenUsageSchema: z$1.ZodObject<{
1461
+ inputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1462
+ outputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1463
+ reasoningTokens: z$1.ZodOptional<z$1.ZodNumber>;
1464
+ cachedInputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1465
+ timeMs: z$1.ZodOptional<z$1.ZodNumber>;
1466
+ }, z$1.core.$strip>;
1467
+ /** Action entry in replay metrics */
1468
+ declare const ReplayActionSchema: z$1.ZodObject<{
1469
+ method: z$1.ZodOptional<z$1.ZodString>;
1470
+ tokenUsage: z$1.ZodOptional<z$1.ZodObject<{
1471
+ inputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1472
+ outputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1473
+ reasoningTokens: z$1.ZodOptional<z$1.ZodNumber>;
1474
+ cachedInputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1475
+ timeMs: z$1.ZodOptional<z$1.ZodNumber>;
1476
+ }, z$1.core.$strip>>;
1477
+ }, z$1.core.$strip>;
1478
+ /** Page entry in replay metrics */
1479
+ declare const ReplayPageSchema: z$1.ZodObject<{
1480
+ actions: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1481
+ method: z$1.ZodOptional<z$1.ZodString>;
1482
+ tokenUsage: z$1.ZodOptional<z$1.ZodObject<{
1483
+ inputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1484
+ outputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1485
+ reasoningTokens: z$1.ZodOptional<z$1.ZodNumber>;
1486
+ cachedInputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1487
+ timeMs: z$1.ZodOptional<z$1.ZodNumber>;
1488
+ }, z$1.core.$strip>>;
1489
+ }, z$1.core.$strip>>>;
1490
+ }, z$1.core.$strip>;
1491
+ /** Inner result data for replay */
1492
+ declare const ReplayResultSchema: z$1.ZodObject<{
1493
+ pages: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1494
+ actions: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1495
+ method: z$1.ZodOptional<z$1.ZodString>;
1496
+ tokenUsage: z$1.ZodOptional<z$1.ZodObject<{
1497
+ inputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1498
+ outputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1499
+ reasoningTokens: z$1.ZodOptional<z$1.ZodNumber>;
1500
+ cachedInputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1501
+ timeMs: z$1.ZodOptional<z$1.ZodNumber>;
1502
+ }, z$1.core.$strip>>;
1503
+ }, z$1.core.$strip>>>;
1504
+ }, z$1.core.$strip>>>;
1505
+ }, z$1.core.$strip>;
1506
+ declare const ReplayResponseSchema: z$1.ZodObject<{
1507
+ success: z$1.ZodBoolean;
1508
+ data: z$1.ZodObject<{
1509
+ pages: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1510
+ actions: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1511
+ method: z$1.ZodOptional<z$1.ZodString>;
1512
+ tokenUsage: z$1.ZodOptional<z$1.ZodObject<{
1513
+ inputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1514
+ outputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1515
+ reasoningTokens: z$1.ZodOptional<z$1.ZodNumber>;
1516
+ cachedInputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1517
+ timeMs: z$1.ZodOptional<z$1.ZodNumber>;
1518
+ }, z$1.core.$strip>>;
1519
+ }, z$1.core.$strip>>>;
1520
+ }, z$1.core.$strip>>>;
1521
+ }, z$1.core.$strip>;
1522
+ }, z$1.core.$strip>;
1523
+ /** Status values for SSE stream events */
1524
+ declare const StreamEventStatusSchema: z$1.ZodEnum<{
1525
+ error: "error";
1526
+ starting: "starting";
1527
+ connected: "connected";
1528
+ running: "running";
1529
+ finished: "finished";
1530
+ }>;
1531
+ /** Type discriminator for SSE stream events */
1532
+ declare const StreamEventTypeSchema: z$1.ZodEnum<{
1533
+ system: "system";
1534
+ log: "log";
1535
+ }>;
1536
+ /** Data payload for system stream events */
1537
+ declare const StreamEventSystemDataSchema: z$1.ZodObject<{
1538
+ status: z$1.ZodEnum<{
1539
+ error: "error";
1540
+ starting: "starting";
1541
+ connected: "connected";
1542
+ running: "running";
1543
+ finished: "finished";
1544
+ }>;
1545
+ result: z$1.ZodOptional<z$1.ZodUnknown>;
1546
+ error: z$1.ZodOptional<z$1.ZodString>;
1547
+ }, z$1.core.$strip>;
1548
+ /** Data payload for log stream events */
1549
+ declare const StreamEventLogDataSchema: z$1.ZodObject<{
1550
+ status: z$1.ZodLiteral<"running">;
1551
+ message: z$1.ZodString;
1552
+ }, z$1.core.$strip>;
1553
+ /**
1554
+ * SSE stream event sent during streaming responses.
1555
+ *
1556
+ * IMPORTANT: Key ordering matters for Stainless SDK generation.
1557
+ * The `data` field MUST be serialized first, with `status` as the first key within it.
1558
+ * This allows Stainless to use `data_starts_with: '{"data":{"status":"finished"'` for event handling.
1559
+ *
1560
+ * Expected serialization order: {"data":{"status":...},"type":...,"id":...}
1561
+ */
1562
+ declare const StreamEventSchema: z$1.ZodObject<{
1563
+ data: z$1.ZodUnion<readonly [z$1.ZodObject<{
1564
+ status: z$1.ZodEnum<{
1565
+ error: "error";
1566
+ starting: "starting";
1567
+ connected: "connected";
1568
+ running: "running";
1569
+ finished: "finished";
1570
+ }>;
1571
+ result: z$1.ZodOptional<z$1.ZodUnknown>;
1572
+ error: z$1.ZodOptional<z$1.ZodString>;
1573
+ }, z$1.core.$strip>, z$1.ZodObject<{
1574
+ status: z$1.ZodLiteral<"running">;
1575
+ message: z$1.ZodString;
1576
+ }, z$1.core.$strip>]>;
1577
+ type: z$1.ZodEnum<{
1578
+ system: "system";
1579
+ log: "log";
1580
+ }>;
1581
+ id: z$1.ZodString;
1582
+ }, z$1.core.$strip>;
1583
+ /** OpenAPI security schemes for authentication */
1584
+ declare const openApiSecuritySchemes: {
1585
+ readonly BrowserbaseApiKey: {
1586
+ readonly type: "apiKey";
1587
+ readonly in: "header";
1588
+ readonly name: "x-bb-api-key";
1589
+ readonly description: "Browserbase API key for authentication";
1590
+ };
1591
+ readonly BrowserbaseProjectId: {
1592
+ readonly type: "apiKey";
1593
+ readonly in: "header";
1594
+ readonly name: "x-bb-project-id";
1595
+ readonly description: "Browserbase project ID";
1596
+ };
1597
+ readonly ModelApiKey: {
1598
+ readonly type: "apiKey";
1599
+ readonly in: "header";
1600
+ readonly name: "x-model-api-key";
1601
+ readonly description: "API key for the AI model provider (OpenAI, Anthropic, etc.)";
1602
+ };
1603
+ };
1604
+ /** OpenAPI links for session operations (used in SessionStart response) */
1605
+ declare const openApiLinks: {
1606
+ readonly SessionAct: {
1607
+ readonly operationId: "SessionAct";
1608
+ readonly parameters: {
1609
+ readonly id: "$response.body#/data/sessionId";
1610
+ };
1611
+ readonly description: "Perform an action on the session";
1612
+ };
1613
+ readonly SessionExtract: {
1614
+ readonly operationId: "SessionExtract";
1615
+ readonly parameters: {
1616
+ readonly id: "$response.body#/data/sessionId";
1617
+ };
1618
+ readonly description: "Extract data from the session";
1619
+ };
1620
+ readonly SessionObserve: {
1621
+ readonly operationId: "SessionObserve";
1622
+ readonly parameters: {
1623
+ readonly id: "$response.body#/data/sessionId";
1624
+ };
1625
+ readonly description: "Observe available actions on the session";
1626
+ };
1627
+ readonly SessionNavigate: {
1628
+ readonly operationId: "SessionNavigate";
1629
+ readonly parameters: {
1630
+ readonly id: "$response.body#/data/sessionId";
1631
+ };
1632
+ readonly description: "Navigate to a URL in the session";
1633
+ };
1634
+ readonly SessionAgentExecute: {
1635
+ readonly operationId: "SessionAgentExecute";
1636
+ readonly parameters: {
1637
+ readonly id: "$response.body#/data/sessionId";
1638
+ };
1639
+ readonly description: "Execute an agent on the session";
1640
+ };
1641
+ readonly SessionReplay: {
1642
+ readonly operationId: "SessionReplay";
1643
+ readonly parameters: {
1644
+ readonly id: "$response.body#/data/sessionId";
1645
+ };
1646
+ readonly description: "Replay session metrics";
1647
+ };
1648
+ readonly SessionEnd: {
1649
+ readonly operationId: "SessionEnd";
1650
+ readonly parameters: {
1651
+ readonly id: "$response.body#/data/sessionId";
1652
+ };
1653
+ readonly description: "End the session and release resources";
1654
+ };
1655
+ };
1656
+ /** OpenAPI operation metadata for each endpoint */
1657
+ declare const Operations: {
1658
+ readonly SessionStart: {
1659
+ readonly operationId: "SessionStart";
1660
+ readonly summary: "Start a new browser session";
1661
+ readonly description: "Creates a new browser session with the specified configuration. Returns a session ID used for all subsequent operations.";
1662
+ };
1663
+ readonly SessionEnd: {
1664
+ readonly operationId: "SessionEnd";
1665
+ readonly summary: "End a browser session";
1666
+ readonly description: "Terminates the browser session and releases all associated resources.";
1667
+ };
1668
+ readonly SessionAct: {
1669
+ readonly operationId: "SessionAct";
1670
+ readonly summary: "Perform an action";
1671
+ readonly description: "Executes a browser action using natural language instructions or a predefined Action object.";
1672
+ };
1673
+ readonly SessionExtract: {
1674
+ readonly operationId: "SessionExtract";
1675
+ readonly summary: "Extract data from the page";
1676
+ readonly description: "Extracts structured data from the current page using AI-powered analysis.";
1677
+ };
1678
+ readonly SessionObserve: {
1679
+ readonly operationId: "SessionObserve";
1680
+ readonly summary: "Observe available actions";
1681
+ readonly description: "Identifies and returns available actions on the current page that match the given instruction.";
1682
+ };
1683
+ readonly SessionNavigate: {
1684
+ readonly operationId: "SessionNavigate";
1685
+ readonly summary: "Navigate to a URL";
1686
+ readonly description: "Navigates the browser to the specified URL.";
1687
+ };
1688
+ readonly SessionAgentExecute: {
1689
+ readonly operationId: "SessionAgentExecute";
1690
+ readonly summary: "Execute an AI agent";
1691
+ readonly description: "Runs an autonomous AI agent that can perform complex multi-step browser tasks.";
1692
+ };
1693
+ readonly SessionReplay: {
1694
+ readonly operationId: "SessionReplay";
1695
+ readonly summary: "Replay session metrics";
1696
+ readonly description: "Retrieves replay metrics for a session.";
1697
+ };
1698
+ };
1699
+ type Action$1 = z$1.infer<typeof ActionSchema>;
1700
+ type ModelConfig = z$1.infer<typeof ModelConfigSchema>;
1701
+ type BrowserConfig = z$1.infer<typeof BrowserConfigSchema>;
1702
+ type SessionIdParams = z$1.infer<typeof SessionIdParamsSchema>;
1703
+ type SessionHeaders = z$1.infer<typeof SessionHeadersSchema>;
1704
+ type BrowserbaseViewport = z$1.infer<typeof BrowserbaseViewportSchema>;
1705
+ type BrowserbaseFingerprintScreen = z$1.infer<typeof BrowserbaseFingerprintScreenSchema>;
1706
+ type BrowserbaseFingerprint = z$1.infer<typeof BrowserbaseFingerprintSchema>;
1707
+ type BrowserbaseContext = z$1.infer<typeof BrowserbaseContextSchema>;
1708
+ type BrowserbaseBrowserSettings = z$1.infer<typeof BrowserbaseBrowserSettingsSchema>;
1709
+ type BrowserbaseProxyGeolocation = z$1.infer<typeof BrowserbaseProxyGeolocationSchema>;
1710
+ type BrowserbaseProxyConfig = z$1.infer<typeof BrowserbaseProxyConfigSchema>;
1711
+ type ExternalProxyConfig = z$1.infer<typeof ExternalProxyConfigSchema>;
1712
+ type BrowserbaseSessionCreateParams = z$1.infer<typeof BrowserbaseSessionCreateParamsSchema>;
1713
+ type SessionStartRequest = z$1.infer<typeof SessionStartRequestSchema>;
1714
+ type SessionStartResult = z$1.infer<typeof SessionStartResultSchema>;
1715
+ type SessionStartResponse = z$1.infer<typeof SessionStartResponseSchema>;
1716
+ type SessionEndResult = z$1.infer<typeof SessionEndResultSchema>;
1717
+ type SessionEndResponse = z$1.infer<typeof SessionEndResponseSchema>;
1718
+ type ActRequest = z$1.infer<typeof ActRequestSchema>;
1719
+ type ActResultData = z$1.infer<typeof ActResultDataSchema>;
1720
+ type ActResult$1 = z$1.infer<typeof ActResultSchema>;
1721
+ type ActResponse = z$1.infer<typeof ActResponseSchema>;
1722
+ type ExtractRequest = z$1.infer<typeof ExtractRequestSchema>;
1723
+ type ExtractResult$1 = z$1.infer<typeof ExtractResultSchema>;
1724
+ type ExtractResponse = z$1.infer<typeof ExtractResponseSchema>;
1725
+ type ObserveRequest = z$1.infer<typeof ObserveRequestSchema>;
1726
+ type ObserveResult = z$1.infer<typeof ObserveResultSchema>;
1727
+ type ObserveResponse = z$1.infer<typeof ObserveResponseSchema>;
1728
+ type AgentAction$1 = z$1.infer<typeof AgentActionSchema>;
1729
+ type AgentUsage = z$1.infer<typeof AgentUsageSchema>;
1730
+ type AgentResultData = z$1.infer<typeof AgentResultDataSchema>;
1731
+ type AgentExecuteRequest = z$1.infer<typeof AgentExecuteRequestSchema>;
1732
+ type AgentExecuteResult = z$1.infer<typeof AgentExecuteResultSchema>;
1733
+ type AgentExecuteResponse = z$1.infer<typeof AgentExecuteResponseSchema>;
1734
+ type NavigateRequest = z$1.infer<typeof NavigateRequestSchema>;
1735
+ type NavigateResult = z$1.infer<typeof NavigateResultSchema>;
1736
+ type NavigateResponse = z$1.infer<typeof NavigateResponseSchema>;
1737
+ type TokenUsage = z$1.infer<typeof TokenUsageSchema>;
1738
+ type ReplayAction = z$1.infer<typeof ReplayActionSchema>;
1739
+ type ReplayPage = z$1.infer<typeof ReplayPageSchema>;
1740
+ type ReplayResult = z$1.infer<typeof ReplayResultSchema>;
1741
+ type ReplayResponse = z$1.infer<typeof ReplayResponseSchema>;
1742
+ type StreamEventStatus = z$1.infer<typeof StreamEventStatusSchema>;
1743
+ type StreamEventType = z$1.infer<typeof StreamEventTypeSchema>;
1744
+ type StreamEventSystemData = z$1.infer<typeof StreamEventSystemDataSchema>;
1745
+ type StreamEventLogData = z$1.infer<typeof StreamEventLogDataSchema>;
1746
+ type StreamEvent = z$1.infer<typeof StreamEventSchema>;
1747
+
1748
+ declare const api_ActOptionsSchema: typeof ActOptionsSchema;
1749
+ type api_ActRequest = ActRequest;
1750
+ declare const api_ActRequestSchema: typeof ActRequestSchema;
1751
+ type api_ActResponse = ActResponse;
1752
+ declare const api_ActResponseSchema: typeof ActResponseSchema;
1753
+ type api_ActResultData = ActResultData;
1754
+ declare const api_ActResultDataSchema: typeof ActResultDataSchema;
1755
+ declare const api_ActResultSchema: typeof ActResultSchema;
1756
+ declare const api_ActionSchema: typeof ActionSchema;
1757
+ declare const api_AgentActionSchema: typeof AgentActionSchema;
1758
+ declare const api_AgentConfigSchema: typeof AgentConfigSchema;
1759
+ declare const api_AgentExecuteOptionsSchema: typeof AgentExecuteOptionsSchema;
1760
+ type api_AgentExecuteRequest = AgentExecuteRequest;
1761
+ declare const api_AgentExecuteRequestSchema: typeof AgentExecuteRequestSchema;
1762
+ type api_AgentExecuteResponse = AgentExecuteResponse;
1763
+ declare const api_AgentExecuteResponseSchema: typeof AgentExecuteResponseSchema;
1764
+ type api_AgentExecuteResult = AgentExecuteResult;
1765
+ declare const api_AgentExecuteResultSchema: typeof AgentExecuteResultSchema;
1766
+ type api_AgentResultData = AgentResultData;
1767
+ declare const api_AgentResultDataSchema: typeof AgentResultDataSchema;
1768
+ type api_AgentUsage = AgentUsage;
1769
+ declare const api_AgentUsageSchema: typeof AgentUsageSchema;
1770
+ type api_BrowserConfig = BrowserConfig;
1771
+ declare const api_BrowserConfigSchema: typeof BrowserConfigSchema;
1772
+ type api_BrowserbaseBrowserSettings = BrowserbaseBrowserSettings;
1773
+ declare const api_BrowserbaseBrowserSettingsSchema: typeof BrowserbaseBrowserSettingsSchema;
1774
+ type api_BrowserbaseContext = BrowserbaseContext;
1775
+ declare const api_BrowserbaseContextSchema: typeof BrowserbaseContextSchema;
1776
+ type api_BrowserbaseFingerprint = BrowserbaseFingerprint;
1777
+ declare const api_BrowserbaseFingerprintSchema: typeof BrowserbaseFingerprintSchema;
1778
+ type api_BrowserbaseFingerprintScreen = BrowserbaseFingerprintScreen;
1779
+ declare const api_BrowserbaseFingerprintScreenSchema: typeof BrowserbaseFingerprintScreenSchema;
1780
+ type api_BrowserbaseProxyConfig = BrowserbaseProxyConfig;
1781
+ declare const api_BrowserbaseProxyConfigSchema: typeof BrowserbaseProxyConfigSchema;
1782
+ type api_BrowserbaseProxyGeolocation = BrowserbaseProxyGeolocation;
1783
+ declare const api_BrowserbaseProxyGeolocationSchema: typeof BrowserbaseProxyGeolocationSchema;
1784
+ type api_BrowserbaseSessionCreateParams = BrowserbaseSessionCreateParams;
1785
+ declare const api_BrowserbaseSessionCreateParamsSchema: typeof BrowserbaseSessionCreateParamsSchema;
1786
+ type api_BrowserbaseViewport = BrowserbaseViewport;
1787
+ declare const api_BrowserbaseViewportSchema: typeof BrowserbaseViewportSchema;
1788
+ declare const api_ErrorResponseSchema: typeof ErrorResponseSchema;
1789
+ type api_ExternalProxyConfig = ExternalProxyConfig;
1790
+ declare const api_ExternalProxyConfigSchema: typeof ExternalProxyConfigSchema;
1791
+ declare const api_ExtractOptionsSchema: typeof ExtractOptionsSchema;
1792
+ type api_ExtractRequest = ExtractRequest;
1793
+ declare const api_ExtractRequestSchema: typeof ExtractRequestSchema;
1794
+ type api_ExtractResponse = ExtractResponse;
1795
+ declare const api_ExtractResponseSchema: typeof ExtractResponseSchema;
1796
+ declare const api_ExtractResultSchema: typeof ExtractResultSchema;
1797
+ declare const api_LocalBrowserLaunchOptionsSchema: typeof LocalBrowserLaunchOptionsSchema;
1798
+ type api_ModelConfig = ModelConfig;
1799
+ declare const api_ModelConfigObjectSchema: typeof ModelConfigObjectSchema;
1800
+ declare const api_ModelConfigSchema: typeof ModelConfigSchema;
1801
+ declare const api_ModelNameSchema: typeof ModelNameSchema;
1802
+ declare const api_NavigateOptionsSchema: typeof NavigateOptionsSchema;
1803
+ type api_NavigateRequest = NavigateRequest;
1804
+ declare const api_NavigateRequestSchema: typeof NavigateRequestSchema;
1805
+ type api_NavigateResponse = NavigateResponse;
1806
+ declare const api_NavigateResponseSchema: typeof NavigateResponseSchema;
1807
+ type api_NavigateResult = NavigateResult;
1808
+ declare const api_NavigateResultSchema: typeof NavigateResultSchema;
1809
+ declare const api_ObserveOptionsSchema: typeof ObserveOptionsSchema;
1810
+ type api_ObserveRequest = ObserveRequest;
1811
+ declare const api_ObserveRequestSchema: typeof ObserveRequestSchema;
1812
+ type api_ObserveResponse = ObserveResponse;
1813
+ declare const api_ObserveResponseSchema: typeof ObserveResponseSchema;
1814
+ type api_ObserveResult = ObserveResult;
1815
+ declare const api_ObserveResultSchema: typeof ObserveResultSchema;
1816
+ declare const api_Operations: typeof Operations;
1817
+ declare const api_ProxyConfigSchema: typeof ProxyConfigSchema;
1818
+ type api_ReplayAction = ReplayAction;
1819
+ declare const api_ReplayActionSchema: typeof ReplayActionSchema;
1820
+ type api_ReplayPage = ReplayPage;
1821
+ declare const api_ReplayPageSchema: typeof ReplayPageSchema;
1822
+ type api_ReplayResponse = ReplayResponse;
1823
+ declare const api_ReplayResponseSchema: typeof ReplayResponseSchema;
1824
+ type api_ReplayResult = ReplayResult;
1825
+ declare const api_ReplayResultSchema: typeof ReplayResultSchema;
1826
+ declare const api_SessionEndRequestSchema: typeof SessionEndRequestSchema;
1827
+ type api_SessionEndResponse = SessionEndResponse;
1828
+ declare const api_SessionEndResponseSchema: typeof SessionEndResponseSchema;
1829
+ type api_SessionEndResult = SessionEndResult;
1830
+ declare const api_SessionEndResultSchema: typeof SessionEndResultSchema;
1831
+ type api_SessionHeaders = SessionHeaders;
1832
+ declare const api_SessionHeadersSchema: typeof SessionHeadersSchema;
1833
+ type api_SessionIdParams = SessionIdParams;
1834
+ declare const api_SessionIdParamsSchema: typeof SessionIdParamsSchema;
1835
+ type api_SessionStartRequest = SessionStartRequest;
1836
+ declare const api_SessionStartRequestSchema: typeof SessionStartRequestSchema;
1837
+ type api_SessionStartResponse = SessionStartResponse;
1838
+ declare const api_SessionStartResponseSchema: typeof SessionStartResponseSchema;
1839
+ type api_SessionStartResult = SessionStartResult;
1840
+ declare const api_SessionStartResultSchema: typeof SessionStartResultSchema;
1841
+ type api_StreamEvent = StreamEvent;
1842
+ type api_StreamEventLogData = StreamEventLogData;
1843
+ declare const api_StreamEventLogDataSchema: typeof StreamEventLogDataSchema;
1844
+ declare const api_StreamEventSchema: typeof StreamEventSchema;
1845
+ type api_StreamEventStatus = StreamEventStatus;
1846
+ declare const api_StreamEventStatusSchema: typeof StreamEventStatusSchema;
1847
+ type api_StreamEventSystemData = StreamEventSystemData;
1848
+ declare const api_StreamEventSystemDataSchema: typeof StreamEventSystemDataSchema;
1849
+ type api_StreamEventType = StreamEventType;
1850
+ declare const api_StreamEventTypeSchema: typeof StreamEventTypeSchema;
1851
+ type api_TokenUsage = TokenUsage;
1852
+ declare const api_TokenUsageSchema: typeof TokenUsageSchema;
1853
+ declare const api_openApiLinks: typeof openApiLinks;
1854
+ declare const api_openApiSecuritySchemes: typeof openApiSecuritySchemes;
1855
+ declare namespace api {
1856
+ export { api_ActOptionsSchema as ActOptionsSchema, type api_ActRequest as ActRequest, api_ActRequestSchema as ActRequestSchema, type api_ActResponse as ActResponse, api_ActResponseSchema as ActResponseSchema, type ActResult$1 as ActResult, type api_ActResultData as ActResultData, api_ActResultDataSchema as ActResultDataSchema, api_ActResultSchema as ActResultSchema, type Action$1 as Action, api_ActionSchema as ActionSchema, type AgentAction$1 as AgentAction, api_AgentActionSchema as AgentActionSchema, api_AgentConfigSchema as AgentConfigSchema, api_AgentExecuteOptionsSchema as AgentExecuteOptionsSchema, type api_AgentExecuteRequest as AgentExecuteRequest, api_AgentExecuteRequestSchema as AgentExecuteRequestSchema, type api_AgentExecuteResponse as AgentExecuteResponse, api_AgentExecuteResponseSchema as AgentExecuteResponseSchema, type api_AgentExecuteResult as AgentExecuteResult, api_AgentExecuteResultSchema as AgentExecuteResultSchema, type api_AgentResultData as AgentResultData, api_AgentResultDataSchema as AgentResultDataSchema, type api_AgentUsage as AgentUsage, api_AgentUsageSchema as AgentUsageSchema, type api_BrowserConfig as BrowserConfig, api_BrowserConfigSchema as BrowserConfigSchema, type api_BrowserbaseBrowserSettings as BrowserbaseBrowserSettings, api_BrowserbaseBrowserSettingsSchema as BrowserbaseBrowserSettingsSchema, type api_BrowserbaseContext as BrowserbaseContext, api_BrowserbaseContextSchema as BrowserbaseContextSchema, type api_BrowserbaseFingerprint as BrowserbaseFingerprint, api_BrowserbaseFingerprintSchema as BrowserbaseFingerprintSchema, type api_BrowserbaseFingerprintScreen as BrowserbaseFingerprintScreen, api_BrowserbaseFingerprintScreenSchema as BrowserbaseFingerprintScreenSchema, type api_BrowserbaseProxyConfig as BrowserbaseProxyConfig, api_BrowserbaseProxyConfigSchema as BrowserbaseProxyConfigSchema, type api_BrowserbaseProxyGeolocation as BrowserbaseProxyGeolocation, api_BrowserbaseProxyGeolocationSchema as BrowserbaseProxyGeolocationSchema, type api_BrowserbaseSessionCreateParams as BrowserbaseSessionCreateParams, api_BrowserbaseSessionCreateParamsSchema as BrowserbaseSessionCreateParamsSchema, type api_BrowserbaseViewport as BrowserbaseViewport, api_BrowserbaseViewportSchema as BrowserbaseViewportSchema, api_ErrorResponseSchema as ErrorResponseSchema, type api_ExternalProxyConfig as ExternalProxyConfig, api_ExternalProxyConfigSchema as ExternalProxyConfigSchema, api_ExtractOptionsSchema as ExtractOptionsSchema, type api_ExtractRequest as ExtractRequest, api_ExtractRequestSchema as ExtractRequestSchema, type api_ExtractResponse as ExtractResponse, api_ExtractResponseSchema as ExtractResponseSchema, type ExtractResult$1 as ExtractResult, api_ExtractResultSchema as ExtractResultSchema, api_LocalBrowserLaunchOptionsSchema as LocalBrowserLaunchOptionsSchema, type api_ModelConfig as ModelConfig, api_ModelConfigObjectSchema as ModelConfigObjectSchema, api_ModelConfigSchema as ModelConfigSchema, api_ModelNameSchema as ModelNameSchema, api_NavigateOptionsSchema as NavigateOptionsSchema, type api_NavigateRequest as NavigateRequest, api_NavigateRequestSchema as NavigateRequestSchema, type api_NavigateResponse as NavigateResponse, api_NavigateResponseSchema as NavigateResponseSchema, type api_NavigateResult as NavigateResult, api_NavigateResultSchema as NavigateResultSchema, api_ObserveOptionsSchema as ObserveOptionsSchema, type api_ObserveRequest as ObserveRequest, api_ObserveRequestSchema as ObserveRequestSchema, type api_ObserveResponse as ObserveResponse, api_ObserveResponseSchema as ObserveResponseSchema, type api_ObserveResult as ObserveResult, api_ObserveResultSchema as ObserveResultSchema, api_Operations as Operations, api_ProxyConfigSchema as ProxyConfigSchema, type api_ReplayAction as ReplayAction, api_ReplayActionSchema as ReplayActionSchema, type api_ReplayPage as ReplayPage, api_ReplayPageSchema as ReplayPageSchema, type api_ReplayResponse as ReplayResponse, api_ReplayResponseSchema as ReplayResponseSchema, type api_ReplayResult as ReplayResult, api_ReplayResultSchema as ReplayResultSchema, api_SessionEndRequestSchema as SessionEndRequestSchema, type api_SessionEndResponse as SessionEndResponse, api_SessionEndResponseSchema as SessionEndResponseSchema, type api_SessionEndResult as SessionEndResult, api_SessionEndResultSchema as SessionEndResultSchema, type api_SessionHeaders as SessionHeaders, api_SessionHeadersSchema as SessionHeadersSchema, type api_SessionIdParams as SessionIdParams, api_SessionIdParamsSchema as SessionIdParamsSchema, type api_SessionStartRequest as SessionStartRequest, api_SessionStartRequestSchema as SessionStartRequestSchema, type api_SessionStartResponse as SessionStartResponse, api_SessionStartResponseSchema as SessionStartResponseSchema, type api_SessionStartResult as SessionStartResult, api_SessionStartResultSchema as SessionStartResultSchema, type api_StreamEvent as StreamEvent, type api_StreamEventLogData as StreamEventLogData, api_StreamEventLogDataSchema as StreamEventLogDataSchema, api_StreamEventSchema as StreamEventSchema, type api_StreamEventStatus as StreamEventStatus, api_StreamEventStatusSchema as StreamEventStatusSchema, type api_StreamEventSystemData as StreamEventSystemData, api_StreamEventSystemDataSchema as StreamEventSystemDataSchema, type api_StreamEventType as StreamEventType, api_StreamEventTypeSchema as StreamEventTypeSchema, type api_TokenUsage as TokenUsage, api_TokenUsageSchema as TokenUsageSchema, api_openApiLinks as openApiLinks, api_openApiSecuritySchemes as openApiSecuritySchemes };
1857
+ }
1858
+
519
1859
  declare class StagehandAPIError extends Error {
520
1860
  constructor(message: string);
521
1861
  }
@@ -614,37 +1954,35 @@ interface StagehandMetrics {
614
1954
  }
615
1955
 
616
1956
  type V3Env = "LOCAL" | "BROWSERBASE";
617
- /** Local launch options for V3 (chrome-launcher + CDP).
618
- * Matches v2 shape where feasible; unsupported fields are accepted but ignored.
619
- */
620
- interface LocalBrowserLaunchOptions {
621
- args?: string[];
622
- executablePath?: string;
623
- userDataDir?: string;
624
- preserveUserDataDir?: boolean;
625
- headless?: boolean;
626
- devtools?: boolean;
627
- chromiumSandbox?: boolean;
628
- ignoreDefaultArgs?: boolean | string[];
629
- proxy?: {
630
- server: string;
631
- bypass?: string;
632
- username?: string;
633
- password?: string;
634
- };
635
- locale?: string;
636
- viewport?: {
637
- width: number;
638
- height: number;
639
- };
640
- deviceScaleFactor?: number;
641
- hasTouch?: boolean;
642
- ignoreHTTPSErrors?: boolean;
643
- cdpUrl?: string;
644
- connectTimeoutMs?: number;
645
- downloadsPath?: string;
646
- acceptDownloads?: boolean;
647
- }
1957
+ declare const localBrowserLaunchOptionsSchema: z.ZodObject<{
1958
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
1959
+ executablePath: z.ZodOptional<z.ZodString>;
1960
+ userDataDir: z.ZodOptional<z.ZodString>;
1961
+ preserveUserDataDir: z.ZodOptional<z.ZodBoolean>;
1962
+ headless: z.ZodOptional<z.ZodBoolean>;
1963
+ devtools: z.ZodOptional<z.ZodBoolean>;
1964
+ chromiumSandbox: z.ZodOptional<z.ZodBoolean>;
1965
+ ignoreDefaultArgs: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
1966
+ proxy: z.ZodOptional<z.ZodObject<{
1967
+ server: z.ZodString;
1968
+ bypass: z.ZodOptional<z.ZodString>;
1969
+ username: z.ZodOptional<z.ZodString>;
1970
+ password: z.ZodOptional<z.ZodString>;
1971
+ }, z.core.$strip>>;
1972
+ locale: z.ZodOptional<z.ZodString>;
1973
+ viewport: z.ZodOptional<z.ZodObject<{
1974
+ width: z.ZodNumber;
1975
+ height: z.ZodNumber;
1976
+ }, z.core.$strip>>;
1977
+ deviceScaleFactor: z.ZodOptional<z.ZodNumber>;
1978
+ hasTouch: z.ZodOptional<z.ZodBoolean>;
1979
+ ignoreHTTPSErrors: z.ZodOptional<z.ZodBoolean>;
1980
+ cdpUrl: z.ZodOptional<z.ZodString>;
1981
+ connectTimeoutMs: z.ZodOptional<z.ZodNumber>;
1982
+ downloadsPath: z.ZodOptional<z.ZodString>;
1983
+ acceptDownloads: z.ZodOptional<z.ZodBoolean>;
1984
+ }, z.core.$strict>;
1985
+ type LocalBrowserLaunchOptions = z.infer<typeof LocalBrowserLaunchOptionsSchema>;
648
1986
  /** Constructor options for V3 */
649
1987
  interface V3Options {
650
1988
  env: V3Env;
@@ -653,9 +1991,7 @@ interface V3Options {
653
1991
  /**
654
1992
  * Optional: fine-tune Browserbase session creation or resume an existing session.
655
1993
  */
656
- browserbaseSessionCreateParams?: Omit<Browserbase.Sessions.SessionCreateParams, "projectId"> & {
657
- projectId?: string;
658
- };
1994
+ browserbaseSessionCreateParams?: BrowserbaseSessionCreateParams;
659
1995
  browserbaseSessionID?: string;
660
1996
  localBrowserLaunchOptions?: LocalBrowserLaunchOptions;
661
1997
  model?: ModelConfiguration;
@@ -665,6 +2001,8 @@ interface V3Options {
665
2001
  experimental?: boolean;
666
2002
  verbose?: 0 | 1 | 2;
667
2003
  selfHeal?: boolean;
2004
+ waitForCaptchaSolves?: boolean;
2005
+ actTimeoutMs?: number;
668
2006
  /** Disable pino logging backend (useful for tests or minimal environments). */
669
2007
  disablePino?: boolean;
670
2008
  /** Optional external logger hook for integrating with host apps. */
@@ -816,6 +2154,9 @@ declare class AgentAbortError extends StagehandError {
816
2154
  readonly reason: string;
817
2155
  constructor(reason?: string);
818
2156
  }
2157
+ declare class StagehandClosedError extends StagehandError {
2158
+ constructor();
2159
+ }
819
2160
 
820
2161
  declare class AISdkClient extends LLMClient {
821
2162
  type: "aisdk";
@@ -826,135 +2167,81 @@ declare class AISdkClient extends LLMClient {
826
2167
  createChatCompletion<T = ChatCompletion>({ options, }: CreateChatCompletionOptions): Promise<T>;
827
2168
  }
828
2169
 
2170
+ /**
2171
+ * Constructor parameters for StagehandAPIClient
2172
+ */
829
2173
  interface StagehandAPIConstructorParams {
830
2174
  apiKey: string;
831
2175
  projectId: string;
832
2176
  logger: (message: LogLine) => void;
833
2177
  }
834
- interface StartSessionParams {
835
- modelName: string;
2178
+ /**
2179
+ * Parameters for starting a session via the API client.
2180
+ * Extends Api.SessionStartRequest with client-specific field (modelApiKey).
2181
+ *
2182
+ * Wire format: Api.SessionStartRequest (modelApiKey sent via header, not body)
2183
+ */
2184
+ interface ClientSessionStartParams extends SessionStartRequest {
2185
+ /** Model API key - sent via x-model-api-key header, not in request body */
836
2186
  modelApiKey: string;
837
- domSettleTimeoutMs: number;
838
- verbose: number;
839
- systemPrompt?: string;
840
- browserbaseSessionCreateParams?: Omit<Browserbase.Sessions.SessionCreateParams, "projectId"> & {
841
- projectId?: string;
842
- };
843
- selfHeal?: boolean;
844
- browserbaseSessionID?: string;
845
- }
846
- interface StartSessionResult {
847
- sessionId: string;
848
- available?: boolean;
849
2187
  }
850
- interface APIActParameters {
851
- input: string | Action;
2188
+ /**
2189
+ * Client parameters for act() method.
2190
+ * Derives structure from Api.ActRequest but uses SDK's ActOptions (which includes `page`).
2191
+ * Before serialization, `page` is stripped to produce Api.ActRequest wire format.
2192
+ */
2193
+ interface ClientActParameters {
2194
+ input: ActRequest["input"];
852
2195
  options?: ActOptions;
853
- frameId?: string;
2196
+ frameId?: ActRequest["frameId"];
854
2197
  }
855
- interface APIExtractParameters {
856
- instruction?: string;
857
- schema?: StagehandZodSchema;
858
- options?: ExtractOptions;
859
- frameId?: string;
860
- }
861
- interface APIObserveParameters {
862
- instruction?: string;
863
- options?: ObserveOptions;
864
- frameId?: string;
865
- }
866
- interface SerializableResponse {
867
- requestId: string;
868
- frameId?: string;
869
- loaderId?: string;
870
- response: Protocol.Network.Response;
871
- fromServiceWorkerFlag?: boolean;
872
- finishedSettled?: boolean;
873
- extraInfoHeaders?: Protocol.Network.Headers | null;
874
- extraInfoHeadersText?: string;
875
- }
876
-
877
2198
  /**
878
- * Represents a path through a Zod schema from the root object down to a
879
- * particular field. The `segments` array describes the chain of keys/indices.
880
- *
881
- * - **String** segments indicate object property names.
882
- * - **Number** segments indicate array indices.
883
- *
884
- * For example, `["users", 0, "homepage"]` might describe reaching
885
- * the `homepage` field in `schema.users[0].homepage`.
2199
+ * Client parameters for extract() method.
2200
+ * Derives structure from Api.ExtractRequest but uses SDK's ExtractOptions (which includes `page`)
2201
+ * and accepts Zod schema (converted to JSON schema for wire format).
886
2202
  */
887
- interface ZodPathSegments {
888
- /**
889
- * The ordered list of keys/indices leading from the schema root
890
- * to the targeted field.
891
- */
892
- segments: Array<string | number>;
2203
+ interface ClientExtractParameters {
2204
+ instruction?: ExtractRequest["instruction"];
2205
+ schema?: StagehandZodSchema;
2206
+ options?: ExtractOptions;
2207
+ frameId?: ExtractRequest["frameId"];
893
2208
  }
894
- type InitScriptSource<Arg> = string | {
895
- path?: string;
896
- content?: string;
897
- } | ((arg: Arg) => unknown);
898
-
899
- type EvaluateOptions = {
900
- /** The question to ask about the task state */
901
- question: string;
902
- /** The answer to the question */
903
- answer?: string;
904
- /** Whether to take a screenshot of the task state, or array of screenshots to evaluate */
905
- screenshot?: boolean | Buffer[];
906
- /** Custom system prompt for the evaluator */
907
- systemPrompt?: string;
908
- /** Delay in milliseconds before taking the screenshot @default 250 */
909
- screenshotDelayMs?: number;
910
- /** The agent's reasoning/thought process for completing the task */
911
- agentReasoning?: string;
912
- };
913
- type BatchAskOptions = {
914
- /** Array of questions with optional answers */
915
- questions: Array<{
916
- question: string;
917
- answer?: string;
918
- }>;
919
- /** Whether to take a screenshot of the task state */
920
- screenshot?: boolean;
921
- /** Custom system prompt for the evaluator */
922
- systemPrompt?: string;
923
- /** Delay in milliseconds before taking the screenshot @default 1000 */
924
- screenshotDelayMs?: number;
925
- };
926
2209
  /**
927
- * Result of an evaluation
2210
+ * Client parameters for observe() method.
2211
+ * Derives structure from Api.ObserveRequest but uses SDK's ObserveOptions (which includes `page`).
2212
+ * Before serialization, `page` is stripped to produce Api.ObserveRequest wire format.
928
2213
  */
929
- interface EvaluationResult {
930
- /**
931
- * The evaluation result ('YES', 'NO', or 'INVALID' if parsing failed or value was unexpected)
932
- */
933
- evaluation: "YES" | "NO" | "INVALID";
934
- /**
935
- * The reasoning behind the evaluation
936
- */
937
- reasoning: string;
2214
+ interface ClientObserveParameters {
2215
+ instruction?: ObserveRequest["instruction"];
2216
+ options?: ObserveOptions;
2217
+ frameId?: ObserveRequest["frameId"];
938
2218
  }
939
-
940
2219
  declare class StagehandAPIClient {
941
2220
  private apiKey;
942
2221
  private projectId;
943
2222
  private sessionId?;
944
2223
  private modelApiKey;
2224
+ private modelProvider?;
945
2225
  private logger;
946
2226
  private fetchWithCookies;
947
2227
  constructor({ apiKey, projectId, logger }: StagehandAPIConstructorParams);
948
- init({ modelName, modelApiKey, domSettleTimeoutMs, verbose, systemPrompt, selfHeal, browserbaseSessionCreateParams, browserbaseSessionID, }: StartSessionParams): Promise<StartSessionResult>;
949
- act({ input, options, frameId }: APIActParameters): Promise<ActResult>;
950
- extract<T extends StagehandZodSchema>({ instruction, schema: zodSchema, options, frameId, }: APIExtractParameters): Promise<ExtractResult<T>>;
951
- observe({ instruction, options, frameId, }: APIObserveParameters): Promise<Action[]>;
952
- goto(url: string, options?: {
953
- waitUntil?: "load" | "domcontentloaded" | "networkidle";
954
- }, frameId?: string): Promise<SerializableResponse | null>;
2228
+ init({ modelName, modelApiKey, domSettleTimeoutMs, verbose, systemPrompt, selfHeal, browserbaseSessionCreateParams, browserbaseSessionID, }: ClientSessionStartParams): Promise<SessionStartResult>;
2229
+ act({ input, options, frameId, }: ClientActParameters): Promise<ActResult>;
2230
+ extract<T extends StagehandZodSchema>({ instruction, schema: zodSchema, options, frameId, }: ClientExtractParameters): Promise<ExtractResult<T>>;
2231
+ observe({ instruction, options, frameId, }: ClientObserveParameters): Promise<Action[]>;
2232
+ goto(url: string, options?: NavigateRequest["options"], frameId?: string): Promise<SerializableResponse | null>;
955
2233
  agentExecute(agentConfig: AgentConfig, executeOptions: AgentExecuteOptions | string, frameId?: string): Promise<AgentResult>;
956
2234
  end(): Promise<Response>;
957
2235
  getReplayMetrics(): Promise<StagehandMetrics>;
2236
+ /**
2237
+ * Prepares a model configuration for the API payload by ensuring the `apiKey`
2238
+ * is included. If the model is passed as a string, converts it to an object
2239
+ * with `modelName` and `apiKey`.
2240
+ *
2241
+ * In API mode, we only attempt to load an API key from env vars when the
2242
+ * model provider differs from the one used to init the session.
2243
+ */
2244
+ private prepareModelConfig;
958
2245
  private execute;
959
2246
  private request;
960
2247
  }
@@ -1086,7 +2373,7 @@ declare class V3Context {
1086
2373
  awaitActivePage(timeoutMs?: number): Promise<Page>;
1087
2374
  }
1088
2375
 
1089
- type AgentReplayStep = AgentReplayActStep | AgentReplayFillFormStep | AgentReplayGotoStep | AgentReplayScrollStep | AgentReplayWaitStep | AgentReplayNavBackStep | {
2376
+ type AgentReplayStep = AgentReplayActStep | AgentReplayFillFormStep | AgentReplayGotoStep | AgentReplayScrollStep | AgentReplayWaitStep | AgentReplayNavBackStep | AgentReplayKeysStep | {
1090
2377
  type: string;
1091
2378
  [key: string]: unknown;
1092
2379
  };
@@ -1129,6 +2416,16 @@ interface AgentReplayNavBackStep {
1129
2416
  type: "navback";
1130
2417
  waitUntil?: LoadState;
1131
2418
  }
2419
+ interface AgentReplayKeysStep {
2420
+ type: "keys";
2421
+ instruction?: string;
2422
+ playwrightArguments: {
2423
+ method: "type" | "press";
2424
+ text?: string;
2425
+ keys?: string;
2426
+ times?: number;
2427
+ };
2428
+ }
1132
2429
 
1133
2430
  /**
1134
2431
  * Response
@@ -1508,6 +2805,12 @@ declare class Page {
1508
2805
  * Mirrors Playwright's API signatures.
1509
2806
  */
1510
2807
  waitForLoadState(state: LoadState, timeoutMs?: number): Promise<void>;
2808
+ /**
2809
+ * Wait for a specified amount of time.
2810
+ *
2811
+ * @param ms The number of milliseconds to wait.
2812
+ */
2813
+ waitForTimeout(ms: number): Promise<void>;
1511
2814
  /**
1512
2815
  * Evaluate a function or expression in the current main frame's main world.
1513
2816
  * - If a string is provided, it is treated as a JS expression.
@@ -1529,52 +2832,32 @@ declare class Page {
1529
2832
  * on the top-level page target's session. Coordinates are relative to the
1530
2833
  * viewport origin (top-left). Does not scroll.
1531
2834
  */
1532
- click(x: number, y: number, options: {
1533
- button?: "left" | "right" | "middle";
1534
- clickCount?: number;
1535
- returnXpath: true;
1536
- }): Promise<string>;
1537
2835
  click(x: number, y: number, options?: {
1538
2836
  button?: "left" | "right" | "middle";
1539
2837
  clickCount?: number;
1540
- returnXpath?: false;
1541
- }): Promise<void>;
1542
- click(x: number, y: number, options: {
1543
- button?: "left" | "right" | "middle";
1544
- clickCount?: number;
1545
- returnXpath: boolean;
1546
- }): Promise<void | string>;
1547
- scroll(x: number, y: number, deltaX: number, deltaY: number, options: {
1548
- returnXpath: true;
2838
+ returnXpath?: boolean;
2839
+ }): Promise<string>;
2840
+ /**
2841
+ * Hover at absolute page coordinates (CSS pixels).
2842
+ * Dispatches mouseMoved via CDP Input domain on the top-level page target's
2843
+ * session.
2844
+ */
2845
+ hover(x: number, y: number, options?: {
2846
+ returnXpath?: boolean;
1549
2847
  }): Promise<string>;
1550
2848
  scroll(x: number, y: number, deltaX: number, deltaY: number, options?: {
1551
- returnXpath?: false;
1552
- }): Promise<void>;
1553
- scroll(x: number, y: number, deltaX: number, deltaY: number, options: {
1554
- returnXpath: boolean;
1555
- }): Promise<void | string>;
2849
+ returnXpath?: boolean;
2850
+ }): Promise<string>;
1556
2851
  /**
1557
2852
  * Drag from (fromX, fromY) to (toX, toY) using mouse events.
1558
2853
  * Sends mouseMoved → mousePressed → mouseMoved (steps) → mouseReleased.
1559
2854
  */
1560
- dragAndDrop(fromX: number, fromY: number, toX: number, toY: number, options: {
1561
- button?: "left" | "right" | "middle";
1562
- steps?: number;
1563
- delay?: number;
1564
- returnXpath: true;
1565
- }): Promise<[string, string]>;
1566
2855
  dragAndDrop(fromX: number, fromY: number, toX: number, toY: number, options?: {
1567
2856
  button?: "left" | "right" | "middle";
1568
2857
  steps?: number;
1569
2858
  delay?: number;
1570
- returnXpath?: false;
1571
- }): Promise<void>;
1572
- dragAndDrop(fromX: number, fromY: number, toX: number, toY: number, options: {
1573
- button?: "left" | "right" | "middle";
1574
- steps?: number;
1575
- delay?: number;
1576
- returnXpath: boolean;
1577
- }): Promise<void | [string, string]>;
2859
+ returnXpath?: boolean;
2860
+ }): Promise<[string, string]>;
1578
2861
  /**
1579
2862
  * Type a string by dispatching keyDown/keyUp events per character.
1580
2863
  * Focus must already be on the desired element. Uses CDP Input.dispatchKeyEvent
@@ -1598,7 +2881,7 @@ declare class Page {
1598
2881
  private keyDown;
1599
2882
  /** Release a pressed key */
1600
2883
  private keyUp;
1601
- /** Normalize modifier key names to match CDP expectations */
2884
+ /** Normalize key names to match CDP expectations */
1602
2885
  private normalizeModifierKey;
1603
2886
  /**
1604
2887
  * Get the map of named keys with their properties
@@ -1672,6 +2955,12 @@ interface AgentResult {
1672
2955
  * @experimental
1673
2956
  */
1674
2957
  messages?: ModelMessage[];
2958
+ /**
2959
+ * Custom output data extracted based on the `output` schema provided in execute options.
2960
+ * Only populated if an `output` schema was provided.
2961
+ * @experimental
2962
+ */
2963
+ output?: Record<string, unknown>;
1675
2964
  }
1676
2965
  type AgentStreamResult = StreamTextResult<ToolSet, never> & {
1677
2966
  result: Promise<AgentResult>;
@@ -1697,6 +2986,11 @@ interface AgentCallbacks {
1697
2986
  * This provides a clear error message when users try to use streaming callbacks without stream: true.
1698
2987
  */
1699
2988
  type StreamingCallbackNotAvailable = "This callback requires 'stream: true' in AgentConfig. Set stream: true to use streaming callbacks like onChunk, onFinish, onError, and onAbort.";
2989
+ /**
2990
+ * Error message for safety confirmation callback misuse.
2991
+ * Safety confirmations are only available for non-streaming CUA agent executions.
2992
+ */
2993
+ type SafetyConfirmationCallbackNotAvailable = "Safety confirmation callbacks are only available via non-streaming AgentExecuteOptions.callbacks when using mode: 'cua'.";
1700
2994
  /**
1701
2995
  * Callbacks specific to the non-streaming execute method.
1702
2996
  */
@@ -1705,6 +2999,11 @@ interface AgentExecuteCallbacks extends AgentCallbacks {
1705
2999
  * Callback called when each step (LLM call) is finished.
1706
3000
  */
1707
3001
  onStepFinish?: GenerateTextOnStepFinishCallback<ToolSet>;
3002
+ /**
3003
+ * Callback for handling safety confirmation requests from CUA providers.
3004
+ * Only available when running an agent configured with mode: "cua".
3005
+ */
3006
+ onSafetyConfirmation?: SafetyConfirmationHandler;
1708
3007
  /**
1709
3008
  * NOT AVAILABLE in non-streaming mode.
1710
3009
  * This callback requires `stream: true` in AgentConfig.
@@ -1794,6 +3093,11 @@ interface AgentStreamCallbacks extends AgentCallbacks {
1794
3093
  onAbort?: (event: {
1795
3094
  steps: Array<StepResult<ToolSet>>;
1796
3095
  }) => PromiseLike<void> | void;
3096
+ /**
3097
+ * NOT AVAILABLE in streaming mode.
3098
+ * Safety confirmations currently require non-streaming execute() on CUA agents.
3099
+ */
3100
+ onSafetyConfirmation?: SafetyConfirmationCallbackNotAvailable;
1797
3101
  }
1798
3102
  /**
1799
3103
  * Base options for agent execution (without callbacks).
@@ -1826,6 +3130,79 @@ interface AgentExecuteOptionsBase {
1826
3130
  * ```
1827
3131
  */
1828
3132
  signal?: AbortSignal;
3133
+ /**
3134
+ * Tools to exclude from this execution.
3135
+ * Pass an array of tool names to prevent the agent from using those tools.
3136
+ *
3137
+ * **Note:** Not supported in CUA mode (`mode: "cua"`).
3138
+ *
3139
+ * **Available tools by mode:**
3140
+ *
3141
+ * **DOM mode (default):**
3142
+ * - `act` - Perform semantic actions (click, type, etc.)
3143
+ * - `fillForm` - Fill form fields using DOM selectors
3144
+ * - `ariaTree` - Get accessibility tree of the page
3145
+ * - `extract` - Extract structured data from page
3146
+ * - `goto` - Navigate to a URL
3147
+ * - `scroll` - Scroll using semantic directions (up/down/left/right)
3148
+ * - `keys` - Press keyboard keys
3149
+ * - `navback` - Navigate back in history
3150
+ * - `screenshot` - Take a screenshot
3151
+ * - `think` - Agent reasoning/planning step
3152
+ * - `wait` - Wait for time or condition
3153
+ * - `close` - Mark task as complete
3154
+ * - `search` - Web search (requires BRAVE_API_KEY)
3155
+ *
3156
+ * **Hybrid mode:**
3157
+ * - `click` - Click at specific coordinates
3158
+ * - `type` - Type text at coordinates
3159
+ * - `dragAndDrop` - Drag from one point to another
3160
+ * - `clickAndHold` - Click and hold at coordinates
3161
+ * - `fillFormVision` - Fill forms using vision/coordinates
3162
+ * - `act` - Perform semantic actions
3163
+ * - `ariaTree` - Get accessibility tree
3164
+ * - `extract` - Extract data from page
3165
+ * - `goto` - Navigate to URL
3166
+ * - `scroll` - Scroll using coordinates
3167
+ * - `keys` - Press keyboard keys
3168
+ * - `navback` - Navigate back
3169
+ * - `screenshot` - Take screenshot
3170
+ * - `think` - Agent reasoning step
3171
+ * - `wait` - Wait for time/condition
3172
+ * - `close` - Mark task complete
3173
+ * - `search` - Web search (requires BRAVE_API_KEY)
3174
+ *
3175
+ * @experimental
3176
+ * @example
3177
+ * ```typescript
3178
+ * // Exclude screenshot and extract tools
3179
+ * const result = await agent.execute({
3180
+ * instruction: "Click the submit button",
3181
+ * excludeTools: ["screenshot", "extract"]
3182
+ * });
3183
+ * ```
3184
+ */
3185
+ excludeTools?: string[];
3186
+ /**
3187
+ * A Zod schema defining custom output data to return when the task completes.
3188
+ * The agent will populate this data in the final close tool call.
3189
+ *
3190
+ * @experimental
3191
+ * @example
3192
+ * ```typescript
3193
+ * const result = await agent.execute({
3194
+ * instruction: "Find the cheapest flight from NYC to LA",
3195
+ * output: z.object({
3196
+ * price: z.string().describe("The price of the flight"),
3197
+ * airline: z.string().describe("The airline name"),
3198
+ * departureTime: z.string().describe("Departure time"),
3199
+ * }),
3200
+ * });
3201
+ *
3202
+ * console.log(result.output); // { price: "$199", airline: "Delta", departureTime: "8:00 AM" }
3203
+ * ```
3204
+ */
3205
+ output?: StagehandZodObject;
1829
3206
  }
1830
3207
  /**
1831
3208
  * Options for non-streaming agent execution.
@@ -1850,7 +3227,7 @@ interface AgentStreamExecuteOptions extends AgentExecuteOptionsBase {
1850
3227
  callbacks?: AgentStreamCallbacks;
1851
3228
  }
1852
3229
  type AgentType = "openai" | "anthropic" | "google" | "microsoft";
1853
- declare const AVAILABLE_CUA_MODELS: readonly ["openai/computer-use-preview", "openai/computer-use-preview-2025-03-11", "anthropic/claude-3-7-sonnet-latest", "anthropic/claude-opus-4-5-20251101", "anthropic/claude-haiku-4-5-20251001", "anthropic/claude-sonnet-4-20250514", "anthropic/claude-sonnet-4-5-20250929", "google/gemini-2.5-computer-use-preview-10-2025", "microsoft/fara-7b"];
3230
+ declare const AVAILABLE_CUA_MODELS: readonly ["openai/computer-use-preview", "openai/computer-use-preview-2025-03-11", "anthropic/claude-3-7-sonnet-latest", "anthropic/claude-opus-4-5-20251101", "anthropic/claude-haiku-4-5-20251001", "anthropic/claude-sonnet-4-20250514", "anthropic/claude-sonnet-4-5-20250929", "google/gemini-2.5-computer-use-preview-10-2025", "google/gemini-3-flash-computer-use", "microsoft/fara-7b"];
1854
3231
  type AvailableCuaModel = (typeof AVAILABLE_CUA_MODELS)[number];
1855
3232
  interface AgentExecutionOptions<TOptions extends AgentExecuteOptions = AgentExecuteOptions> {
1856
3233
  options: TOptions;
@@ -1868,6 +3245,52 @@ interface ActionExecutionResult {
1868
3245
  error?: string;
1869
3246
  data?: unknown;
1870
3247
  }
3248
+ /**
3249
+ * Represents a safety check that requires user confirmation before proceeding.
3250
+ * These are issued by CUA providers (OpenAI, Google) when the agent attempts
3251
+ * potentially risky actions.
3252
+ */
3253
+ interface SafetyCheck {
3254
+ /** Unique identifier for this safety check */
3255
+ id: string;
3256
+ /** Code identifying the type of safety concern */
3257
+ code: string;
3258
+ /** Human-readable description of the safety concern */
3259
+ message: string;
3260
+ }
3261
+ /**
3262
+ * Response from the user for a safety confirmation request.
3263
+ */
3264
+ interface SafetyConfirmationResponse {
3265
+ /** Whether the user acknowledged/approved the safety checks */
3266
+ acknowledged: boolean;
3267
+ }
3268
+ /**
3269
+ * Callback for handling safety confirmation requests.
3270
+ * Called when the CUA provider issues safety checks that require user confirmation.
3271
+ * The callback should return a promise that resolves when the user has made a decision.
3272
+ *
3273
+ * @param safetyChecks - Array of safety checks requiring confirmation
3274
+ * @returns Promise resolving to the user's response
3275
+ *
3276
+ * @example
3277
+ * ```typescript
3278
+ * const agent = stagehand.agent({
3279
+ * mode: "cua",
3280
+ * });
3281
+ * await agent.execute({
3282
+ * instruction: "...",
3283
+ * callbacks: {
3284
+ * onSafetyConfirmation: async (checks) => {
3285
+ * console.log("Safety checks:", checks);
3286
+ * const userApproved = await showConfirmationDialog(checks);
3287
+ * return { acknowledged: userApproved };
3288
+ * },
3289
+ * },
3290
+ * });
3291
+ * ```
3292
+ */
3293
+ type SafetyConfirmationHandler = (safetyChecks: SafetyCheck[]) => Promise<SafetyConfirmationResponse>;
1871
3294
  interface ToolUseItem extends ResponseItem {
1872
3295
  type: "tool_use";
1873
3296
  id: string;
@@ -1945,6 +3368,13 @@ type AgentProviderType = AgentType;
1945
3368
  type AgentModelConfig<TModelName extends string = string> = {
1946
3369
  modelName: TModelName;
1947
3370
  } & Record<string, unknown>;
3371
+ /**
3372
+ * Agent tool mode determines which set of tools are available to the agent.
3373
+ * - 'dom': Uses DOM-based tools (act, fillForm) - better for structured page interactions
3374
+ * - 'hybrid': Uses coordinate-based tools (click, type, dragAndDrop, etc.) - better for visual/screenshot-based interactions
3375
+ * - 'cua': Uses Computer Use Agent (CUA) providers like Anthropic Claude or Google Gemini for screenshot-based automation
3376
+ */
3377
+ type AgentToolMode = "dom" | "hybrid" | "cua";
1948
3378
  type AgentConfig = {
1949
3379
  /**
1950
3380
  * Custom system prompt to provide to the agent. Overrides the default system prompt.
@@ -1959,7 +3389,8 @@ type AgentConfig = {
1959
3389
  */
1960
3390
  tools?: ToolSet;
1961
3391
  /**
1962
- * Indicates CUA is disabled for this configuration
3392
+ * @deprecated Use `mode: "cua"` instead. This option will be removed in a future version.
3393
+ * Enables Computer Use Agent (CUA) mode.
1963
3394
  */
1964
3395
  cua?: boolean;
1965
3396
  /**
@@ -1978,6 +3409,14 @@ type AgentConfig = {
1978
3409
  * When false (default), execute() returns AgentResult after completion.
1979
3410
  */
1980
3411
  stream?: boolean;
3412
+ /**
3413
+ * Tool mode for the agent. Determines which set of tools are available.
3414
+ * - 'dom' (default): Uses DOM-based tools (act, fillForm) for structured interactions
3415
+ * - 'hybrid': Uses coordinate-based tools (click, type, dragAndDrop, clickAndHold, fillFormVision)
3416
+ * for visual/screenshot-based interactions
3417
+ * - 'cua': Uses Computer Use Agent (CUA) providers for screenshot-based automation
3418
+ */
3419
+ mode?: AgentToolMode;
1981
3420
  };
1982
3421
  /**
1983
3422
  * Agent instance returned when stream: true is set in AgentConfig.
@@ -1995,6 +3434,63 @@ interface StreamingAgentInstance {
1995
3434
  interface NonStreamingAgentInstance {
1996
3435
  execute: (instructionOrOptions: string | AgentExecuteOptions) => Promise<AgentResult>;
1997
3436
  }
3437
+ /**
3438
+ * Content item type for toModelOutput return values.
3439
+ * Used in tool definitions to return text and/or media to the model.
3440
+ */
3441
+ type ModelOutputContentItem = {
3442
+ type: "text";
3443
+ text: string;
3444
+ } | {
3445
+ type: "media";
3446
+ mediaType: string;
3447
+ data: string;
3448
+ };
3449
+ interface ClickToolResult {
3450
+ success: boolean;
3451
+ describe?: string;
3452
+ coordinates?: number[];
3453
+ error?: string;
3454
+ screenshotBase64?: string;
3455
+ }
3456
+ interface TypeToolResult {
3457
+ success: boolean;
3458
+ describe?: string;
3459
+ text?: string;
3460
+ error?: string;
3461
+ screenshotBase64?: string;
3462
+ }
3463
+ interface DragAndDropToolResult {
3464
+ success: boolean;
3465
+ describe?: string;
3466
+ error?: string;
3467
+ screenshotBase64?: string;
3468
+ }
3469
+ interface FillFormField {
3470
+ action: string;
3471
+ value: string;
3472
+ coordinates: {
3473
+ x: number;
3474
+ y: number;
3475
+ };
3476
+ }
3477
+ interface FillFormVisionToolResult {
3478
+ success: boolean;
3479
+ playwrightArguments?: FillFormField[];
3480
+ error?: string;
3481
+ screenshotBase64?: string;
3482
+ }
3483
+ interface ScrollVisionToolResult {
3484
+ success: boolean;
3485
+ message: string;
3486
+ scrolledPixels: number;
3487
+ screenshotBase64?: string;
3488
+ }
3489
+ interface WaitToolResult {
3490
+ success: boolean;
3491
+ waited: number;
3492
+ screenshotBase64?: string;
3493
+ }
1998
3494
 
1999
3495
  type OpenAIClientOptions = Pick<ClientOptions$1, "baseURL" | "apiKey">;
2000
3496
  type AnthropicClientOptions = Pick<ClientOptions$2, "baseURL" | "apiKey">;
@@ -2196,6 +3692,11 @@ declare class V3 {
2196
3692
  private observeHandler;
2197
3693
  private ctx;
2198
3694
  llmClient: LLMClient;
3695
+ /**
3696
+ * Event bus for internal communication.
3697
+ * Emits events like 'screenshot' when screenshots are captured during agent execution.
3698
+ */
3699
+ readonly bus: EventEmitter;
2199
3700
  private modelName;
2200
3701
  private modelClientOptions;
2201
3702
  private llmProvider;
@@ -2208,6 +3709,10 @@ declare class V3 {
2208
3709
  get browserbaseSessionID(): string | undefined;
2209
3710
  get browserbaseSessionURL(): string | undefined;
2210
3711
  get browserbaseDebugURL(): string | undefined;
3712
+ /**
3713
+ * Returns true if the browser is running on Browserbase.
3714
+ */
3715
+ get isBrowserbase(): boolean;
2211
3716
  private _onCdpClosed;
2212
3717
  readonly experimental: boolean;
2213
3718
  readonly logInferenceToFile: boolean;
@@ -2366,6 +3871,259 @@ declare class AgentProvider {
2366
3871
  static getAgentProvider(modelName: string): AgentProviderType;
2367
3872
  }
2368
3873
 
3874
+ declare const gotoTool: (v3: V3) => ai.Tool<{
3875
+ url: string;
3876
+ }, {
3877
+ success: boolean;
3878
+ url: string;
3879
+ error?: undefined;
3880
+ } | {
3881
+ success: boolean;
3882
+ error: any;
3883
+ url?: undefined;
3884
+ }>;
3885
+
3886
+ declare const actTool: (v3: V3, executionModel?: string) => ai.Tool<{
3887
+ action: string;
3888
+ }, {
3889
+ success: boolean;
3890
+ action: string;
3891
+ playwrightArguments: Action;
3892
+ error?: undefined;
3893
+ } | {
3894
+ success: boolean;
3895
+ error: any;
3896
+ action?: undefined;
3897
+ playwrightArguments?: undefined;
3898
+ }>;
3899
+
3900
+ declare const screenshotTool: (v3: V3) => ai.Tool<Record<string, never>, {
3901
+ base64: string;
3902
+ timestamp: number;
3903
+ pageUrl: string;
3904
+ }>;
3905
+
3906
+ declare const waitTool: (v3: V3, mode?: AgentToolMode) => ai.Tool<{
3907
+ timeMs: number;
3908
+ }, WaitToolResult>;
3909
+
3910
+ declare const navBackTool: (v3: V3) => ai.Tool<{
3911
+ reasoningText: string;
3912
+ }, {
3913
+ success: boolean;
3914
+ }>;
3915
+
3916
+ declare const ariaTreeTool: (v3: V3) => ai.Tool<Record<string, never>, {
3917
+ content: string;
3918
+ pageUrl: string;
3919
+ }>;
3920
+
3921
+ declare const fillFormTool: (v3: V3, executionModel?: string) => ai.Tool<{
3922
+ fields: {
3923
+ action: string;
3924
+ value: string;
3925
+ }[];
3926
+ }, {
3927
+ success: boolean;
3928
+ actions: unknown[];
3929
+ playwrightArguments: Action[];
3930
+ }>;
3931
+
3932
+ /**
3933
+ * Simple scroll tool for DOM mode (non-grounding models).
3934
+ * No coordinates - scrolls from viewport center.
3935
+ */
3936
+ declare const scrollTool: (v3: V3) => ai.Tool<{
3937
+ direction: "up" | "down";
3938
+ percentage?: number;
3939
+ }, {
3940
+ success: boolean;
3941
+ message: string;
3942
+ scrolledPixels: number;
3943
+ }>;
3944
+ /**
3945
+ * Scroll tool for hybrid mode (grounding models).
3946
+ * Supports optional coordinates for scrolling within nested scrollable elements.
3947
+ */
3948
+ declare const scrollVisionTool: (v3: V3, provider?: string) => ai.Tool<{
3949
+ direction: "up" | "down";
3950
+ coordinates?: number[];
3951
+ percentage?: number;
3952
+ }, ScrollVisionToolResult>;
3953
+
3954
+ declare const extractTool: (v3: V3, executionModel?: string, logger?: (message: LogLine) => void) => ai.Tool<{
3955
+ instruction: string;
3956
+ schema?: string;
3957
+ }, {
3958
+ success: boolean;
3959
+ result: any;
3960
+ error?: undefined;
3961
+ } | {
3962
+ success: boolean;
3963
+ error: any;
3964
+ result?: undefined;
3965
+ }>;
3966
+
3967
+ declare const clickTool: (v3: V3, provider?: string) => ai.Tool<{
3968
+ describe: string;
3969
+ coordinates: number[];
3970
+ }, ClickToolResult>;
3971
+
3972
+ declare const typeTool: (v3: V3, provider?: string) => ai.Tool<{
3973
+ describe: string;
3974
+ text: string;
3975
+ coordinates: number[];
3976
+ }, TypeToolResult>;
3977
+
3978
+ declare const dragAndDropTool: (v3: V3, provider?: string) => ai.Tool<{
3979
+ describe: string;
3980
+ startCoordinates: number[];
3981
+ endCoordinates: number[];
3982
+ }, DragAndDropToolResult>;
3983
+
3984
+ declare const clickAndHoldTool: (v3: V3, provider?: string) => ai.Tool<{
3985
+ describe: string;
3986
+ duration: number;
3987
+ coordinates: number[];
3988
+ }, {
3989
+ success: boolean;
3990
+ describe: string;
3991
+ error?: undefined;
3992
+ } | {
3993
+ success: boolean;
3994
+ error: string;
3995
+ describe?: undefined;
3996
+ }>;
3997
+
3998
+ declare const keysTool: (v3: V3) => ai.Tool<{
3999
+ method: "type" | "press";
4000
+ value: string;
4001
+ repeat?: number;
4002
+ }, {
4003
+ success: boolean;
4004
+ method: "type";
4005
+ value: string;
4006
+ times: number;
4007
+ error?: undefined;
4008
+ } | {
4009
+ success: boolean;
4010
+ method: "press";
4011
+ value: string;
4012
+ times: number;
4013
+ error?: undefined;
4014
+ } | {
4015
+ success: boolean;
4016
+ error: string;
4017
+ method?: undefined;
4018
+ value?: undefined;
4019
+ times?: undefined;
4020
+ }>;
4021
+
4022
+ declare const fillFormVisionTool: (v3: V3, provider?: string) => ai.Tool<{
4023
+ fields: {
4024
+ action: string;
4025
+ value: string;
4026
+ coordinates: {
4027
+ x: number;
4028
+ y: number;
4029
+ };
4030
+ }[];
4031
+ }, FillFormVisionToolResult>;
4032
+
4033
+ declare const thinkTool: () => ai.Tool<{
4034
+ reasoning: string;
4035
+ }, {
4036
+ acknowledged: boolean;
4037
+ message: string;
4038
+ }>;
4039
+
4040
+ interface BraveSearchResult {
4041
+ title: string;
4042
+ url: string;
4043
+ description?: string;
4044
+ }
4045
+ declare const searchTool: (v3: V3) => ai.Tool<{
4046
+ query: string;
4047
+ }, {
4048
+ timestamp: number;
4049
+ data?: {
4050
+ results: BraveSearchResult[];
4051
+ };
4052
+ error?: string;
4053
+ }>;
4054
+
4055
+ interface V3AgentToolOptions {
4056
+ executionModel?: string;
4057
+ logger?: (message: LogLine) => void;
4058
+ /**
4059
+ * Tool mode determines which set of tools are available.
4060
+ * - 'dom' (default): Uses DOM-based tools (act, fillForm) - removes coordinate-based tools
4061
+ * - 'hybrid': Uses coordinate-based tools (click, type, dragAndDrop, etc.) - removes fillForm
4062
+ */
4063
+ mode?: AgentToolMode;
4064
+ /**
4065
+ * The model provider. Used for model-specific coordinate handling
4066
+ */
4067
+ provider?: string;
4068
+ /**
4069
+ * Tools to exclude from the available toolset.
4070
+ * These tools will be filtered out after mode-based filtering.
4071
+ */
4072
+ excludeTools?: string[];
4073
+ }
4074
+ declare function createAgentTools(v3: V3, options?: V3AgentToolOptions): ToolSet;
4075
+ type AgentTools = ReturnType<typeof createAgentTools>;
4076
+ /**
4077
+ * Type map of all agent tools for strong typing of tool calls and results.
4078
+ * Note: `search` is optional as it's only available when BRAVE_API_KEY is configured.
4079
+ */
4080
+ type AgentToolTypesMap = {
4081
+ act: ReturnType<typeof actTool>;
4082
+ ariaTree: ReturnType<typeof ariaTreeTool>;
4083
+ click: ReturnType<typeof clickTool>;
4084
+ clickAndHold: ReturnType<typeof clickAndHoldTool>;
4085
+ dragAndDrop: ReturnType<typeof dragAndDropTool>;
4086
+ extract: ReturnType<typeof extractTool>;
4087
+ fillForm: ReturnType<typeof fillFormTool>;
4088
+ fillFormVision: ReturnType<typeof fillFormVisionTool>;
4089
+ goto: ReturnType<typeof gotoTool>;
4090
+ keys: ReturnType<typeof keysTool>;
4091
+ navback: ReturnType<typeof navBackTool>;
4092
+ screenshot: ReturnType<typeof screenshotTool>;
4093
+ scroll: ReturnType<typeof scrollTool> | ReturnType<typeof scrollVisionTool>;
4094
+ search?: ReturnType<typeof searchTool>;
4095
+ think: ReturnType<typeof thinkTool>;
4096
+ type: ReturnType<typeof typeTool>;
4097
+ wait: ReturnType<typeof waitTool>;
4098
+ };
4099
+ /**
4100
+ * Inferred UI tools type for type-safe tool inputs and outputs.
4101
+ * Use with UIMessage for full type safety in UI contexts.
4102
+ */
4103
+ type AgentUITools = InferUITools<AgentToolTypesMap>;
4104
+ /**
4105
+ * Union type for all possible agent tool calls.
4106
+ * Provides type-safe access to tool call arguments.
4107
+ */
4108
+ type AgentToolCall = {
4109
+ [K in keyof AgentToolTypesMap]: {
4110
+ toolName: K;
4111
+ toolCallId: string;
4112
+ args: AgentUITools[K]["input"];
4113
+ };
4114
+ }[keyof AgentToolTypesMap];
4115
+ /**
4116
+ * Union type for all possible agent tool results.
4117
+ * Provides type-safe access to tool result values.
4118
+ */
4119
+ type AgentToolResult = {
4120
+ [K in keyof AgentToolTypesMap]: {
4121
+ toolName: K;
4122
+ toolCallId: string;
4123
+ result: AgentUITools[K]["output"];
4124
+ };
4125
+ }[keyof AgentToolTypesMap];
4126
+
2369
4127
  declare function validateZodSchema(schema: StagehandZodSchema, data: unknown): boolean;
2370
4128
  /**
2371
4129
  * Detects if the code is running in the Bun runtime environment.
@@ -2457,4 +4215,4 @@ declare class V3Evaluator {
2457
4215
  private _evaluateWithMultipleScreenshots;
2458
4216
  }
2459
4217
 
2460
- export { type AISDKCustomProvider, type AISDKProvider, AISdkClient, AVAILABLE_CUA_MODELS, type ActOptions, type ActResult, ActTimeoutError, type Action, type ActionExecutionResult, AgentAbortError, type AgentAction, type AgentCallbacks, type AgentConfig, type AgentContext, type AgentExecuteCallbacks, type AgentExecuteOptions, type AgentExecuteOptionsBase, type AgentExecutionOptions, type AgentHandlerOptions, type AgentInstance, type AgentModelConfig, AgentProvider, type AgentProviderType, type AgentResult, AgentScreenshotProviderError, type AgentState, type AgentStreamCallbacks, type AgentStreamExecuteOptions, type AgentStreamResult, type AgentType, AnnotatedScreenshotText, type AnthropicClientOptions, type AnthropicContentBlock, type AnthropicJsonSchemaObject, type AnthropicMessage, type AnthropicTextBlock, type AnthropicToolResult, type AnyPage, type AvailableCuaModel, type AvailableModel, BrowserbaseSessionNotFoundError, CaptchaTimeoutError, type ChatCompletionOptions, type ChatMessage, type ChatMessageContent, type ChatMessageImageContent, type ChatMessageTextContent, type ClientOptions, type ComputerCallItem, ConnectionTimeoutError, type ConsoleListener, ConsoleMessage, ContentFrameNotFoundError, type CreateChatCompletionOptions, CreateChatCompletionResponseError, CuaModelRequiredError, ElementNotVisibleError, ExperimentalApiConflictError, ExperimentalNotConfiguredError, type ExtractOptions, type ExtractResult, ExtractTimeoutError, type FunctionCallItem, type GoogleServiceAccountCredentials, type GoogleVertexProviderSettings, HandlerNotInitializedError, type HistoryEntry, type InferStagehandSchema, InvalidAISDKModelFormatError, type JsonSchema, type JsonSchemaDocument, type JsonSchemaProperty, LLMClient, type LLMParsedResponse, type LLMResponse, LLMResponseError, type LLMTool, type LLMUsage, LOG_LEVEL_NAMES, type LoadState, type LocalBrowserLaunchOptions, type LogLevel, type LogLine, type Logger, MCPConnectionError, MissingEnvironmentVariableError, MissingLLMConfigurationError, type ModelConfiguration, type ModelProvider, type NonStreamingAgentInstance, type ObserveOptions, ObserveTimeoutError, type OpenAIClientOptions, Page, PageNotFoundError, Response$1 as Response, ResponseBodyError, type ResponseInputItem, type ResponseItem, ResponseParseError, V3 as Stagehand, StagehandAPIError, StagehandAPIUnauthorizedError, StagehandClickError, StagehandDefaultError, StagehandDomProcessError, StagehandElementNotFoundError, StagehandEnvironmentError, StagehandError, StagehandEvalError, StagehandHttpError, StagehandIframeError, StagehandInitError, StagehandInvalidArgumentError, type StagehandMetrics, StagehandMissingArgumentError, StagehandNotInitializedError, StagehandResponseBodyError, StagehandResponseParseError, StagehandServerError, StagehandShadowRootMissingError, StagehandShadowSegmentEmptyError, StagehandShadowSegmentNotFoundError, type StagehandZodObject, type StagehandZodSchema, type StreamingAgentInstance, StreamingCallbacksInNonStreamingModeError, TimeoutError, type ToolUseItem, UnsupportedAISDKModelProviderError, UnsupportedModelError, UnsupportedModelProviderError, V3, type V3Env, V3Evaluator, V3FunctionName, type V3Options, XPathResolutionError, ZodSchemaValidationError, connectToMCPServer, defaultExtractSchema, getZodType, injectUrls, isRunningInBun, isZod3Schema, isZod4Schema, jsonSchemaToZod, loadApiKeyFromEnv, modelToAgentProviderMap, pageTextSchema, providerEnvVarMap, toGeminiSchema, toJsonSchema, transformSchema, trimTrailingTextNode, validateZodSchema };
4218
+ export { type AISDKCustomProvider, type AISDKProvider, AISdkClient, AVAILABLE_CUA_MODELS, type ActOptions, type ActResult, ActTimeoutError, type Action, type ActionExecutionResult, AgentAbortError, type AgentAction, type AgentCallbacks, type AgentConfig, type AgentContext, type AgentExecuteCallbacks, type AgentExecuteOptions, type AgentExecuteOptionsBase, type AgentExecutionOptions, type AgentHandlerOptions, type AgentInstance, type AgentModelConfig, AgentProvider, type AgentProviderType, type AgentResult, AgentScreenshotProviderError, type AgentState, type AgentStreamCallbacks, type AgentStreamExecuteOptions, type AgentStreamResult, type AgentToolCall, type AgentToolMode, type AgentToolResult, type AgentToolTypesMap, type AgentTools, type AgentType, type AgentUITools, AnnotatedScreenshotText, type AnthropicClientOptions, type AnthropicContentBlock, type AnthropicJsonSchemaObject, type AnthropicMessage, type AnthropicTextBlock, type AnthropicToolResult, type AnyPage, api as Api, type AvailableCuaModel, type AvailableModel, BrowserbaseSessionNotFoundError, CaptchaTimeoutError, type ChatCompletionOptions, type ChatMessage, type ChatMessageContent, type ChatMessageImageContent, type ChatMessageTextContent, type ClickToolResult, type ClientOptions, type ComputerCallItem, ConnectionTimeoutError, type ConsoleListener, ConsoleMessage, ContentFrameNotFoundError, type CreateChatCompletionOptions, CreateChatCompletionResponseError, CuaModelRequiredError, type DragAndDropToolResult, ElementNotVisibleError, ExperimentalApiConflictError, ExperimentalNotConfiguredError, type ExtractOptions, type ExtractResult, ExtractTimeoutError, type FillFormField, type FillFormVisionToolResult, type FunctionCallItem, type GoogleServiceAccountCredentials, type GoogleVertexProviderSettings, HandlerNotInitializedError, type HistoryEntry, type InferStagehandSchema, InvalidAISDKModelFormatError, type JsonSchema, type JsonSchemaDocument, type JsonSchemaProperty, LLMClient, type LLMParsedResponse, type LLMResponse, LLMResponseError, type LLMTool, type LLMUsage, LOG_LEVEL_NAMES, type LoadState, type LocalBrowserLaunchOptions, type LogLevel, type LogLine, type Logger, MCPConnectionError, MissingEnvironmentVariableError, MissingLLMConfigurationError, type ModelConfiguration, type ModelOutputContentItem, type ModelProvider, type NonStreamingAgentInstance, type ObserveOptions, ObserveTimeoutError, type OpenAIClientOptions, Page, PageNotFoundError, Response$1 as Response, ResponseBodyError, type ResponseInputItem, type ResponseItem, ResponseParseError, type SafetyCheck, type SafetyConfirmationHandler, type SafetyConfirmationResponse, type ScrollVisionToolResult, V3 as Stagehand, StagehandAPIError, StagehandAPIUnauthorizedError, StagehandClickError, StagehandClosedError, StagehandDefaultError, StagehandDomProcessError, StagehandElementNotFoundError, StagehandEnvironmentError, StagehandError, StagehandEvalError, StagehandHttpError, StagehandIframeError, StagehandInitError, StagehandInvalidArgumentError, type StagehandMetrics, StagehandMissingArgumentError, StagehandNotInitializedError, StagehandResponseBodyError, StagehandResponseParseError, StagehandServerError, StagehandShadowRootMissingError, StagehandShadowSegmentEmptyError, StagehandShadowSegmentNotFoundError, type StagehandZodObject, type StagehandZodSchema, type StreamingAgentInstance, StreamingCallbacksInNonStreamingModeError, TimeoutError, type ToolUseItem, type TypeToolResult, UnsupportedAISDKModelProviderError, UnsupportedModelError, UnsupportedModelProviderError, V3, type V3Env, V3Evaluator, V3FunctionName, type V3Options, type WaitToolResult, XPathResolutionError, ZodSchemaValidationError, connectToMCPServer, defaultExtractSchema, getZodType, injectUrls, isRunningInBun, isZod3Schema, isZod4Schema, jsonSchemaToZod, loadApiKeyFromEnv, localBrowserLaunchOptionsSchema, modelToAgentProviderMap, pageTextSchema, providerEnvVarMap, toGeminiSchema, toJsonSchema, transformSchema, trimTrailingTextNode, validateZodSchema };