fleet-python 0.2.0__py3-none-any.whl → 0.2.2__py3-none-any.whl
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.
Potentially problematic release.
This version of fleet-python might be problematic. Click here for more details.
- examples/dsl_example.py +112 -0
- examples/example.py +38 -0
- examples/nova_act_example.py +180 -0
- examples/openai_example.py +448 -0
- examples/quickstart.py +5 -5
- fleet/__init__.py +24 -3
- fleet/base.py +1 -1
- fleet/client.py +60 -28
- fleet/env/__init__.py +2 -7
- fleet/env/client.py +9 -235
- fleet/manager/__init__.py +22 -0
- fleet/manager/client.py +258 -0
- fleet/{env → manager}/models.py +15 -14
- fleet/resources/base.py +5 -2
- fleet/resources/browser.py +32 -6
- fleet/resources/sqlite.py +5 -5
- fleet/verifiers/__init__.py +4 -0
- fleet/verifiers/database_snapshot.py +666 -0
- fleet/verifiers/sql_differ.py +187 -0
- {fleet_python-0.2.0.dist-info → fleet_python-0.2.2.dist-info}/METADATA +1 -1
- fleet_python-0.2.2.dist-info/RECORD +27 -0
- examples/browser_control_example.py +0 -51
- fleet_python-0.2.0.dist-info/RECORD +0 -19
- /fleet/{env → manager}/base.py +0 -0
- {fleet_python-0.2.0.dist-info → fleet_python-0.2.2.dist-info}/WHEEL +0 -0
- {fleet_python-0.2.0.dist-info → fleet_python-0.2.2.dist-info}/licenses/LICENSE +0 -0
- {fleet_python-0.2.0.dist-info → fleet_python-0.2.2.dist-info}/top_level.txt +0 -0
fleet/{env → manager}/models.py
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# generated by datamodel-codegen:
|
|
2
|
-
# filename:
|
|
3
|
-
# timestamp: 2025-07-
|
|
2
|
+
# filename: openapi (2).json
|
|
3
|
+
# timestamp: 2025-07-09T20:11:31+00:00
|
|
4
4
|
|
|
5
5
|
from __future__ import annotations
|
|
6
6
|
|
|
@@ -10,22 +10,27 @@ from typing import Any, Dict, List, Optional, Union
|
|
|
10
10
|
from pydantic import BaseModel, Field
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
class
|
|
13
|
+
class CDPDescribeResponse(BaseModel):
|
|
14
14
|
success: bool = Field(..., title="Success")
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
cdp_page_url: str = Field(..., title="Url")
|
|
16
|
+
cdp_browser_url: str = Field(..., title="Browser Url")
|
|
17
|
+
cdp_devtools_url: str = Field(..., title="Devtools Url")
|
|
17
18
|
|
|
18
19
|
|
|
19
|
-
class
|
|
20
|
-
start_page: Optional[str] = Field("about:blank", title="Start Page")
|
|
20
|
+
class ChromeStartRequest(BaseModel):
|
|
21
21
|
resolution: Optional[str] = Field("1920x1080", title="Resolution")
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
class
|
|
24
|
+
class ChromeStartResponse(BaseModel):
|
|
25
25
|
success: bool = Field(..., title="Success")
|
|
26
26
|
message: str = Field(..., title="Message")
|
|
27
27
|
|
|
28
28
|
|
|
29
|
+
class ChromeStatusResponse(BaseModel):
|
|
30
|
+
running: bool = Field(..., title="Running")
|
|
31
|
+
message: str = Field(..., title="Message")
|
|
32
|
+
|
|
33
|
+
|
|
29
34
|
class CreateSnapshotsResponse(BaseModel):
|
|
30
35
|
success: bool = Field(..., title="Success")
|
|
31
36
|
initial_snapshot_path: Optional[str] = Field(None, title="Initial Snapshot Path")
|
|
@@ -69,8 +74,8 @@ class QueryResponse(BaseModel):
|
|
|
69
74
|
|
|
70
75
|
|
|
71
76
|
class ResetRequest(BaseModel):
|
|
77
|
+
timestamp: Optional[int] = Field(None, title="Timestamp")
|
|
72
78
|
seed: Optional[int] = Field(None, title="Seed")
|
|
73
|
-
timestamp: Optional[str] = Field(None, title="Timestamp")
|
|
74
79
|
|
|
75
80
|
|
|
76
81
|
class ResetResponse(BaseModel):
|
|
@@ -84,7 +89,7 @@ class ResourceMode(Enum):
|
|
|
84
89
|
|
|
85
90
|
|
|
86
91
|
class ResourceType(Enum):
|
|
87
|
-
|
|
92
|
+
db = "sqlite"
|
|
88
93
|
cdp = "cdp"
|
|
89
94
|
|
|
90
95
|
|
|
@@ -121,7 +126,3 @@ class Resource(BaseModel):
|
|
|
121
126
|
type: ResourceType
|
|
122
127
|
mode: ResourceMode
|
|
123
128
|
label: Optional[str] = Field(None, title="Label")
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
class ResourcesResponse(BaseModel):
|
|
127
|
-
resources: List[Resource] = Field(..., title="Resources")
|
fleet/resources/base.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from abc import ABC
|
|
2
|
-
from ..
|
|
2
|
+
from ..manager.models import Resource as ResourceModel, ResourceType, ResourceMode
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class Resource(ABC):
|
|
@@ -8,7 +8,7 @@ class Resource(ABC):
|
|
|
8
8
|
|
|
9
9
|
@property
|
|
10
10
|
def uri(self) -> str:
|
|
11
|
-
return f"{self.resource.type}://{self.resource.name}"
|
|
11
|
+
return f"{self.resource.type.value}://{self.resource.name}"
|
|
12
12
|
|
|
13
13
|
@property
|
|
14
14
|
def name(self) -> str:
|
|
@@ -21,3 +21,6 @@ class Resource(ABC):
|
|
|
21
21
|
@property
|
|
22
22
|
def mode(self) -> ResourceMode:
|
|
23
23
|
return self.resource.mode
|
|
24
|
+
|
|
25
|
+
def __repr__(self) -> str:
|
|
26
|
+
return f"Resource(uri={self.uri}, mode={self.mode.value})"
|
fleet/resources/browser.py
CHANGED
|
@@ -1,18 +1,44 @@
|
|
|
1
|
-
from
|
|
2
|
-
from ..
|
|
1
|
+
from typing import Optional
|
|
2
|
+
from ..manager.models import (
|
|
3
|
+
Resource as ResourceModel,
|
|
4
|
+
CDPDescribeResponse,
|
|
5
|
+
ChromeStartRequest,
|
|
6
|
+
ChromeStartResponse,
|
|
7
|
+
)
|
|
3
8
|
from .base import Resource
|
|
4
9
|
|
|
5
10
|
from typing import TYPE_CHECKING
|
|
6
11
|
|
|
7
12
|
if TYPE_CHECKING:
|
|
8
|
-
from ..
|
|
13
|
+
from ..manager.base import AsyncWrapper
|
|
9
14
|
|
|
10
15
|
|
|
11
16
|
class AsyncBrowserResource(Resource):
|
|
12
17
|
def __init__(self, resource: ResourceModel, client: "AsyncWrapper"):
|
|
13
18
|
super().__init__(resource)
|
|
14
19
|
self.client = client
|
|
20
|
+
self._describe: Optional[CDPDescribeResponse] = None
|
|
15
21
|
|
|
16
|
-
async def
|
|
17
|
-
response = await self.client.request(
|
|
18
|
-
|
|
22
|
+
async def start(self, width: int = 1920, height: int = 1080) -> CDPDescribeResponse:
|
|
23
|
+
response = await self.client.request(
|
|
24
|
+
"POST",
|
|
25
|
+
"/resources/cdp/start",
|
|
26
|
+
json=ChromeStartRequest(resolution=f"{width},{height}").model_dump(),
|
|
27
|
+
)
|
|
28
|
+
ChromeStartResponse(**response.json())
|
|
29
|
+
return await self.describe()
|
|
30
|
+
|
|
31
|
+
async def describe(self) -> CDPDescribeResponse:
|
|
32
|
+
if self._describe is None:
|
|
33
|
+
response = await self.client.request("GET", "/resources/cdp/describe")
|
|
34
|
+
if response.status_code != 200:
|
|
35
|
+
await self.start()
|
|
36
|
+
response = await self.client.request("GET", "/resources/cdp/describe")
|
|
37
|
+
self._describe = CDPDescribeResponse(**response.json())
|
|
38
|
+
return self._describe
|
|
39
|
+
|
|
40
|
+
async def cdp_url(self) -> str:
|
|
41
|
+
return (await self.describe()).cdp_browser_url
|
|
42
|
+
|
|
43
|
+
async def devtools_url(self) -> str:
|
|
44
|
+
return (await self.describe()).cdp_devtools_url
|
fleet/resources/sqlite.py
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
from typing import Any, List, Optional
|
|
2
|
-
from ..
|
|
3
|
-
from ..
|
|
2
|
+
from ..manager.models import Resource as ResourceModel
|
|
3
|
+
from ..manager.models import DescribeResponse, QueryRequest, QueryResponse
|
|
4
4
|
from .base import Resource
|
|
5
5
|
|
|
6
6
|
from typing import TYPE_CHECKING
|
|
7
7
|
|
|
8
8
|
if TYPE_CHECKING:
|
|
9
|
-
from ..
|
|
9
|
+
from ..manager.base import AsyncWrapper
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class AsyncSQLiteResource(Resource):
|
|
@@ -17,7 +17,7 @@ class AsyncSQLiteResource(Resource):
|
|
|
17
17
|
async def describe(self) -> DescribeResponse:
|
|
18
18
|
"""Describe the SQLite database schema."""
|
|
19
19
|
response = await self.client.request(
|
|
20
|
-
"GET", f"/
|
|
20
|
+
"GET", f"/resources/sqlite/{self.resource.name}/describe"
|
|
21
21
|
)
|
|
22
22
|
return DescribeResponse(**response.json())
|
|
23
23
|
|
|
@@ -35,7 +35,7 @@ class AsyncSQLiteResource(Resource):
|
|
|
35
35
|
request = QueryRequest(query=query, args=args, read_only=read_only)
|
|
36
36
|
response = await self.client.request(
|
|
37
37
|
"POST",
|
|
38
|
-
f"/
|
|
38
|
+
f"/resources/sqlite/{self.resource.name}/query",
|
|
39
39
|
json=request.model_dump(),
|
|
40
40
|
)
|
|
41
41
|
return QueryResponse(**response.json())
|