@browserbasehq/orca 3.0.2-zod359 → 3.0.2-zod370
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 +12 -25
- package/dist/index.js +310 -565
- package/package.json +3 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as z3 from 'zod/v3';
|
|
1
|
+
import { ZodType, z, ZodError, ZodTypeAny } from 'zod';
|
|
3
2
|
import { ClientOptions as ClientOptions$2 } from '@anthropic-ai/sdk';
|
|
4
3
|
import { LanguageModelV2 } from '@ai-sdk/provider';
|
|
5
4
|
import { ClientOptions as ClientOptions$1 } from 'openai';
|
|
@@ -18,16 +17,6 @@ import { ChatCompletion } from 'openai/resources';
|
|
|
18
17
|
import { ToolSet as ToolSet$1 } from 'ai/dist';
|
|
19
18
|
import { Schema } from '@google/genai';
|
|
20
19
|
|
|
21
|
-
type StagehandZodSchema = ZodTypeAny | z3.ZodTypeAny;
|
|
22
|
-
type StagehandZodObject = ZodObject<ZodRawShape> | z3.ZodObject<z3.ZodRawShape>;
|
|
23
|
-
type InferStagehandSchema<T extends StagehandZodSchema> = T extends z3.ZodTypeAny ? z3.infer<T> : T extends ZodTypeAny ? z.infer<T> : never;
|
|
24
|
-
declare const isZod4Schema: (schema: StagehandZodSchema) => schema is ZodTypeAny & {
|
|
25
|
-
_zod: unknown;
|
|
26
|
-
};
|
|
27
|
-
declare const isZod3Schema: (schema: StagehandZodSchema) => schema is z3.ZodTypeAny;
|
|
28
|
-
type JsonSchemaDocument = Record<string, unknown>;
|
|
29
|
-
declare function toJsonSchema(schema: StagehandZodSchema): JsonSchemaDocument;
|
|
30
|
-
|
|
31
20
|
type AnthropicJsonSchemaObject = {
|
|
32
21
|
definitions?: {
|
|
33
22
|
MySchema?: {
|
|
@@ -113,7 +102,7 @@ interface ChatCompletionOptions {
|
|
|
113
102
|
};
|
|
114
103
|
response_model?: {
|
|
115
104
|
name: string;
|
|
116
|
-
schema:
|
|
105
|
+
schema: ZodType;
|
|
117
106
|
};
|
|
118
107
|
tools?: LLMTool[];
|
|
119
108
|
tool_choice?: "auto" | "none" | "required";
|
|
@@ -178,7 +167,7 @@ declare abstract class LLMClient {
|
|
|
178
167
|
options: {
|
|
179
168
|
response_model: {
|
|
180
169
|
name: string;
|
|
181
|
-
schema:
|
|
170
|
+
schema: ZodType;
|
|
182
171
|
};
|
|
183
172
|
};
|
|
184
173
|
}): Promise<LLMParsedResponse<T>>;
|
|
@@ -789,7 +778,7 @@ declare class StagehandAPIClient {
|
|
|
789
778
|
constructor({ apiKey, projectId, logger }: StagehandAPIConstructorParams);
|
|
790
779
|
init({ modelName, modelApiKey, domSettleTimeoutMs, verbose, systemPrompt, selfHeal, browserbaseSessionCreateParams, browserbaseSessionID, }: StartSessionParams): Promise<StartSessionResult>;
|
|
791
780
|
act({ input, options, frameId }: APIActParameters): Promise<ActResult>;
|
|
792
|
-
extract<T extends
|
|
781
|
+
extract<T extends z.ZodObject>({ instruction, schema: zodSchema, options, frameId, }: APIExtractParameters): Promise<ExtractResult<T>>;
|
|
793
782
|
observe({ instruction, options, frameId, }: APIObserveParameters): Promise<Action[]>;
|
|
794
783
|
goto(url: string, options?: {
|
|
795
784
|
waitUntil?: "load" | "domcontentloaded" | "networkidle";
|
|
@@ -1344,7 +1333,7 @@ interface ActResult {
|
|
|
1344
1333
|
actionDescription: string;
|
|
1345
1334
|
actions: Action[];
|
|
1346
1335
|
}
|
|
1347
|
-
type ExtractResult<T extends
|
|
1336
|
+
type ExtractResult<T extends z.ZodObject> = z.infer<T>;
|
|
1348
1337
|
interface Action {
|
|
1349
1338
|
selector: string;
|
|
1350
1339
|
description: string;
|
|
@@ -1634,7 +1623,7 @@ interface APIActParameters {
|
|
|
1634
1623
|
}
|
|
1635
1624
|
interface APIExtractParameters {
|
|
1636
1625
|
instruction?: string;
|
|
1637
|
-
schema?:
|
|
1626
|
+
schema?: ZodTypeAny;
|
|
1638
1627
|
options?: ExtractOptions;
|
|
1639
1628
|
frameId?: string;
|
|
1640
1629
|
}
|
|
@@ -1981,8 +1970,7 @@ declare class V3 {
|
|
|
1981
1970
|
extract(): Promise<z.infer<typeof pageTextSchema>>;
|
|
1982
1971
|
extract(options: ExtractOptions): Promise<z.infer<typeof pageTextSchema>>;
|
|
1983
1972
|
extract(instruction: string, options?: ExtractOptions): Promise<z.infer<typeof defaultExtractSchema>>;
|
|
1984
|
-
extract<T extends
|
|
1985
|
-
extract(instruction: string, schema: unknown, options?: ExtractOptions): Promise<unknown>;
|
|
1973
|
+
extract<T extends ZodTypeAny>(instruction: string, schema: T, options?: ExtractOptions): Promise<z.infer<T>>;
|
|
1986
1974
|
/**
|
|
1987
1975
|
* Run an "observe" instruction through the ObserveHandler.
|
|
1988
1976
|
*/
|
|
@@ -2054,14 +2042,14 @@ declare class AgentProvider {
|
|
|
2054
2042
|
static getAgentProvider(modelName: string): AgentProviderType;
|
|
2055
2043
|
}
|
|
2056
2044
|
|
|
2057
|
-
declare function validateZodSchema(schema:
|
|
2045
|
+
declare function validateZodSchema(schema: z.ZodTypeAny, data: unknown): boolean;
|
|
2058
2046
|
/**
|
|
2059
2047
|
* Detects if the code is running in the Bun runtime environment.
|
|
2060
2048
|
* @returns {boolean} True if running in Bun, false otherwise.
|
|
2061
2049
|
*/
|
|
2062
2050
|
declare function isRunningInBun(): boolean;
|
|
2063
|
-
declare function toGeminiSchema(zodSchema:
|
|
2064
|
-
declare function getZodType(schema:
|
|
2051
|
+
declare function toGeminiSchema(zodSchema: z.ZodTypeAny): Schema;
|
|
2052
|
+
declare function getZodType(schema: z.ZodTypeAny): string;
|
|
2065
2053
|
/**
|
|
2066
2054
|
* Recursively traverses a given Zod schema, scanning for any fields of type `z.string().url()`.
|
|
2067
2055
|
* For each such field, it replaces the `z.string().url()` with `z.number()`.
|
|
@@ -2075,7 +2063,7 @@ declare function getZodType(schema: StagehandZodSchema): string;
|
|
|
2075
2063
|
* 1. The updated Zod schema, with any `.url()` fields replaced by `z.number()`.
|
|
2076
2064
|
* 2. An array of {@link ZodPathSegments} objects representing each replaced field, including the path segments.
|
|
2077
2065
|
*/
|
|
2078
|
-
declare function transformSchema(schema:
|
|
2066
|
+
declare function transformSchema(schema: z.ZodTypeAny, currentPath: Array<string | number>): [z.ZodTypeAny, ZodPathSegments[]];
|
|
2079
2067
|
/**
|
|
2080
2068
|
* Once we get the final extracted object that has numeric IDs in place of URLs,
|
|
2081
2069
|
* use `injectUrls` to walk the object and replace numeric IDs
|
|
@@ -2104,7 +2092,6 @@ interface JsonSchemaProperty {
|
|
|
2104
2092
|
minimum?: number;
|
|
2105
2093
|
maximum?: number;
|
|
2106
2094
|
description?: string;
|
|
2107
|
-
format?: string;
|
|
2108
2095
|
}
|
|
2109
2096
|
interface JsonSchema extends JsonSchemaProperty {
|
|
2110
2097
|
type: string;
|
|
@@ -2145,4 +2132,4 @@ declare class V3Evaluator {
|
|
|
2145
2132
|
private _evaluateWithMultipleScreenshots;
|
|
2146
2133
|
}
|
|
2147
2134
|
|
|
2148
|
-
export { type AISDKCustomProvider, type AISDKProvider, AISdkClient, AVAILABLE_CUA_MODELS, type ActOptions, type ActResult, type Action, type ActionExecutionResult, type AgentAction, type AgentConfig, type AgentExecuteOptions, type AgentExecutionOptions, type AgentHandlerOptions, type AgentInstance, type AgentModelConfig, AgentProvider, type AgentProviderType, type AgentResult, AgentScreenshotProviderError, type AgentType, AnnotatedScreenshotText, 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, type FunctionCallItem, HandlerNotInitializedError, type HistoryEntry,
|
|
2135
|
+
export { type AISDKCustomProvider, type AISDKProvider, AISdkClient, AVAILABLE_CUA_MODELS, type ActOptions, type ActResult, type Action, type ActionExecutionResult, type AgentAction, type AgentConfig, type AgentExecuteOptions, type AgentExecutionOptions, type AgentHandlerOptions, type AgentInstance, type AgentModelConfig, AgentProvider, type AgentProviderType, type AgentResult, AgentScreenshotProviderError, type AgentType, AnnotatedScreenshotText, 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, type FunctionCallItem, HandlerNotInitializedError, type HistoryEntry, InvalidAISDKModelFormatError, type JsonSchema, 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 ObserveOptions, 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, TimeoutError, type ToolUseItem, UnsupportedAISDKModelProviderError, UnsupportedModelError, UnsupportedModelProviderError, V3, type V3Env, V3Evaluator, V3FunctionName, type V3Options, XPathResolutionError, ZodSchemaValidationError, connectToMCPServer, defaultExtractSchema, getZodType, injectUrls, isRunningInBun, jsonSchemaToZod, loadApiKeyFromEnv, modelToAgentProviderMap, pageTextSchema, providerEnvVarMap, toGeminiSchema, transformSchema, trimTrailingTextNode, validateZodSchema };
|