@browserbasehq/orca 3.0.8-google-cua → 3.0.8-google-cua-2
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.js +55 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -179,7 +179,7 @@ var __forAwait = (obj, it, method) => (it = obj[__knownSymbol("asyncIterator")])
|
|
|
179
179
|
var STAGEHAND_VERSION;
|
|
180
180
|
var init_version = __esm({
|
|
181
181
|
"lib/version.ts"() {
|
|
182
|
-
STAGEHAND_VERSION = "3.0.
|
|
182
|
+
STAGEHAND_VERSION = "3.0.8-google-cua-2";
|
|
183
183
|
}
|
|
184
184
|
});
|
|
185
185
|
|
|
@@ -35123,6 +35123,51 @@ var GoogleCUAClient = class extends AgentClient {
|
|
|
35123
35123
|
const functionResponses = [];
|
|
35124
35124
|
if (result.actions.length > 0) {
|
|
35125
35125
|
let hasError = false;
|
|
35126
|
+
const safetyAcknowledgements = /* @__PURE__ */ new Map();
|
|
35127
|
+
for (const functionCall of result.functionCalls) {
|
|
35128
|
+
if ((_b = functionCall.args) == null ? void 0 : _b.safety_decision) {
|
|
35129
|
+
logger({
|
|
35130
|
+
category: "agent",
|
|
35131
|
+
message: `Safety decision required before action execution`,
|
|
35132
|
+
level: 1
|
|
35133
|
+
});
|
|
35134
|
+
const acknowledgement = yield this.handleSafetyConfirmation(
|
|
35135
|
+
functionCall.args.safety_decision,
|
|
35136
|
+
logger
|
|
35137
|
+
);
|
|
35138
|
+
safetyAcknowledgements.set(functionCall.name || "", acknowledgement);
|
|
35139
|
+
if (acknowledgement === void 0) {
|
|
35140
|
+
logger({
|
|
35141
|
+
category: "agent",
|
|
35142
|
+
message: `Safety decision rejected - skipping action execution`,
|
|
35143
|
+
level: 1
|
|
35144
|
+
});
|
|
35145
|
+
const rejectionResponse = {
|
|
35146
|
+
functionResponse: {
|
|
35147
|
+
name: functionCall.name,
|
|
35148
|
+
response: {
|
|
35149
|
+
error: "Action rejected by user due to safety concerns",
|
|
35150
|
+
safety_acknowledgement: "false"
|
|
35151
|
+
}
|
|
35152
|
+
}
|
|
35153
|
+
};
|
|
35154
|
+
this.history.push({
|
|
35155
|
+
role: "user",
|
|
35156
|
+
parts: [rejectionResponse]
|
|
35157
|
+
});
|
|
35158
|
+
return {
|
|
35159
|
+
actions: [],
|
|
35160
|
+
message: "Action rejected due to safety concerns",
|
|
35161
|
+
completed: false,
|
|
35162
|
+
usage: {
|
|
35163
|
+
input_tokens: (usageMetadata == null ? void 0 : usageMetadata.promptTokenCount) || 0,
|
|
35164
|
+
output_tokens: (usageMetadata == null ? void 0 : usageMetadata.candidatesTokenCount) || 0,
|
|
35165
|
+
inference_time_ms: endTime - startTime
|
|
35166
|
+
}
|
|
35167
|
+
};
|
|
35168
|
+
}
|
|
35169
|
+
}
|
|
35170
|
+
}
|
|
35126
35171
|
for (let i2 = 0; i2 < result.actions.length; i2++) {
|
|
35127
35172
|
const action = result.actions[i2];
|
|
35128
35173
|
logger({
|
|
@@ -35197,13 +35242,9 @@ var GoogleCUAClient = class extends AgentClient {
|
|
|
35197
35242
|
""
|
|
35198
35243
|
);
|
|
35199
35244
|
for (const functionCall of computerUseFunctionCalls) {
|
|
35200
|
-
|
|
35201
|
-
|
|
35202
|
-
|
|
35203
|
-
functionCall.args.safety_decision,
|
|
35204
|
-
logger
|
|
35205
|
-
);
|
|
35206
|
-
}
|
|
35245
|
+
const safetyAcknowledgement = safetyAcknowledgements.get(
|
|
35246
|
+
functionCall.name || ""
|
|
35247
|
+
);
|
|
35207
35248
|
const functionResponsePart = {
|
|
35208
35249
|
functionResponse: {
|
|
35209
35250
|
name: functionCall.name,
|
|
@@ -35530,14 +35571,17 @@ var GoogleCUAClient = class extends AgentClient {
|
|
|
35530
35571
|
}
|
|
35531
35572
|
}
|
|
35532
35573
|
/**
|
|
35533
|
-
* Normalize coordinates from Google's 0-1000 range to
|
|
35574
|
+
* Normalize coordinates from Google's 0-1000 range to fixed viewport dimensions.
|
|
35575
|
+
* Google CUA outputs coordinates in 0-1000 range based on the screenshot it sees,
|
|
35576
|
+
* which is always 1288x711 regardless of browser-reported viewport size.
|
|
35534
35577
|
*/
|
|
35535
35578
|
normalizeCoordinates(x2, y) {
|
|
35579
|
+
const GOOGLE_CUA_VIEWPORT = { width: 1288, height: 711 };
|
|
35536
35580
|
x2 = Math.min(999, Math.max(0, x2));
|
|
35537
35581
|
y = Math.min(999, Math.max(0, y));
|
|
35538
35582
|
return {
|
|
35539
|
-
x: Math.floor(x2 / 1e3 *
|
|
35540
|
-
y: Math.floor(y / 1e3 *
|
|
35583
|
+
x: Math.floor(x2 / 1e3 * GOOGLE_CUA_VIEWPORT.width),
|
|
35584
|
+
y: Math.floor(y / 1e3 * GOOGLE_CUA_VIEWPORT.height)
|
|
35541
35585
|
};
|
|
35542
35586
|
}
|
|
35543
35587
|
captureScreenshot(options) {
|
package/package.json
CHANGED