@browserbasehq/stagehand 2.0.0 → 2.0.1-alpha-cf167a437865e8e8bdb8739d22c3b3bb84e185de

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -707,6 +707,86 @@ declare const operatorSummarySchema: z.ZodObject<{
707
707
  }>;
708
708
  type OperatorSummary = z.infer<typeof operatorSummarySchema>;
709
709
 
710
+ declare class StagehandError extends Error {
711
+ constructor(message: string);
712
+ }
713
+ declare class StagehandDefaultError extends StagehandError {
714
+ constructor();
715
+ }
716
+ declare class StagehandEnvironmentError extends StagehandError {
717
+ constructor(currentEnvironment: string, requiredEnvironment: string, feature: string);
718
+ }
719
+ declare class MissingEnvironmentVariableError extends StagehandError {
720
+ constructor(missingEnvironmentVariable: string, feature: string);
721
+ }
722
+ declare class UnsupportedModelError extends StagehandError {
723
+ constructor(supportedModels: string[], feature?: string);
724
+ }
725
+ declare class UnsupportedModelProviderError extends StagehandError {
726
+ constructor(supportedProviders: string[], feature?: string);
727
+ }
728
+ declare class StagehandNotInitializedError extends StagehandError {
729
+ constructor(prop: string);
730
+ }
731
+ declare class BrowserbaseSessionNotFoundError extends StagehandError {
732
+ constructor();
733
+ }
734
+ declare class CaptchaTimeoutError extends StagehandError {
735
+ constructor();
736
+ }
737
+ declare class MissingLLMConfigurationError extends StagehandError {
738
+ constructor();
739
+ }
740
+ declare class HandlerNotInitializedError extends StagehandError {
741
+ constructor(handlerType: string);
742
+ }
743
+ declare class StagehandNotImplementedError extends StagehandError {
744
+ constructor(message: string);
745
+ }
746
+ declare class StagehandDeprecationError extends StagehandError {
747
+ constructor(message: string);
748
+ }
749
+ declare class StagehandInvalidArgumentError extends StagehandError {
750
+ constructor(message: string);
751
+ }
752
+ declare class StagehandElementNotFoundError extends StagehandError {
753
+ constructor(xpaths: string[]);
754
+ }
755
+ declare class AgentScreenshotProviderError extends StagehandError {
756
+ constructor(message: string);
757
+ }
758
+ declare class StagehandMissingArgumentError extends StagehandError {
759
+ constructor(message: string);
760
+ }
761
+ declare class CreateChatCompletionResponseError extends StagehandError {
762
+ constructor(message: string);
763
+ }
764
+ declare class StagehandEvalError extends StagehandError {
765
+ constructor(message: string);
766
+ }
767
+ declare class StagehandDomProcessError extends StagehandError {
768
+ constructor(message: string);
769
+ }
770
+
771
+ declare class StagehandAPIError extends Error {
772
+ constructor(message: string);
773
+ }
774
+ declare class StagehandAPIUnauthorizedError extends StagehandAPIError {
775
+ constructor(message?: string);
776
+ }
777
+ declare class StagehandHttpError extends StagehandAPIError {
778
+ constructor(message: string);
779
+ }
780
+ declare class StagehandServerError extends StagehandAPIError {
781
+ constructor(message: string);
782
+ }
783
+ declare class StagehandResponseBodyError extends StagehandAPIError {
784
+ constructor();
785
+ }
786
+ declare class StagehandResponseParseError extends StagehandAPIError {
787
+ constructor(message: string);
788
+ }
789
+
710
790
  declare class Stagehand {
711
791
  private stagehandPage;
712
792
  private stagehandContext;
@@ -773,4 +853,4 @@ declare class Stagehand {
773
853
  get history(): ReadonlyArray<HistoryEntry>;
774
854
  }
775
855
 
776
- export { type ActOptions, type ActResult, type ActionExecutionResult, type AgentAction, type AgentClientOptions, type AgentConfig, type AgentExecuteOptions, type AgentExecuteParams, type AgentExecutionOptions, type AgentHandlerOptions, type AgentOptions, type AgentProviderType, type AgentResult, type AgentType, AnnotatedScreenshotText, type AnthropicContentBlock, type AnthropicJsonSchemaObject, type AnthropicMessage, type AnthropicTextBlock, type AnthropicToolResult, type AvailableModel, AvailableModelSchema, type Browser, type BrowserContext, type BrowserResult, type ChatCompletionOptions, type ChatMessage, type ChatMessageContent, type ChatMessageImageContent, type ChatMessageTextContent, type ClientOptions, type ComputerCallItem, type ConstructorParams, type CreateChatCompletionOptions, type ExtractOptions, type ExtractResult, type FunctionCallItem, type GotoOptions, type HistoryEntry, type InitResult, LLMClient, type LLMResponse, LOG_LEVEL_NAMES, type LocalBrowserLaunchOptions, type LogLevel, type LogLine, type Logger, type ModelProvider, type ObserveOptions, type ObserveResult, type OperatorResponse, type OperatorSummary, type Page, PlaywrightCommandException, PlaywrightCommandMethodNotSupportedException, type ResponseInputItem, type ResponseItem, Stagehand, StagehandFunctionName, type StagehandMetrics, type ToolUseItem, defaultExtractSchema, operatorResponseSchema, operatorSummarySchema, pageTextSchema };
856
+ export { type ActOptions, type ActResult, type ActionExecutionResult, type AgentAction, type AgentClientOptions, type AgentConfig, type AgentExecuteOptions, type AgentExecuteParams, type AgentExecutionOptions, type AgentHandlerOptions, type AgentOptions, type AgentProviderType, type AgentResult, AgentScreenshotProviderError, type AgentType, AnnotatedScreenshotText, type AnthropicContentBlock, type AnthropicJsonSchemaObject, type AnthropicMessage, type AnthropicTextBlock, type AnthropicToolResult, type AvailableModel, AvailableModelSchema, type Browser, type BrowserContext, type BrowserResult, BrowserbaseSessionNotFoundError, CaptchaTimeoutError, type ChatCompletionOptions, type ChatMessage, type ChatMessageContent, type ChatMessageImageContent, type ChatMessageTextContent, type ClientOptions, type ComputerCallItem, type ConstructorParams, type CreateChatCompletionOptions, CreateChatCompletionResponseError, type ExtractOptions, type ExtractResult, type FunctionCallItem, type GotoOptions, HandlerNotInitializedError, type HistoryEntry, type InitResult, LLMClient, type LLMResponse, LOG_LEVEL_NAMES, type LocalBrowserLaunchOptions, type LogLevel, type LogLine, type Logger, MissingEnvironmentVariableError, MissingLLMConfigurationError, type ModelProvider, type ObserveOptions, type ObserveResult, type OperatorResponse, type OperatorSummary, type Page, PlaywrightCommandException, PlaywrightCommandMethodNotSupportedException, type ResponseInputItem, type ResponseItem, Stagehand, StagehandAPIError, StagehandAPIUnauthorizedError, StagehandDefaultError, StagehandDeprecationError, StagehandDomProcessError, StagehandElementNotFoundError, StagehandEnvironmentError, StagehandError, StagehandEvalError, StagehandFunctionName, StagehandHttpError, StagehandInvalidArgumentError, type StagehandMetrics, StagehandMissingArgumentError, StagehandNotImplementedError, StagehandNotInitializedError, StagehandResponseBodyError, StagehandResponseParseError, StagehandServerError, type ToolUseItem, UnsupportedModelError, UnsupportedModelProviderError, defaultExtractSchema, operatorResponseSchema, operatorSummarySchema, pageTextSchema };
package/dist/index.js CHANGED
@@ -80,14 +80,40 @@ var __async = (__this, __arguments, generator) => {
80
80
  // lib/index.ts
81
81
  var index_exports = {};
82
82
  __export(index_exports, {
83
+ AgentScreenshotProviderError: () => AgentScreenshotProviderError,
83
84
  AnnotatedScreenshotText: () => AnnotatedScreenshotText,
84
85
  AvailableModelSchema: () => AvailableModelSchema,
86
+ BrowserbaseSessionNotFoundError: () => BrowserbaseSessionNotFoundError,
87
+ CaptchaTimeoutError: () => CaptchaTimeoutError,
88
+ CreateChatCompletionResponseError: () => CreateChatCompletionResponseError,
89
+ HandlerNotInitializedError: () => HandlerNotInitializedError,
85
90
  LLMClient: () => LLMClient,
86
91
  LOG_LEVEL_NAMES: () => LOG_LEVEL_NAMES,
92
+ MissingEnvironmentVariableError: () => MissingEnvironmentVariableError,
93
+ MissingLLMConfigurationError: () => MissingLLMConfigurationError,
87
94
  PlaywrightCommandException: () => PlaywrightCommandException,
88
95
  PlaywrightCommandMethodNotSupportedException: () => PlaywrightCommandMethodNotSupportedException,
89
96
  Stagehand: () => Stagehand3,
97
+ StagehandAPIError: () => StagehandAPIError,
98
+ StagehandAPIUnauthorizedError: () => StagehandAPIUnauthorizedError,
99
+ StagehandDefaultError: () => StagehandDefaultError,
100
+ StagehandDeprecationError: () => StagehandDeprecationError,
101
+ StagehandDomProcessError: () => StagehandDomProcessError,
102
+ StagehandElementNotFoundError: () => StagehandElementNotFoundError,
103
+ StagehandEnvironmentError: () => StagehandEnvironmentError,
104
+ StagehandError: () => StagehandError,
105
+ StagehandEvalError: () => StagehandEvalError,
90
106
  StagehandFunctionName: () => StagehandFunctionName,
107
+ StagehandHttpError: () => StagehandHttpError,
108
+ StagehandInvalidArgumentError: () => StagehandInvalidArgumentError,
109
+ StagehandMissingArgumentError: () => StagehandMissingArgumentError,
110
+ StagehandNotImplementedError: () => StagehandNotImplementedError,
111
+ StagehandNotInitializedError: () => StagehandNotInitializedError,
112
+ StagehandResponseBodyError: () => StagehandResponseBodyError,
113
+ StagehandResponseParseError: () => StagehandResponseParseError,
114
+ StagehandServerError: () => StagehandServerError,
115
+ UnsupportedModelError: () => UnsupportedModelError,
116
+ UnsupportedModelProviderError: () => UnsupportedModelProviderError,
91
117
  defaultExtractSchema: () => defaultExtractSchema,
92
118
  operatorResponseSchema: () => operatorResponseSchema,
93
119
  operatorSummarySchema: () => operatorSummarySchema,
@@ -391,11 +417,21 @@ var StagehandNotImplementedError = class extends StagehandError {
391
417
  super(`NotImplementedError: ${message}`);
392
418
  }
393
419
  };
420
+ var StagehandDeprecationError = class extends StagehandError {
421
+ constructor(message) {
422
+ super(`DeprecationError: ${message}`);
423
+ }
424
+ };
394
425
  var StagehandInvalidArgumentError = class extends StagehandError {
395
426
  constructor(message) {
396
427
  super(`InvalidArgumentError: ${message}`);
397
428
  }
398
429
  };
430
+ var StagehandElementNotFoundError = class extends StagehandError {
431
+ constructor(xpaths) {
432
+ super(`Could not find an element for the given xPath(s): ${xpaths}`);
433
+ }
434
+ };
399
435
  var AgentScreenshotProviderError = class extends StagehandError {
400
436
  constructor(message) {
401
437
  super(`ScreenshotProviderError: ${message}`);
@@ -411,6 +447,16 @@ var CreateChatCompletionResponseError = class extends StagehandError {
411
447
  super(`CreateChatCompletionResponseError: ${message}`);
412
448
  }
413
449
  };
450
+ var StagehandEvalError = class extends StagehandError {
451
+ constructor(message) {
452
+ super(`StagehandEvalError: ${message}`);
453
+ }
454
+ };
455
+ var StagehandDomProcessError = class extends StagehandError {
456
+ constructor(message) {
457
+ super(`Error Processing Dom: ${message}`);
458
+ }
459
+ };
414
460
 
415
461
  // lib/dom/utils.ts
416
462
  function getNodeFromXpath(xpath) {
@@ -8269,14 +8315,40 @@ var Stagehand3 = class {
8269
8315
  };
8270
8316
  // Annotate the CommonJS export names for ESM import in node:
8271
8317
  0 && (module.exports = {
8318
+ AgentScreenshotProviderError,
8272
8319
  AnnotatedScreenshotText,
8273
8320
  AvailableModelSchema,
8321
+ BrowserbaseSessionNotFoundError,
8322
+ CaptchaTimeoutError,
8323
+ CreateChatCompletionResponseError,
8324
+ HandlerNotInitializedError,
8274
8325
  LLMClient,
8275
8326
  LOG_LEVEL_NAMES,
8327
+ MissingEnvironmentVariableError,
8328
+ MissingLLMConfigurationError,
8276
8329
  PlaywrightCommandException,
8277
8330
  PlaywrightCommandMethodNotSupportedException,
8278
8331
  Stagehand,
8332
+ StagehandAPIError,
8333
+ StagehandAPIUnauthorizedError,
8334
+ StagehandDefaultError,
8335
+ StagehandDeprecationError,
8336
+ StagehandDomProcessError,
8337
+ StagehandElementNotFoundError,
8338
+ StagehandEnvironmentError,
8339
+ StagehandError,
8340
+ StagehandEvalError,
8279
8341
  StagehandFunctionName,
8342
+ StagehandHttpError,
8343
+ StagehandInvalidArgumentError,
8344
+ StagehandMissingArgumentError,
8345
+ StagehandNotImplementedError,
8346
+ StagehandNotInitializedError,
8347
+ StagehandResponseBodyError,
8348
+ StagehandResponseParseError,
8349
+ StagehandServerError,
8350
+ UnsupportedModelError,
8351
+ UnsupportedModelProviderError,
8280
8352
  defaultExtractSchema,
8281
8353
  operatorResponseSchema,
8282
8354
  operatorSummarySchema,
@@ -82,3 +82,5 @@ export * from "../types/stagehand";
82
82
  export * from "../types/operator";
83
83
  export * from "../types/agent";
84
84
  export * from "./llm/LLMClient";
85
+ export * from "../types/stagehandErrors";
86
+ export * from "../types/stagehandApiErrors";
package/lib/index.ts CHANGED
@@ -918,3 +918,5 @@ export * from "../types/stagehand";
918
918
  export * from "../types/operator";
919
919
  export * from "../types/agent";
920
920
  export * from "./llm/LLMClient";
921
+ export * from "../types/stagehandErrors";
922
+ export * from "../types/stagehandApiErrors";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browserbasehq/stagehand",
3
- "version": "2.0.0",
3
+ "version": "2.0.1-alpha-cf167a437865e8e8bdb8739d22c3b3bb84e185de",
4
4
  "description": "An AI web browsing framework focused on simplicity and extensibility.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",