stagehand 4.2.0a0.dev1539__tar.gz → 4.2.0a0.dev1541__tar.gz
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.
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/PKG-INFO +1 -1
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/pyproject.toml +1 -1
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/_extension/content-script.js +32 -10
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/_extension/service-worker.js +6 -7
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/_generated/models.py +1 -7
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/_generated/protocol_version.py +1 -1
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/README.md +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/__init__.py +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/_extension/blank.html +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/_extension/manifest.json +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/_extension/offscreen/service-worker-heartbeat.html +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/_extension/offscreen/service-worker-heartbeat.js +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/_extension/wake-service-worker.html +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/_extension/wake-service-worker.js +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/_generated/__init__.py +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/_generated/input_types.py +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/_sdk_identity.py +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/_validation.py +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/browser.py +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/browser_clipboard.py +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/browser_context.py +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/browserbase_services.py +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/browserbase_session.py +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/cdp_client.py +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/client_models.py +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/client_types.py +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/extension_assets.py +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/file_upload.py +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/locator.py +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/page.py +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/py.typed +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/response.py +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/rpc_client.py +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/stagehand.py +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/timeouts.py +0 -0
- {stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/webmcp.py +0 -0
{stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/_extension/content-script.js
RENAMED
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
* - Attribute equality predicates (`[@attr='value']`, `[@attr="value"]`)
|
|
13
13
|
* - Attribute existence (`[@attr]`)
|
|
14
14
|
* - Attribute contains/starts-with (`contains(@attr,'v')`, `starts-with(@attr,'v')`)
|
|
15
|
-
* - Text equality/contains (`[text()='v']`, `[contains(text(),'v')]`, `[.='v']`)
|
|
15
|
+
* - Text equality/contains (`[text()='v']`, `[contains(text(),'v')]`, `[.='v']`),
|
|
16
|
+
* where `text()` reads direct child text nodes and `.` the whole subtree
|
|
16
17
|
* - normalize-space on text/attributes (`[normalize-space(text())='v']`)
|
|
17
18
|
* - Basic boolean predicates (`and`, `or`, `not(...)`)
|
|
18
19
|
* - Multiple predicates per step (`[@class='foo'][2]`)
|
|
@@ -159,11 +160,12 @@ function parseAtomicPredicate(input) {
|
|
|
159
160
|
value: normalizeAttrMatch[2] ?? normalizeAttrMatch[3] ?? "",
|
|
160
161
|
normalize: true
|
|
161
162
|
};
|
|
162
|
-
const normalizeTextMatch = input.match(new RegExp(`^normalize-space\\(\\s*(
|
|
163
|
+
const normalizeTextMatch = input.match(new RegExp(`^normalize-space\\(\\s*(text\\(\\)|\\.)\\s*\\)\\s*=\\s*${quoted}$`));
|
|
163
164
|
if (normalizeTextMatch) return {
|
|
164
165
|
type: "textEquals",
|
|
165
|
-
value: normalizeTextMatch[
|
|
166
|
-
normalize: true
|
|
166
|
+
value: normalizeTextMatch[2] ?? normalizeTextMatch[3] ?? "",
|
|
167
|
+
normalize: true,
|
|
168
|
+
source: textSource(normalizeTextMatch[1])
|
|
167
169
|
};
|
|
168
170
|
const attrEqualsMatch = input.match(new RegExp(`^@(${attrName})\\s*=\\s*${quoted}$`));
|
|
169
171
|
if (attrEqualsMatch) return {
|
|
@@ -188,15 +190,17 @@ function parseAtomicPredicate(input) {
|
|
|
188
190
|
name: attrStartsMatch[1],
|
|
189
191
|
value: attrStartsMatch[2] ?? attrStartsMatch[3] ?? ""
|
|
190
192
|
};
|
|
191
|
-
const textEqualsMatch = input.match(new RegExp(`^(
|
|
193
|
+
const textEqualsMatch = input.match(new RegExp(`^(text\\(\\)|\\.)\\s*=\\s*${quoted}$`));
|
|
192
194
|
if (textEqualsMatch) return {
|
|
193
195
|
type: "textEquals",
|
|
194
|
-
value: textEqualsMatch[
|
|
196
|
+
value: textEqualsMatch[2] ?? textEqualsMatch[3] ?? "",
|
|
197
|
+
source: textSource(textEqualsMatch[1])
|
|
195
198
|
};
|
|
196
|
-
const textContainsMatch = input.match(new RegExp(`^contains\\(\\s*(
|
|
199
|
+
const textContainsMatch = input.match(new RegExp(`^contains\\(\\s*(text\\(\\)|\\.)\\s*,\\s*${quoted}\\s*\\)$`));
|
|
197
200
|
if (textContainsMatch) return {
|
|
198
201
|
type: "textContains",
|
|
199
|
-
value: textContainsMatch[
|
|
202
|
+
value: textContainsMatch[2] ?? textContainsMatch[3] ?? "",
|
|
203
|
+
source: textSource(textContainsMatch[1])
|
|
200
204
|
};
|
|
201
205
|
if (valueMatch.test(input)) return null;
|
|
202
206
|
return null;
|
|
@@ -276,9 +280,23 @@ function hasBalancedParens(input) {
|
|
|
276
280
|
return depth === 0;
|
|
277
281
|
}
|
|
278
282
|
var normalizeSpace = (value) => value.replace(/\s+/g, " ").trim();
|
|
283
|
+
var TEXT_NODE = 3;
|
|
284
|
+
function textSource(token) {
|
|
285
|
+
return token === "text()" ? "text" : "self";
|
|
286
|
+
}
|
|
279
287
|
function textValue(element) {
|
|
280
288
|
return String(element.textContent ?? "");
|
|
281
289
|
}
|
|
290
|
+
/** The node-set `text()` selects: direct child text nodes, in document order. */
|
|
291
|
+
function childTextValues(element) {
|
|
292
|
+
const values = [];
|
|
293
|
+
for (const node of Array.from(element.childNodes)) if (node.nodeType === TEXT_NODE) values.push(String(node.nodeValue ?? ""));
|
|
294
|
+
return values;
|
|
295
|
+
}
|
|
296
|
+
/** `string(node-set)` is the string-value of its first node, or `""` when empty. */
|
|
297
|
+
function firstChildTextValue(element) {
|
|
298
|
+
return childTextValues(element)[0] ?? "";
|
|
299
|
+
}
|
|
282
300
|
function normalizeMaybe(value, normalize) {
|
|
283
301
|
return normalize ? normalizeSpace(value) : value;
|
|
284
302
|
}
|
|
@@ -303,8 +321,12 @@ function evaluatePredicate(element, predicate) {
|
|
|
303
321
|
if (attr === null) return false;
|
|
304
322
|
return normalizeMaybe(attr, predicate.normalize).startsWith(normalizeMaybe(predicate.value, predicate.normalize));
|
|
305
323
|
}
|
|
306
|
-
case "textEquals":
|
|
307
|
-
|
|
324
|
+
case "textEquals": {
|
|
325
|
+
const target = normalizeMaybe(predicate.value, predicate.normalize);
|
|
326
|
+
if (predicate.source === "text") return predicate.normalize ? normalizeSpace(firstChildTextValue(element)) === target : childTextValues(element).some((value) => value === target);
|
|
327
|
+
return normalizeMaybe(textValue(element), predicate.normalize) === target;
|
|
328
|
+
}
|
|
329
|
+
case "textContains": return normalizeMaybe(predicate.source === "text" ? firstChildTextValue(element) : textValue(element), predicate.normalize).includes(normalizeMaybe(predicate.value, predicate.normalize));
|
|
308
330
|
case "index": return true;
|
|
309
331
|
default: return true;
|
|
310
332
|
}
|
{stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/_extension/service-worker.js
RENAMED
|
@@ -7359,7 +7359,7 @@ function isRecord$1(value) {
|
|
|
7359
7359
|
}
|
|
7360
7360
|
var package_default$1 = {
|
|
7361
7361
|
name: "@browserbasehq/stagehand-protocol",
|
|
7362
|
-
version: "2.1.0-alpha-
|
|
7362
|
+
version: "2.1.0-alpha-70f4e91f1983677c1e8ca9a86f0b738f828d059a",
|
|
7363
7363
|
"private": true,
|
|
7364
7364
|
type: "module",
|
|
7365
7365
|
exports: {
|
|
@@ -8440,10 +8440,6 @@ var LocatorDescriptorSchema = strictObject({
|
|
|
8440
8440
|
pageId: string(),
|
|
8441
8441
|
...LocatorSchema.shape
|
|
8442
8442
|
}).meta({ id: "LocatorDescriptor" });
|
|
8443
|
-
var DEFAULT_TELEMETRY_CONFIG = { traces: {
|
|
8444
|
-
endpoint: "https://example.com/v1/traces",
|
|
8445
|
-
headers: {}
|
|
8446
|
-
} };
|
|
8447
8443
|
var ImplementationInfoSchema = strictObject({
|
|
8448
8444
|
name: string().min(1),
|
|
8449
8445
|
version: string().min(1)
|
|
@@ -8464,7 +8460,7 @@ var StagehandInitParamsSchema = strictObject({
|
|
|
8464
8460
|
apiUrl: url().refine((value) => !value.includes("?") && !value.includes("#"), "Stagehand apiUrl must not include a query string or fragment").refine((value) => !new URL(value).pathname.replace(/\/+$/, "").endsWith("/v1"), { message: "Stagehand apiUrl must be a service origin without /v1" }).optional().meta({ description: "Stagehand API base URL override for managed services such as Model Gateway and server-side caching" }),
|
|
8465
8461
|
browser: BrowserSessionMetadataSchema.optional(),
|
|
8466
8462
|
model: union([ModelConfigSchema, ClientModelReferenceSchema]).optional().meta({ description: "Default model configuration; when omitted and a Browserbase Model Gateway session is available, Browserbase selects a model automatically for inference calls" }),
|
|
8467
|
-
telemetry: TelemetryConfigSchema.
|
|
8463
|
+
telemetry: TelemetryConfigSchema.optional(),
|
|
8468
8464
|
logLevel: _enum([
|
|
8469
8465
|
"off",
|
|
8470
8466
|
"error",
|
|
@@ -53965,7 +53961,7 @@ var WebTracerProvider = class extends BasicTracerProvider {
|
|
|
53965
53961
|
};
|
|
53966
53962
|
var package_default = {
|
|
53967
53963
|
name: "@browserbasehq/stagehand-extension",
|
|
53968
|
-
version: "1.1.0-alpha-
|
|
53964
|
+
version: "1.1.0-alpha-70f4e91f1983677c1e8ca9a86f0b738f828d059a",
|
|
53969
53965
|
"private": true,
|
|
53970
53966
|
type: "module",
|
|
53971
53967
|
scripts: {
|
|
@@ -54062,6 +54058,9 @@ function createStagehandTracing(options = {}, dependencies = DEFAULT_TRACING_RUN
|
|
|
54062
54058
|
const previousRuntime = runtime;
|
|
54063
54059
|
runtime = void 0;
|
|
54064
54060
|
await previousRuntime?.shutdown();
|
|
54061
|
+
activeTelemetry = void 0;
|
|
54062
|
+
activeClientInfo = void 0;
|
|
54063
|
+
if (!telemetry) return;
|
|
54065
54064
|
const registerGlobals = options.registerGlobals !== false && !globalsRegistered;
|
|
54066
54065
|
runtime = createStagehandTracingRuntime({
|
|
54067
54066
|
...options,
|
|
@@ -2151,13 +2151,7 @@ class StagehandInitParams(WireModel):
|
|
|
2151
2151
|
browser: Optional[BrowserSessionMetadata] = None
|
|
2152
2152
|
model: Optional[Union[ModelConfig, ClientModelReference]] = None
|
|
2153
2153
|
"""Default model configuration; when omitted and a Browserbase Model Gateway session is available, Browserbase selects a model automatically for inference calls"""
|
|
2154
|
-
telemetry:
|
|
2155
|
-
default_factory=lambda: TelemetryConfig.model_validate(
|
|
2156
|
-
{
|
|
2157
|
-
"traces": {"endpoint": "https://example.com/v1/traces", "headers": {}}
|
|
2158
|
-
}
|
|
2159
|
-
)
|
|
2160
|
-
)
|
|
2154
|
+
telemetry: Optional[TelemetryConfig] = None
|
|
2161
2155
|
log_level: LogLevel = LogLevel.info
|
|
2162
2156
|
system_prompt: Optional[StrictStr] = None
|
|
2163
2157
|
self_heal: Optional[StrictBool] = None
|
{stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/_generated/protocol_version.py
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"""Generated from packages/protocol/package.json. Do not edit."""
|
|
2
2
|
|
|
3
3
|
PROTOCOL_SEMVER_PATTERN = '^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[A-Za-z-][0-9A-Za-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?$'
|
|
4
|
-
STAGEHAND_PROTOCOL_VERSION = '2.1.0-alpha-
|
|
4
|
+
STAGEHAND_PROTOCOL_VERSION = '2.1.0-alpha-70f4e91f1983677c1e8ca9a86f0b738f828d059a'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/_extension/manifest.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/_generated/__init__.py
RENAMED
|
File without changes
|
{stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/_generated/input_types.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/browserbase_services.py
RENAMED
|
File without changes
|
{stagehand-4.2.0a0.dev1539 → stagehand-4.2.0a0.dev1541}/src/stagehand/browserbase_session.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|