@browserbasehq/orca 3.0.0-preview.1 → 3.0.0-preview.3
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 +759 -593
- package/dist/index.js +25560 -24375
- package/package.json +35 -74
- package/README.md +0 -165
- package/dist/lib/StagehandContext.d.ts +0 -25
- package/dist/lib/StagehandPage.d.ts +0 -103
- package/dist/lib/a11y/utils.d.ts +0 -144
- package/dist/lib/agent/AgentClient.d.ts +0 -20
- package/dist/lib/agent/AgentProvider.d.ts +0 -19
- package/dist/lib/agent/AnthropicCUAClient.d.ts +0 -56
- package/dist/lib/agent/GoogleCUAClient.d.ts +0 -63
- package/dist/lib/agent/OpenAICUAClient.d.ts +0 -65
- package/dist/lib/agent/StagehandAgent.d.ts +0 -15
- package/dist/lib/agent/tools/act.d.ts +0 -59
- package/dist/lib/agent/tools/ariaTree.d.ts +0 -11
- package/dist/lib/agent/tools/close.d.ts +0 -22
- package/dist/lib/agent/tools/extract.d.ts +0 -38
- package/dist/lib/agent/tools/fillform.d.ts +0 -37
- package/dist/lib/agent/tools/goto.d.ts +0 -29
- package/dist/lib/agent/tools/index.d.ts +0 -257
- package/dist/lib/agent/tools/navback.d.ts +0 -17
- package/dist/lib/agent/tools/screenshot.d.ts +0 -13
- package/dist/lib/agent/tools/scroll.d.ts +0 -23
- package/dist/lib/agent/tools/wait.d.ts +0 -18
- package/dist/lib/agent/utils/cuaKeyMapping.d.ts +0 -10
- package/dist/lib/agent/utils/imageCompression.d.ts +0 -53
- package/dist/lib/agent/utils/messageProcessing.d.ts +0 -13
- package/dist/lib/api.d.ts +0 -23
- package/dist/lib/browserbaseDefaults.d.ts +0 -9
- package/dist/lib/cache/ActionCache.d.ts +0 -62
- package/dist/lib/cache/BaseCache.d.ts +0 -66
- package/dist/lib/cache/LLMCache.d.ts +0 -22
- package/dist/lib/cache.d.ts +0 -29
- package/dist/lib/dom/build/scriptContent.d.ts +0 -1
- package/dist/lib/dom/elementCheckUtils.d.ts +0 -2
- package/dist/lib/dom/genDomScripts.d.ts +0 -1
- package/dist/lib/dom/index.d.ts +0 -2
- package/dist/lib/dom/process.d.ts +0 -17
- package/dist/lib/dom/utils.d.ts +0 -7
- package/dist/lib/dom/xpathUtils.d.ts +0 -14
- package/dist/lib/handlers/actHandler.d.ts +0 -33
- package/dist/lib/handlers/cuaAgentHandler.d.ts +0 -58
- package/dist/lib/handlers/extractHandler.d.ts +0 -54
- package/dist/lib/handlers/handlerUtils/actHandlerUtils.d.ts +0 -21
- package/dist/lib/handlers/observeHandler.d.ts +0 -40
- package/dist/lib/handlers/stagehandAgentHandler.d.ts +0 -27
- package/dist/lib/index.d.ts +0 -94
- package/dist/lib/inference.d.ts +0 -71
- package/dist/lib/inferenceLogUtils.d.ts +0 -12
- package/dist/lib/llm/AnthropicClient.d.ts +0 -21
- package/dist/lib/llm/CerebrasClient.d.ts +0 -22
- package/dist/lib/llm/GoogleClient.d.ts +0 -24
- package/dist/lib/llm/GroqClient.d.ts +0 -22
- package/dist/lib/llm/LLMClient.d.ts +0 -99
- package/dist/lib/llm/LLMProvider.d.ts +0 -13
- package/dist/lib/llm/OpenAIClient.d.ts +0 -20
- package/dist/lib/llm/aisdk.d.ts +0 -20
- package/dist/lib/logger.d.ts +0 -54
- package/dist/lib/mcp/connection.d.ts +0 -11
- package/dist/lib/mcp/utils.d.ts +0 -3
- package/dist/lib/prompt.d.ts +0 -12
- package/dist/lib/utils.d.ts +0 -65
- package/dist/lib/v3/agent/AgentClient.d.ts +0 -18
- package/dist/lib/v3/agent/AgentProvider.d.ts +0 -18
- package/dist/lib/v3/agent/AnthropicCUAClient.d.ts +0 -55
- package/dist/lib/v3/agent/OpenAICUAClient.d.ts +0 -64
- package/dist/lib/v3/agent/StagehandAgent.d.ts +0 -15
- package/dist/lib/v3/agent/tools/index.d.ts +0 -229
- package/dist/lib/v3/agent/tools/v3-act.d.ts +0 -29
- package/dist/lib/v3/agent/tools/v3-ariaTree.d.ts +0 -11
- package/dist/lib/v3/agent/tools/v3-close.d.ts +0 -24
- package/dist/lib/v3/agent/tools/v3-extract.d.ts +0 -38
- package/dist/lib/v3/agent/tools/v3-fillform.d.ts +0 -37
- package/dist/lib/v3/agent/tools/v3-goto.d.ts +0 -29
- package/dist/lib/v3/agent/tools/v3-navback.d.ts +0 -17
- package/dist/lib/v3/agent/tools/v3-screenshot.d.ts +0 -13
- package/dist/lib/v3/agent/tools/v3-scroll.d.ts +0 -23
- package/dist/lib/v3/agent/tools/v3-wait.d.ts +0 -19
- package/dist/lib/v3/agent/utils/cuaKeyMapping.d.ts +0 -10
- package/dist/lib/v3/agent/utils/imageCompression.d.ts +0 -18
- package/dist/lib/v3/agent/utils/messageProcessing.d.ts +0 -13
- package/dist/lib/v3/dom/build/scriptV3Content.d.ts +0 -1
- package/dist/lib/v3/dom/genDomScripts.d.ts +0 -1
- package/dist/lib/v3/dom/index.d.ts +0 -1
- package/dist/lib/v3/dom/piercer.entry.d.ts +0 -1
- package/dist/lib/v3/dom/piercer.runtime.d.ts +0 -25
- package/dist/lib/v3/handlers/actHandler.d.ts +0 -18
- package/dist/lib/v3/handlers/extractHandler.d.ts +0 -29
- package/dist/lib/v3/handlers/handlerUtils/actHandlerUtils.d.ts +0 -18
- package/dist/lib/v3/handlers/observeHandler.d.ts +0 -15
- package/dist/lib/v3/handlers/v3AgentHandler.d.ts +0 -17
- package/dist/lib/v3/handlers/v3CuaAgentHandler.d.ts +0 -26
- package/dist/lib/v3/index.d.ts +0 -10
- package/dist/lib/v3/launch/browserbase.d.ts +0 -8
- package/dist/lib/v3/launch/local.d.ts +0 -13
- package/dist/lib/v3/llm/AnthropicClient.d.ts +0 -16
- package/dist/lib/v3/llm/CerebrasClient.d.ts +0 -17
- package/dist/lib/v3/llm/GoogleClient.d.ts +0 -19
- package/dist/lib/v3/llm/GroqClient.d.ts +0 -17
- package/dist/lib/v3/llm/LLMClient.d.ts +0 -99
- package/dist/lib/v3/llm/LLMProvider.d.ts +0 -10
- package/dist/lib/v3/llm/OpenAIClient.d.ts +0 -15
- package/dist/lib/v3/llm/aisdk.d.ts +0 -15
- package/dist/lib/v3/logger.d.ts +0 -48
- package/dist/lib/v3/mcp/connection.d.ts +0 -11
- package/dist/lib/v3/mcp/utils.d.ts +0 -3
- package/dist/lib/v3/tests/default-page-tracking.spec.d.ts +0 -1
- package/dist/lib/v3/tests/downloads.spec.d.ts +0 -1
- package/dist/lib/v3/tests/perform-understudy-method.spec.d.ts +0 -1
- package/dist/lib/v3/tests/shadow-iframe.spec.d.ts +0 -1
- package/dist/lib/v3/tests/timeouts.spec.d.ts +0 -1
- package/dist/lib/v3/tests/v3.bb.config.d.ts +0 -4
- package/dist/lib/v3/tests/v3.config.d.ts +0 -4
- package/dist/lib/v3/tests/v3.playwright.config.d.ts +0 -2
- package/dist/lib/v3/tests/xpath-for-location-deep.spec.d.ts +0 -1
- package/dist/lib/v3/types/act.d.ts +0 -10
- package/dist/lib/v3/types/agent.d.ts +0 -132
- package/dist/lib/v3/types/api.d.ts +0 -40
- package/dist/lib/v3/types/cache.d.ts +0 -71
- package/dist/lib/v3/types/context.d.ts +0 -2
- package/dist/lib/v3/types/evals.d.ts +0 -71
- package/dist/lib/v3/types/evaluator.d.ts +0 -40
- package/dist/lib/v3/types/llm.d.ts +0 -11
- package/dist/lib/v3/types/log.d.ts +0 -23
- package/dist/lib/v3/types/model.d.ts +0 -20
- package/dist/lib/v3/types/playwright.d.ts +0 -6
- package/dist/lib/v3/types/stagehand.d.ts +0 -113
- package/dist/lib/v3/types/stagehandApiErrors.d.ts +0 -18
- package/dist/lib/v3/types/stagehandErrors.d.ts +0 -104
- package/dist/lib/v3/types.d.ts +0 -176
- package/dist/lib/v3/understudy/a11y/snapshot.d.ts +0 -71
- package/dist/lib/v3/understudy/cdp.d.ts +0 -58
- package/dist/lib/v3/understudy/context.d.ts +0 -120
- package/dist/lib/v3/understudy/deepLocator.d.ts +0 -69
- package/dist/lib/v3/understudy/executionContextRegistry.d.ts +0 -15
- package/dist/lib/v3/understudy/frame.d.ts +0 -63
- package/dist/lib/v3/understudy/frameLocator.d.ts +0 -46
- package/dist/lib/v3/understudy/frameRegistry.d.ts +0 -100
- package/dist/lib/v3/understudy/locator.d.ts +0 -196
- package/dist/lib/v3/understudy/page.d.ts +0 -241
- package/dist/lib/v3/understudy/piercer.d.ts +0 -4
- package/dist/lib/v3/v3.d.ts +0 -158
- package/dist/lib/version.d.ts +0 -5
- package/dist/stagehand.config.d.ts +0 -3
- package/dist/types/act.d.ts +0 -50
- package/dist/types/agent.d.ts +0 -143
- package/dist/types/api.d.ts +0 -40
- package/dist/types/browser.d.ts +0 -10
- package/dist/types/context.d.ts +0 -117
- package/dist/types/evals.d.ts +0 -94
- package/dist/types/evaluator.d.ts +0 -40
- package/dist/types/llm.d.ts +0 -11
- package/dist/types/log.d.ts +0 -23
- package/dist/types/model.d.ts +0 -17
- package/dist/types/page.d.ts +0 -38
- package/dist/types/playwright.d.ts +0 -12
- package/dist/types/stagehand.d.ts +0 -330
- package/dist/types/stagehandApiErrors.d.ts +0 -18
- package/dist/types/stagehandErrors.d.ts +0 -104
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export interface V3ShadowPatchOptions {
|
|
2
|
-
debug?: boolean;
|
|
3
|
-
tagExisting?: boolean;
|
|
4
|
-
}
|
|
5
|
-
export interface StagehandV3Backdoor {
|
|
6
|
-
/** Closed shadow-root accessors */
|
|
7
|
-
getClosedRoot(host: Element): ShadowRoot | undefined;
|
|
8
|
-
/** Stats + quick health check */
|
|
9
|
-
stats(): {
|
|
10
|
-
installed: true;
|
|
11
|
-
url: string;
|
|
12
|
-
isTop: boolean;
|
|
13
|
-
open: number;
|
|
14
|
-
closed: number;
|
|
15
|
-
};
|
|
16
|
-
/** Simple composed-tree resolver (axis '/', '//' and trailing [n] only; no iframe hops) */
|
|
17
|
-
resolveSimpleXPath(xp: string): Element | null;
|
|
18
|
-
}
|
|
19
|
-
declare global {
|
|
20
|
-
interface Window {
|
|
21
|
-
__stagehandV3Injected?: boolean;
|
|
22
|
-
__stagehandV3__?: StagehandV3Backdoor;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export declare function installV3ShadowPiercer(opts?: V3ShadowPatchOptions): void;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ActHandlerParams, V3FunctionName } from "@/lib/v3/types";
|
|
2
|
-
import { LLMClient } from "../llm/LLMClient";
|
|
3
|
-
import { AvailableModel, ClientOptions } from "../types/model";
|
|
4
|
-
import type { Page } from "../understudy/page";
|
|
5
|
-
import type { Action, ActResult } from "../types/stagehand";
|
|
6
|
-
export declare class ActHandler {
|
|
7
|
-
private readonly llmClient;
|
|
8
|
-
private readonly defaultModelName;
|
|
9
|
-
private readonly defaultClientOptions;
|
|
10
|
-
private readonly systemPrompt;
|
|
11
|
-
private readonly logInferenceToFile;
|
|
12
|
-
private readonly selfHeal;
|
|
13
|
-
private readonly onMetrics?;
|
|
14
|
-
private readonly defaultDomSettleTimeoutMs?;
|
|
15
|
-
constructor(llmClient: LLMClient, defaultModelName: AvailableModel, defaultClientOptions: ClientOptions, systemPrompt?: string, logInferenceToFile?: boolean, selfHeal?: boolean, onMetrics?: (functionName: V3FunctionName, promptTokens: number, completionTokens: number, inferenceTimeMs: number) => void, defaultDomSettleTimeoutMs?: number);
|
|
16
|
-
act(params: ActHandlerParams): Promise<ActResult>;
|
|
17
|
-
actFromObserveResult(action: Action, page: Page, domSettleTimeoutMs?: number): Promise<ActResult>;
|
|
18
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { z, ZodTypeAny } from "zod/v3";
|
|
2
|
-
import { ExtractHandlerParams, V3FunctionName } from "@/lib/v3/types";
|
|
3
|
-
import { LLMClient } from "../llm/LLMClient";
|
|
4
|
-
import { AvailableModel, ClientOptions } from "../types/model";
|
|
5
|
-
import { ZodPathSegments } from "../types/stagehand";
|
|
6
|
-
/**
|
|
7
|
-
* Scans the provided Zod schema for any `z.string().url()` fields and
|
|
8
|
-
* replaces them with `z.number()`.
|
|
9
|
-
*
|
|
10
|
-
* @param schema - The Zod object schema to transform.
|
|
11
|
-
* @returns A tuple containing:
|
|
12
|
-
* 1. The transformed schema (or the original schema if no changes were needed).
|
|
13
|
-
* 2. An array of {@link ZodPathSegments} objects representing all the replaced URL fields,
|
|
14
|
-
* with each path segment showing where in the schema the replacement occurred.
|
|
15
|
-
*/
|
|
16
|
-
export declare function transformUrlStringsToNumericIds<T extends ZodTypeAny>(schema: T): [T, ZodPathSegments[]];
|
|
17
|
-
export declare class ExtractHandler {
|
|
18
|
-
private readonly llmClient;
|
|
19
|
-
private readonly defaultModelName;
|
|
20
|
-
private readonly defaultClientOptions;
|
|
21
|
-
private readonly systemPrompt;
|
|
22
|
-
private readonly logInferenceToFile;
|
|
23
|
-
private readonly experimental;
|
|
24
|
-
private readonly onMetrics?;
|
|
25
|
-
constructor(llmClient: LLMClient, defaultModelName: AvailableModel, defaultClientOptions: ClientOptions, systemPrompt?: string, logInferenceToFile?: boolean, experimental?: boolean, onMetrics?: (functionName: V3FunctionName, promptTokens: number, completionTokens: number, inferenceTimeMs: number) => void);
|
|
26
|
-
extract<T extends ZodTypeAny>(params: ExtractHandlerParams<T>): Promise<z.infer<T> | {
|
|
27
|
-
pageText: string;
|
|
28
|
-
}>;
|
|
29
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Frame } from "../../understudy/frame";
|
|
2
|
-
import { Locator } from "../../understudy/locator";
|
|
3
|
-
import type { Page } from "../../understudy/page";
|
|
4
|
-
export declare class UnderstudyCommandException extends Error {
|
|
5
|
-
constructor(message: string);
|
|
6
|
-
}
|
|
7
|
-
export interface UnderstudyMethodHandlerContext {
|
|
8
|
-
method: string;
|
|
9
|
-
locator: Locator;
|
|
10
|
-
xpath: string;
|
|
11
|
-
args: ReadonlyArray<string>;
|
|
12
|
-
frame: Frame;
|
|
13
|
-
page: Page;
|
|
14
|
-
initialUrl: string;
|
|
15
|
-
domSettleTimeoutMs?: number;
|
|
16
|
-
}
|
|
17
|
-
export declare function performUnderstudyMethod(page: Page, frame: Frame, method: string, rawXPath: string, args: ReadonlyArray<unknown>, domSettleTimeoutMs?: number): Promise<void>;
|
|
18
|
-
export declare function selectOption(ctx: UnderstudyMethodHandlerContext): Promise<void>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ObserveHandlerParams, V3FunctionName } from "@/lib/v3/types";
|
|
2
|
-
import { AvailableModel, ClientOptions } from "../types/model";
|
|
3
|
-
import { LLMClient } from "../llm/LLMClient";
|
|
4
|
-
import { Action } from "../types/stagehand";
|
|
5
|
-
export declare class ObserveHandler {
|
|
6
|
-
private readonly llmClient;
|
|
7
|
-
private readonly defaultModelName;
|
|
8
|
-
private readonly defaultClientOptions;
|
|
9
|
-
private readonly systemPrompt;
|
|
10
|
-
private readonly logInferenceToFile;
|
|
11
|
-
private readonly experimental;
|
|
12
|
-
private readonly onMetrics?;
|
|
13
|
-
constructor(llmClient: LLMClient, defaultModelName: AvailableModel, defaultClientOptions: ClientOptions, systemPrompt?: string, logInferenceToFile?: boolean, experimental?: boolean, onMetrics?: (functionName: V3FunctionName, promptTokens: number, completionTokens: number, inferenceTimeMs: number) => void);
|
|
14
|
-
observe(params: ObserveHandlerParams): Promise<Action[]>;
|
|
15
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { AgentExecuteOptions, AgentResult } from "../types/agent";
|
|
2
|
-
import { LogLine } from "../types/log";
|
|
3
|
-
import { LLMClient } from "../llm/LLMClient";
|
|
4
|
-
import { ToolSet } from "ai";
|
|
5
|
-
import { V3 } from "@/lib/v3/v3";
|
|
6
|
-
export declare class V3AgentHandler {
|
|
7
|
-
private v3;
|
|
8
|
-
private logger;
|
|
9
|
-
private llmClient;
|
|
10
|
-
private executionModel?;
|
|
11
|
-
private systemInstructions?;
|
|
12
|
-
private mcpTools?;
|
|
13
|
-
constructor(v3: V3, logger: (message: LogLine) => void, llmClient: LLMClient, executionModel?: string, systemInstructions?: string, mcpTools?: ToolSet);
|
|
14
|
-
execute(instructionOrOptions: string | AgentExecuteOptions): Promise<AgentResult>;
|
|
15
|
-
private buildSystemPrompt;
|
|
16
|
-
private createTools;
|
|
17
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { AgentExecuteOptions, AgentHandlerOptions, AgentResult } from "../types/agent";
|
|
2
|
-
import { LogLine } from "../types/log";
|
|
3
|
-
import { V3 } from "@/lib/v3/v3";
|
|
4
|
-
import { ToolSet } from "ai";
|
|
5
|
-
export declare class V3CuaAgentHandler {
|
|
6
|
-
private v3;
|
|
7
|
-
private agent;
|
|
8
|
-
private provider;
|
|
9
|
-
private logger;
|
|
10
|
-
private agentClient;
|
|
11
|
-
private options;
|
|
12
|
-
constructor(v3: V3, logger: (message: LogLine) => void, options: AgentHandlerOptions, tools?: ToolSet);
|
|
13
|
-
private setupAgentClient;
|
|
14
|
-
execute(optionsOrInstruction: AgentExecuteOptions | string): Promise<AgentResult>;
|
|
15
|
-
private executeAction;
|
|
16
|
-
private ensureXPath;
|
|
17
|
-
private describePointerAction;
|
|
18
|
-
private describeTypeAction;
|
|
19
|
-
private describeDragAction;
|
|
20
|
-
private buildInstructionFallback;
|
|
21
|
-
private recordCuaActStep;
|
|
22
|
-
private updateClientViewport;
|
|
23
|
-
private updateClientUrl;
|
|
24
|
-
captureAndSendScreenshot(): Promise<unknown>;
|
|
25
|
-
private injectCursor;
|
|
26
|
-
}
|
package/dist/lib/v3/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { V3 } from "./v3";
|
|
2
|
-
export { V3 as Stagehand } from "./v3";
|
|
3
|
-
export * from "./types/agent";
|
|
4
|
-
export * from "./types/model";
|
|
5
|
-
export * from "./types/log";
|
|
6
|
-
export * from "./types/stagehand";
|
|
7
|
-
export * from "./types/stagehandApiErrors";
|
|
8
|
-
export * from "./types/stagehandErrors";
|
|
9
|
-
export * from "./llm/LLMClient";
|
|
10
|
-
export { connectToMCPServer } from "../v3/mcp/connection";
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import Browserbase from "@browserbasehq/sdk";
|
|
2
|
-
export declare function createBrowserbaseSession(apiKey: string, projectId: string, params?: Omit<Browserbase.Sessions.SessionCreateParams, "projectId"> & {
|
|
3
|
-
projectId?: string;
|
|
4
|
-
}, resumeSessionId?: string): Promise<{
|
|
5
|
-
ws: string;
|
|
6
|
-
sessionId: string;
|
|
7
|
-
bb: Browserbase;
|
|
8
|
-
}>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { LaunchedChrome } from "chrome-launcher";
|
|
2
|
-
interface LaunchLocalOptions {
|
|
3
|
-
chromePath?: string;
|
|
4
|
-
chromeFlags?: string[];
|
|
5
|
-
headless?: boolean;
|
|
6
|
-
userDataDir?: string;
|
|
7
|
-
connectTimeoutMs?: number;
|
|
8
|
-
}
|
|
9
|
-
export declare function launchLocalChrome(opts: LaunchLocalOptions): Promise<{
|
|
10
|
-
ws: string;
|
|
11
|
-
chrome: LaunchedChrome;
|
|
12
|
-
}>;
|
|
13
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ClientOptions } from "@anthropic-ai/sdk";
|
|
2
|
-
import { LogLine } from "../types/log";
|
|
3
|
-
import { AvailableModel } from "../types/model";
|
|
4
|
-
import { CreateChatCompletionOptions, LLMClient, LLMResponse } from "./LLMClient";
|
|
5
|
-
export declare class AnthropicClient extends LLMClient {
|
|
6
|
-
type: "anthropic";
|
|
7
|
-
private client;
|
|
8
|
-
clientOptions: ClientOptions;
|
|
9
|
-
constructor({ modelName, clientOptions, userProvidedInstructions, }: {
|
|
10
|
-
logger: (message: LogLine) => void;
|
|
11
|
-
modelName: AvailableModel;
|
|
12
|
-
clientOptions?: ClientOptions;
|
|
13
|
-
userProvidedInstructions?: string;
|
|
14
|
-
});
|
|
15
|
-
createChatCompletion<T = LLMResponse>({ options, retries, logger, }: CreateChatCompletionOptions): Promise<T>;
|
|
16
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { ClientOptions } from "openai";
|
|
2
|
-
import { LogLine } from "../types/log";
|
|
3
|
-
import { AvailableModel } from "../types/model";
|
|
4
|
-
import { CreateChatCompletionOptions, LLMClient, LLMResponse } from "./LLMClient";
|
|
5
|
-
export declare class CerebrasClient extends LLMClient {
|
|
6
|
-
type: "cerebras";
|
|
7
|
-
private client;
|
|
8
|
-
clientOptions: ClientOptions;
|
|
9
|
-
hasVision: boolean;
|
|
10
|
-
constructor({ modelName, clientOptions, userProvidedInstructions, }: {
|
|
11
|
-
logger: (message: LogLine) => void;
|
|
12
|
-
modelName: AvailableModel;
|
|
13
|
-
clientOptions?: ClientOptions;
|
|
14
|
-
userProvidedInstructions?: string;
|
|
15
|
-
});
|
|
16
|
-
createChatCompletion<T = LLMResponse>({ options, retries, logger, }: CreateChatCompletionOptions): Promise<T>;
|
|
17
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { LogLine } from "../types/log";
|
|
2
|
-
import { AvailableModel, ClientOptions } from "../types/model";
|
|
3
|
-
import { CreateChatCompletionOptions, LLMClient, LLMResponse } from "./LLMClient";
|
|
4
|
-
export declare class GoogleClient extends LLMClient {
|
|
5
|
-
type: "google";
|
|
6
|
-
private client;
|
|
7
|
-
clientOptions: ClientOptions;
|
|
8
|
-
hasVision: boolean;
|
|
9
|
-
private logger;
|
|
10
|
-
constructor({ logger, // Added logger based on other clients
|
|
11
|
-
modelName, clientOptions, }: {
|
|
12
|
-
logger: (message: LogLine) => void;
|
|
13
|
-
modelName: AvailableModel;
|
|
14
|
-
clientOptions?: ClientOptions;
|
|
15
|
-
});
|
|
16
|
-
private formatMessages;
|
|
17
|
-
private formatTools;
|
|
18
|
-
createChatCompletion<T = LLMResponse>({ options, logger, retries, }: CreateChatCompletionOptions): Promise<T>;
|
|
19
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { ClientOptions } from "openai";
|
|
2
|
-
import { LogLine } from "../types/log";
|
|
3
|
-
import { AvailableModel } from "../types/model";
|
|
4
|
-
import { CreateChatCompletionOptions, LLMClient, LLMResponse } from "./LLMClient";
|
|
5
|
-
export declare class GroqClient extends LLMClient {
|
|
6
|
-
type: "groq";
|
|
7
|
-
private client;
|
|
8
|
-
clientOptions: ClientOptions;
|
|
9
|
-
hasVision: boolean;
|
|
10
|
-
constructor({ modelName, clientOptions, userProvidedInstructions, }: {
|
|
11
|
-
logger: (message: LogLine) => void;
|
|
12
|
-
modelName: AvailableModel;
|
|
13
|
-
clientOptions?: ClientOptions;
|
|
14
|
-
userProvidedInstructions?: string;
|
|
15
|
-
});
|
|
16
|
-
createChatCompletion<T = LLMResponse>({ options, retries, logger, }: CreateChatCompletionOptions): Promise<T>;
|
|
17
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { LLMTool } from "../types/llm";
|
|
2
|
-
import { embed, embedMany, experimental_generateImage, experimental_generateSpeech, experimental_transcribe, generateObject, generateText, LanguageModel, streamObject, streamText } from "ai";
|
|
3
|
-
import { ZodType } from "zod/v3";
|
|
4
|
-
import { LogLine } from "../types/log";
|
|
5
|
-
import { AvailableModel, ClientOptions } from "../types/model";
|
|
6
|
-
export interface ChatMessage {
|
|
7
|
-
role: "system" | "user" | "assistant";
|
|
8
|
-
content: ChatMessageContent;
|
|
9
|
-
}
|
|
10
|
-
export type ChatMessageContent = string | (ChatMessageImageContent | ChatMessageTextContent)[];
|
|
11
|
-
export interface ChatMessageImageContent {
|
|
12
|
-
type: string;
|
|
13
|
-
image_url?: {
|
|
14
|
-
url: string;
|
|
15
|
-
};
|
|
16
|
-
text?: string;
|
|
17
|
-
source?: {
|
|
18
|
-
type: string;
|
|
19
|
-
media_type: string;
|
|
20
|
-
data: string;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export interface ChatMessageTextContent {
|
|
24
|
-
type: string;
|
|
25
|
-
text: string;
|
|
26
|
-
}
|
|
27
|
-
export declare const AnnotatedScreenshotText = "This is a screenshot of the current page state with the elements annotated on it. Each element id is annotated with a number to the top left of it. Duplicate annotations at the same location are under each other vertically.";
|
|
28
|
-
export interface ChatCompletionOptions {
|
|
29
|
-
messages: ChatMessage[];
|
|
30
|
-
temperature?: number;
|
|
31
|
-
top_p?: number;
|
|
32
|
-
frequency_penalty?: number;
|
|
33
|
-
presence_penalty?: number;
|
|
34
|
-
image?: {
|
|
35
|
-
buffer: Buffer;
|
|
36
|
-
description?: string;
|
|
37
|
-
};
|
|
38
|
-
response_model?: {
|
|
39
|
-
name: string;
|
|
40
|
-
schema: ZodType;
|
|
41
|
-
};
|
|
42
|
-
tools?: LLMTool[];
|
|
43
|
-
tool_choice?: "auto" | "none" | "required";
|
|
44
|
-
maxTokens?: number;
|
|
45
|
-
requestId?: string;
|
|
46
|
-
}
|
|
47
|
-
export type LLMResponse = {
|
|
48
|
-
id: string;
|
|
49
|
-
object: string;
|
|
50
|
-
created: number;
|
|
51
|
-
model: string;
|
|
52
|
-
choices: {
|
|
53
|
-
index: number;
|
|
54
|
-
message: {
|
|
55
|
-
role: string;
|
|
56
|
-
content: string | null;
|
|
57
|
-
tool_calls: {
|
|
58
|
-
id: string;
|
|
59
|
-
type: string;
|
|
60
|
-
function: {
|
|
61
|
-
name: string;
|
|
62
|
-
arguments: string;
|
|
63
|
-
};
|
|
64
|
-
}[];
|
|
65
|
-
};
|
|
66
|
-
finish_reason: string;
|
|
67
|
-
}[];
|
|
68
|
-
usage: {
|
|
69
|
-
prompt_tokens: number;
|
|
70
|
-
completion_tokens: number;
|
|
71
|
-
total_tokens: number;
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
export interface CreateChatCompletionOptions {
|
|
75
|
-
options: ChatCompletionOptions;
|
|
76
|
-
logger: (message: LogLine) => void;
|
|
77
|
-
retries?: number;
|
|
78
|
-
}
|
|
79
|
-
export declare abstract class LLMClient {
|
|
80
|
-
type: "openai" | "anthropic" | "cerebras" | "groq" | (string & {});
|
|
81
|
-
modelName: AvailableModel | (string & {});
|
|
82
|
-
hasVision: boolean;
|
|
83
|
-
clientOptions: ClientOptions;
|
|
84
|
-
userProvidedInstructions?: string;
|
|
85
|
-
constructor(modelName: AvailableModel, userProvidedInstructions?: string);
|
|
86
|
-
abstract createChatCompletion<T = LLMResponse & {
|
|
87
|
-
usage?: LLMResponse["usage"];
|
|
88
|
-
}>(options: CreateChatCompletionOptions): Promise<T>;
|
|
89
|
-
generateObject: typeof generateObject;
|
|
90
|
-
generateText: typeof generateText;
|
|
91
|
-
streamText: typeof streamText;
|
|
92
|
-
streamObject: typeof streamObject;
|
|
93
|
-
generateImage: typeof experimental_generateImage;
|
|
94
|
-
embed: typeof embed;
|
|
95
|
-
embedMany: typeof embedMany;
|
|
96
|
-
transcribe: typeof experimental_transcribe;
|
|
97
|
-
generateSpeech: typeof experimental_generateSpeech;
|
|
98
|
-
getLanguageModel?(): LanguageModel;
|
|
99
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { LogLine } from "../types/log";
|
|
2
|
-
import { AvailableModel, ClientOptions, ModelProvider } from "../types/model";
|
|
3
|
-
import { LLMClient } from "./LLMClient";
|
|
4
|
-
export declare function getAISDKLanguageModel(subProvider: string, subModelName: string, apiKey?: string, baseURL?: string): import("ai/dist").LanguageModelV1;
|
|
5
|
-
export declare class LLMProvider {
|
|
6
|
-
private logger;
|
|
7
|
-
constructor(logger: (message: LogLine) => void);
|
|
8
|
-
getClient(modelName: AvailableModel, clientOptions?: ClientOptions): LLMClient;
|
|
9
|
-
static getModelProvider(modelName: AvailableModel): ModelProvider;
|
|
10
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ClientOptions } from "openai";
|
|
2
|
-
import { LogLine } from "../types/log";
|
|
3
|
-
import { AvailableModel } from "../types/model";
|
|
4
|
-
import { CreateChatCompletionOptions, LLMClient, LLMResponse } from "./LLMClient";
|
|
5
|
-
export declare class OpenAIClient extends LLMClient {
|
|
6
|
-
type: "openai";
|
|
7
|
-
private client;
|
|
8
|
-
clientOptions: ClientOptions;
|
|
9
|
-
constructor({ modelName, clientOptions, }: {
|
|
10
|
-
logger: (message: LogLine) => void;
|
|
11
|
-
modelName: AvailableModel;
|
|
12
|
-
clientOptions?: ClientOptions;
|
|
13
|
-
});
|
|
14
|
-
createChatCompletion<T = LLMResponse>({ options: optionsInitial, logger, retries, }: CreateChatCompletionOptions): Promise<T>;
|
|
15
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { LanguageModel } from "ai";
|
|
2
|
-
import { ChatCompletion } from "openai/resources";
|
|
3
|
-
import { LogLine } from "../types/log";
|
|
4
|
-
import { CreateChatCompletionOptions, LLMClient } from "./LLMClient";
|
|
5
|
-
export declare class AISdkClient extends LLMClient {
|
|
6
|
-
type: "aisdk";
|
|
7
|
-
private model;
|
|
8
|
-
private logger?;
|
|
9
|
-
constructor({ model, logger, }: {
|
|
10
|
-
model: LanguageModel;
|
|
11
|
-
logger?: (message: LogLine) => void;
|
|
12
|
-
});
|
|
13
|
-
getLanguageModel(): LanguageModel;
|
|
14
|
-
createChatCompletion<T = ChatCompletion>({ options, }: CreateChatCompletionOptions): Promise<T>;
|
|
15
|
-
}
|
package/dist/lib/v3/logger.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { LogLine } from "./types/log";
|
|
2
|
-
/**
|
|
3
|
-
* Stagehand V3 Logging
|
|
4
|
-
*
|
|
5
|
-
* Design goals:
|
|
6
|
-
* - Provide a single global logging sink (Pino or console) for general output.
|
|
7
|
-
* - Support concurrent V3 instances by routing logs to an instance-bound external logger
|
|
8
|
-
* (e.g., Braintrust EvalLogger) without cross-talk.
|
|
9
|
-
* - Keep the public API simple: per-instance binding happens via V3, not here.
|
|
10
|
-
*
|
|
11
|
-
* How it works:
|
|
12
|
-
* - initV3Logger(): initializes the global logger backend (Pino if enabled, otherwise a
|
|
13
|
-
* lightweight console logger). No external logger is bound globally.
|
|
14
|
-
* - bindInstanceLogger()/unbindInstanceLogger(): registers an external logger callback per
|
|
15
|
-
* instance id for use by v3Logger.
|
|
16
|
-
* - withInstanceLogContext(): establishes a context so v3Logger can route logs to the
|
|
17
|
-
* correct instance's external logger during that call tree.
|
|
18
|
-
* - v3Logger(): preferred entrypoint for emitting structured logs from V3 internals and handlers.
|
|
19
|
-
* It routes to the instance logger when available, or falls back to the global backend.
|
|
20
|
-
*/
|
|
21
|
-
type Verbosity = 0 | 1 | 2;
|
|
22
|
-
type MinimalLogger = {
|
|
23
|
-
log: (line: LogLine) => void;
|
|
24
|
-
setVerbosity: (v: Verbosity) => void;
|
|
25
|
-
error: (msg: string, data?: Record<string, unknown>) => void;
|
|
26
|
-
info: (msg: string, data?: Record<string, unknown>) => void;
|
|
27
|
-
debug: (msg: string, data?: Record<string, unknown>) => void;
|
|
28
|
-
};
|
|
29
|
-
export declare function bindInstanceLogger(instanceId: string, logger: (line: LogLine) => void): void;
|
|
30
|
-
export declare function unbindInstanceLogger(instanceId: string): void;
|
|
31
|
-
export declare function withInstanceLogContext<T>(instanceId: string, fn: () => T): T;
|
|
32
|
-
/**
|
|
33
|
-
* Initialize the global V3 logger backend.
|
|
34
|
-
* - When disablePino is false (default), uses the Stagehand Pino logger for rich console output.
|
|
35
|
-
* - When disablePino is true, uses a lightweight console logger that respects verbosity.
|
|
36
|
-
*
|
|
37
|
-
* Note: This function never binds an external logger globally. Use bindInstanceLogger()
|
|
38
|
-
* with withInstanceLogContext() for per-instance routing.
|
|
39
|
-
*/
|
|
40
|
-
export declare function initV3Logger(opts?: {
|
|
41
|
-
verbose?: Verbosity;
|
|
42
|
-
disablePino?: boolean;
|
|
43
|
-
pretty?: boolean;
|
|
44
|
-
}): Promise<void>;
|
|
45
|
-
export declare function getV3Logger(): MinimalLogger;
|
|
46
|
-
export declare function v3Logger(line: LogLine): void;
|
|
47
|
-
export declare function setV3Verbosity(v: Verbosity): void;
|
|
48
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Client, ClientOptions } from "@modelcontextprotocol/sdk/client/index.js";
|
|
2
|
-
export interface ConnectToMCPServerOptions {
|
|
3
|
-
serverUrl: string | URL;
|
|
4
|
-
clientOptions?: ClientOptions;
|
|
5
|
-
}
|
|
6
|
-
export interface StdioServerConfig {
|
|
7
|
-
command: string;
|
|
8
|
-
args?: string[];
|
|
9
|
-
env?: Record<string, string>;
|
|
10
|
-
}
|
|
11
|
-
export declare const connectToMCPServer: (serverConfig: string | URL | StdioServerConfig | ConnectToMCPServerOptions) => Promise<Client>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare enum SupportedPlaywrightAction {
|
|
2
|
-
CLICK = "click",
|
|
3
|
-
FILL = "fill",
|
|
4
|
-
TYPE = "type",
|
|
5
|
-
PRESS = "press",
|
|
6
|
-
SCROLL = "scrollTo",
|
|
7
|
-
NEXT_CHUNK = "nextChunk",
|
|
8
|
-
PREV_CHUNK = "prevChunk",
|
|
9
|
-
SELECT_OPTION_FROM_DROPDOWN = "selectOptionFromDropdown"
|
|
10
|
-
}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { LogLine } from "./log";
|
|
2
|
-
export interface AgentAction {
|
|
3
|
-
type: string;
|
|
4
|
-
reasoning?: string;
|
|
5
|
-
taskCompleted?: boolean;
|
|
6
|
-
action?: string;
|
|
7
|
-
timeMs?: number;
|
|
8
|
-
pageText?: string;
|
|
9
|
-
pageUrl?: string;
|
|
10
|
-
instruction?: string;
|
|
11
|
-
[key: string]: unknown;
|
|
12
|
-
}
|
|
13
|
-
export interface AgentResult {
|
|
14
|
-
success: boolean;
|
|
15
|
-
message: string;
|
|
16
|
-
actions: AgentAction[];
|
|
17
|
-
completed: boolean;
|
|
18
|
-
metadata?: Record<string, unknown>;
|
|
19
|
-
usage?: {
|
|
20
|
-
input_tokens: number;
|
|
21
|
-
output_tokens: number;
|
|
22
|
-
inference_time_ms: number;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
export interface AgentOptions {
|
|
26
|
-
maxSteps?: number;
|
|
27
|
-
autoScreenshot?: boolean;
|
|
28
|
-
waitBetweenActions?: number;
|
|
29
|
-
context?: string;
|
|
30
|
-
}
|
|
31
|
-
export interface AgentExecuteOptions extends AgentOptions {
|
|
32
|
-
instruction: string;
|
|
33
|
-
}
|
|
34
|
-
export type AgentProviderType = "openai" | "anthropic";
|
|
35
|
-
export interface AgentClientOptions {
|
|
36
|
-
apiKey: string;
|
|
37
|
-
organization?: string;
|
|
38
|
-
baseURL?: string;
|
|
39
|
-
defaultMaxSteps?: number;
|
|
40
|
-
[key: string]: unknown;
|
|
41
|
-
}
|
|
42
|
-
export type AgentType = "openai" | "anthropic";
|
|
43
|
-
export interface AgentExecutionOptions {
|
|
44
|
-
options: AgentExecuteOptions;
|
|
45
|
-
logger: (message: LogLine) => void;
|
|
46
|
-
retries?: number;
|
|
47
|
-
}
|
|
48
|
-
export interface AgentHandlerOptions {
|
|
49
|
-
modelName: string;
|
|
50
|
-
clientOptions?: Record<string, unknown>;
|
|
51
|
-
userProvidedInstructions?: string;
|
|
52
|
-
agentType: AgentType;
|
|
53
|
-
experimental?: boolean;
|
|
54
|
-
}
|
|
55
|
-
export interface ActionExecutionResult {
|
|
56
|
-
success: boolean;
|
|
57
|
-
error?: string;
|
|
58
|
-
data?: unknown;
|
|
59
|
-
}
|
|
60
|
-
export interface ToolUseItem extends ResponseItem {
|
|
61
|
-
type: "tool_use";
|
|
62
|
-
id: string;
|
|
63
|
-
name: string;
|
|
64
|
-
input: Record<string, unknown>;
|
|
65
|
-
}
|
|
66
|
-
export interface AnthropicMessage {
|
|
67
|
-
role: string;
|
|
68
|
-
content: string | Array<AnthropicContentBlock>;
|
|
69
|
-
}
|
|
70
|
-
export interface AnthropicContentBlock {
|
|
71
|
-
type: string;
|
|
72
|
-
[key: string]: unknown;
|
|
73
|
-
}
|
|
74
|
-
export interface AnthropicTextBlock extends AnthropicContentBlock {
|
|
75
|
-
type: "text";
|
|
76
|
-
text: string;
|
|
77
|
-
}
|
|
78
|
-
export interface AnthropicToolResult {
|
|
79
|
-
type: "tool_result";
|
|
80
|
-
tool_use_id: string;
|
|
81
|
-
content: string | Array<AnthropicContentBlock>;
|
|
82
|
-
}
|
|
83
|
-
export interface ResponseItem {
|
|
84
|
-
type: string;
|
|
85
|
-
id: string;
|
|
86
|
-
[key: string]: unknown;
|
|
87
|
-
}
|
|
88
|
-
export interface ComputerCallItem extends ResponseItem {
|
|
89
|
-
type: "computer_call";
|
|
90
|
-
call_id: string;
|
|
91
|
-
action: {
|
|
92
|
-
type: string;
|
|
93
|
-
[key: string]: unknown;
|
|
94
|
-
};
|
|
95
|
-
pending_safety_checks?: Array<{
|
|
96
|
-
id: string;
|
|
97
|
-
code: string;
|
|
98
|
-
message: string;
|
|
99
|
-
}>;
|
|
100
|
-
}
|
|
101
|
-
export interface FunctionCallItem extends ResponseItem {
|
|
102
|
-
type: "function_call";
|
|
103
|
-
call_id: string;
|
|
104
|
-
name: string;
|
|
105
|
-
arguments: string;
|
|
106
|
-
}
|
|
107
|
-
export type ResponseInputItem = {
|
|
108
|
-
role: string;
|
|
109
|
-
content: string;
|
|
110
|
-
} | {
|
|
111
|
-
type: "computer_call_output";
|
|
112
|
-
call_id: string;
|
|
113
|
-
output: {
|
|
114
|
-
type: "input_image";
|
|
115
|
-
image_url: string;
|
|
116
|
-
current_url?: string;
|
|
117
|
-
error?: string;
|
|
118
|
-
[key: string]: unknown;
|
|
119
|
-
} | string;
|
|
120
|
-
acknowledged_safety_checks?: Array<{
|
|
121
|
-
id: string;
|
|
122
|
-
code: string;
|
|
123
|
-
message: string;
|
|
124
|
-
}>;
|
|
125
|
-
} | {
|
|
126
|
-
type: "function_call_output";
|
|
127
|
-
call_id: string;
|
|
128
|
-
output: string;
|
|
129
|
-
};
|
|
130
|
-
export interface AgentInstance {
|
|
131
|
-
execute: (instructionOrOptions: string | AgentExecuteOptions) => Promise<AgentResult>;
|
|
132
|
-
}
|