stagehand 4.2.0a0.dev1525__tar.gz → 4.2.0a0.dev1526__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.dev1525 → stagehand-4.2.0a0.dev1526}/PKG-INFO +2 -1
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/pyproject.toml +8 -6
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/_extension/service-worker.js +2 -2
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/_generated/models.py +18 -10
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/_generated/protocol_version.py +1 -1
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/_validation.py +2 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/browser.py +11 -8
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/client_models.py +2 -1
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/README.md +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/__init__.py +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/_extension/blank.html +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/_extension/content-script.js +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/_extension/manifest.json +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/_extension/offscreen/service-worker-heartbeat.html +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/_extension/offscreen/service-worker-heartbeat.js +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/_extension/wake-service-worker.html +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/_extension/wake-service-worker.js +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/_generated/__init__.py +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/_generated/input_types.py +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/_sdk_identity.py +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/browser_clipboard.py +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/browser_context.py +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/browserbase_services.py +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/browserbase_session.py +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/cdp_client.py +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/client_types.py +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/extension_assets.py +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/file_upload.py +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/locator.py +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/page.py +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/py.typed +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/response.py +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/rpc_client.py +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/stagehand.py +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/timeouts.py +0 -0
- {stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/webmcp.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: stagehand
|
|
3
|
-
Version: 4.2.0a0.
|
|
3
|
+
Version: 4.2.0a0.dev1526
|
|
4
4
|
Summary: Browserbase's SDK for building browser agents
|
|
5
5
|
Keywords: ai,browser,automation,web-scraping,testing
|
|
6
6
|
Author: Browserbase
|
|
@@ -8,6 +8,7 @@ License-Expression: MIT
|
|
|
8
8
|
Requires-Dist: browserbase>=1.15,<2
|
|
9
9
|
Requires-Dist: opentelemetry-api>=1.35,<2
|
|
10
10
|
Requires-Dist: pydantic>=2.12,<3
|
|
11
|
+
Requires-Dist: typing-extensions>=4.12,<5
|
|
11
12
|
Requires-Dist: websockets>=16.1.1
|
|
12
13
|
Requires-Python: >=3.11
|
|
13
14
|
Project-URL: Homepage, https://stagehand.dev
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "stagehand"
|
|
3
|
-
version = "4.2.0a0.
|
|
3
|
+
version = "4.2.0a0.dev1526"
|
|
4
4
|
description = "Browserbase's SDK for building browser agents"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.11"
|
|
@@ -8,6 +8,7 @@ dependencies = [
|
|
|
8
8
|
"browserbase>=1.15,<2",
|
|
9
9
|
"opentelemetry-api>=1.35,<2",
|
|
10
10
|
"pydantic>=2.12,<3",
|
|
11
|
+
"typing_extensions>=4.12,<5",
|
|
11
12
|
"websockets>=16.1.1",
|
|
12
13
|
]
|
|
13
14
|
license = "MIT"
|
|
@@ -39,12 +40,13 @@ select = ["ANN", "E", "F", "I", "PYI", "UP"]
|
|
|
39
40
|
[tool.ty.environment]
|
|
40
41
|
python-version = "3.11"
|
|
41
42
|
|
|
42
|
-
[tool.ty.src]
|
|
43
|
-
exclude = ["src/stagehand/_generated"]
|
|
44
|
-
|
|
45
43
|
[tool.ty.rules]
|
|
46
44
|
missing-type-argument = "error"
|
|
47
|
-
possibly-unresolved-reference = "
|
|
45
|
+
possibly-unresolved-reference = "error"
|
|
46
|
+
unsound-return-statement = "error"
|
|
47
|
+
dynamic-function-decorator-return = "error"
|
|
48
|
+
missing-override-decorator = "error"
|
|
49
|
+
unused-ignore-comment = "error"
|
|
48
50
|
|
|
49
51
|
[tool.pytest.ini_options]
|
|
50
52
|
asyncio_mode = "auto"
|
|
@@ -58,5 +60,5 @@ dev = [
|
|
|
58
60
|
"pytest==9.0.2",
|
|
59
61
|
"pytest-asyncio==1.3.0",
|
|
60
62
|
"ruff==0.15.7",
|
|
61
|
-
"ty==0.0.
|
|
63
|
+
"ty==0.0.82",
|
|
62
64
|
]
|
{stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/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-ea2789ca56e8a7ee154850de37657823c98604f8",
|
|
7363
7363
|
"private": true,
|
|
7364
7364
|
type: "module",
|
|
7365
7365
|
exports: {
|
|
@@ -53981,7 +53981,7 @@ var WebTracerProvider = class extends BasicTracerProvider {
|
|
|
53981
53981
|
};
|
|
53982
53982
|
var package_default = {
|
|
53983
53983
|
name: "@browserbasehq/stagehand-extension",
|
|
53984
|
-
version: "1.1.0-alpha-
|
|
53984
|
+
version: "1.1.0-alpha-ea2789ca56e8a7ee154850de37657823c98604f8",
|
|
53985
53985
|
"private": true,
|
|
53986
53986
|
type: "module",
|
|
53987
53987
|
scripts: {
|
|
@@ -2117,13 +2117,17 @@ class StagehandExtractParams(WireModel):
|
|
|
2117
2117
|
)
|
|
2118
2118
|
page_id: Annotated[StrictStr, Field(min_length=1)]
|
|
2119
2119
|
instruction: Annotated[StrictStr, Field(min_length=1)]
|
|
2120
|
-
schema_: Annotated[Optional[FieldSchema0], Field(alias="schema", validate_default=True)] =
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2120
|
+
schema_: Annotated[Optional[FieldSchema0], Field(alias="schema", validate_default=True)] = Field(
|
|
2121
|
+
default_factory=lambda: FieldSchema0.model_validate(
|
|
2122
|
+
{
|
|
2123
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
2124
|
+
"type": "object",
|
|
2125
|
+
"properties": {"extraction": {"type": "string"}},
|
|
2126
|
+
"required": ["extraction"],
|
|
2127
|
+
"additionalProperties": False,
|
|
2128
|
+
}
|
|
2129
|
+
)
|
|
2130
|
+
)
|
|
2127
2131
|
options: Optional[ExtractOptions] = None
|
|
2128
2132
|
|
|
2129
2133
|
|
|
@@ -2147,9 +2151,13 @@ class StagehandInitParams(WireModel):
|
|
|
2147
2151
|
browser: Optional[BrowserSessionMetadata] = None
|
|
2148
2152
|
model: Optional[Union[ModelConfig, ClientModelReference]] = None
|
|
2149
2153
|
"""Default model configuration; when omitted and a Browserbase Model Gateway session is available, Browserbase selects a model automatically for inference calls"""
|
|
2150
|
-
telemetry: Annotated[TelemetryConfig, Field(validate_default=True)] =
|
|
2151
|
-
|
|
2152
|
-
|
|
2154
|
+
telemetry: Annotated[TelemetryConfig, Field(validate_default=True)] = Field(
|
|
2155
|
+
default_factory=lambda: TelemetryConfig.model_validate(
|
|
2156
|
+
{
|
|
2157
|
+
"traces": {"endpoint": "https://example.com/v1/traces", "headers": {}}
|
|
2158
|
+
}
|
|
2159
|
+
)
|
|
2160
|
+
)
|
|
2153
2161
|
log_level: LogLevel = LogLevel.info
|
|
2154
2162
|
system_prompt: Optional[StrictStr] = None
|
|
2155
2163
|
self_heal: Optional[StrictBool] = None
|
{stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/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-ea2789ca56e8a7ee154850de37657823c98604f8'
|
|
@@ -3,6 +3,7 @@ from typing import Annotated
|
|
|
3
3
|
from urllib.parse import urlparse
|
|
4
4
|
|
|
5
5
|
from pydantic import AfterValidator, AnyUrl, BaseModel, ConfigDict, TypeAdapter, model_validator
|
|
6
|
+
from typing_extensions import override
|
|
6
7
|
|
|
7
8
|
_url_adapter = TypeAdapter(AnyUrl)
|
|
8
9
|
|
|
@@ -18,6 +19,7 @@ WireUrl = Annotated[str, AfterValidator(_validate_url)]
|
|
|
18
19
|
class WireModel(BaseModel):
|
|
19
20
|
model_config = ConfigDict(validate_assignment=True)
|
|
20
21
|
|
|
22
|
+
@override
|
|
21
23
|
def model_post_init(self, context: object, /) -> None:
|
|
22
24
|
super().model_post_init(context)
|
|
23
25
|
# Protocol defaults must survive `model_dump(exclude_unset=True)` at the wire boundary.
|
|
@@ -15,7 +15,7 @@ from collections.abc import Awaitable, Callable, Mapping, Sequence
|
|
|
15
15
|
from contextlib import suppress
|
|
16
16
|
from dataclasses import dataclass, field
|
|
17
17
|
from pathlib import Path, PureWindowsPath
|
|
18
|
-
from typing import TYPE_CHECKING, Any, Literal, Protocol
|
|
18
|
+
from typing import TYPE_CHECKING, Any, Literal, Protocol, cast
|
|
19
19
|
|
|
20
20
|
if TYPE_CHECKING:
|
|
21
21
|
from .browser_context import BrowserContext
|
|
@@ -281,7 +281,8 @@ class _LocalBrowserOptions(Protocol):
|
|
|
281
281
|
|
|
282
282
|
|
|
283
283
|
class _WaitableChromeProcess(Protocol):
|
|
284
|
-
|
|
284
|
+
@property
|
|
285
|
+
def returncode(self) -> int | None: ...
|
|
285
286
|
|
|
286
287
|
async def wait(self) -> int: ...
|
|
287
288
|
|
|
@@ -721,7 +722,7 @@ async def _launch_local_browser(options: _LocalBrowserOptions) -> ResolvedBrowse
|
|
|
721
722
|
process: _ChromeProcess | None = None
|
|
722
723
|
try:
|
|
723
724
|
try:
|
|
724
|
-
|
|
725
|
+
launched_process = await asyncio.create_subprocess_exec(
|
|
725
726
|
chrome_path,
|
|
726
727
|
*flags,
|
|
727
728
|
stdin=asyncio.subprocess.DEVNULL,
|
|
@@ -729,9 +730,10 @@ async def _launch_local_browser(options: _LocalBrowserOptions) -> ResolvedBrowse
|
|
|
729
730
|
stderr=asyncio.subprocess.DEVNULL,
|
|
730
731
|
start_new_session=sys.platform != "win32",
|
|
731
732
|
)
|
|
733
|
+
process = launched_process
|
|
732
734
|
except OSError as error:
|
|
733
735
|
raise RuntimeError(f"Failed to start Chrome: {error}") from error
|
|
734
|
-
await _wait_for_chrome(f"http://127.0.0.1:{port}",
|
|
736
|
+
await _wait_for_chrome(f"http://127.0.0.1:{port}", launched_process)
|
|
735
737
|
except BaseException as launch_error:
|
|
736
738
|
try:
|
|
737
739
|
if process is not None:
|
|
@@ -746,7 +748,7 @@ async def _launch_local_browser(options: _LocalBrowserOptions) -> ResolvedBrowse
|
|
|
746
748
|
raise
|
|
747
749
|
|
|
748
750
|
async def close() -> None:
|
|
749
|
-
await _close_local_chrome(
|
|
751
|
+
await _close_local_chrome(launched_process, profile)
|
|
750
752
|
|
|
751
753
|
return ResolvedBrowserSource(
|
|
752
754
|
cdp_url=f"http://127.0.0.1:{port}",
|
|
@@ -838,10 +840,10 @@ def _read_chrome_version(cdp_url: str) -> dict[str, object]:
|
|
|
838
840
|
url,
|
|
839
841
|
timeout=_CHROME_REQUEST_TIMEOUT_SECONDS,
|
|
840
842
|
) as response:
|
|
841
|
-
value:
|
|
843
|
+
value: object = json.load(response)
|
|
842
844
|
if not isinstance(value, dict):
|
|
843
845
|
raise RuntimeError("Chrome version endpoint returned invalid JSON")
|
|
844
|
-
return value
|
|
846
|
+
return {str(key): item for key, item in value.items()}
|
|
845
847
|
|
|
846
848
|
|
|
847
849
|
def _chrome_exited_before_ready_error(returncode: int | None) -> RuntimeError:
|
|
@@ -992,7 +994,8 @@ def _should_disable_chromium_sandbox(
|
|
|
992
994
|
) -> bool:
|
|
993
995
|
platform = sys.platform if platform is None else platform
|
|
994
996
|
environment = os.environ if environment is None else environment
|
|
995
|
-
|
|
997
|
+
if getuid is None:
|
|
998
|
+
getuid = cast("Callable[[], int] | None", getattr(os, "getuid", None))
|
|
996
999
|
return (
|
|
997
1000
|
bool(environment.get("CI"))
|
|
998
1001
|
or options.chromium_sandbox is False
|
|
@@ -66,7 +66,8 @@ Cache = bool | CacheOptions
|
|
|
66
66
|
def _cache_config(cache: CacheInput) -> bool | dict[str, int]:
|
|
67
67
|
if isinstance(cache, bool):
|
|
68
68
|
return cache
|
|
69
|
-
|
|
69
|
+
options = CacheOptions.model_validate(cache)
|
|
70
|
+
return {"threshold": options.threshold} if options.threshold is not None else {}
|
|
70
71
|
|
|
71
72
|
|
|
72
73
|
class LocalViewport(WireModel):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/_extension/content-script.js
RENAMED
|
File without changes
|
{stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/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.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/_generated/__init__.py
RENAMED
|
File without changes
|
{stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/_generated/input_types.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/src/stagehand/browserbase_services.py
RENAMED
|
File without changes
|
{stagehand-4.2.0a0.dev1525 → stagehand-4.2.0a0.dev1526}/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
|