@browserbasehq/orca 3.7.0-preview.1 → 3.7.2-preview.0
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/cjs/lib/modelUtils.d.ts +10 -0
- package/dist/cjs/lib/modelUtils.js +11 -0
- package/dist/cjs/lib/modelUtils.js.map +1 -1
- package/dist/cjs/lib/v3/agent/AgentProvider.js +3 -0
- package/dist/cjs/lib/v3/agent/AgentProvider.js.map +1 -1
- package/dist/cjs/lib/v3/agent/tools/click.js +15 -4
- package/dist/cjs/lib/v3/agent/tools/click.js.map +1 -1
- package/dist/cjs/lib/v3/agent/tools/fillFormVision.js +12 -4
- package/dist/cjs/lib/v3/agent/tools/fillFormVision.js.map +1 -1
- package/dist/cjs/lib/v3/agent/tools/type.js +12 -3
- package/dist/cjs/lib/v3/agent/tools/type.js.map +1 -1
- package/dist/cjs/lib/v3/agent/utils/handleDoneToolCall.js +3 -1
- package/dist/cjs/lib/v3/agent/utils/handleDoneToolCall.js.map +1 -1
- package/dist/cjs/lib/v3/api.d.ts +1 -1
- package/dist/cjs/lib/v3/api.js +11 -1
- package/dist/cjs/lib/v3/api.js.map +1 -1
- package/dist/cjs/lib/v3/cache/AgentCache.js +6 -1
- package/dist/cjs/lib/v3/cache/AgentCache.js.map +1 -1
- package/dist/cjs/lib/v3/external_clients/aisdk.js +2 -0
- package/dist/cjs/lib/v3/external_clients/aisdk.js.map +1 -1
- package/dist/cjs/lib/v3/handlers/handlerUtils/actHandlerUtils.js +20 -0
- package/dist/cjs/lib/v3/handlers/handlerUtils/actHandlerUtils.js.map +1 -1
- package/dist/cjs/lib/v3/handlers/v3AgentHandler.js +5 -4
- package/dist/cjs/lib/v3/handlers/v3AgentHandler.js.map +1 -1
- package/dist/cjs/lib/v3/handlers/v3CuaAgentHandler.js +32 -0
- package/dist/cjs/lib/v3/handlers/v3CuaAgentHandler.js.map +1 -1
- package/dist/cjs/lib/v3/index.d.ts +1 -1
- package/dist/cjs/lib/v3/llm/LLMProvider.js +9 -2
- package/dist/cjs/lib/v3/llm/LLMProvider.js.map +1 -1
- package/dist/cjs/lib/v3/llm/aisdk.js +2 -0
- package/dist/cjs/lib/v3/llm/aisdk.js.map +1 -1
- package/dist/cjs/lib/v3/llm/providerOptions.d.ts +7 -0
- package/dist/cjs/lib/v3/llm/providerOptions.js +9 -0
- package/dist/cjs/lib/v3/llm/providerOptions.js.map +1 -0
- package/dist/cjs/lib/v3/types/private/agent.d.ts +1 -1
- package/dist/cjs/lib/v3/types/private/agent.js +1 -0
- package/dist/cjs/lib/v3/types/private/agent.js.map +1 -1
- package/dist/cjs/lib/v3/types/public/agent.d.ts +1 -1
- package/dist/cjs/lib/v3/types/public/agent.js +3 -0
- package/dist/cjs/lib/v3/types/public/agent.js.map +1 -1
- package/dist/cjs/lib/v3/types/public/api.d.ts +53 -0
- package/dist/cjs/lib/v3/types/public/api.js +8 -0
- package/dist/cjs/lib/v3/types/public/api.js.map +1 -1
- package/dist/cjs/lib/v3/types/public/model.d.ts +7 -0
- package/dist/cjs/lib/v3/types/public/model.js.map +1 -1
- package/dist/cjs/lib/v3/types/public/options.d.ts +13 -0
- package/dist/cjs/lib/v3/types/public/options.js.map +1 -1
- package/dist/cjs/lib/v3/understudy/a11y/snapshot/capture.js +4 -3
- package/dist/cjs/lib/v3/understudy/a11y/snapshot/capture.js.map +1 -1
- package/dist/cjs/lib/v3/understudy/locator.d.ts +12 -0
- package/dist/cjs/lib/v3/understudy/locator.js +44 -0
- package/dist/cjs/lib/v3/understudy/locator.js.map +1 -1
- package/dist/cjs/lib/v3/understudy/page.d.ts +15 -0
- package/dist/cjs/lib/v3/understudy/page.js +50 -0
- package/dist/cjs/lib/v3/understudy/page.js.map +1 -1
- package/dist/cjs/lib/v3/v3.d.ts +8 -0
- package/dist/cjs/lib/v3/v3.js +50 -3
- package/dist/cjs/lib/v3/v3.js.map +1 -1
- package/dist/cjs/lib/v3/verifier/types.d.ts +3 -2
- package/dist/cjs/lib/v3/verifier/types.js.map +1 -1
- package/dist/cjs/lib/version.d.ts +1 -1
- package/dist/cjs/lib/version.js +1 -1
- package/dist/cjs/lib/version.js.map +1 -1
- package/dist/esm/lib/modelUtils.d.ts +10 -0
- package/dist/esm/lib/modelUtils.js +9 -0
- package/dist/esm/lib/modelUtils.js.map +1 -1
- package/dist/esm/lib/v3/agent/AgentProvider.js +3 -0
- package/dist/esm/lib/v3/agent/AgentProvider.js.map +1 -1
- package/dist/esm/lib/v3/agent/tools/click.js +15 -4
- package/dist/esm/lib/v3/agent/tools/click.js.map +1 -1
- package/dist/esm/lib/v3/agent/tools/fillFormVision.js +12 -4
- package/dist/esm/lib/v3/agent/tools/fillFormVision.js.map +1 -1
- package/dist/esm/lib/v3/agent/tools/type.js +12 -3
- package/dist/esm/lib/v3/agent/tools/type.js.map +1 -1
- package/dist/esm/lib/v3/agent/utils/handleDoneToolCall.js +3 -1
- package/dist/esm/lib/v3/agent/utils/handleDoneToolCall.js.map +1 -1
- package/dist/esm/lib/v3/api.d.ts +1 -1
- package/dist/esm/lib/v3/api.js +11 -1
- package/dist/esm/lib/v3/api.js.map +1 -1
- package/dist/esm/lib/v3/cache/AgentCache.js +6 -1
- package/dist/esm/lib/v3/cache/AgentCache.js.map +1 -1
- package/dist/esm/lib/v3/external_clients/aisdk.js +2 -0
- package/dist/esm/lib/v3/external_clients/aisdk.js.map +1 -1
- package/dist/esm/lib/v3/handlers/handlerUtils/actHandlerUtils.js +20 -0
- package/dist/esm/lib/v3/handlers/handlerUtils/actHandlerUtils.js.map +1 -1
- package/dist/esm/lib/v3/handlers/v3AgentHandler.js +5 -4
- package/dist/esm/lib/v3/handlers/v3AgentHandler.js.map +1 -1
- package/dist/esm/lib/v3/handlers/v3CuaAgentHandler.js +32 -0
- package/dist/esm/lib/v3/handlers/v3CuaAgentHandler.js.map +1 -1
- package/dist/esm/lib/v3/index.d.ts +1 -1
- package/dist/esm/lib/v3/llm/LLMProvider.js +9 -2
- package/dist/esm/lib/v3/llm/LLMProvider.js.map +1 -1
- package/dist/esm/lib/v3/llm/aisdk.js +2 -0
- package/dist/esm/lib/v3/llm/aisdk.js.map +1 -1
- package/dist/esm/lib/v3/llm/providerOptions.d.ts +7 -0
- package/dist/esm/lib/v3/llm/providerOptions.js +6 -0
- package/dist/esm/lib/v3/llm/providerOptions.js.map +1 -0
- package/dist/esm/lib/v3/types/private/agent.d.ts +1 -1
- package/dist/esm/lib/v3/types/private/agent.js +1 -0
- package/dist/esm/lib/v3/types/private/agent.js.map +1 -1
- package/dist/esm/lib/v3/types/public/agent.d.ts +1 -1
- package/dist/esm/lib/v3/types/public/agent.js +3 -0
- package/dist/esm/lib/v3/types/public/agent.js.map +1 -1
- package/dist/esm/lib/v3/types/public/api.d.ts +53 -0
- package/dist/esm/lib/v3/types/public/api.js +8 -0
- package/dist/esm/lib/v3/types/public/api.js.map +1 -1
- package/dist/esm/lib/v3/types/public/model.d.ts +7 -0
- package/dist/esm/lib/v3/types/public/model.js.map +1 -1
- package/dist/esm/lib/v3/types/public/options.d.ts +13 -0
- package/dist/esm/lib/v3/types/public/options.js.map +1 -1
- package/dist/esm/lib/v3/understudy/a11y/snapshot/capture.js +4 -3
- package/dist/esm/lib/v3/understudy/a11y/snapshot/capture.js.map +1 -1
- package/dist/esm/lib/v3/understudy/locator.d.ts +12 -0
- package/dist/esm/lib/v3/understudy/locator.js +44 -0
- package/dist/esm/lib/v3/understudy/locator.js.map +1 -1
- package/dist/esm/lib/v3/understudy/page.d.ts +15 -0
- package/dist/esm/lib/v3/understudy/page.js +50 -0
- package/dist/esm/lib/v3/understudy/page.js.map +1 -1
- package/dist/esm/lib/v3/v3.d.ts +8 -0
- package/dist/esm/lib/v3/v3.js +51 -4
- package/dist/esm/lib/v3/v3.js.map +1 -1
- package/dist/esm/lib/v3/verifier/types.d.ts +3 -2
- package/dist/esm/lib/v3/verifier/types.js.map +1 -1
- package/dist/esm/lib/version.d.ts +1 -1
- package/dist/esm/lib/version.js +1 -1
- package/dist/esm/lib/version.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/lib/v3/v3.d.ts
CHANGED
|
@@ -73,6 +73,14 @@ export declare class V3 {
|
|
|
73
73
|
* @deprecated Use `isVerified` instead. This alias will be removed in a future version.
|
|
74
74
|
*/
|
|
75
75
|
get isAdvancedStealth(): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Whether coordinate pointer actions should actuate as touch instead of mouse.
|
|
78
|
+
*
|
|
79
|
+
* Explicit opt-in via the `useTouch` option — no session-derived or probed
|
|
80
|
+
* detection, so the answer is known before the first action, is stable for the
|
|
81
|
+
* whole run, and never surprises a caller who didn't ask for touch.
|
|
82
|
+
*/
|
|
83
|
+
get usesTouch(): boolean;
|
|
76
84
|
/**
|
|
77
85
|
* Returns the configured viewport dimensions from launch options.
|
|
78
86
|
* Falls back to default 1288x711 if not configured.
|
package/dist/esm/lib/v3/v3.js
CHANGED
|
@@ -60,7 +60,7 @@ import { resolveTools } from "./mcp/utils.js";
|
|
|
60
60
|
import { HYBRID_CAPABLE_MODEL_PATTERNS } from "./types/private/agent.js";
|
|
61
61
|
import { AVAILABLE_CUA_MODELS, defaultExtractSchema, V3FunctionName, CuaModelRequiredError, StagehandInvalidArgumentError, StagehandNotInitializedError, MissingEnvironmentVariableError, StagehandInitError, } from "./types/public/index.js";
|
|
62
62
|
import { V3Context } from "./understudy/context.js";
|
|
63
|
-
import { resolveModel } from "../modelUtils.js";
|
|
63
|
+
import { AUTO_MODEL_NAME, isAutoModel, resolveModel } from "../modelUtils.js";
|
|
64
64
|
import { StagehandAPIClient } from "./api.js";
|
|
65
65
|
import { validateExperimentalFeatures } from "./agent/utils/validateExperimentalFeatures.js";
|
|
66
66
|
import { flattenVariables } from "./agent/utils/variables.js";
|
|
@@ -69,6 +69,7 @@ import { EventEmitterWithWildcardSupport } from "./flowlogger/EventEmitter.js";
|
|
|
69
69
|
import { EventStore } from "./flowlogger/EventStore.js";
|
|
70
70
|
import { createTimeoutGuard } from "./handlers/handlerUtils/timeoutGuard.js";
|
|
71
71
|
import { ActTimeoutError } from "./types/public/sdkErrors.js";
|
|
72
|
+
const AUTO_MODEL_API_ONLY_MESSAGE = `model: "${AUTO_MODEL_NAME}" is only supported when running through the Stagehand API (env: "BROWSERBASE" with disableAPI: false and experimental: false). Specify a concrete model (e.g. "openai/gpt-5") instead.`;
|
|
72
73
|
const DEFAULT_MODEL_NAME = "openai/gpt-4.1-mini";
|
|
73
74
|
const DEFAULT_VIEWPORT = { width: 1288, height: 711 };
|
|
74
75
|
const DEFAULT_AGENT_TOOL_TIMEOUT_MS = 45000;
|
|
@@ -190,6 +191,16 @@ let V3 = (() => {
|
|
|
190
191
|
get isAdvancedStealth() {
|
|
191
192
|
return this.isVerified;
|
|
192
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Whether coordinate pointer actions should actuate as touch instead of mouse.
|
|
196
|
+
*
|
|
197
|
+
* Explicit opt-in via the `useTouch` option — no session-derived or probed
|
|
198
|
+
* detection, so the answer is known before the first action, is stable for the
|
|
199
|
+
* whole run, and never surprises a caller who didn't ask for touch.
|
|
200
|
+
*/
|
|
201
|
+
get usesTouch() {
|
|
202
|
+
return this.opts.useTouch === true;
|
|
203
|
+
}
|
|
193
204
|
/**
|
|
194
205
|
* Returns the configured viewport dimensions from launch options.
|
|
195
206
|
* Falls back to default 1288x711 if not configured.
|
|
@@ -310,7 +321,18 @@ let V3 = (() => {
|
|
|
310
321
|
const baseClientOptions = clientOptions
|
|
311
322
|
? { ...clientOptions }
|
|
312
323
|
: {};
|
|
313
|
-
if (
|
|
324
|
+
if (isAutoModel(this.modelName)) {
|
|
325
|
+
if (opts.llmClient ||
|
|
326
|
+
opts.env !== "BROWSERBASE" ||
|
|
327
|
+
this.disableAPI ||
|
|
328
|
+
this.experimental) {
|
|
329
|
+
throw new StagehandInvalidArgumentError(AUTO_MODEL_API_ONLY_MESSAGE);
|
|
330
|
+
}
|
|
331
|
+
// "auto" delegates model selection to the Stagehand API, so no local
|
|
332
|
+
// LLM client is created and no provider API key is required.
|
|
333
|
+
this.modelClientOptions = baseClientOptions;
|
|
334
|
+
}
|
|
335
|
+
else if (opts.llmClient) {
|
|
314
336
|
this.llmClient = opts.llmClient;
|
|
315
337
|
this.modelClientOptions = baseClientOptions;
|
|
316
338
|
this.disableAPI = true;
|
|
@@ -486,6 +508,15 @@ let V3 = (() => {
|
|
|
486
508
|
clientOptions = rest;
|
|
487
509
|
perCallMiddleware = middleware;
|
|
488
510
|
}
|
|
511
|
+
if (isAutoModel(modelName)) {
|
|
512
|
+
if (!this.apiClient) {
|
|
513
|
+
throw new StagehandInvalidArgumentError(AUTO_MODEL_API_ONLY_MESSAGE);
|
|
514
|
+
}
|
|
515
|
+
// The Stagehand API resolves "auto" server-side and intercepts every
|
|
516
|
+
// act/extract/observe, so the local client is never dereferenced here.
|
|
517
|
+
// Note it is undefined when the session's base model is also "auto".
|
|
518
|
+
return this.llmClient;
|
|
519
|
+
}
|
|
489
520
|
if (modelName === this.modelName &&
|
|
490
521
|
!perCallMiddleware &&
|
|
491
522
|
(!clientOptions || Object.keys(clientOptions).length === 0)) {
|
|
@@ -838,10 +869,21 @@ let V3 = (() => {
|
|
|
838
869
|
verbose: this.verbose,
|
|
839
870
|
systemPrompt: this.opts.systemPrompt,
|
|
840
871
|
selfHeal: this.opts.selfHeal,
|
|
872
|
+
useTouch: this.opts.useTouch,
|
|
841
873
|
browserbaseSessionCreateParams: createSessionPayload,
|
|
842
874
|
browserbaseSessionID: this.opts.browserbaseSessionID,
|
|
843
875
|
});
|
|
844
876
|
if (!available) {
|
|
877
|
+
if (isAutoModel(this.modelName)) {
|
|
878
|
+
// "auto" has no local fallback; end the just-created session
|
|
879
|
+
// best-effort before surfacing the error. Never end a
|
|
880
|
+
// caller-supplied (resumed) session we didn't create.
|
|
881
|
+
if (!this.opts.browserbaseSessionID) {
|
|
882
|
+
await this.apiClient.end().catch(() => { });
|
|
883
|
+
}
|
|
884
|
+
this.apiClient = null;
|
|
885
|
+
throw new StagehandInitError(`model: "${AUTO_MODEL_NAME}" requires the Stagehand API, but it is unavailable for this session (sessionId: ${sessionId}). Specify a concrete model (e.g. "openai/gpt-5") instead.`);
|
|
886
|
+
}
|
|
845
887
|
this.apiClient = null;
|
|
846
888
|
}
|
|
847
889
|
this.opts.browserbaseSessionID = sessionId;
|
|
@@ -994,7 +1036,10 @@ let V3 = (() => {
|
|
|
994
1036
|
let actCacheContext = null;
|
|
995
1037
|
const canUseCache = typeof input === "string" &&
|
|
996
1038
|
!this.isAgentReplayRecording() &&
|
|
997
|
-
this.actCache.enabled
|
|
1039
|
+
this.actCache.enabled &&
|
|
1040
|
+
// "auto" sessions have no local LLM client for replay self-heal;
|
|
1041
|
+
// rely on the API (and its server-side cache) instead.
|
|
1042
|
+
!isAutoModel(this.modelName);
|
|
998
1043
|
if (canUseCache) {
|
|
999
1044
|
actCacheContext = await this.actCache.prepareContext(input, page, flattenVariables(options?.variables));
|
|
1000
1045
|
if (actCacheContext) {
|
|
@@ -1478,7 +1523,9 @@ let V3 = (() => {
|
|
|
1478
1523
|
cua: { value: isCuaMode ? "true" : "false", type: "boolean" },
|
|
1479
1524
|
mode: { value: loggedMode, type: "string" },
|
|
1480
1525
|
model: {
|
|
1481
|
-
value: extractModelName(options?.model) ??
|
|
1526
|
+
value: extractModelName(options?.model) ??
|
|
1527
|
+
this.llmClient?.modelName ??
|
|
1528
|
+
this.modelName,
|
|
1482
1529
|
type: "string",
|
|
1483
1530
|
},
|
|
1484
1531
|
systemPrompt: { value: options?.systemPrompt ?? "", type: "string" },
|