@browserbasehq/orca 3.0.2 → 3.0.3-patch
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 +37 -12
- package/dist/index.js +530 -314
- package/package.json +18 -17
- package/LICENSE +0 -21
package/dist/index.d.ts
CHANGED
|
@@ -234,9 +234,12 @@ declare class Frame implements FrameManager {
|
|
|
234
234
|
session: CDPSessionLike;
|
|
235
235
|
frameId: string;
|
|
236
236
|
pageId: string;
|
|
237
|
+
private readonly remoteBrowser;
|
|
237
238
|
/** Owning CDP session id (useful for logs); null for root connection (should not happen for targets) */
|
|
238
239
|
readonly sessionId: string | null;
|
|
239
|
-
constructor(session: CDPSessionLike, frameId: string, pageId: string);
|
|
240
|
+
constructor(session: CDPSessionLike, frameId: string, pageId: string, remoteBrowser: boolean);
|
|
241
|
+
/** True when the controlled browser runs on a different machine. */
|
|
242
|
+
isBrowserRemote(): boolean;
|
|
240
243
|
/** DOM.getNodeForLocation → DOM.describeNode */
|
|
241
244
|
getNodeAtLocation(x: number, y: number): Promise<Protocol.DOM.Node>;
|
|
242
245
|
/** CSS selector → DOM.querySelector → DOM.getBoxModel */
|
|
@@ -280,6 +283,14 @@ declare class Frame implements FrameManager {
|
|
|
280
283
|
private getExecutionContextId;
|
|
281
284
|
}
|
|
282
285
|
|
|
286
|
+
interface SetInputFilePayload {
|
|
287
|
+
name: string;
|
|
288
|
+
mimeType?: string;
|
|
289
|
+
buffer: ArrayBuffer | Uint8Array | Buffer$1 | string;
|
|
290
|
+
lastModified?: number;
|
|
291
|
+
}
|
|
292
|
+
type SetInputFilesArgument = string | string[] | SetInputFilePayload | SetInputFilePayload[];
|
|
293
|
+
|
|
283
294
|
type MouseButton = "left" | "right" | "middle";
|
|
284
295
|
/**
|
|
285
296
|
* Locator
|
|
@@ -322,15 +333,16 @@ declare class Locator {
|
|
|
322
333
|
* - Best‑effort dispatches change/input via CDP (Chrome does by default).
|
|
323
334
|
* - Passing an empty array clears the selection.
|
|
324
335
|
*/
|
|
325
|
-
setInputFiles(files:
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
336
|
+
setInputFiles(files: SetInputFilesArgument): Promise<void>;
|
|
337
|
+
/**
|
|
338
|
+
* Remote browser fallback: build File objects inside the page and attach them via JS.
|
|
339
|
+
*
|
|
340
|
+
* When Stagehand is driving a browser that cannot see the local filesystem (Browserbase,
|
|
341
|
+
* remote CDP, etc.), CDP's DOM.setFileInputFiles would fail because Chrome can't reach
|
|
342
|
+
* our temp files. Instead we base64-encode the payloads, send them into the page, and
|
|
343
|
+
* let a DOM helper create File objects + dispatch change/input events.
|
|
344
|
+
*/
|
|
345
|
+
private assignFilesViaPayloadInjection;
|
|
334
346
|
/**
|
|
335
347
|
* Return the DOM backendNodeId for this locator's target element.
|
|
336
348
|
* Useful for identity comparisons without needing element handles.
|
|
@@ -797,6 +809,7 @@ declare class Page {
|
|
|
797
809
|
private nextOrdinal;
|
|
798
810
|
/** cache Frames per frameId so everyone uses the same one */
|
|
799
811
|
private readonly frameCache;
|
|
812
|
+
private readonly browserIsRemote;
|
|
800
813
|
/** Stable id for Frames created by this Page (use top-level TargetId). */
|
|
801
814
|
private readonly pageId;
|
|
802
815
|
/** Cached current URL for synchronous page.url() */
|
|
@@ -817,7 +830,7 @@ declare class Page {
|
|
|
817
830
|
* Factory: create Page and seed registry with the shallow tree from Page.getFrameTree.
|
|
818
831
|
* Assumes Page domain is already enabled on the session passed in.
|
|
819
832
|
*/
|
|
820
|
-
static create(conn: CdpConnection, session: CDPSessionLike, targetId: string, apiClient?: StagehandAPIClient | null, localBrowserLaunchOptions?: LocalBrowserLaunchOptions | null): Promise<Page>;
|
|
833
|
+
static create(conn: CdpConnection, session: CDPSessionLike, targetId: string, apiClient?: StagehandAPIClient | null, localBrowserLaunchOptions?: LocalBrowserLaunchOptions | null, browserIsRemote?: boolean): Promise<Page>;
|
|
821
834
|
/**
|
|
822
835
|
* Parent/child session emitted a `frameAttached`.
|
|
823
836
|
* Topology update + ownership stamped to **emitting session**.
|
|
@@ -1132,6 +1145,8 @@ interface AgentResult {
|
|
|
1132
1145
|
usage?: {
|
|
1133
1146
|
input_tokens: number;
|
|
1134
1147
|
output_tokens: number;
|
|
1148
|
+
reasoning_tokens?: number;
|
|
1149
|
+
cached_input_tokens?: number;
|
|
1135
1150
|
inference_time_ms: number;
|
|
1136
1151
|
};
|
|
1137
1152
|
}
|
|
@@ -1346,18 +1361,28 @@ declare enum V3FunctionName {
|
|
|
1346
1361
|
interface StagehandMetrics {
|
|
1347
1362
|
actPromptTokens: number;
|
|
1348
1363
|
actCompletionTokens: number;
|
|
1364
|
+
actReasoningTokens: number;
|
|
1365
|
+
actCachedInputTokens: number;
|
|
1349
1366
|
actInferenceTimeMs: number;
|
|
1350
1367
|
extractPromptTokens: number;
|
|
1351
1368
|
extractCompletionTokens: number;
|
|
1369
|
+
extractReasoningTokens: number;
|
|
1370
|
+
extractCachedInputTokens: number;
|
|
1352
1371
|
extractInferenceTimeMs: number;
|
|
1353
1372
|
observePromptTokens: number;
|
|
1354
1373
|
observeCompletionTokens: number;
|
|
1374
|
+
observeReasoningTokens: number;
|
|
1375
|
+
observeCachedInputTokens: number;
|
|
1355
1376
|
observeInferenceTimeMs: number;
|
|
1356
1377
|
agentPromptTokens: number;
|
|
1357
1378
|
agentCompletionTokens: number;
|
|
1379
|
+
agentReasoningTokens: number;
|
|
1380
|
+
agentCachedInputTokens: number;
|
|
1358
1381
|
agentInferenceTimeMs: number;
|
|
1359
1382
|
totalPromptTokens: number;
|
|
1360
1383
|
totalCompletionTokens: number;
|
|
1384
|
+
totalReasoningTokens: number;
|
|
1385
|
+
totalCachedInputTokens: number;
|
|
1361
1386
|
totalInferenceTimeMs: number;
|
|
1362
1387
|
}
|
|
1363
1388
|
|
|
@@ -1898,7 +1923,7 @@ declare class V3 {
|
|
|
1898
1923
|
*/
|
|
1899
1924
|
get history(): Promise<ReadonlyArray<HistoryEntry>>;
|
|
1900
1925
|
addToHistory(method: HistoryEntry["method"], parameters: unknown, result?: unknown): void;
|
|
1901
|
-
updateMetrics(functionName: V3FunctionName, promptTokens: number, completionTokens: number, inferenceTimeMs: number): void;
|
|
1926
|
+
updateMetrics(functionName: V3FunctionName, promptTokens: number, completionTokens: number, reasoningTokens: number, cachedInputTokens: number, inferenceTimeMs: number): void;
|
|
1902
1927
|
private updateTotalMetrics;
|
|
1903
1928
|
private _immediateShutdown;
|
|
1904
1929
|
private static _installProcessGuards;
|