@browserbasehq/orca 3.0.0-preview.7 → 3.0.0-preview.8
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 +13 -4
- package/dist/index.js +44 -29
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -522,6 +522,15 @@ declare class DeepLocatorDelegate {
|
|
|
522
522
|
composed?: boolean;
|
|
523
523
|
detail?: number;
|
|
524
524
|
}): Promise<void>;
|
|
525
|
+
setInputFiles(files: string | string[] | {
|
|
526
|
+
name: string;
|
|
527
|
+
mimeType: string;
|
|
528
|
+
buffer: ArrayBuffer | Uint8Array | Buffer | string;
|
|
529
|
+
} | Array<{
|
|
530
|
+
name: string;
|
|
531
|
+
mimeType: string;
|
|
532
|
+
buffer: ArrayBuffer | Uint8Array | Buffer | string;
|
|
533
|
+
}>): Promise<void>;
|
|
525
534
|
first(): DeepLocatorDelegate;
|
|
526
535
|
nth(index: number): DeepLocatorDelegate;
|
|
527
536
|
}
|
|
@@ -1098,7 +1107,7 @@ declare enum V3FunctionName {
|
|
|
1098
1107
|
AGENT = "AGENT"
|
|
1099
1108
|
}
|
|
1100
1109
|
|
|
1101
|
-
interface
|
|
1110
|
+
interface StagehandMetrics {
|
|
1102
1111
|
actPromptTokens: number;
|
|
1103
1112
|
actCompletionTokens: number;
|
|
1104
1113
|
actInferenceTimeMs: number;
|
|
@@ -1591,13 +1600,13 @@ declare class V3 {
|
|
|
1591
1600
|
private actCache;
|
|
1592
1601
|
private agentCache;
|
|
1593
1602
|
private apiClient;
|
|
1594
|
-
|
|
1603
|
+
stagehandMetrics: StagehandMetrics;
|
|
1595
1604
|
constructor(opts: V3Options);
|
|
1596
1605
|
/**
|
|
1597
1606
|
* Async property for metrics so callers can `await v3.metrics`.
|
|
1598
1607
|
* Returning a Promise future-proofs async aggregation/storage.
|
|
1599
1608
|
*/
|
|
1600
|
-
get metrics(): Promise<
|
|
1609
|
+
get metrics(): Promise<StagehandMetrics>;
|
|
1601
1610
|
private resolveLlmClient;
|
|
1602
1611
|
private beginAgentReplayRecording;
|
|
1603
1612
|
private endAgentReplayRecording;
|
|
@@ -1807,4 +1816,4 @@ declare class V3Evaluator {
|
|
|
1807
1816
|
private _evaluateWithMultipleScreenshots;
|
|
1808
1817
|
}
|
|
1809
1818
|
|
|
1810
|
-
export { type AISDKCustomProvider, type AISDKProvider, 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, ContentFrameNotFoundError, type CreateChatCompletionOptions, CreateChatCompletionResponseError, ExperimentalApiConflictError, ExperimentalNotConfiguredError, type ExtractOptions, type ExtractResult, type FunctionCallItem, HandlerNotInitializedError, type HistoryEntry, InvalidAISDKModelFormatError, type JsonSchema, type JsonSchemaProperty, LLMClient, type LLMResponse, LLMResponseError, type LLMTool, LOG_LEVEL_NAMES, type LoadState, type LocalBrowserLaunchOptions, type LogLevel, type LogLine, type Logger, MCPConnectionError, MissingEnvironmentVariableError, MissingLLMConfigurationError, type ModelConfiguration, type ModelProvider, type ObserveOptions, type ResponseInputItem, type ResponseItem, V3 as Stagehand, StagehandAPIError, StagehandAPIUnauthorizedError, StagehandClickError, StagehandDefaultError, StagehandDomProcessError, StagehandElementNotFoundError, StagehandEnvironmentError, StagehandError, StagehandEvalError, StagehandHttpError, StagehandIframeError, StagehandInitError, StagehandInvalidArgumentError, StagehandMissingArgumentError, StagehandNotInitializedError, StagehandResponseBodyError, StagehandResponseParseError, StagehandServerError, StagehandShadowRootMissingError, StagehandShadowSegmentEmptyError, StagehandShadowSegmentNotFoundError, type ToolUseItem, UnsupportedAISDKModelProviderError, UnsupportedModelError, UnsupportedModelProviderError, V3, type V3Env, V3Evaluator, V3FunctionName, type
|
|
1819
|
+
export { type AISDKCustomProvider, type AISDKProvider, 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, ContentFrameNotFoundError, type CreateChatCompletionOptions, CreateChatCompletionResponseError, ExperimentalApiConflictError, ExperimentalNotConfiguredError, type ExtractOptions, type ExtractResult, type FunctionCallItem, HandlerNotInitializedError, type HistoryEntry, InvalidAISDKModelFormatError, type JsonSchema, type JsonSchemaProperty, LLMClient, type LLMResponse, LLMResponseError, type LLMTool, LOG_LEVEL_NAMES, type LoadState, type LocalBrowserLaunchOptions, type LogLevel, type LogLine, type Logger, MCPConnectionError, MissingEnvironmentVariableError, MissingLLMConfigurationError, type ModelConfiguration, type ModelProvider, type ObserveOptions, type ResponseInputItem, type ResponseItem, 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 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 };
|
package/dist/index.js
CHANGED
|
@@ -3102,6 +3102,11 @@ var init_deepLocator = __esm({
|
|
|
3102
3102
|
return (yield this.real()).sendClickEvent(options);
|
|
3103
3103
|
});
|
|
3104
3104
|
}
|
|
3105
|
+
setInputFiles(files) {
|
|
3106
|
+
return __async(this, null, function* () {
|
|
3107
|
+
return (yield this.real()).setInputFiles(files);
|
|
3108
|
+
});
|
|
3109
|
+
}
|
|
3105
3110
|
first() {
|
|
3106
3111
|
return this.nth(0);
|
|
3107
3112
|
}
|
|
@@ -6290,7 +6295,7 @@ var import_path5 = __toESM(require("path"));
|
|
|
6290
6295
|
var import_process2 = __toESM(require("process"));
|
|
6291
6296
|
|
|
6292
6297
|
// lib/version.ts
|
|
6293
|
-
var STAGEHAND_VERSION = "3.0.0-preview.
|
|
6298
|
+
var STAGEHAND_VERSION = "3.0.0-preview.8";
|
|
6294
6299
|
|
|
6295
6300
|
// lib/v3/types/public/sdkErrors.ts
|
|
6296
6301
|
var StagehandError = class extends Error {
|
|
@@ -6959,7 +6964,18 @@ function isTestEnvironment() {
|
|
|
6959
6964
|
var _StagehandLogger = class _StagehandLogger {
|
|
6960
6965
|
constructor(options = {}, externalLogger) {
|
|
6961
6966
|
this.isTest = isTestEnvironment();
|
|
6962
|
-
this.
|
|
6967
|
+
this.externalLogger = externalLogger;
|
|
6968
|
+
const externalProvided = typeof externalLogger === "function";
|
|
6969
|
+
const explicitUsePino = options.usePino;
|
|
6970
|
+
if (this.isTest) {
|
|
6971
|
+
this.usePino = false;
|
|
6972
|
+
} else if (explicitUsePino === true) {
|
|
6973
|
+
this.usePino = true;
|
|
6974
|
+
} else if (explicitUsePino === false) {
|
|
6975
|
+
this.usePino = false;
|
|
6976
|
+
} else {
|
|
6977
|
+
this.usePino = !externalProvided;
|
|
6978
|
+
}
|
|
6963
6979
|
if (this.usePino) {
|
|
6964
6980
|
if (!_StagehandLogger.sharedPinoLogger) {
|
|
6965
6981
|
_StagehandLogger.sharedPinoLogger = createLogger(options);
|
|
@@ -6967,7 +6983,6 @@ var _StagehandLogger = class _StagehandLogger {
|
|
|
6967
6983
|
this.logger = _StagehandLogger.sharedPinoLogger;
|
|
6968
6984
|
}
|
|
6969
6985
|
this.verbose = 1;
|
|
6970
|
-
this.externalLogger = externalLogger;
|
|
6971
6986
|
}
|
|
6972
6987
|
/**
|
|
6973
6988
|
* Set the verbosity level
|
|
@@ -38438,7 +38453,7 @@ var _V3 = class _V3 {
|
|
|
38438
38453
|
this.verbose = 1;
|
|
38439
38454
|
this._history = [];
|
|
38440
38455
|
this.apiClient = null;
|
|
38441
|
-
this.
|
|
38456
|
+
this.stagehandMetrics = {
|
|
38442
38457
|
actPromptTokens: 0,
|
|
38443
38458
|
actCompletionTokens: 0,
|
|
38444
38459
|
actInferenceTimeMs: 0,
|
|
@@ -38460,15 +38475,15 @@ var _V3 = class _V3 {
|
|
|
38460
38475
|
this.externalLogger = opts.logger;
|
|
38461
38476
|
this.verbose = (_a = opts.verbose) != null ? _a : 1;
|
|
38462
38477
|
this.instanceId = (_d = (_c = (_b = globalThis.crypto) == null ? void 0 : _b.randomUUID) == null ? void 0 : _c.call(_b)) != null ? _d : `${Date.now()}-${Math.floor(Math.random() * 1e9)}`;
|
|
38463
|
-
|
|
38464
|
-
|
|
38465
|
-
|
|
38466
|
-
|
|
38467
|
-
|
|
38468
|
-
|
|
38469
|
-
|
|
38470
|
-
|
|
38471
|
-
);
|
|
38478
|
+
const loggerOptions = {
|
|
38479
|
+
pretty: true,
|
|
38480
|
+
level: "info"
|
|
38481
|
+
// Most permissive - filtering happens at instance level
|
|
38482
|
+
};
|
|
38483
|
+
if (opts.disablePino !== void 0) {
|
|
38484
|
+
loggerOptions.usePino = !opts.disablePino;
|
|
38485
|
+
}
|
|
38486
|
+
this.stagehandLogger = new StagehandLogger(loggerOptions, opts.logger);
|
|
38472
38487
|
this.stagehandLogger.setVerbosity(this.verbose);
|
|
38473
38488
|
try {
|
|
38474
38489
|
if (this.externalLogger) {
|
|
@@ -38546,7 +38561,7 @@ var _V3 = class _V3 {
|
|
|
38546
38561
|
* Returning a Promise future-proofs async aggregation/storage.
|
|
38547
38562
|
*/
|
|
38548
38563
|
get metrics() {
|
|
38549
|
-
return Promise.resolve(this.
|
|
38564
|
+
return Promise.resolve(this.stagehandMetrics);
|
|
38550
38565
|
}
|
|
38551
38566
|
resolveLlmClient(model) {
|
|
38552
38567
|
if (!model) {
|
|
@@ -38625,32 +38640,32 @@ var _V3 = class _V3 {
|
|
|
38625
38640
|
updateMetrics(functionName, promptTokens, completionTokens, inferenceTimeMs) {
|
|
38626
38641
|
switch (functionName) {
|
|
38627
38642
|
case "ACT" /* ACT */:
|
|
38628
|
-
this.
|
|
38629
|
-
this.
|
|
38630
|
-
this.
|
|
38643
|
+
this.stagehandMetrics.actPromptTokens += promptTokens;
|
|
38644
|
+
this.stagehandMetrics.actCompletionTokens += completionTokens;
|
|
38645
|
+
this.stagehandMetrics.actInferenceTimeMs += inferenceTimeMs;
|
|
38631
38646
|
break;
|
|
38632
38647
|
case "EXTRACT" /* EXTRACT */:
|
|
38633
|
-
this.
|
|
38634
|
-
this.
|
|
38635
|
-
this.
|
|
38648
|
+
this.stagehandMetrics.extractPromptTokens += promptTokens;
|
|
38649
|
+
this.stagehandMetrics.extractCompletionTokens += completionTokens;
|
|
38650
|
+
this.stagehandMetrics.extractInferenceTimeMs += inferenceTimeMs;
|
|
38636
38651
|
break;
|
|
38637
38652
|
case "OBSERVE" /* OBSERVE */:
|
|
38638
|
-
this.
|
|
38639
|
-
this.
|
|
38640
|
-
this.
|
|
38653
|
+
this.stagehandMetrics.observePromptTokens += promptTokens;
|
|
38654
|
+
this.stagehandMetrics.observeCompletionTokens += completionTokens;
|
|
38655
|
+
this.stagehandMetrics.observeInferenceTimeMs += inferenceTimeMs;
|
|
38641
38656
|
break;
|
|
38642
38657
|
case "AGENT" /* AGENT */:
|
|
38643
|
-
this.
|
|
38644
|
-
this.
|
|
38645
|
-
this.
|
|
38658
|
+
this.stagehandMetrics.agentPromptTokens += promptTokens;
|
|
38659
|
+
this.stagehandMetrics.agentCompletionTokens += completionTokens;
|
|
38660
|
+
this.stagehandMetrics.agentInferenceTimeMs += inferenceTimeMs;
|
|
38646
38661
|
break;
|
|
38647
38662
|
}
|
|
38648
38663
|
this.updateTotalMetrics(promptTokens, completionTokens, inferenceTimeMs);
|
|
38649
38664
|
}
|
|
38650
38665
|
updateTotalMetrics(promptTokens, completionTokens, inferenceTimeMs) {
|
|
38651
|
-
this.
|
|
38652
|
-
this.
|
|
38653
|
-
this.
|
|
38666
|
+
this.stagehandMetrics.totalPromptTokens += promptTokens;
|
|
38667
|
+
this.stagehandMetrics.totalCompletionTokens += completionTokens;
|
|
38668
|
+
this.stagehandMetrics.totalInferenceTimeMs += inferenceTimeMs;
|
|
38654
38669
|
}
|
|
38655
38670
|
_immediateShutdown(reason) {
|
|
38656
38671
|
return __async(this, null, function* () {
|
package/package.json
CHANGED