@browserbasehq/orca 3.0.6-alpha-1 → 3.0.7-alpha-1

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 (3) hide show
  1. package/dist/index.d.ts +1900 -176
  2. package/dist/index.js +4582 -2018
  3. 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,7 +6,8 @@ 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
+ 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';
9
11
  export { ModelMessage } from 'ai';
10
12
  import { Page as Page$1 } from 'playwright-core';
11
13
  export { Page as PlaywrightPage } from 'playwright-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,1339 @@ 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
+ declare const SessionEndResultSchema: z$1.ZodObject<{}, z$1.core.$strict>;
1073
+ /** Session end response - just success flag, no data wrapper */
1074
+ declare const SessionEndResponseSchema: z$1.ZodObject<{
1075
+ success: z$1.ZodBoolean;
1076
+ }, z$1.core.$strict>;
1077
+ declare const ActOptionsSchema: z$1.ZodOptional<z$1.ZodObject<{
1078
+ model: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodObject<{
1079
+ provider: z$1.ZodOptional<z$1.ZodEnum<{
1080
+ openai: "openai";
1081
+ anthropic: "anthropic";
1082
+ google: "google";
1083
+ microsoft: "microsoft";
1084
+ }>>;
1085
+ modelName: z$1.ZodString;
1086
+ apiKey: z$1.ZodOptional<z$1.ZodString>;
1087
+ baseURL: z$1.ZodOptional<z$1.ZodString>;
1088
+ }, z$1.core.$strip>]>>;
1089
+ variables: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
1090
+ timeout: z$1.ZodOptional<z$1.ZodNumber>;
1091
+ }, z$1.core.$strip>>;
1092
+ declare const ActRequestSchema: z$1.ZodObject<{
1093
+ input: z$1.ZodUnion<[z$1.ZodString, z$1.ZodObject<{
1094
+ selector: z$1.ZodString;
1095
+ description: z$1.ZodString;
1096
+ backendNodeId: z$1.ZodOptional<z$1.ZodNumber>;
1097
+ method: z$1.ZodOptional<z$1.ZodString>;
1098
+ arguments: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1099
+ }, z$1.core.$strip>]>;
1100
+ options: z$1.ZodOptional<z$1.ZodObject<{
1101
+ model: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodObject<{
1102
+ provider: z$1.ZodOptional<z$1.ZodEnum<{
1103
+ openai: "openai";
1104
+ anthropic: "anthropic";
1105
+ google: "google";
1106
+ microsoft: "microsoft";
1107
+ }>>;
1108
+ modelName: z$1.ZodString;
1109
+ apiKey: z$1.ZodOptional<z$1.ZodString>;
1110
+ baseURL: z$1.ZodOptional<z$1.ZodString>;
1111
+ }, z$1.core.$strip>]>>;
1112
+ variables: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
1113
+ timeout: z$1.ZodOptional<z$1.ZodNumber>;
1114
+ }, z$1.core.$strip>>;
1115
+ frameId: z$1.ZodOptional<z$1.ZodString>;
1116
+ streamResponse: z$1.ZodOptional<z$1.ZodBoolean>;
1117
+ }, z$1.core.$strip>;
1118
+ /** Inner act result data */
1119
+ declare const ActResultDataSchema: z$1.ZodObject<{
1120
+ success: z$1.ZodBoolean;
1121
+ message: z$1.ZodString;
1122
+ actionDescription: z$1.ZodString;
1123
+ actions: z$1.ZodArray<z$1.ZodObject<{
1124
+ selector: z$1.ZodString;
1125
+ description: z$1.ZodString;
1126
+ backendNodeId: z$1.ZodOptional<z$1.ZodNumber>;
1127
+ method: z$1.ZodOptional<z$1.ZodString>;
1128
+ arguments: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1129
+ }, z$1.core.$strip>>;
1130
+ }, z$1.core.$strip>;
1131
+ declare const ActResultSchema: z$1.ZodObject<{
1132
+ result: z$1.ZodObject<{
1133
+ success: z$1.ZodBoolean;
1134
+ message: z$1.ZodString;
1135
+ actionDescription: z$1.ZodString;
1136
+ actions: z$1.ZodArray<z$1.ZodObject<{
1137
+ selector: z$1.ZodString;
1138
+ description: z$1.ZodString;
1139
+ backendNodeId: z$1.ZodOptional<z$1.ZodNumber>;
1140
+ method: z$1.ZodOptional<z$1.ZodString>;
1141
+ arguments: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1142
+ }, z$1.core.$strip>>;
1143
+ }, z$1.core.$strip>;
1144
+ actionId: z$1.ZodOptional<z$1.ZodString>;
1145
+ }, z$1.core.$strip>;
1146
+ declare const ActResponseSchema: z$1.ZodObject<{
1147
+ success: z$1.ZodBoolean;
1148
+ data: z$1.ZodObject<{
1149
+ result: z$1.ZodObject<{
1150
+ success: z$1.ZodBoolean;
1151
+ message: z$1.ZodString;
1152
+ actionDescription: z$1.ZodString;
1153
+ actions: z$1.ZodArray<z$1.ZodObject<{
1154
+ selector: z$1.ZodString;
1155
+ description: z$1.ZodString;
1156
+ backendNodeId: z$1.ZodOptional<z$1.ZodNumber>;
1157
+ method: z$1.ZodOptional<z$1.ZodString>;
1158
+ arguments: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1159
+ }, z$1.core.$strip>>;
1160
+ }, z$1.core.$strip>;
1161
+ actionId: z$1.ZodOptional<z$1.ZodString>;
1162
+ }, z$1.core.$strip>;
1163
+ }, z$1.core.$strip>;
1164
+ declare const ExtractOptionsSchema: z$1.ZodOptional<z$1.ZodObject<{
1165
+ model: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodObject<{
1166
+ provider: z$1.ZodOptional<z$1.ZodEnum<{
1167
+ openai: "openai";
1168
+ anthropic: "anthropic";
1169
+ google: "google";
1170
+ microsoft: "microsoft";
1171
+ }>>;
1172
+ modelName: z$1.ZodString;
1173
+ apiKey: z$1.ZodOptional<z$1.ZodString>;
1174
+ baseURL: z$1.ZodOptional<z$1.ZodString>;
1175
+ }, z$1.core.$strip>]>>;
1176
+ timeout: z$1.ZodOptional<z$1.ZodNumber>;
1177
+ selector: z$1.ZodOptional<z$1.ZodString>;
1178
+ }, z$1.core.$strip>>;
1179
+ declare const ExtractRequestSchema: z$1.ZodObject<{
1180
+ instruction: z$1.ZodOptional<z$1.ZodString>;
1181
+ schema: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
1182
+ options: z$1.ZodOptional<z$1.ZodObject<{
1183
+ model: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodObject<{
1184
+ provider: z$1.ZodOptional<z$1.ZodEnum<{
1185
+ openai: "openai";
1186
+ anthropic: "anthropic";
1187
+ google: "google";
1188
+ microsoft: "microsoft";
1189
+ }>>;
1190
+ modelName: z$1.ZodString;
1191
+ apiKey: z$1.ZodOptional<z$1.ZodString>;
1192
+ baseURL: z$1.ZodOptional<z$1.ZodString>;
1193
+ }, z$1.core.$strip>]>>;
1194
+ timeout: z$1.ZodOptional<z$1.ZodNumber>;
1195
+ selector: z$1.ZodOptional<z$1.ZodString>;
1196
+ }, z$1.core.$strip>>;
1197
+ frameId: z$1.ZodOptional<z$1.ZodString>;
1198
+ streamResponse: z$1.ZodOptional<z$1.ZodBoolean>;
1199
+ }, z$1.core.$strip>;
1200
+ declare const ExtractResultSchema: z$1.ZodObject<{
1201
+ result: z$1.ZodUnknown;
1202
+ actionId: z$1.ZodOptional<z$1.ZodString>;
1203
+ }, z$1.core.$strip>;
1204
+ declare const ExtractResponseSchema: z$1.ZodObject<{
1205
+ success: z$1.ZodBoolean;
1206
+ data: z$1.ZodObject<{
1207
+ result: z$1.ZodUnknown;
1208
+ actionId: z$1.ZodOptional<z$1.ZodString>;
1209
+ }, z$1.core.$strip>;
1210
+ }, z$1.core.$strip>;
1211
+ declare const ObserveOptionsSchema: z$1.ZodOptional<z$1.ZodObject<{
1212
+ model: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodObject<{
1213
+ provider: z$1.ZodOptional<z$1.ZodEnum<{
1214
+ openai: "openai";
1215
+ anthropic: "anthropic";
1216
+ google: "google";
1217
+ microsoft: "microsoft";
1218
+ }>>;
1219
+ modelName: z$1.ZodString;
1220
+ apiKey: z$1.ZodOptional<z$1.ZodString>;
1221
+ baseURL: z$1.ZodOptional<z$1.ZodString>;
1222
+ }, z$1.core.$strip>]>>;
1223
+ timeout: z$1.ZodOptional<z$1.ZodNumber>;
1224
+ selector: z$1.ZodOptional<z$1.ZodString>;
1225
+ }, z$1.core.$strip>>;
1226
+ declare const ObserveRequestSchema: z$1.ZodObject<{
1227
+ instruction: z$1.ZodOptional<z$1.ZodString>;
1228
+ options: z$1.ZodOptional<z$1.ZodObject<{
1229
+ model: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodObject<{
1230
+ provider: z$1.ZodOptional<z$1.ZodEnum<{
1231
+ openai: "openai";
1232
+ anthropic: "anthropic";
1233
+ google: "google";
1234
+ microsoft: "microsoft";
1235
+ }>>;
1236
+ modelName: z$1.ZodString;
1237
+ apiKey: z$1.ZodOptional<z$1.ZodString>;
1238
+ baseURL: z$1.ZodOptional<z$1.ZodString>;
1239
+ }, z$1.core.$strip>]>>;
1240
+ timeout: z$1.ZodOptional<z$1.ZodNumber>;
1241
+ selector: z$1.ZodOptional<z$1.ZodString>;
1242
+ }, z$1.core.$strip>>;
1243
+ frameId: z$1.ZodOptional<z$1.ZodString>;
1244
+ streamResponse: z$1.ZodOptional<z$1.ZodBoolean>;
1245
+ }, z$1.core.$strip>;
1246
+ declare const ObserveResultSchema: z$1.ZodObject<{
1247
+ result: z$1.ZodArray<z$1.ZodObject<{
1248
+ selector: z$1.ZodString;
1249
+ description: z$1.ZodString;
1250
+ backendNodeId: z$1.ZodOptional<z$1.ZodNumber>;
1251
+ method: z$1.ZodOptional<z$1.ZodString>;
1252
+ arguments: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1253
+ }, z$1.core.$strip>>;
1254
+ actionId: z$1.ZodOptional<z$1.ZodString>;
1255
+ }, z$1.core.$strip>;
1256
+ declare const ObserveResponseSchema: z$1.ZodObject<{
1257
+ success: z$1.ZodBoolean;
1258
+ data: z$1.ZodObject<{
1259
+ result: z$1.ZodArray<z$1.ZodObject<{
1260
+ selector: z$1.ZodString;
1261
+ description: z$1.ZodString;
1262
+ backendNodeId: z$1.ZodOptional<z$1.ZodNumber>;
1263
+ method: z$1.ZodOptional<z$1.ZodString>;
1264
+ arguments: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
1265
+ }, z$1.core.$strip>>;
1266
+ actionId: z$1.ZodOptional<z$1.ZodString>;
1267
+ }, z$1.core.$strip>;
1268
+ }, z$1.core.$strip>;
1269
+ declare const AgentConfigSchema: z$1.ZodObject<{
1270
+ provider: z$1.ZodOptional<z$1.ZodEnum<{
1271
+ openai: "openai";
1272
+ anthropic: "anthropic";
1273
+ google: "google";
1274
+ microsoft: "microsoft";
1275
+ }>>;
1276
+ model: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodObject<{
1277
+ provider: z$1.ZodOptional<z$1.ZodEnum<{
1278
+ openai: "openai";
1279
+ anthropic: "anthropic";
1280
+ google: "google";
1281
+ microsoft: "microsoft";
1282
+ }>>;
1283
+ modelName: z$1.ZodString;
1284
+ apiKey: z$1.ZodOptional<z$1.ZodString>;
1285
+ baseURL: z$1.ZodOptional<z$1.ZodString>;
1286
+ }, z$1.core.$strip>]>>;
1287
+ systemPrompt: z$1.ZodOptional<z$1.ZodString>;
1288
+ cua: z$1.ZodOptional<z$1.ZodBoolean>;
1289
+ }, z$1.core.$strip>;
1290
+ /** Action taken by the agent during execution */
1291
+ declare const AgentActionSchema: z$1.ZodObject<{
1292
+ type: z$1.ZodString;
1293
+ reasoning: z$1.ZodOptional<z$1.ZodString>;
1294
+ taskCompleted: z$1.ZodOptional<z$1.ZodBoolean>;
1295
+ action: z$1.ZodOptional<z$1.ZodString>;
1296
+ timeMs: z$1.ZodOptional<z$1.ZodNumber>;
1297
+ pageText: z$1.ZodOptional<z$1.ZodString>;
1298
+ pageUrl: z$1.ZodOptional<z$1.ZodString>;
1299
+ instruction: z$1.ZodOptional<z$1.ZodString>;
1300
+ }, z$1.core.$loose>;
1301
+ /** Token usage statistics for agent execution */
1302
+ declare const AgentUsageSchema: z$1.ZodObject<{
1303
+ input_tokens: z$1.ZodNumber;
1304
+ output_tokens: z$1.ZodNumber;
1305
+ reasoning_tokens: z$1.ZodOptional<z$1.ZodNumber>;
1306
+ cached_input_tokens: z$1.ZodOptional<z$1.ZodNumber>;
1307
+ inference_time_ms: z$1.ZodNumber;
1308
+ }, z$1.core.$strip>;
1309
+ /** Result data from agent execution */
1310
+ declare const AgentResultDataSchema: z$1.ZodObject<{
1311
+ success: z$1.ZodBoolean;
1312
+ message: z$1.ZodString;
1313
+ actions: z$1.ZodArray<z$1.ZodObject<{
1314
+ type: z$1.ZodString;
1315
+ reasoning: z$1.ZodOptional<z$1.ZodString>;
1316
+ taskCompleted: z$1.ZodOptional<z$1.ZodBoolean>;
1317
+ action: z$1.ZodOptional<z$1.ZodString>;
1318
+ timeMs: z$1.ZodOptional<z$1.ZodNumber>;
1319
+ pageText: z$1.ZodOptional<z$1.ZodString>;
1320
+ pageUrl: z$1.ZodOptional<z$1.ZodString>;
1321
+ instruction: z$1.ZodOptional<z$1.ZodString>;
1322
+ }, z$1.core.$loose>>;
1323
+ completed: z$1.ZodBoolean;
1324
+ metadata: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
1325
+ usage: z$1.ZodOptional<z$1.ZodObject<{
1326
+ input_tokens: z$1.ZodNumber;
1327
+ output_tokens: z$1.ZodNumber;
1328
+ reasoning_tokens: z$1.ZodOptional<z$1.ZodNumber>;
1329
+ cached_input_tokens: z$1.ZodOptional<z$1.ZodNumber>;
1330
+ inference_time_ms: z$1.ZodNumber;
1331
+ }, z$1.core.$strip>>;
1332
+ }, z$1.core.$strip>;
1333
+ declare const AgentExecuteOptionsSchema: z$1.ZodObject<{
1334
+ instruction: z$1.ZodString;
1335
+ maxSteps: z$1.ZodOptional<z$1.ZodNumber>;
1336
+ highlightCursor: z$1.ZodOptional<z$1.ZodBoolean>;
1337
+ }, z$1.core.$strip>;
1338
+ declare const AgentExecuteRequestSchema: z$1.ZodObject<{
1339
+ agentConfig: z$1.ZodObject<{
1340
+ provider: z$1.ZodOptional<z$1.ZodEnum<{
1341
+ openai: "openai";
1342
+ anthropic: "anthropic";
1343
+ google: "google";
1344
+ microsoft: "microsoft";
1345
+ }>>;
1346
+ model: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodObject<{
1347
+ provider: z$1.ZodOptional<z$1.ZodEnum<{
1348
+ openai: "openai";
1349
+ anthropic: "anthropic";
1350
+ google: "google";
1351
+ microsoft: "microsoft";
1352
+ }>>;
1353
+ modelName: z$1.ZodString;
1354
+ apiKey: z$1.ZodOptional<z$1.ZodString>;
1355
+ baseURL: z$1.ZodOptional<z$1.ZodString>;
1356
+ }, z$1.core.$strip>]>>;
1357
+ systemPrompt: z$1.ZodOptional<z$1.ZodString>;
1358
+ cua: z$1.ZodOptional<z$1.ZodBoolean>;
1359
+ }, z$1.core.$strip>;
1360
+ executeOptions: z$1.ZodObject<{
1361
+ instruction: z$1.ZodString;
1362
+ maxSteps: z$1.ZodOptional<z$1.ZodNumber>;
1363
+ highlightCursor: z$1.ZodOptional<z$1.ZodBoolean>;
1364
+ }, z$1.core.$strip>;
1365
+ frameId: z$1.ZodOptional<z$1.ZodString>;
1366
+ streamResponse: z$1.ZodOptional<z$1.ZodBoolean>;
1367
+ }, z$1.core.$strip>;
1368
+ declare const AgentExecuteResultSchema: z$1.ZodObject<{
1369
+ result: z$1.ZodObject<{
1370
+ success: z$1.ZodBoolean;
1371
+ message: z$1.ZodString;
1372
+ actions: z$1.ZodArray<z$1.ZodObject<{
1373
+ type: z$1.ZodString;
1374
+ reasoning: z$1.ZodOptional<z$1.ZodString>;
1375
+ taskCompleted: z$1.ZodOptional<z$1.ZodBoolean>;
1376
+ action: z$1.ZodOptional<z$1.ZodString>;
1377
+ timeMs: z$1.ZodOptional<z$1.ZodNumber>;
1378
+ pageText: z$1.ZodOptional<z$1.ZodString>;
1379
+ pageUrl: z$1.ZodOptional<z$1.ZodString>;
1380
+ instruction: z$1.ZodOptional<z$1.ZodString>;
1381
+ }, z$1.core.$loose>>;
1382
+ completed: z$1.ZodBoolean;
1383
+ metadata: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
1384
+ usage: z$1.ZodOptional<z$1.ZodObject<{
1385
+ input_tokens: z$1.ZodNumber;
1386
+ output_tokens: z$1.ZodNumber;
1387
+ reasoning_tokens: z$1.ZodOptional<z$1.ZodNumber>;
1388
+ cached_input_tokens: z$1.ZodOptional<z$1.ZodNumber>;
1389
+ inference_time_ms: z$1.ZodNumber;
1390
+ }, z$1.core.$strip>>;
1391
+ }, z$1.core.$strip>;
1392
+ }, z$1.core.$strip>;
1393
+ declare const AgentExecuteResponseSchema: z$1.ZodObject<{
1394
+ success: z$1.ZodBoolean;
1395
+ data: z$1.ZodObject<{
1396
+ result: z$1.ZodObject<{
1397
+ success: z$1.ZodBoolean;
1398
+ message: z$1.ZodString;
1399
+ actions: z$1.ZodArray<z$1.ZodObject<{
1400
+ type: z$1.ZodString;
1401
+ reasoning: z$1.ZodOptional<z$1.ZodString>;
1402
+ taskCompleted: z$1.ZodOptional<z$1.ZodBoolean>;
1403
+ action: z$1.ZodOptional<z$1.ZodString>;
1404
+ timeMs: z$1.ZodOptional<z$1.ZodNumber>;
1405
+ pageText: z$1.ZodOptional<z$1.ZodString>;
1406
+ pageUrl: z$1.ZodOptional<z$1.ZodString>;
1407
+ instruction: z$1.ZodOptional<z$1.ZodString>;
1408
+ }, z$1.core.$loose>>;
1409
+ completed: z$1.ZodBoolean;
1410
+ metadata: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
1411
+ usage: z$1.ZodOptional<z$1.ZodObject<{
1412
+ input_tokens: z$1.ZodNumber;
1413
+ output_tokens: z$1.ZodNumber;
1414
+ reasoning_tokens: z$1.ZodOptional<z$1.ZodNumber>;
1415
+ cached_input_tokens: z$1.ZodOptional<z$1.ZodNumber>;
1416
+ inference_time_ms: z$1.ZodNumber;
1417
+ }, z$1.core.$strip>>;
1418
+ }, z$1.core.$strip>;
1419
+ }, z$1.core.$strip>;
1420
+ }, z$1.core.$strip>;
1421
+ declare const NavigateOptionsSchema: z$1.ZodOptional<z$1.ZodObject<{
1422
+ referer: z$1.ZodOptional<z$1.ZodString>;
1423
+ timeout: z$1.ZodOptional<z$1.ZodNumber>;
1424
+ waitUntil: z$1.ZodOptional<z$1.ZodEnum<{
1425
+ load: "load";
1426
+ domcontentloaded: "domcontentloaded";
1427
+ networkidle: "networkidle";
1428
+ }>>;
1429
+ }, z$1.core.$strip>>;
1430
+ declare const NavigateRequestSchema: z$1.ZodObject<{
1431
+ url: z$1.ZodString;
1432
+ options: z$1.ZodOptional<z$1.ZodObject<{
1433
+ referer: z$1.ZodOptional<z$1.ZodString>;
1434
+ timeout: z$1.ZodOptional<z$1.ZodNumber>;
1435
+ waitUntil: z$1.ZodOptional<z$1.ZodEnum<{
1436
+ load: "load";
1437
+ domcontentloaded: "domcontentloaded";
1438
+ networkidle: "networkidle";
1439
+ }>>;
1440
+ }, z$1.core.$strip>>;
1441
+ frameId: z$1.ZodOptional<z$1.ZodString>;
1442
+ streamResponse: z$1.ZodOptional<z$1.ZodBoolean>;
1443
+ }, z$1.core.$strip>;
1444
+ declare const NavigateResultSchema: z$1.ZodObject<{
1445
+ result: z$1.ZodNullable<z$1.ZodUnknown>;
1446
+ actionId: z$1.ZodOptional<z$1.ZodString>;
1447
+ }, z$1.core.$strip>;
1448
+ declare const NavigateResponseSchema: z$1.ZodObject<{
1449
+ success: z$1.ZodBoolean;
1450
+ data: z$1.ZodObject<{
1451
+ result: z$1.ZodNullable<z$1.ZodUnknown>;
1452
+ actionId: z$1.ZodOptional<z$1.ZodString>;
1453
+ }, z$1.core.$strip>;
1454
+ }, z$1.core.$strip>;
1455
+ /** Token usage for a single action */
1456
+ declare const TokenUsageSchema: z$1.ZodObject<{
1457
+ inputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1458
+ outputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1459
+ reasoningTokens: z$1.ZodOptional<z$1.ZodNumber>;
1460
+ cachedInputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1461
+ timeMs: z$1.ZodOptional<z$1.ZodNumber>;
1462
+ }, z$1.core.$strip>;
1463
+ /** Action entry in replay metrics */
1464
+ declare const ReplayActionSchema: z$1.ZodObject<{
1465
+ method: z$1.ZodOptional<z$1.ZodString>;
1466
+ tokenUsage: z$1.ZodOptional<z$1.ZodObject<{
1467
+ inputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1468
+ outputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1469
+ reasoningTokens: z$1.ZodOptional<z$1.ZodNumber>;
1470
+ cachedInputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1471
+ timeMs: z$1.ZodOptional<z$1.ZodNumber>;
1472
+ }, z$1.core.$strip>>;
1473
+ }, z$1.core.$strip>;
1474
+ /** Page entry in replay metrics */
1475
+ declare const ReplayPageSchema: z$1.ZodObject<{
1476
+ actions: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1477
+ method: z$1.ZodOptional<z$1.ZodString>;
1478
+ tokenUsage: z$1.ZodOptional<z$1.ZodObject<{
1479
+ inputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1480
+ outputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1481
+ reasoningTokens: z$1.ZodOptional<z$1.ZodNumber>;
1482
+ cachedInputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1483
+ timeMs: z$1.ZodOptional<z$1.ZodNumber>;
1484
+ }, z$1.core.$strip>>;
1485
+ }, z$1.core.$strip>>>;
1486
+ }, z$1.core.$strip>;
1487
+ /** Inner result data for replay */
1488
+ declare const ReplayResultSchema: z$1.ZodObject<{
1489
+ pages: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1490
+ actions: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1491
+ method: z$1.ZodOptional<z$1.ZodString>;
1492
+ tokenUsage: z$1.ZodOptional<z$1.ZodObject<{
1493
+ inputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1494
+ outputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1495
+ reasoningTokens: z$1.ZodOptional<z$1.ZodNumber>;
1496
+ cachedInputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1497
+ timeMs: z$1.ZodOptional<z$1.ZodNumber>;
1498
+ }, z$1.core.$strip>>;
1499
+ }, z$1.core.$strip>>>;
1500
+ }, z$1.core.$strip>>>;
1501
+ }, z$1.core.$strip>;
1502
+ declare const ReplayResponseSchema: z$1.ZodObject<{
1503
+ success: z$1.ZodBoolean;
1504
+ data: z$1.ZodObject<{
1505
+ pages: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1506
+ actions: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
1507
+ method: z$1.ZodOptional<z$1.ZodString>;
1508
+ tokenUsage: z$1.ZodOptional<z$1.ZodObject<{
1509
+ inputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1510
+ outputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1511
+ reasoningTokens: z$1.ZodOptional<z$1.ZodNumber>;
1512
+ cachedInputTokens: z$1.ZodOptional<z$1.ZodNumber>;
1513
+ timeMs: z$1.ZodOptional<z$1.ZodNumber>;
1514
+ }, z$1.core.$strip>>;
1515
+ }, z$1.core.$strip>>>;
1516
+ }, z$1.core.$strip>>>;
1517
+ }, z$1.core.$strip>;
1518
+ }, z$1.core.$strip>;
1519
+ /** Status values for SSE stream events */
1520
+ declare const StreamEventStatusSchema: z$1.ZodEnum<{
1521
+ error: "error";
1522
+ starting: "starting";
1523
+ connected: "connected";
1524
+ running: "running";
1525
+ finished: "finished";
1526
+ }>;
1527
+ /** Type discriminator for SSE stream events */
1528
+ declare const StreamEventTypeSchema: z$1.ZodEnum<{
1529
+ system: "system";
1530
+ log: "log";
1531
+ }>;
1532
+ /** Data payload for system stream events */
1533
+ declare const StreamEventSystemDataSchema: z$1.ZodObject<{
1534
+ status: z$1.ZodEnum<{
1535
+ error: "error";
1536
+ starting: "starting";
1537
+ connected: "connected";
1538
+ running: "running";
1539
+ finished: "finished";
1540
+ }>;
1541
+ result: z$1.ZodOptional<z$1.ZodUnknown>;
1542
+ error: z$1.ZodOptional<z$1.ZodString>;
1543
+ }, z$1.core.$strip>;
1544
+ /** Data payload for log stream events */
1545
+ declare const StreamEventLogDataSchema: z$1.ZodObject<{
1546
+ status: z$1.ZodLiteral<"running">;
1547
+ message: z$1.ZodString;
1548
+ }, z$1.core.$strip>;
1549
+ /**
1550
+ * SSE stream event sent during streaming responses.
1551
+ *
1552
+ * IMPORTANT: Key ordering matters for Stainless SDK generation.
1553
+ * The `data` field MUST be serialized first, with `status` as the first key within it.
1554
+ * This allows Stainless to use `data_starts_with: '{"data":{"status":"finished"'` for event handling.
1555
+ *
1556
+ * Expected serialization order: {"data":{"status":...},"type":...,"id":...}
1557
+ */
1558
+ declare const StreamEventSchema: z$1.ZodObject<{
1559
+ data: z$1.ZodUnion<readonly [z$1.ZodObject<{
1560
+ status: z$1.ZodEnum<{
1561
+ error: "error";
1562
+ starting: "starting";
1563
+ connected: "connected";
1564
+ running: "running";
1565
+ finished: "finished";
1566
+ }>;
1567
+ result: z$1.ZodOptional<z$1.ZodUnknown>;
1568
+ error: z$1.ZodOptional<z$1.ZodString>;
1569
+ }, z$1.core.$strip>, z$1.ZodObject<{
1570
+ status: z$1.ZodLiteral<"running">;
1571
+ message: z$1.ZodString;
1572
+ }, z$1.core.$strip>]>;
1573
+ type: z$1.ZodEnum<{
1574
+ system: "system";
1575
+ log: "log";
1576
+ }>;
1577
+ id: z$1.ZodString;
1578
+ }, z$1.core.$strip>;
1579
+ /** OpenAPI security schemes for authentication */
1580
+ declare const openApiSecuritySchemes: {
1581
+ readonly BrowserbaseApiKey: {
1582
+ readonly type: "apiKey";
1583
+ readonly in: "header";
1584
+ readonly name: "x-bb-api-key";
1585
+ readonly description: "Browserbase API key for authentication";
1586
+ };
1587
+ readonly BrowserbaseProjectId: {
1588
+ readonly type: "apiKey";
1589
+ readonly in: "header";
1590
+ readonly name: "x-bb-project-id";
1591
+ readonly description: "Browserbase project ID";
1592
+ };
1593
+ readonly ModelApiKey: {
1594
+ readonly type: "apiKey";
1595
+ readonly in: "header";
1596
+ readonly name: "x-model-api-key";
1597
+ readonly description: "API key for the AI model provider (OpenAI, Anthropic, etc.)";
1598
+ };
1599
+ };
1600
+ /** OpenAPI links for session operations (used in SessionStart response) */
1601
+ declare const openApiLinks: {
1602
+ readonly SessionAct: {
1603
+ readonly operationId: "SessionAct";
1604
+ readonly parameters: {
1605
+ readonly id: "$response.body#/data/sessionId";
1606
+ };
1607
+ readonly description: "Perform an action on the session";
1608
+ };
1609
+ readonly SessionExtract: {
1610
+ readonly operationId: "SessionExtract";
1611
+ readonly parameters: {
1612
+ readonly id: "$response.body#/data/sessionId";
1613
+ };
1614
+ readonly description: "Extract data from the session";
1615
+ };
1616
+ readonly SessionObserve: {
1617
+ readonly operationId: "SessionObserve";
1618
+ readonly parameters: {
1619
+ readonly id: "$response.body#/data/sessionId";
1620
+ };
1621
+ readonly description: "Observe available actions on the session";
1622
+ };
1623
+ readonly SessionNavigate: {
1624
+ readonly operationId: "SessionNavigate";
1625
+ readonly parameters: {
1626
+ readonly id: "$response.body#/data/sessionId";
1627
+ };
1628
+ readonly description: "Navigate to a URL in the session";
1629
+ };
1630
+ readonly SessionAgentExecute: {
1631
+ readonly operationId: "SessionAgentExecute";
1632
+ readonly parameters: {
1633
+ readonly id: "$response.body#/data/sessionId";
1634
+ };
1635
+ readonly description: "Execute an agent on the session";
1636
+ };
1637
+ readonly SessionReplay: {
1638
+ readonly operationId: "SessionReplay";
1639
+ readonly parameters: {
1640
+ readonly id: "$response.body#/data/sessionId";
1641
+ };
1642
+ readonly description: "Replay session metrics";
1643
+ };
1644
+ readonly SessionEnd: {
1645
+ readonly operationId: "SessionEnd";
1646
+ readonly parameters: {
1647
+ readonly id: "$response.body#/data/sessionId";
1648
+ };
1649
+ readonly description: "End the session and release resources";
1650
+ };
1651
+ };
1652
+ /** OpenAPI operation metadata for each endpoint */
1653
+ declare const Operations: {
1654
+ readonly SessionStart: {
1655
+ readonly operationId: "SessionStart";
1656
+ readonly summary: "Start a new browser session";
1657
+ readonly description: "Creates a new browser session with the specified configuration. Returns a session ID used for all subsequent operations.";
1658
+ };
1659
+ readonly SessionEnd: {
1660
+ readonly operationId: "SessionEnd";
1661
+ readonly summary: "End a browser session";
1662
+ readonly description: "Terminates the browser session and releases all associated resources.";
1663
+ };
1664
+ readonly SessionAct: {
1665
+ readonly operationId: "SessionAct";
1666
+ readonly summary: "Perform an action";
1667
+ readonly description: "Executes a browser action using natural language instructions or a predefined Action object.";
1668
+ };
1669
+ readonly SessionExtract: {
1670
+ readonly operationId: "SessionExtract";
1671
+ readonly summary: "Extract data from the page";
1672
+ readonly description: "Extracts structured data from the current page using AI-powered analysis.";
1673
+ };
1674
+ readonly SessionObserve: {
1675
+ readonly operationId: "SessionObserve";
1676
+ readonly summary: "Observe available actions";
1677
+ readonly description: "Identifies and returns available actions on the current page that match the given instruction.";
1678
+ };
1679
+ readonly SessionNavigate: {
1680
+ readonly operationId: "SessionNavigate";
1681
+ readonly summary: "Navigate to a URL";
1682
+ readonly description: "Navigates the browser to the specified URL.";
1683
+ };
1684
+ readonly SessionAgentExecute: {
1685
+ readonly operationId: "SessionAgentExecute";
1686
+ readonly summary: "Execute an AI agent";
1687
+ readonly description: "Runs an autonomous AI agent that can perform complex multi-step browser tasks.";
1688
+ };
1689
+ readonly SessionReplay: {
1690
+ readonly operationId: "SessionReplay";
1691
+ readonly summary: "Replay session metrics";
1692
+ readonly description: "Retrieves replay metrics for a session.";
1693
+ };
1694
+ };
1695
+ type Action$1 = z$1.infer<typeof ActionSchema>;
1696
+ type ModelConfig = z$1.infer<typeof ModelConfigSchema>;
1697
+ type BrowserConfig = z$1.infer<typeof BrowserConfigSchema>;
1698
+ type SessionIdParams = z$1.infer<typeof SessionIdParamsSchema>;
1699
+ type SessionHeaders = z$1.infer<typeof SessionHeadersSchema>;
1700
+ type BrowserbaseViewport = z$1.infer<typeof BrowserbaseViewportSchema>;
1701
+ type BrowserbaseFingerprintScreen = z$1.infer<typeof BrowserbaseFingerprintScreenSchema>;
1702
+ type BrowserbaseFingerprint = z$1.infer<typeof BrowserbaseFingerprintSchema>;
1703
+ type BrowserbaseContext = z$1.infer<typeof BrowserbaseContextSchema>;
1704
+ type BrowserbaseBrowserSettings = z$1.infer<typeof BrowserbaseBrowserSettingsSchema>;
1705
+ type BrowserbaseProxyGeolocation = z$1.infer<typeof BrowserbaseProxyGeolocationSchema>;
1706
+ type BrowserbaseProxyConfig = z$1.infer<typeof BrowserbaseProxyConfigSchema>;
1707
+ type ExternalProxyConfig = z$1.infer<typeof ExternalProxyConfigSchema>;
1708
+ type BrowserbaseSessionCreateParams = z$1.infer<typeof BrowserbaseSessionCreateParamsSchema>;
1709
+ type SessionStartRequest = z$1.infer<typeof SessionStartRequestSchema>;
1710
+ type SessionStartResult = z$1.infer<typeof SessionStartResultSchema>;
1711
+ type SessionStartResponse = z$1.infer<typeof SessionStartResponseSchema>;
1712
+ type SessionEndResult = z$1.infer<typeof SessionEndResultSchema>;
1713
+ type SessionEndResponse = z$1.infer<typeof SessionEndResponseSchema>;
1714
+ type ActRequest = z$1.infer<typeof ActRequestSchema>;
1715
+ type ActResultData = z$1.infer<typeof ActResultDataSchema>;
1716
+ type ActResult$1 = z$1.infer<typeof ActResultSchema>;
1717
+ type ActResponse = z$1.infer<typeof ActResponseSchema>;
1718
+ type ExtractRequest = z$1.infer<typeof ExtractRequestSchema>;
1719
+ type ExtractResult$1 = z$1.infer<typeof ExtractResultSchema>;
1720
+ type ExtractResponse = z$1.infer<typeof ExtractResponseSchema>;
1721
+ type ObserveRequest = z$1.infer<typeof ObserveRequestSchema>;
1722
+ type ObserveResult = z$1.infer<typeof ObserveResultSchema>;
1723
+ type ObserveResponse = z$1.infer<typeof ObserveResponseSchema>;
1724
+ type AgentAction$1 = z$1.infer<typeof AgentActionSchema>;
1725
+ type AgentUsage = z$1.infer<typeof AgentUsageSchema>;
1726
+ type AgentResultData = z$1.infer<typeof AgentResultDataSchema>;
1727
+ type AgentExecuteRequest = z$1.infer<typeof AgentExecuteRequestSchema>;
1728
+ type AgentExecuteResult = z$1.infer<typeof AgentExecuteResultSchema>;
1729
+ type AgentExecuteResponse = z$1.infer<typeof AgentExecuteResponseSchema>;
1730
+ type NavigateRequest = z$1.infer<typeof NavigateRequestSchema>;
1731
+ type NavigateResult = z$1.infer<typeof NavigateResultSchema>;
1732
+ type NavigateResponse = z$1.infer<typeof NavigateResponseSchema>;
1733
+ type TokenUsage = z$1.infer<typeof TokenUsageSchema>;
1734
+ type ReplayAction = z$1.infer<typeof ReplayActionSchema>;
1735
+ type ReplayPage = z$1.infer<typeof ReplayPageSchema>;
1736
+ type ReplayResult = z$1.infer<typeof ReplayResultSchema>;
1737
+ type ReplayResponse = z$1.infer<typeof ReplayResponseSchema>;
1738
+ type StreamEventStatus = z$1.infer<typeof StreamEventStatusSchema>;
1739
+ type StreamEventType = z$1.infer<typeof StreamEventTypeSchema>;
1740
+ type StreamEventSystemData = z$1.infer<typeof StreamEventSystemDataSchema>;
1741
+ type StreamEventLogData = z$1.infer<typeof StreamEventLogDataSchema>;
1742
+ type StreamEvent = z$1.infer<typeof StreamEventSchema>;
1743
+
1744
+ declare const api_ActOptionsSchema: typeof ActOptionsSchema;
1745
+ type api_ActRequest = ActRequest;
1746
+ declare const api_ActRequestSchema: typeof ActRequestSchema;
1747
+ type api_ActResponse = ActResponse;
1748
+ declare const api_ActResponseSchema: typeof ActResponseSchema;
1749
+ type api_ActResultData = ActResultData;
1750
+ declare const api_ActResultDataSchema: typeof ActResultDataSchema;
1751
+ declare const api_ActResultSchema: typeof ActResultSchema;
1752
+ declare const api_ActionSchema: typeof ActionSchema;
1753
+ declare const api_AgentActionSchema: typeof AgentActionSchema;
1754
+ declare const api_AgentConfigSchema: typeof AgentConfigSchema;
1755
+ declare const api_AgentExecuteOptionsSchema: typeof AgentExecuteOptionsSchema;
1756
+ type api_AgentExecuteRequest = AgentExecuteRequest;
1757
+ declare const api_AgentExecuteRequestSchema: typeof AgentExecuteRequestSchema;
1758
+ type api_AgentExecuteResponse = AgentExecuteResponse;
1759
+ declare const api_AgentExecuteResponseSchema: typeof AgentExecuteResponseSchema;
1760
+ type api_AgentExecuteResult = AgentExecuteResult;
1761
+ declare const api_AgentExecuteResultSchema: typeof AgentExecuteResultSchema;
1762
+ type api_AgentResultData = AgentResultData;
1763
+ declare const api_AgentResultDataSchema: typeof AgentResultDataSchema;
1764
+ type api_AgentUsage = AgentUsage;
1765
+ declare const api_AgentUsageSchema: typeof AgentUsageSchema;
1766
+ type api_BrowserConfig = BrowserConfig;
1767
+ declare const api_BrowserConfigSchema: typeof BrowserConfigSchema;
1768
+ type api_BrowserbaseBrowserSettings = BrowserbaseBrowserSettings;
1769
+ declare const api_BrowserbaseBrowserSettingsSchema: typeof BrowserbaseBrowserSettingsSchema;
1770
+ type api_BrowserbaseContext = BrowserbaseContext;
1771
+ declare const api_BrowserbaseContextSchema: typeof BrowserbaseContextSchema;
1772
+ type api_BrowserbaseFingerprint = BrowserbaseFingerprint;
1773
+ declare const api_BrowserbaseFingerprintSchema: typeof BrowserbaseFingerprintSchema;
1774
+ type api_BrowserbaseFingerprintScreen = BrowserbaseFingerprintScreen;
1775
+ declare const api_BrowserbaseFingerprintScreenSchema: typeof BrowserbaseFingerprintScreenSchema;
1776
+ type api_BrowserbaseProxyConfig = BrowserbaseProxyConfig;
1777
+ declare const api_BrowserbaseProxyConfigSchema: typeof BrowserbaseProxyConfigSchema;
1778
+ type api_BrowserbaseProxyGeolocation = BrowserbaseProxyGeolocation;
1779
+ declare const api_BrowserbaseProxyGeolocationSchema: typeof BrowserbaseProxyGeolocationSchema;
1780
+ type api_BrowserbaseSessionCreateParams = BrowserbaseSessionCreateParams;
1781
+ declare const api_BrowserbaseSessionCreateParamsSchema: typeof BrowserbaseSessionCreateParamsSchema;
1782
+ type api_BrowserbaseViewport = BrowserbaseViewport;
1783
+ declare const api_BrowserbaseViewportSchema: typeof BrowserbaseViewportSchema;
1784
+ declare const api_ErrorResponseSchema: typeof ErrorResponseSchema;
1785
+ type api_ExternalProxyConfig = ExternalProxyConfig;
1786
+ declare const api_ExternalProxyConfigSchema: typeof ExternalProxyConfigSchema;
1787
+ declare const api_ExtractOptionsSchema: typeof ExtractOptionsSchema;
1788
+ type api_ExtractRequest = ExtractRequest;
1789
+ declare const api_ExtractRequestSchema: typeof ExtractRequestSchema;
1790
+ type api_ExtractResponse = ExtractResponse;
1791
+ declare const api_ExtractResponseSchema: typeof ExtractResponseSchema;
1792
+ declare const api_ExtractResultSchema: typeof ExtractResultSchema;
1793
+ declare const api_LocalBrowserLaunchOptionsSchema: typeof LocalBrowserLaunchOptionsSchema;
1794
+ type api_ModelConfig = ModelConfig;
1795
+ declare const api_ModelConfigObjectSchema: typeof ModelConfigObjectSchema;
1796
+ declare const api_ModelConfigSchema: typeof ModelConfigSchema;
1797
+ declare const api_ModelNameSchema: typeof ModelNameSchema;
1798
+ declare const api_NavigateOptionsSchema: typeof NavigateOptionsSchema;
1799
+ type api_NavigateRequest = NavigateRequest;
1800
+ declare const api_NavigateRequestSchema: typeof NavigateRequestSchema;
1801
+ type api_NavigateResponse = NavigateResponse;
1802
+ declare const api_NavigateResponseSchema: typeof NavigateResponseSchema;
1803
+ type api_NavigateResult = NavigateResult;
1804
+ declare const api_NavigateResultSchema: typeof NavigateResultSchema;
1805
+ declare const api_ObserveOptionsSchema: typeof ObserveOptionsSchema;
1806
+ type api_ObserveRequest = ObserveRequest;
1807
+ declare const api_ObserveRequestSchema: typeof ObserveRequestSchema;
1808
+ type api_ObserveResponse = ObserveResponse;
1809
+ declare const api_ObserveResponseSchema: typeof ObserveResponseSchema;
1810
+ type api_ObserveResult = ObserveResult;
1811
+ declare const api_ObserveResultSchema: typeof ObserveResultSchema;
1812
+ declare const api_Operations: typeof Operations;
1813
+ declare const api_ProxyConfigSchema: typeof ProxyConfigSchema;
1814
+ type api_ReplayAction = ReplayAction;
1815
+ declare const api_ReplayActionSchema: typeof ReplayActionSchema;
1816
+ type api_ReplayPage = ReplayPage;
1817
+ declare const api_ReplayPageSchema: typeof ReplayPageSchema;
1818
+ type api_ReplayResponse = ReplayResponse;
1819
+ declare const api_ReplayResponseSchema: typeof ReplayResponseSchema;
1820
+ type api_ReplayResult = ReplayResult;
1821
+ declare const api_ReplayResultSchema: typeof ReplayResultSchema;
1822
+ type api_SessionEndResponse = SessionEndResponse;
1823
+ declare const api_SessionEndResponseSchema: typeof SessionEndResponseSchema;
1824
+ type api_SessionEndResult = SessionEndResult;
1825
+ declare const api_SessionEndResultSchema: typeof SessionEndResultSchema;
1826
+ type api_SessionHeaders = SessionHeaders;
1827
+ declare const api_SessionHeadersSchema: typeof SessionHeadersSchema;
1828
+ type api_SessionIdParams = SessionIdParams;
1829
+ declare const api_SessionIdParamsSchema: typeof SessionIdParamsSchema;
1830
+ type api_SessionStartRequest = SessionStartRequest;
1831
+ declare const api_SessionStartRequestSchema: typeof SessionStartRequestSchema;
1832
+ type api_SessionStartResponse = SessionStartResponse;
1833
+ declare const api_SessionStartResponseSchema: typeof SessionStartResponseSchema;
1834
+ type api_SessionStartResult = SessionStartResult;
1835
+ declare const api_SessionStartResultSchema: typeof SessionStartResultSchema;
1836
+ type api_StreamEvent = StreamEvent;
1837
+ type api_StreamEventLogData = StreamEventLogData;
1838
+ declare const api_StreamEventLogDataSchema: typeof StreamEventLogDataSchema;
1839
+ declare const api_StreamEventSchema: typeof StreamEventSchema;
1840
+ type api_StreamEventStatus = StreamEventStatus;
1841
+ declare const api_StreamEventStatusSchema: typeof StreamEventStatusSchema;
1842
+ type api_StreamEventSystemData = StreamEventSystemData;
1843
+ declare const api_StreamEventSystemDataSchema: typeof StreamEventSystemDataSchema;
1844
+ type api_StreamEventType = StreamEventType;
1845
+ declare const api_StreamEventTypeSchema: typeof StreamEventTypeSchema;
1846
+ type api_TokenUsage = TokenUsage;
1847
+ declare const api_TokenUsageSchema: typeof TokenUsageSchema;
1848
+ declare const api_openApiLinks: typeof openApiLinks;
1849
+ declare const api_openApiSecuritySchemes: typeof openApiSecuritySchemes;
1850
+ declare namespace api {
1851
+ 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, 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 };
1852
+ }
1853
+
519
1854
  declare class StagehandAPIError extends Error {
520
1855
  constructor(message: string);
521
1856
  }
@@ -614,37 +1949,35 @@ interface StagehandMetrics {
614
1949
  }
615
1950
 
616
1951
  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
- }
1952
+ declare const localBrowserLaunchOptionsSchema: z.ZodObject<{
1953
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
1954
+ executablePath: z.ZodOptional<z.ZodString>;
1955
+ userDataDir: z.ZodOptional<z.ZodString>;
1956
+ preserveUserDataDir: z.ZodOptional<z.ZodBoolean>;
1957
+ headless: z.ZodOptional<z.ZodBoolean>;
1958
+ devtools: z.ZodOptional<z.ZodBoolean>;
1959
+ chromiumSandbox: z.ZodOptional<z.ZodBoolean>;
1960
+ ignoreDefaultArgs: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
1961
+ proxy: z.ZodOptional<z.ZodObject<{
1962
+ server: z.ZodString;
1963
+ bypass: z.ZodOptional<z.ZodString>;
1964
+ username: z.ZodOptional<z.ZodString>;
1965
+ password: z.ZodOptional<z.ZodString>;
1966
+ }, z.core.$strip>>;
1967
+ locale: z.ZodOptional<z.ZodString>;
1968
+ viewport: z.ZodOptional<z.ZodObject<{
1969
+ width: z.ZodNumber;
1970
+ height: z.ZodNumber;
1971
+ }, z.core.$strip>>;
1972
+ deviceScaleFactor: z.ZodOptional<z.ZodNumber>;
1973
+ hasTouch: z.ZodOptional<z.ZodBoolean>;
1974
+ ignoreHTTPSErrors: z.ZodOptional<z.ZodBoolean>;
1975
+ cdpUrl: z.ZodOptional<z.ZodString>;
1976
+ connectTimeoutMs: z.ZodOptional<z.ZodNumber>;
1977
+ downloadsPath: z.ZodOptional<z.ZodString>;
1978
+ acceptDownloads: z.ZodOptional<z.ZodBoolean>;
1979
+ }, z.core.$strict>;
1980
+ type LocalBrowserLaunchOptions = z.infer<typeof LocalBrowserLaunchOptionsSchema>;
648
1981
  /** Constructor options for V3 */
649
1982
  interface V3Options {
650
1983
  env: V3Env;
@@ -653,9 +1986,7 @@ interface V3Options {
653
1986
  /**
654
1987
  * Optional: fine-tune Browserbase session creation or resume an existing session.
655
1988
  */
656
- browserbaseSessionCreateParams?: Omit<Browserbase.Sessions.SessionCreateParams, "projectId"> & {
657
- projectId?: string;
658
- };
1989
+ browserbaseSessionCreateParams?: BrowserbaseSessionCreateParams;
659
1990
  browserbaseSessionID?: string;
660
1991
  localBrowserLaunchOptions?: LocalBrowserLaunchOptions;
661
1992
  model?: ModelConfiguration;
@@ -665,6 +1996,8 @@ interface V3Options {
665
1996
  experimental?: boolean;
666
1997
  verbose?: 0 | 1 | 2;
667
1998
  selfHeal?: boolean;
1999
+ waitForCaptchaSolves?: boolean;
2000
+ actTimeoutMs?: number;
668
2001
  /** Disable pino logging backend (useful for tests or minimal environments). */
669
2002
  disablePino?: boolean;
670
2003
  /** Optional external logger hook for integrating with host apps. */
@@ -816,6 +2149,9 @@ declare class AgentAbortError extends StagehandError {
816
2149
  readonly reason: string;
817
2150
  constructor(reason?: string);
818
2151
  }
2152
+ declare class StagehandClosedError extends StagehandError {
2153
+ constructor();
2154
+ }
819
2155
 
820
2156
  declare class AISdkClient extends LLMClient {
821
2157
  type: "aisdk";
@@ -826,135 +2162,81 @@ declare class AISdkClient extends LLMClient {
826
2162
  createChatCompletion<T = ChatCompletion>({ options, }: CreateChatCompletionOptions): Promise<T>;
827
2163
  }
828
2164
 
2165
+ /**
2166
+ * Constructor parameters for StagehandAPIClient
2167
+ */
829
2168
  interface StagehandAPIConstructorParams {
830
2169
  apiKey: string;
831
2170
  projectId: string;
832
2171
  logger: (message: LogLine) => void;
833
2172
  }
834
- interface StartSessionParams {
835
- modelName: string;
2173
+ /**
2174
+ * Parameters for starting a session via the API client.
2175
+ * Extends Api.SessionStartRequest with client-specific field (modelApiKey).
2176
+ *
2177
+ * Wire format: Api.SessionStartRequest (modelApiKey sent via header, not body)
2178
+ */
2179
+ interface ClientSessionStartParams extends SessionStartRequest {
2180
+ /** Model API key - sent via x-model-api-key header, not in request body */
836
2181
  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
2182
  }
850
- interface APIActParameters {
851
- input: string | Action;
2183
+ /**
2184
+ * Client parameters for act() method.
2185
+ * Derives structure from Api.ActRequest but uses SDK's ActOptions (which includes `page`).
2186
+ * Before serialization, `page` is stripped to produce Api.ActRequest wire format.
2187
+ */
2188
+ interface ClientActParameters {
2189
+ input: ActRequest["input"];
852
2190
  options?: ActOptions;
853
- frameId?: string;
2191
+ frameId?: ActRequest["frameId"];
854
2192
  }
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
2193
  /**
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`.
2194
+ * Client parameters for extract() method.
2195
+ * Derives structure from Api.ExtractRequest but uses SDK's ExtractOptions (which includes `page`)
2196
+ * and accepts Zod schema (converted to JSON schema for wire format).
886
2197
  */
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>;
2198
+ interface ClientExtractParameters {
2199
+ instruction?: ExtractRequest["instruction"];
2200
+ schema?: StagehandZodSchema;
2201
+ options?: ExtractOptions;
2202
+ frameId?: ExtractRequest["frameId"];
893
2203
  }
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
2204
  /**
927
- * Result of an evaluation
2205
+ * Client parameters for observe() method.
2206
+ * Derives structure from Api.ObserveRequest but uses SDK's ObserveOptions (which includes `page`).
2207
+ * Before serialization, `page` is stripped to produce Api.ObserveRequest wire format.
928
2208
  */
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;
2209
+ interface ClientObserveParameters {
2210
+ instruction?: ObserveRequest["instruction"];
2211
+ options?: ObserveOptions;
2212
+ frameId?: ObserveRequest["frameId"];
938
2213
  }
939
-
940
2214
  declare class StagehandAPIClient {
941
2215
  private apiKey;
942
2216
  private projectId;
943
2217
  private sessionId?;
944
2218
  private modelApiKey;
2219
+ private modelProvider?;
945
2220
  private logger;
946
2221
  private fetchWithCookies;
947
2222
  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>;
2223
+ init({ modelName, modelApiKey, domSettleTimeoutMs, verbose, systemPrompt, selfHeal, browserbaseSessionCreateParams, browserbaseSessionID, }: ClientSessionStartParams): Promise<SessionStartResult>;
2224
+ act({ input, options, frameId, }: ClientActParameters): Promise<ActResult>;
2225
+ extract<T extends StagehandZodSchema>({ instruction, schema: zodSchema, options, frameId, }: ClientExtractParameters): Promise<ExtractResult<T>>;
2226
+ observe({ instruction, options, frameId, }: ClientObserveParameters): Promise<Action[]>;
2227
+ goto(url: string, options?: NavigateRequest["options"], frameId?: string): Promise<SerializableResponse | null>;
955
2228
  agentExecute(agentConfig: AgentConfig, executeOptions: AgentExecuteOptions | string, frameId?: string): Promise<AgentResult>;
956
2229
  end(): Promise<Response>;
957
2230
  getReplayMetrics(): Promise<StagehandMetrics>;
2231
+ /**
2232
+ * Prepares a model configuration for the API payload by ensuring the `apiKey`
2233
+ * is included. If the model is passed as a string, converts it to an object
2234
+ * with `modelName` and `apiKey`.
2235
+ *
2236
+ * In API mode, we only attempt to load an API key from env vars when the
2237
+ * model provider differs from the one used to init the session.
2238
+ */
2239
+ private prepareModelConfig;
958
2240
  private execute;
959
2241
  private request;
960
2242
  }
@@ -1086,7 +2368,7 @@ declare class V3Context {
1086
2368
  awaitActivePage(timeoutMs?: number): Promise<Page>;
1087
2369
  }
1088
2370
 
1089
- type AgentReplayStep = AgentReplayActStep | AgentReplayFillFormStep | AgentReplayGotoStep | AgentReplayScrollStep | AgentReplayWaitStep | AgentReplayNavBackStep | {
2371
+ type AgentReplayStep = AgentReplayActStep | AgentReplayFillFormStep | AgentReplayGotoStep | AgentReplayScrollStep | AgentReplayWaitStep | AgentReplayNavBackStep | AgentReplayKeysStep | {
1090
2372
  type: string;
1091
2373
  [key: string]: unknown;
1092
2374
  };
@@ -1129,6 +2411,16 @@ interface AgentReplayNavBackStep {
1129
2411
  type: "navback";
1130
2412
  waitUntil?: LoadState;
1131
2413
  }
2414
+ interface AgentReplayKeysStep {
2415
+ type: "keys";
2416
+ instruction?: string;
2417
+ playwrightArguments: {
2418
+ method: "type" | "press";
2419
+ text?: string;
2420
+ keys?: string;
2421
+ times?: number;
2422
+ };
2423
+ }
1132
2424
 
1133
2425
  /**
1134
2426
  * Response
@@ -1529,52 +2821,32 @@ declare class Page {
1529
2821
  * on the top-level page target's session. Coordinates are relative to the
1530
2822
  * viewport origin (top-left). Does not scroll.
1531
2823
  */
1532
- click(x: number, y: number, options: {
1533
- button?: "left" | "right" | "middle";
1534
- clickCount?: number;
1535
- returnXpath: true;
1536
- }): Promise<string>;
1537
2824
  click(x: number, y: number, options?: {
1538
2825
  button?: "left" | "right" | "middle";
1539
2826
  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;
2827
+ returnXpath?: boolean;
2828
+ }): Promise<string>;
2829
+ /**
2830
+ * Hover at absolute page coordinates (CSS pixels).
2831
+ * Dispatches mouseMoved via CDP Input domain on the top-level page target's
2832
+ * session.
2833
+ */
2834
+ hover(x: number, y: number, options?: {
2835
+ returnXpath?: boolean;
1549
2836
  }): Promise<string>;
1550
2837
  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>;
2838
+ returnXpath?: boolean;
2839
+ }): Promise<string>;
1556
2840
  /**
1557
2841
  * Drag from (fromX, fromY) to (toX, toY) using mouse events.
1558
2842
  * Sends mouseMoved → mousePressed → mouseMoved (steps) → mouseReleased.
1559
2843
  */
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
2844
  dragAndDrop(fromX: number, fromY: number, toX: number, toY: number, options?: {
1567
2845
  button?: "left" | "right" | "middle";
1568
2846
  steps?: number;
1569
2847
  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]>;
2848
+ returnXpath?: boolean;
2849
+ }): Promise<[string, string]>;
1578
2850
  /**
1579
2851
  * Type a string by dispatching keyDown/keyUp events per character.
1580
2852
  * Focus must already be on the desired element. Uses CDP Input.dispatchKeyEvent
@@ -1598,7 +2870,7 @@ declare class Page {
1598
2870
  private keyDown;
1599
2871
  /** Release a pressed key */
1600
2872
  private keyUp;
1601
- /** Normalize modifier key names to match CDP expectations */
2873
+ /** Normalize key names to match CDP expectations */
1602
2874
  private normalizeModifierKey;
1603
2875
  /**
1604
2876
  * Get the map of named keys with their properties
@@ -1697,6 +2969,11 @@ interface AgentCallbacks {
1697
2969
  * This provides a clear error message when users try to use streaming callbacks without stream: true.
1698
2970
  */
1699
2971
  type StreamingCallbackNotAvailable = "This callback requires 'stream: true' in AgentConfig. Set stream: true to use streaming callbacks like onChunk, onFinish, onError, and onAbort.";
2972
+ /**
2973
+ * Error message for safety confirmation callback misuse.
2974
+ * Safety confirmations are only available for non-streaming CUA agent executions.
2975
+ */
2976
+ type SafetyConfirmationCallbackNotAvailable = "Safety confirmation callbacks are only available via non-streaming AgentExecuteOptions.callbacks when using mode: 'cua'.";
1700
2977
  /**
1701
2978
  * Callbacks specific to the non-streaming execute method.
1702
2979
  */
@@ -1705,6 +2982,11 @@ interface AgentExecuteCallbacks extends AgentCallbacks {
1705
2982
  * Callback called when each step (LLM call) is finished.
1706
2983
  */
1707
2984
  onStepFinish?: GenerateTextOnStepFinishCallback<ToolSet>;
2985
+ /**
2986
+ * Callback for handling safety confirmation requests from CUA providers.
2987
+ * Only available when running an agent configured with mode: "cua".
2988
+ */
2989
+ onSafetyConfirmation?: SafetyConfirmationHandler;
1708
2990
  /**
1709
2991
  * NOT AVAILABLE in non-streaming mode.
1710
2992
  * This callback requires `stream: true` in AgentConfig.
@@ -1794,6 +3076,11 @@ interface AgentStreamCallbacks extends AgentCallbacks {
1794
3076
  onAbort?: (event: {
1795
3077
  steps: Array<StepResult<ToolSet>>;
1796
3078
  }) => PromiseLike<void> | void;
3079
+ /**
3080
+ * NOT AVAILABLE in streaming mode.
3081
+ * Safety confirmations currently require non-streaming execute() on CUA agents.
3082
+ */
3083
+ onSafetyConfirmation?: SafetyConfirmationCallbackNotAvailable;
1797
3084
  }
1798
3085
  /**
1799
3086
  * Base options for agent execution (without callbacks).
@@ -1826,6 +3113,59 @@ interface AgentExecuteOptionsBase {
1826
3113
  * ```
1827
3114
  */
1828
3115
  signal?: AbortSignal;
3116
+ /**
3117
+ * Tools to exclude from this execution.
3118
+ * Pass an array of tool names to prevent the agent from using those tools.
3119
+ *
3120
+ * **Note:** Not supported in CUA mode (`mode: "cua"`).
3121
+ *
3122
+ * **Available tools by mode:**
3123
+ *
3124
+ * **DOM mode (default):**
3125
+ * - `act` - Perform semantic actions (click, type, etc.)
3126
+ * - `fillForm` - Fill form fields using DOM selectors
3127
+ * - `ariaTree` - Get accessibility tree of the page
3128
+ * - `extract` - Extract structured data from page
3129
+ * - `goto` - Navigate to a URL
3130
+ * - `scroll` - Scroll using semantic directions (up/down/left/right)
3131
+ * - `keys` - Press keyboard keys
3132
+ * - `navback` - Navigate back in history
3133
+ * - `screenshot` - Take a screenshot
3134
+ * - `think` - Agent reasoning/planning step
3135
+ * - `wait` - Wait for time or condition
3136
+ * - `close` - Mark task as complete
3137
+ * - `search` - Web search (requires BRAVE_API_KEY)
3138
+ *
3139
+ * **Hybrid mode:**
3140
+ * - `click` - Click at specific coordinates
3141
+ * - `type` - Type text at coordinates
3142
+ * - `dragAndDrop` - Drag from one point to another
3143
+ * - `clickAndHold` - Click and hold at coordinates
3144
+ * - `fillFormVision` - Fill forms using vision/coordinates
3145
+ * - `act` - Perform semantic actions
3146
+ * - `ariaTree` - Get accessibility tree
3147
+ * - `extract` - Extract data from page
3148
+ * - `goto` - Navigate to URL
3149
+ * - `scroll` - Scroll using coordinates
3150
+ * - `keys` - Press keyboard keys
3151
+ * - `navback` - Navigate back
3152
+ * - `screenshot` - Take screenshot
3153
+ * - `think` - Agent reasoning step
3154
+ * - `wait` - Wait for time/condition
3155
+ * - `close` - Mark task complete
3156
+ * - `search` - Web search (requires BRAVE_API_KEY)
3157
+ *
3158
+ * @experimental
3159
+ * @example
3160
+ * ```typescript
3161
+ * // Exclude screenshot and extract tools
3162
+ * const result = await agent.execute({
3163
+ * instruction: "Click the submit button",
3164
+ * excludeTools: ["screenshot", "extract"]
3165
+ * });
3166
+ * ```
3167
+ */
3168
+ excludeTools?: string[];
1829
3169
  }
1830
3170
  /**
1831
3171
  * Options for non-streaming agent execution.
@@ -1868,6 +3208,52 @@ interface ActionExecutionResult {
1868
3208
  error?: string;
1869
3209
  data?: unknown;
1870
3210
  }
3211
+ /**
3212
+ * Represents a safety check that requires user confirmation before proceeding.
3213
+ * These are issued by CUA providers (OpenAI, Google) when the agent attempts
3214
+ * potentially risky actions.
3215
+ */
3216
+ interface SafetyCheck {
3217
+ /** Unique identifier for this safety check */
3218
+ id: string;
3219
+ /** Code identifying the type of safety concern */
3220
+ code: string;
3221
+ /** Human-readable description of the safety concern */
3222
+ message: string;
3223
+ }
3224
+ /**
3225
+ * Response from the user for a safety confirmation request.
3226
+ */
3227
+ interface SafetyConfirmationResponse {
3228
+ /** Whether the user acknowledged/approved the safety checks */
3229
+ acknowledged: boolean;
3230
+ }
3231
+ /**
3232
+ * Callback for handling safety confirmation requests.
3233
+ * Called when the CUA provider issues safety checks that require user confirmation.
3234
+ * The callback should return a promise that resolves when the user has made a decision.
3235
+ *
3236
+ * @param safetyChecks - Array of safety checks requiring confirmation
3237
+ * @returns Promise resolving to the user's response
3238
+ *
3239
+ * @example
3240
+ * ```typescript
3241
+ * const agent = stagehand.agent({
3242
+ * mode: "cua",
3243
+ * });
3244
+ * await agent.execute({
3245
+ * instruction: "...",
3246
+ * callbacks: {
3247
+ * onSafetyConfirmation: async (checks) => {
3248
+ * console.log("Safety checks:", checks);
3249
+ * const userApproved = await showConfirmationDialog(checks);
3250
+ * return { acknowledged: userApproved };
3251
+ * },
3252
+ * },
3253
+ * });
3254
+ * ```
3255
+ */
3256
+ type SafetyConfirmationHandler = (safetyChecks: SafetyCheck[]) => Promise<SafetyConfirmationResponse>;
1871
3257
  interface ToolUseItem extends ResponseItem {
1872
3258
  type: "tool_use";
1873
3259
  id: string;
@@ -1945,6 +3331,13 @@ type AgentProviderType = AgentType;
1945
3331
  type AgentModelConfig<TModelName extends string = string> = {
1946
3332
  modelName: TModelName;
1947
3333
  } & Record<string, unknown>;
3334
+ /**
3335
+ * Agent tool mode determines which set of tools are available to the agent.
3336
+ * - 'dom': Uses DOM-based tools (act, fillForm) - better for structured page interactions
3337
+ * - 'hybrid': Uses coordinate-based tools (click, type, dragAndDrop, etc.) - better for visual/screenshot-based interactions
3338
+ * - 'cua': Uses Computer Use Agent (CUA) providers like Anthropic Claude or Google Gemini for screenshot-based automation
3339
+ */
3340
+ type AgentToolMode = "dom" | "hybrid" | "cua";
1948
3341
  type AgentConfig = {
1949
3342
  /**
1950
3343
  * Custom system prompt to provide to the agent. Overrides the default system prompt.
@@ -1959,7 +3352,8 @@ type AgentConfig = {
1959
3352
  */
1960
3353
  tools?: ToolSet;
1961
3354
  /**
1962
- * Indicates CUA is disabled for this configuration
3355
+ * @deprecated Use `mode: "cua"` instead. This option will be removed in a future version.
3356
+ * Enables Computer Use Agent (CUA) mode.
1963
3357
  */
1964
3358
  cua?: boolean;
1965
3359
  /**
@@ -1978,6 +3372,14 @@ type AgentConfig = {
1978
3372
  * When false (default), execute() returns AgentResult after completion.
1979
3373
  */
1980
3374
  stream?: boolean;
3375
+ /**
3376
+ * Tool mode for the agent. Determines which set of tools are available.
3377
+ * - 'dom' (default): Uses DOM-based tools (act, fillForm) for structured interactions
3378
+ * - 'hybrid': Uses coordinate-based tools (click, type, dragAndDrop, clickAndHold, fillFormVision)
3379
+ * for visual/screenshot-based interactions
3380
+ * - 'cua': Uses Computer Use Agent (CUA) providers for screenshot-based automation
3381
+ */
3382
+ mode?: AgentToolMode;
1981
3383
  };
1982
3384
  /**
1983
3385
  * Agent instance returned when stream: true is set in AgentConfig.
@@ -2196,6 +3598,11 @@ declare class V3 {
2196
3598
  private observeHandler;
2197
3599
  private ctx;
2198
3600
  llmClient: LLMClient;
3601
+ /**
3602
+ * Event bus for internal communication.
3603
+ * Emits events like 'screenshot' when screenshots are captured during agent execution.
3604
+ */
3605
+ readonly bus: EventEmitter;
2199
3606
  private modelName;
2200
3607
  private modelClientOptions;
2201
3608
  private llmProvider;
@@ -2208,6 +3615,10 @@ declare class V3 {
2208
3615
  get browserbaseSessionID(): string | undefined;
2209
3616
  get browserbaseSessionURL(): string | undefined;
2210
3617
  get browserbaseDebugURL(): string | undefined;
3618
+ /**
3619
+ * Returns true if the browser is running on Browserbase.
3620
+ */
3621
+ get isBrowserbase(): boolean;
2211
3622
  private _onCdpClosed;
2212
3623
  readonly experimental: boolean;
2213
3624
  readonly logInferenceToFile: boolean;
@@ -2366,6 +3777,319 @@ declare class AgentProvider {
2366
3777
  static getAgentProvider(modelName: string): AgentProviderType;
2367
3778
  }
2368
3779
 
3780
+ declare const gotoTool: (v3: V3) => ai.Tool<{
3781
+ url: string;
3782
+ }, {
3783
+ success: boolean;
3784
+ url: string;
3785
+ error?: undefined;
3786
+ } | {
3787
+ success: boolean;
3788
+ error: any;
3789
+ url?: undefined;
3790
+ }>;
3791
+
3792
+ declare const actTool: (v3: V3, executionModel?: string) => ai.Tool<{
3793
+ action: string;
3794
+ }, {
3795
+ success: boolean;
3796
+ action: string;
3797
+ playwrightArguments: Action;
3798
+ error?: undefined;
3799
+ } | {
3800
+ success: boolean;
3801
+ error: any;
3802
+ action?: undefined;
3803
+ playwrightArguments?: undefined;
3804
+ }>;
3805
+
3806
+ declare const screenshotTool: (v3: V3) => ai.Tool<Record<string, never>, {
3807
+ base64: string;
3808
+ timestamp: number;
3809
+ pageUrl: string;
3810
+ }>;
3811
+
3812
+ declare const waitTool: (v3: V3) => ai.Tool<{
3813
+ timeMs: number;
3814
+ }, {
3815
+ success: boolean;
3816
+ waited: number;
3817
+ }>;
3818
+
3819
+ declare const navBackTool: (v3: V3) => ai.Tool<{
3820
+ reasoningText: string;
3821
+ }, {
3822
+ success: boolean;
3823
+ }>;
3824
+
3825
+ declare const closeTool: () => ai.Tool<{
3826
+ reasoning: string;
3827
+ taskComplete: boolean;
3828
+ }, {
3829
+ success: boolean;
3830
+ reasoning: string;
3831
+ taskComplete: boolean;
3832
+ }>;
3833
+
3834
+ declare const ariaTreeTool: (v3: V3) => ai.Tool<Record<string, never>, {
3835
+ content: string;
3836
+ pageUrl: string;
3837
+ }>;
3838
+
3839
+ declare const fillFormTool: (v3: V3, executionModel?: string) => ai.Tool<{
3840
+ fields: {
3841
+ action: string;
3842
+ value: string;
3843
+ }[];
3844
+ }, {
3845
+ success: boolean;
3846
+ actions: unknown[];
3847
+ playwrightArguments: Action[];
3848
+ }>;
3849
+
3850
+ /**
3851
+ * Simple scroll tool for DOM mode (non-grounding models).
3852
+ * No coordinates - scrolls from viewport center.
3853
+ */
3854
+ declare const scrollTool: (v3: V3) => ai.Tool<{
3855
+ direction: "up" | "down";
3856
+ percentage?: number;
3857
+ }, {
3858
+ success: boolean;
3859
+ message: string;
3860
+ scrolledPixels: number;
3861
+ }>;
3862
+ /**
3863
+ * Scroll tool for hybrid mode (grounding models).
3864
+ * Supports optional coordinates for scrolling within nested scrollable elements.
3865
+ */
3866
+ declare const scrollVisionTool: (v3: V3, provider?: string) => ai.Tool<{
3867
+ direction: "up" | "down";
3868
+ coordinates?: number[];
3869
+ percentage?: number;
3870
+ }, {
3871
+ success: boolean;
3872
+ message: string;
3873
+ scrolledPixels: number;
3874
+ }>;
3875
+
3876
+ declare const extractTool: (v3: V3, executionModel?: string, logger?: (message: LogLine) => void) => ai.Tool<{
3877
+ instruction: string;
3878
+ schema?: string;
3879
+ }, {
3880
+ success: boolean;
3881
+ result: any;
3882
+ error?: undefined;
3883
+ } | {
3884
+ success: boolean;
3885
+ error: any;
3886
+ result?: undefined;
3887
+ }>;
3888
+
3889
+ declare const clickTool: (v3: V3, provider?: string) => ai.Tool<{
3890
+ describe: string;
3891
+ coordinates: number[];
3892
+ }, {
3893
+ success: boolean;
3894
+ describe: string;
3895
+ coordinates: number[];
3896
+ error?: undefined;
3897
+ } | {
3898
+ success: boolean;
3899
+ error: string;
3900
+ describe?: undefined;
3901
+ coordinates?: undefined;
3902
+ }>;
3903
+
3904
+ declare const typeTool: (v3: V3, provider?: string) => ai.Tool<{
3905
+ describe: string;
3906
+ text: string;
3907
+ coordinates: number[];
3908
+ }, {
3909
+ success: boolean;
3910
+ describe: string;
3911
+ text: string;
3912
+ error?: undefined;
3913
+ } | {
3914
+ success: boolean;
3915
+ error: string;
3916
+ describe?: undefined;
3917
+ text?: undefined;
3918
+ }>;
3919
+
3920
+ declare const dragAndDropTool: (v3: V3, provider?: string) => ai.Tool<{
3921
+ describe: string;
3922
+ startCoordinates: number[];
3923
+ endCoordinates: number[];
3924
+ }, {
3925
+ success: boolean;
3926
+ describe: string;
3927
+ error?: undefined;
3928
+ } | {
3929
+ success: boolean;
3930
+ error: string;
3931
+ describe?: undefined;
3932
+ }>;
3933
+
3934
+ declare const clickAndHoldTool: (v3: V3, provider?: string) => ai.Tool<{
3935
+ describe: string;
3936
+ duration: number;
3937
+ coordinates: number[];
3938
+ }, {
3939
+ success: boolean;
3940
+ describe: string;
3941
+ error?: undefined;
3942
+ } | {
3943
+ success: boolean;
3944
+ error: string;
3945
+ describe?: undefined;
3946
+ }>;
3947
+
3948
+ declare const keysTool: (v3: V3) => ai.Tool<{
3949
+ method: "type" | "press";
3950
+ value: string;
3951
+ repeat?: number;
3952
+ }, {
3953
+ success: boolean;
3954
+ method: "type";
3955
+ value: string;
3956
+ times: number;
3957
+ error?: undefined;
3958
+ } | {
3959
+ success: boolean;
3960
+ method: "press";
3961
+ value: string;
3962
+ times: number;
3963
+ error?: undefined;
3964
+ } | {
3965
+ success: boolean;
3966
+ error: string;
3967
+ method?: undefined;
3968
+ value?: undefined;
3969
+ times?: undefined;
3970
+ }>;
3971
+
3972
+ declare const fillFormVisionTool: (v3: V3, provider?: string) => ai.Tool<{
3973
+ fields: {
3974
+ action: string;
3975
+ value: string;
3976
+ coordinates: {
3977
+ x: number;
3978
+ y: number;
3979
+ };
3980
+ }[];
3981
+ }, {
3982
+ success: boolean;
3983
+ playwrightArguments: {
3984
+ coordinates: {
3985
+ x: number;
3986
+ y: number;
3987
+ };
3988
+ action: string;
3989
+ value: string;
3990
+ }[];
3991
+ error?: undefined;
3992
+ } | {
3993
+ success: boolean;
3994
+ error: string;
3995
+ playwrightArguments?: undefined;
3996
+ }>;
3997
+
3998
+ declare const thinkTool: () => ai.Tool<{
3999
+ reasoning: string;
4000
+ }, {
4001
+ acknowledged: boolean;
4002
+ message: string;
4003
+ }>;
4004
+
4005
+ interface BraveSearchResult {
4006
+ title: string;
4007
+ url: string;
4008
+ description?: string;
4009
+ }
4010
+ declare const searchTool: (v3: V3) => ai.Tool<{
4011
+ query: string;
4012
+ }, {
4013
+ timestamp: number;
4014
+ data?: {
4015
+ results: BraveSearchResult[];
4016
+ };
4017
+ error?: string;
4018
+ }>;
4019
+
4020
+ interface V3AgentToolOptions {
4021
+ executionModel?: string;
4022
+ logger?: (message: LogLine) => void;
4023
+ /**
4024
+ * Tool mode determines which set of tools are available.
4025
+ * - 'dom' (default): Uses DOM-based tools (act, fillForm) - removes coordinate-based tools
4026
+ * - 'hybrid': Uses coordinate-based tools (click, type, dragAndDrop, etc.) - removes fillForm
4027
+ */
4028
+ mode?: AgentToolMode;
4029
+ /**
4030
+ * The model provider. Used for model-specific coordinate handling
4031
+ */
4032
+ provider?: string;
4033
+ /**
4034
+ * Tools to exclude from the available toolset.
4035
+ * These tools will be filtered out after mode-based filtering.
4036
+ */
4037
+ excludeTools?: string[];
4038
+ }
4039
+ declare function createAgentTools(v3: V3, options?: V3AgentToolOptions): ToolSet;
4040
+ type AgentTools = ReturnType<typeof createAgentTools>;
4041
+ /**
4042
+ * Type map of all agent tools for strong typing of tool calls and results.
4043
+ * Note: `search` is optional as it's only available when BRAVE_API_KEY is configured.
4044
+ */
4045
+ type AgentToolTypesMap = {
4046
+ act: ReturnType<typeof actTool>;
4047
+ ariaTree: ReturnType<typeof ariaTreeTool>;
4048
+ click: ReturnType<typeof clickTool>;
4049
+ clickAndHold: ReturnType<typeof clickAndHoldTool>;
4050
+ close: ReturnType<typeof closeTool>;
4051
+ dragAndDrop: ReturnType<typeof dragAndDropTool>;
4052
+ extract: ReturnType<typeof extractTool>;
4053
+ fillForm: ReturnType<typeof fillFormTool>;
4054
+ fillFormVision: ReturnType<typeof fillFormVisionTool>;
4055
+ goto: ReturnType<typeof gotoTool>;
4056
+ keys: ReturnType<typeof keysTool>;
4057
+ navback: ReturnType<typeof navBackTool>;
4058
+ screenshot: ReturnType<typeof screenshotTool>;
4059
+ scroll: ReturnType<typeof scrollTool> | ReturnType<typeof scrollVisionTool>;
4060
+ search?: ReturnType<typeof searchTool>;
4061
+ think: ReturnType<typeof thinkTool>;
4062
+ type: ReturnType<typeof typeTool>;
4063
+ wait: ReturnType<typeof waitTool>;
4064
+ };
4065
+ /**
4066
+ * Inferred UI tools type for type-safe tool inputs and outputs.
4067
+ * Use with UIMessage for full type safety in UI contexts.
4068
+ */
4069
+ type AgentUITools = InferUITools<AgentToolTypesMap>;
4070
+ /**
4071
+ * Union type for all possible agent tool calls.
4072
+ * Provides type-safe access to tool call arguments.
4073
+ */
4074
+ type AgentToolCall = {
4075
+ [K in keyof AgentToolTypesMap]: {
4076
+ toolName: K;
4077
+ toolCallId: string;
4078
+ args: AgentUITools[K]["input"];
4079
+ };
4080
+ }[keyof AgentToolTypesMap];
4081
+ /**
4082
+ * Union type for all possible agent tool results.
4083
+ * Provides type-safe access to tool result values.
4084
+ */
4085
+ type AgentToolResult = {
4086
+ [K in keyof AgentToolTypesMap]: {
4087
+ toolName: K;
4088
+ toolCallId: string;
4089
+ result: AgentUITools[K]["output"];
4090
+ };
4091
+ }[keyof AgentToolTypesMap];
4092
+
2369
4093
  declare function validateZodSchema(schema: StagehandZodSchema, data: unknown): boolean;
2370
4094
  /**
2371
4095
  * Detects if the code is running in the Bun runtime environment.
@@ -2457,4 +4181,4 @@ declare class V3Evaluator {
2457
4181
  private _evaluateWithMultipleScreenshots;
2458
4182
  }
2459
4183
 
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 };
4184
+ 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 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, type SafetyCheck, type SafetyConfirmationHandler, type SafetyConfirmationResponse, 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, UnsupportedAISDKModelProviderError, UnsupportedModelError, UnsupportedModelProviderError, V3, type V3Env, V3Evaluator, V3FunctionName, type V3Options, XPathResolutionError, ZodSchemaValidationError, connectToMCPServer, defaultExtractSchema, getZodType, injectUrls, isRunningInBun, isZod3Schema, isZod4Schema, jsonSchemaToZod, loadApiKeyFromEnv, localBrowserLaunchOptionsSchema, modelToAgentProviderMap, pageTextSchema, providerEnvVarMap, toGeminiSchema, toJsonSchema, transformSchema, trimTrailingTextNode, validateZodSchema };