plato-sdk-v2 2.1.17__py3-none-any.whl → 2.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.
- plato/_sims_generator/instruction.py +4 -3
- plato/agents/trajectory.py +4 -4
- plato/chronos/models/__init__.py +1 -1
- plato/sims/cli.py +7 -4
- plato/sims/registry.py +0 -1
- plato/v1/cli/agent.py +10 -0
- plato/v1/cli/main.py +2 -0
- plato/v1/cli/pm.py +80 -47
- plato/v1/cli/sandbox.py +45 -12
- plato/v1/cli/sim.py +11 -0
- plato/v1/cli/verify.py +1269 -0
- plato/v1/cli/world.py +3 -0
- plato/v1/flow_executor.py +21 -17
- plato/v1/models/env.py +11 -11
- plato/v1/sdk.py +2 -2
- plato/v1/sync_env.py +11 -11
- plato/v1/sync_flow_executor.py +21 -17
- plato/v1/sync_sdk.py +4 -2
- plato/v2/async_/session.py +4 -4
- plato/v2/sync/session.py +4 -4
- plato/worlds/config.py +2 -2
- {plato_sdk_v2-2.1.17.dist-info → plato_sdk_v2-2.2.2.dist-info}/METADATA +1 -1
- {plato_sdk_v2-2.1.17.dist-info → plato_sdk_v2-2.2.2.dist-info}/RECORD +25 -23
- {plato_sdk_v2-2.1.17.dist-info → plato_sdk_v2-2.2.2.dist-info}/WHEEL +0 -0
- {plato_sdk_v2-2.1.17.dist-info → plato_sdk_v2-2.2.2.dist-info}/entry_points.txt +0 -0
plato/v1/cli/world.py
CHANGED
|
@@ -235,6 +235,8 @@ def world_publish(
|
|
|
235
235
|
upload_url = f"{api_url}/v2/pypi/worlds/"
|
|
236
236
|
console.print(f"\n[cyan]Uploading to {upload_url}...[/cyan]")
|
|
237
237
|
|
|
238
|
+
# api_key is guaranteed to be set (checked earlier when not dry_run)
|
|
239
|
+
assert api_key is not None, "api_key must be set when not in dry_run mode"
|
|
238
240
|
try:
|
|
239
241
|
result = subprocess.run(
|
|
240
242
|
[
|
|
@@ -250,6 +252,7 @@ def world_publish(
|
|
|
250
252
|
],
|
|
251
253
|
capture_output=True,
|
|
252
254
|
text=True,
|
|
255
|
+
check=False,
|
|
253
256
|
)
|
|
254
257
|
|
|
255
258
|
if result.returncode == 0:
|
plato/v1/flow_executor.py
CHANGED
|
@@ -7,15 +7,13 @@ import logging
|
|
|
7
7
|
import os
|
|
8
8
|
import sys
|
|
9
9
|
from pathlib import Path
|
|
10
|
-
from typing import
|
|
10
|
+
from typing import TYPE_CHECKING, cast
|
|
11
11
|
from urllib.parse import urljoin
|
|
12
12
|
|
|
13
13
|
sys.path.insert(0, os.path.dirname(__file__))
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
if TYPE_CHECKING:
|
|
16
16
|
from playwright.async_api import Page
|
|
17
|
-
except ImportError:
|
|
18
|
-
Page = Any # Fallback if playwright not installed
|
|
19
17
|
|
|
20
18
|
from plato.v1.models.flow import (
|
|
21
19
|
CheckElementStep,
|
|
@@ -42,7 +40,7 @@ class FlowExecutor:
|
|
|
42
40
|
|
|
43
41
|
def __init__(
|
|
44
42
|
self,
|
|
45
|
-
page: Page,
|
|
43
|
+
page: "Page",
|
|
46
44
|
flow: Flow,
|
|
47
45
|
screenshots_dir: Path | None = None,
|
|
48
46
|
logger: logging.Logger = logging.getLogger(__name__),
|
|
@@ -108,29 +106,29 @@ class FlowExecutor:
|
|
|
108
106
|
async def _execute_step(self, step: FlowStep) -> bool:
|
|
109
107
|
"""Execute a single step in a flow using type attribute."""
|
|
110
108
|
if step.type == "wait_for_selector":
|
|
111
|
-
return await self._wait_for_selector(step)
|
|
109
|
+
return await self._wait_for_selector(cast(WaitForSelectorStep, step))
|
|
112
110
|
elif step.type == "click":
|
|
113
|
-
return await self._click(step)
|
|
111
|
+
return await self._click(cast(ClickStep, step))
|
|
114
112
|
elif step.type == "fill":
|
|
115
|
-
return await self._fill(step)
|
|
113
|
+
return await self._fill(cast(FillStep, step))
|
|
116
114
|
elif step.type == "wait":
|
|
117
|
-
return await self._wait(step)
|
|
115
|
+
return await self._wait(cast(WaitStep, step))
|
|
118
116
|
elif step.type == "navigate":
|
|
119
|
-
return await self._navigate(step)
|
|
117
|
+
return await self._navigate(cast(NavigateStep, step))
|
|
120
118
|
elif step.type == "wait_for_url":
|
|
121
|
-
return await self._wait_for_url(step)
|
|
119
|
+
return await self._wait_for_url(cast(WaitForUrlStep, step))
|
|
122
120
|
elif step.type == "check_element":
|
|
123
|
-
return await self._check_element(step)
|
|
121
|
+
return await self._check_element(cast(CheckElementStep, step))
|
|
124
122
|
elif step.type == "verify":
|
|
125
|
-
return await self._verify(step)
|
|
123
|
+
return await self._verify(cast(VerifyStep, step))
|
|
126
124
|
elif step.type == "screenshot":
|
|
127
|
-
return await self._screenshot(step)
|
|
125
|
+
return await self._screenshot(cast(ScreenshotStep, step))
|
|
128
126
|
elif step.type == "verify_text":
|
|
129
|
-
return await self._verify_text(step)
|
|
127
|
+
return await self._verify_text(cast(VerifyTextStep, step))
|
|
130
128
|
elif step.type == "verify_url":
|
|
131
|
-
return await self._verify_url(step)
|
|
129
|
+
return await self._verify_url(cast(VerifyUrlStep, step))
|
|
132
130
|
elif step.type == "verify_no_errors":
|
|
133
|
-
return await self._verify_no_errors(step)
|
|
131
|
+
return await self._verify_no_errors(cast(VerifyNoErrorsStep, step))
|
|
134
132
|
else:
|
|
135
133
|
self.logger.error(f"❌ Unknown step type: {step.type}")
|
|
136
134
|
return False
|
|
@@ -248,6 +246,7 @@ class FlowExecutor:
|
|
|
248
246
|
|
|
249
247
|
async def _verify_element_exists(self, step: VerifyStep) -> bool:
|
|
250
248
|
"""Verify that an element exists in the DOM."""
|
|
249
|
+
assert step.selector is not None # Guaranteed by VerifyStep model validator
|
|
251
250
|
try:
|
|
252
251
|
element = await self.page.query_selector(step.selector)
|
|
253
252
|
if element:
|
|
@@ -262,6 +261,7 @@ class FlowExecutor:
|
|
|
262
261
|
|
|
263
262
|
async def _verify_element_visible(self, step: VerifyStep) -> bool:
|
|
264
263
|
"""Verify that an element is visible on the page."""
|
|
264
|
+
assert step.selector is not None # Guaranteed by VerifyStep model validator
|
|
265
265
|
try:
|
|
266
266
|
element = await self.page.query_selector(step.selector)
|
|
267
267
|
if element:
|
|
@@ -281,6 +281,8 @@ class FlowExecutor:
|
|
|
281
281
|
|
|
282
282
|
async def _verify_element_text(self, step: VerifyStep) -> bool:
|
|
283
283
|
"""Verify that an element contains specific text."""
|
|
284
|
+
assert step.selector is not None # Guaranteed by VerifyStep model validator
|
|
285
|
+
assert step.text is not None # Guaranteed by VerifyStep model validator
|
|
284
286
|
try:
|
|
285
287
|
element = await self.page.query_selector(step.selector)
|
|
286
288
|
if element:
|
|
@@ -318,6 +320,7 @@ class FlowExecutor:
|
|
|
318
320
|
|
|
319
321
|
async def _verify_element_count(self, step: VerifyStep) -> bool:
|
|
320
322
|
"""Verify the count of elements matching a selector."""
|
|
323
|
+
assert step.selector is not None # Guaranteed by VerifyStep model validator
|
|
321
324
|
try:
|
|
322
325
|
elements = await self.page.query_selector_all(step.selector)
|
|
323
326
|
actual_count = len(elements)
|
|
@@ -336,6 +339,7 @@ class FlowExecutor:
|
|
|
336
339
|
|
|
337
340
|
async def _verify_page_title(self, step: VerifyStep) -> bool:
|
|
338
341
|
"""Verify the page title."""
|
|
342
|
+
assert step.title is not None # Guaranteed by VerifyStep model validator
|
|
339
343
|
try:
|
|
340
344
|
actual_title = await self.page.title()
|
|
341
345
|
|
plato/v1/models/env.py
CHANGED
|
@@ -13,11 +13,6 @@ from urllib.parse import urlparse
|
|
|
13
13
|
|
|
14
14
|
import yaml
|
|
15
15
|
|
|
16
|
-
try:
|
|
17
|
-
from playwright.async_api import Page
|
|
18
|
-
except ImportError:
|
|
19
|
-
Page = Any # Fallback if playwright not installed
|
|
20
|
-
|
|
21
16
|
from plato.v1.exceptions import PlatoClientError
|
|
22
17
|
from plato.v1.flow_executor import FlowExecutor
|
|
23
18
|
from plato.v1.models.flow import Flow
|
|
@@ -27,6 +22,8 @@ logger = logging.getLogger(__name__)
|
|
|
27
22
|
|
|
28
23
|
# Using TYPE_CHECKING for proper type annotation without circular imports
|
|
29
24
|
if TYPE_CHECKING:
|
|
25
|
+
from playwright.async_api import Page
|
|
26
|
+
|
|
30
27
|
from plato.sdk import Plato
|
|
31
28
|
|
|
32
29
|
|
|
@@ -48,8 +45,8 @@ class PlatoEnvironment:
|
|
|
48
45
|
|
|
49
46
|
_current_task: PlatoTask | None = None
|
|
50
47
|
_client: "Plato" = None
|
|
51
|
-
id: str = None
|
|
52
|
-
env_id: str = None
|
|
48
|
+
id: str = None # type: ignore
|
|
49
|
+
env_id: str = None # type: ignore
|
|
53
50
|
alias: str | None = None
|
|
54
51
|
_run_session_id: str | None = None
|
|
55
52
|
_heartbeat_task: asyncio.Task | None = None
|
|
@@ -66,7 +63,7 @@ class PlatoEnvironment:
|
|
|
66
63
|
):
|
|
67
64
|
self._client = client
|
|
68
65
|
self.id = id
|
|
69
|
-
self.env_id = env_id
|
|
66
|
+
self.env_id = env_id # type: ignore[assignment]
|
|
70
67
|
self.alias = alias
|
|
71
68
|
self._run_session_id = None
|
|
72
69
|
self._heartbeat_task = None
|
|
@@ -77,7 +74,7 @@ class PlatoEnvironment:
|
|
|
77
74
|
|
|
78
75
|
async def login(
|
|
79
76
|
self,
|
|
80
|
-
page: Page,
|
|
77
|
+
page: "Page",
|
|
81
78
|
throw_on_login_error: bool = False,
|
|
82
79
|
screenshots_dir: Path | None = None,
|
|
83
80
|
dataset: str = "base",
|
|
@@ -97,7 +94,7 @@ class PlatoEnvironment:
|
|
|
97
94
|
f"{self._client.base_url}/env/{self.id}/flows",
|
|
98
95
|
headers=headers,
|
|
99
96
|
) as resp:
|
|
100
|
-
await self._client._handle_response_error(resp)
|
|
97
|
+
await self._client._handle_response_error(resp)
|
|
101
98
|
body_text = await resp.text()
|
|
102
99
|
# Endpoint may return JSON with { data: { flows: "...yaml..." } } or raw YAML
|
|
103
100
|
try:
|
|
@@ -394,7 +391,10 @@ class PlatoEnvironment:
|
|
|
394
391
|
if not self._run_session_id:
|
|
395
392
|
raise PlatoClientError("No active run session. Call reset() first.")
|
|
396
393
|
|
|
397
|
-
if not self._current_task
|
|
394
|
+
if not self._current_task:
|
|
395
|
+
logger.warning("No current task set")
|
|
396
|
+
raise PlatoClientError("No evaluation config found for task")
|
|
397
|
+
if not self._current_task.eval_config:
|
|
398
398
|
logger.warning(f"No evaluation config found for task: {self._current_task.name}")
|
|
399
399
|
raise PlatoClientError("No evaluation config found for task")
|
|
400
400
|
|
plato/v1/sdk.py
CHANGED
|
@@ -538,7 +538,7 @@ class Plato:
|
|
|
538
538
|
default_scoring_config=t.get("defaultScoringConfig", {}),
|
|
539
539
|
scoring_type=[ScoringType(st) for st in t.get("scoringTypes", [])]
|
|
540
540
|
if t.get("scoringTypes")
|
|
541
|
-
else
|
|
541
|
+
else [ScoringType.MUTATIONS], # Use default when not provided
|
|
542
542
|
output_schema=t.get("outputSchema"),
|
|
543
543
|
is_sample=t.get("isSample", False),
|
|
544
544
|
simulator_artifact_id=(
|
|
@@ -685,7 +685,7 @@ class Plato:
|
|
|
685
685
|
return await response.json()
|
|
686
686
|
|
|
687
687
|
async def create_simulator(
|
|
688
|
-
self, name: str, description: str = None, sim_type: str = "docker_app"
|
|
688
|
+
self, name: str, description: str | None = None, sim_type: str = "docker_app"
|
|
689
689
|
) -> dict[str, Any]:
|
|
690
690
|
"""Create a new simulator.
|
|
691
691
|
|
plato/v1/sync_env.py
CHANGED
|
@@ -10,11 +10,6 @@ from urllib.parse import urlparse
|
|
|
10
10
|
|
|
11
11
|
import yaml
|
|
12
12
|
|
|
13
|
-
try:
|
|
14
|
-
from playwright.sync_api import Page
|
|
15
|
-
except ImportError:
|
|
16
|
-
Page = Any # Fallback if playwright not installed
|
|
17
|
-
|
|
18
13
|
from plato.v1.exceptions import PlatoClientError
|
|
19
14
|
from plato.v1.models.flow import Flow
|
|
20
15
|
from plato.v1.models.task import CustomEvalConfig, EvaluationResult, PlatoTask
|
|
@@ -24,6 +19,8 @@ logger = logging.getLogger(__name__)
|
|
|
24
19
|
|
|
25
20
|
# Using TYPE_CHECKING for proper type annotation without circular imports
|
|
26
21
|
if TYPE_CHECKING:
|
|
22
|
+
from playwright.sync_api import Page
|
|
23
|
+
|
|
27
24
|
from plato.sync_sdk import SyncPlato
|
|
28
25
|
|
|
29
26
|
|
|
@@ -45,8 +42,8 @@ class SyncPlatoEnvironment:
|
|
|
45
42
|
|
|
46
43
|
_current_task: PlatoTask | None = None
|
|
47
44
|
_client: "SyncPlato" = None
|
|
48
|
-
id: str = None
|
|
49
|
-
env_id: str = None
|
|
45
|
+
id: str = None # type: ignore
|
|
46
|
+
env_id: str = None # type: ignore
|
|
50
47
|
alias: str | None = None
|
|
51
48
|
_run_session_id: str | None = None
|
|
52
49
|
_heartbeat_thread: threading.Thread | None = None
|
|
@@ -64,7 +61,7 @@ class SyncPlatoEnvironment:
|
|
|
64
61
|
):
|
|
65
62
|
self._client = client
|
|
66
63
|
self.id = id
|
|
67
|
-
self.env_id = env_id
|
|
64
|
+
self.env_id = env_id # type: ignore[assignment]
|
|
68
65
|
self.alias = alias
|
|
69
66
|
self._run_session_id = active_session
|
|
70
67
|
self._heartbeat_thread = None
|
|
@@ -75,7 +72,7 @@ class SyncPlatoEnvironment:
|
|
|
75
72
|
|
|
76
73
|
def login(
|
|
77
74
|
self,
|
|
78
|
-
page: Page,
|
|
75
|
+
page: "Page",
|
|
79
76
|
throw_on_login_error: bool = False,
|
|
80
77
|
screenshots_dir: Path | None = None,
|
|
81
78
|
dataset: str = "base",
|
|
@@ -95,7 +92,7 @@ class SyncPlatoEnvironment:
|
|
|
95
92
|
try:
|
|
96
93
|
headers = {"X-API-Key": self._client.api_key}
|
|
97
94
|
resp = self._client.http_session.get(f"{self._client.base_url}/env/{self.id}/flows", headers=headers)
|
|
98
|
-
self._client._handle_response_error(resp)
|
|
95
|
+
self._client._handle_response_error(resp)
|
|
99
96
|
body_text = resp.text
|
|
100
97
|
# Endpoint may return JSON with { data: { flows: "...yaml..." } } or raw YAML
|
|
101
98
|
try:
|
|
@@ -379,7 +376,10 @@ class SyncPlatoEnvironment:
|
|
|
379
376
|
if not self._run_session_id:
|
|
380
377
|
raise PlatoClientError("No active run session. Call reset() first.")
|
|
381
378
|
|
|
382
|
-
if not self._current_task
|
|
379
|
+
if not self._current_task:
|
|
380
|
+
logger.warning("No current task set")
|
|
381
|
+
raise PlatoClientError("No evaluation config found for task")
|
|
382
|
+
if not self._current_task.eval_config:
|
|
383
383
|
logger.warning(f"No evaluation config found for task: {self._current_task.name}")
|
|
384
384
|
raise PlatoClientError("No evaluation config found for task")
|
|
385
385
|
|
plato/v1/sync_flow_executor.py
CHANGED
|
@@ -7,15 +7,13 @@ import logging
|
|
|
7
7
|
import os
|
|
8
8
|
import sys
|
|
9
9
|
from pathlib import Path
|
|
10
|
-
from typing import
|
|
10
|
+
from typing import TYPE_CHECKING, cast
|
|
11
11
|
from urllib.parse import urljoin
|
|
12
12
|
|
|
13
13
|
sys.path.insert(0, os.path.dirname(__file__))
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
if TYPE_CHECKING:
|
|
16
16
|
from playwright.sync_api import Page
|
|
17
|
-
except ImportError:
|
|
18
|
-
Page = Any # Fallback if playwright not installed
|
|
19
17
|
|
|
20
18
|
from plato.v1.models.flow import (
|
|
21
19
|
CheckElementStep,
|
|
@@ -40,7 +38,7 @@ class SyncFlowExecutor:
|
|
|
40
38
|
|
|
41
39
|
def __init__(
|
|
42
40
|
self,
|
|
43
|
-
page: Page,
|
|
41
|
+
page: "Page",
|
|
44
42
|
flow: Flow,
|
|
45
43
|
screenshots_dir: Path | None = None,
|
|
46
44
|
logger: logging.Logger = logging.getLogger(__name__),
|
|
@@ -104,29 +102,29 @@ class SyncFlowExecutor:
|
|
|
104
102
|
def _execute_step(self, step: FlowStep) -> bool:
|
|
105
103
|
"""Execute a single step in a flow using action attribute."""
|
|
106
104
|
if step.type == "wait_for_selector":
|
|
107
|
-
return self._wait_for_selector(step)
|
|
105
|
+
return self._wait_for_selector(cast(WaitForSelectorStep, step))
|
|
108
106
|
elif step.type == "click":
|
|
109
|
-
return self._click(step)
|
|
107
|
+
return self._click(cast(ClickStep, step))
|
|
110
108
|
elif step.type == "fill":
|
|
111
|
-
return self._fill(step)
|
|
109
|
+
return self._fill(cast(FillStep, step))
|
|
112
110
|
elif step.type == "wait":
|
|
113
|
-
return self._wait(step)
|
|
111
|
+
return self._wait(cast(WaitStep, step))
|
|
114
112
|
elif step.type == "navigate":
|
|
115
|
-
return self._navigate(step)
|
|
113
|
+
return self._navigate(cast(NavigateStep, step))
|
|
116
114
|
elif step.type == "wait_for_url":
|
|
117
|
-
return self._wait_for_url(step)
|
|
115
|
+
return self._wait_for_url(cast(WaitForUrlStep, step))
|
|
118
116
|
elif step.type == "check_element":
|
|
119
|
-
return self._check_element(step)
|
|
117
|
+
return self._check_element(cast(CheckElementStep, step))
|
|
120
118
|
elif step.type == "verify":
|
|
121
|
-
return self._verify(step)
|
|
119
|
+
return self._verify(cast(VerifyStep, step))
|
|
122
120
|
elif step.type == "screenshot":
|
|
123
|
-
return self._screenshot(step)
|
|
121
|
+
return self._screenshot(cast(ScreenshotStep, step))
|
|
124
122
|
elif step.type == "verify_text":
|
|
125
|
-
return self._verify_text(step)
|
|
123
|
+
return self._verify_text(cast(VerifyTextStep, step))
|
|
126
124
|
elif step.type == "verify_url":
|
|
127
|
-
return self._verify_url(step)
|
|
125
|
+
return self._verify_url(cast(VerifyUrlStep, step))
|
|
128
126
|
elif step.type == "verify_no_errors":
|
|
129
|
-
return self._verify_no_errors(step)
|
|
127
|
+
return self._verify_no_errors(cast(VerifyNoErrorsStep, step))
|
|
130
128
|
else:
|
|
131
129
|
self.logger.error(f"❌ Unknown step action: {step.type}")
|
|
132
130
|
return False
|
|
@@ -242,6 +240,7 @@ class SyncFlowExecutor:
|
|
|
242
240
|
|
|
243
241
|
def _verify_element_exists(self, step: VerifyStep) -> bool:
|
|
244
242
|
"""Verify that an element exists in the DOM."""
|
|
243
|
+
assert step.selector is not None # Guaranteed by VerifyStep model validator
|
|
245
244
|
try:
|
|
246
245
|
element = self.page.query_selector(step.selector)
|
|
247
246
|
if element:
|
|
@@ -256,6 +255,7 @@ class SyncFlowExecutor:
|
|
|
256
255
|
|
|
257
256
|
def _verify_element_visible(self, step: VerifyStep) -> bool:
|
|
258
257
|
"""Verify that an element is visible on the page."""
|
|
258
|
+
assert step.selector is not None # Guaranteed by VerifyStep model validator
|
|
259
259
|
try:
|
|
260
260
|
element = self.page.query_selector(step.selector)
|
|
261
261
|
if element:
|
|
@@ -275,6 +275,8 @@ class SyncFlowExecutor:
|
|
|
275
275
|
|
|
276
276
|
def _verify_element_text(self, step: VerifyStep) -> bool:
|
|
277
277
|
"""Verify that an element contains specific text."""
|
|
278
|
+
assert step.selector is not None # Guaranteed by VerifyStep model validator
|
|
279
|
+
assert step.text is not None # Guaranteed by VerifyStep model validator
|
|
278
280
|
try:
|
|
279
281
|
element = self.page.query_selector(step.selector)
|
|
280
282
|
if element:
|
|
@@ -312,6 +314,7 @@ class SyncFlowExecutor:
|
|
|
312
314
|
|
|
313
315
|
def _verify_element_count(self, step: VerifyStep) -> bool:
|
|
314
316
|
"""Verify the count of elements matching a selector."""
|
|
317
|
+
assert step.selector is not None # Guaranteed by VerifyStep model validator
|
|
315
318
|
try:
|
|
316
319
|
elements = self.page.query_selector_all(step.selector)
|
|
317
320
|
actual_count = len(elements)
|
|
@@ -330,6 +333,7 @@ class SyncFlowExecutor:
|
|
|
330
333
|
|
|
331
334
|
def _verify_page_title(self, step: VerifyStep) -> bool:
|
|
332
335
|
"""Verify the page title."""
|
|
336
|
+
assert step.title is not None # Guaranteed by VerifyStep model validator
|
|
333
337
|
try:
|
|
334
338
|
actual_title = self.page.title()
|
|
335
339
|
|
plato/v1/sync_sdk.py
CHANGED
|
@@ -89,7 +89,7 @@ class SyncPlato:
|
|
|
89
89
|
Raises:
|
|
90
90
|
PlatoClientError: With the actual error message from the response
|
|
91
91
|
"""
|
|
92
|
-
if response.status_code >= 400:
|
|
92
|
+
if response.status_code >= 400: # type: ignore[operator]
|
|
93
93
|
try:
|
|
94
94
|
# Try to get the error message from the response body
|
|
95
95
|
error_data = response.json()
|
|
@@ -525,7 +525,9 @@ class SyncPlato:
|
|
|
525
525
|
average_steps=t.get("averageStepsTaken"),
|
|
526
526
|
num_validator_human_scores=t.get("defaultScoringConfig", {}).get("num_sessions_used", 0),
|
|
527
527
|
default_scoring_config=t.get("defaultScoringConfig", {}),
|
|
528
|
-
scoring_type=[ScoringType(st) for st in t.get("scoringTypes", [])]
|
|
528
|
+
scoring_type=[ScoringType(st) for st in t.get("scoringTypes", [])]
|
|
529
|
+
if t.get("scoringTypes")
|
|
530
|
+
else [ScoringType.MUTATIONS],
|
|
529
531
|
output_schema=t.get("outputSchema"),
|
|
530
532
|
is_sample=t.get("isSample", False),
|
|
531
533
|
simulator_artifact_id=(
|
plato/v2/async_/session.py
CHANGED
|
@@ -799,10 +799,10 @@ class Session:
|
|
|
799
799
|
"""
|
|
800
800
|
self._check_closed()
|
|
801
801
|
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
raise ImportError("The login() method requires playwright. Install it with: pip install playwright")
|
|
802
|
+
import importlib.util
|
|
803
|
+
|
|
804
|
+
if importlib.util.find_spec("playwright") is None:
|
|
805
|
+
raise ImportError("The login() method requires playwright. Install it with: pip install playwright")
|
|
806
806
|
|
|
807
807
|
context = await browser.new_context()
|
|
808
808
|
pages: dict[str, Page] = {}
|
plato/v2/sync/session.py
CHANGED
|
@@ -660,10 +660,10 @@ class Session:
|
|
|
660
660
|
"""
|
|
661
661
|
self._check_closed()
|
|
662
662
|
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
raise ImportError("The login() method requires playwright. Install it with: pip install playwright")
|
|
663
|
+
import importlib.util
|
|
664
|
+
|
|
665
|
+
if importlib.util.find_spec("playwright") is None:
|
|
666
|
+
raise ImportError("The login() method requires playwright. Install it with: pip install playwright")
|
|
667
667
|
|
|
668
668
|
context = browser.new_context()
|
|
669
669
|
pages: dict[str, Page] = {}
|
plato/worlds/config.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from pathlib import Path
|
|
6
|
-
from typing import Any
|
|
6
|
+
from typing import Any
|
|
7
7
|
|
|
8
8
|
from pydantic import BaseModel, Field
|
|
9
9
|
|
|
@@ -15,7 +15,7 @@ from plato._generated.models import (
|
|
|
15
15
|
from plato.v2.async_.session import SerializedSession
|
|
16
16
|
|
|
17
17
|
# Union type for environment configurations
|
|
18
|
-
EnvConfig =
|
|
18
|
+
EnvConfig = EnvFromArtifact | EnvFromSimulator | EnvFromResource
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
class AgentConfig(BaseModel):
|
|
@@ -285,7 +285,7 @@ plato/_generated/api/version/check.py,sha256=HTVNw0oi9gbvX4pOVoH4y4JywCxdl1pJTCk
|
|
|
285
285
|
plato/_generated/models/__init__.py,sha256=VGsTMYUCCqa7r_tl5m--dwjy7viYAN20nU2HhVAibcU,154130
|
|
286
286
|
plato/_sims_generator/__init__.py,sha256=Km4QOl9wxjQ5dgpdhk9QnBFJFFc9eq3rPbMWIQRjIn0,1602
|
|
287
287
|
plato/_sims_generator/cli.py,sha256=mzolN-dxfMkVAdA-vC0esnai-cGg-i4ozOw8dACefV4,2709
|
|
288
|
-
plato/_sims_generator/instruction.py,sha256=
|
|
288
|
+
plato/_sims_generator/instruction.py,sha256=Na9M-jIdBPhp_fLuBPTicoFnWriRyi8YiZ-eQBj64HI,6644
|
|
289
289
|
plato/_sims_generator/parser.py,sha256=BbgRYllqYf7H76JyMfe7LYo1we-kh7YEOxUwrYT3shc,38347
|
|
290
290
|
plato/_sims_generator/python.py,sha256=ZYZJeOhGhYV95iB2_G-stQHaIv5sQj0jo3GXSLb6SdA,18295
|
|
291
291
|
plato/_sims_generator/templates/instruction/helpers.py.jinja,sha256=kJ8lhVLPygjMh8l-In9rLtFci6Bxg3zVoz5BZFfLKms,4937
|
|
@@ -303,7 +303,7 @@ plato/agents/build.py,sha256=CNMbVQFs2_pYit1dA29Davve28Yi4c7TNK9wBB7odrE,1621
|
|
|
303
303
|
plato/agents/config.py,sha256=VZVMdCmEQnoR0VkrGdScG8p6zSKVFe7BZPd2h8lKNjI,5460
|
|
304
304
|
plato/agents/logging.py,sha256=z9rDlGPbrpcTS8PephbK2rDqT7thC1KyLkua4ypUkv4,12210
|
|
305
305
|
plato/agents/runner.py,sha256=rOWYTSAhdola_FdrbviP955NBusNtBUy-q_c5fDA9to,5123
|
|
306
|
-
plato/agents/trajectory.py,sha256=
|
|
306
|
+
plato/agents/trajectory.py,sha256=WdiBmua0KvCrNaM3qgPI7-7B4xmSkfbP4oZ_9_8qHzU,10529
|
|
307
307
|
plato/chronos/__init__.py,sha256=RHMvSrQS_-vkKOyTRuAkp2gKDP1HEuBLDnw8jcZs1Jg,739
|
|
308
308
|
plato/chronos/client.py,sha256=YcOGtHWERyOD9z8LKt8bRMVL0cEwL2hiAP4qQgdZlUI,5495
|
|
309
309
|
plato/chronos/errors.py,sha256=xqQIQB43nAL5urF8qc_1KUJql7KCnspULOFHLNnf83M,4199
|
|
@@ -372,32 +372,34 @@ plato/chronos/api/worlds/create_world.py,sha256=H6yl5QIazNXgryOR5rvscSIMf8Y9kjc6
|
|
|
372
372
|
plato/chronos/api/worlds/delete_world.py,sha256=UETu3Zk0e2VkDdAyMilv1ev-0g_j-oujH1Dc8DBqQOc,1239
|
|
373
373
|
plato/chronos/api/worlds/get_world.py,sha256=eHTM1U5JiNTaZwYLh7x4QVBoRQeI5kaJ9o6xSi4-nos,1356
|
|
374
374
|
plato/chronos/api/worlds/list_worlds.py,sha256=hBAuGb69tlasyn-kV_LNr9x6Rr7SHhST5hXJn1uqMf8,1253
|
|
375
|
-
plato/chronos/models/__init__.py,sha256=
|
|
375
|
+
plato/chronos/models/__init__.py,sha256=5Hil8v_jFX1YU6LpOfqyJM4WV867Ckv6CX052Q4SCso,20996
|
|
376
376
|
plato/sims/README.md,sha256=FIbJhNVNAV-SO6dq_cXX3Rg0C7HdQCfEY9YxGlkCmsM,6902
|
|
377
377
|
plato/sims/__init__.py,sha256=tnoCGKZwNx6h22tEWLujdpLv6K4PpFU2RnDOhL1o-Uc,1494
|
|
378
378
|
plato/sims/agent_helpers.py,sha256=kITvQywoTCS8mGhro3jZWuPJHDlje-UZujhjoahqhd0,10291
|
|
379
|
-
plato/sims/cli.py,sha256=
|
|
379
|
+
plato/sims/cli.py,sha256=lvdc_fSyNVmXvblFaE0saiVPdTpoR8Tlh9NN2LCBrd8,52704
|
|
380
380
|
plato/sims/generate_clients.py,sha256=nEe39v3UOcks-ggv5jomcwN33R5U9n8MDNCpHoZ2lDg,5958
|
|
381
|
-
plato/sims/registry.py,sha256=
|
|
381
|
+
plato/sims/registry.py,sha256=1LHW1SMJJNYIvn0zY9BPkHo4yHpdDAk7BxTYw1HpweY,11963
|
|
382
382
|
plato/v1/__init__.py,sha256=t1Ejb7YCFOVSKZL9hJ0UsmEE1mULDvO__f75dz1UueQ,197
|
|
383
383
|
plato/v1/audit_ui.py,sha256=zYYufJKn7291uCNb_59ItmDTYsPr7YLshBFwcAwl1LQ,10990
|
|
384
384
|
plato/v1/cli.py,sha256=iEt58vvW7ab9YH0CLcBHvf4653fk1gcEdij4HZc10YY,269
|
|
385
385
|
plato/v1/config.py,sha256=Zc5qGBcR8UfLuZrfQhkZ5cUmV_9pPKHPyKpU0SNysGY,667
|
|
386
386
|
plato/v1/exceptions.py,sha256=BS5A0NLZ2FgL6YVaIL-c8FXASTsOpuKrF3_Pb0tad6w,109
|
|
387
|
-
plato/v1/flow_executor.py,sha256=
|
|
387
|
+
plato/v1/flow_executor.py,sha256=rHYPPG4XPdq00Ty7_c4r7dZ-LixtUrEV3KEg1i-Owto,19720
|
|
388
388
|
plato/v1/sandbox_sdk.py,sha256=5-ESB3spe4BFGn1dVfgSWwKyfQeeUokPWsmbti3obOY,41854
|
|
389
|
-
plato/v1/sdk.py,sha256=
|
|
390
|
-
plato/v1/sync_env.py,sha256=
|
|
391
|
-
plato/v1/sync_flow_executor.py,sha256=
|
|
392
|
-
plato/v1/sync_sdk.py,sha256=
|
|
389
|
+
plato/v1/sdk.py,sha256=zNcYgANeMZG8r9AH3POJhJ11UQcOvdsLfUFABoB1cwg,33382
|
|
390
|
+
plato/v1/sync_env.py,sha256=UIfDpx3nPHBNWzahSddvol0SvfK9vU4mr3MOIOPCGr8,24878
|
|
391
|
+
plato/v1/sync_flow_executor.py,sha256=kgvNYOtA9FHeNfP7qb8ZPUIlTsfIss_Z98W8uX5veck,19233
|
|
392
|
+
plato/v1/sync_sdk.py,sha256=2sedg1QJiSxr1I3kCyfaLAnlAgHlbblc3QQP_47O30k,25697
|
|
393
393
|
plato/v1/cli/__init__.py,sha256=om4b7PxgsoI7rEwuQelmQkqPdhMVn53_5qEN8kvksYw,105
|
|
394
|
-
plato/v1/cli/agent.py,sha256=
|
|
395
|
-
plato/v1/cli/main.py,sha256=
|
|
396
|
-
plato/v1/cli/pm.py,sha256=
|
|
397
|
-
plato/v1/cli/sandbox.py,sha256=
|
|
394
|
+
plato/v1/cli/agent.py,sha256=G6TV3blG_BqMDBWS-CG7GwzqoqcJTMsIKQ88jvLXb4k,43745
|
|
395
|
+
plato/v1/cli/main.py,sha256=ZBF9J82Cp6TB-1mLkabJryxP44yNAYJoKE8K7LUNQng,6916
|
|
396
|
+
plato/v1/cli/pm.py,sha256=uLM6WszKqxq9Czg1FraDyWb9_INUuHZq63imvRYfRLw,49734
|
|
397
|
+
plato/v1/cli/sandbox.py,sha256=7VoiDIL6u2_8wZI4sj9J6CyI8IMfjHmHOp8FPiXs-3U,89411
|
|
398
|
+
plato/v1/cli/sim.py,sha256=qF3H2RqMS96kQX8MwDpqXskZhpM4YFSgb283wcsMbfQ,266
|
|
398
399
|
plato/v1/cli/ssh.py,sha256=pePHD0lFPwSkATZYSannpFtHfJWKImAdLyS2463aRRw,6287
|
|
399
400
|
plato/v1/cli/utils.py,sha256=be-llK6T6NHnIQl_Kfs-8EPu9JhIuZ_k9tJ3Ts-AKt4,3887
|
|
400
|
-
plato/v1/cli/
|
|
401
|
+
plato/v1/cli/verify.py,sha256=WZFxAqjpgq8vA0tc32g0VsNQjSZ1S0n4o_QoHQBkmsI,48404
|
|
402
|
+
plato/v1/cli/world.py,sha256=yBUadOJs1QYm6Jmx_ACDzogybRq5x4B-BnTvGO_ulQk,9757
|
|
401
403
|
plato/v1/examples/doordash_tasks.py,sha256=8Sz9qx-vTmiOAiCAbrDRvZGsA1qQQBr1KHbxXdjr7OI,23233
|
|
402
404
|
plato/v1/examples/loadtest.py,sha256=ZsQYNN_fZjE7CbrbVJb4KDc0OLaH7b66iPrEHDhuw0U,5609
|
|
403
405
|
plato/v1/examples/test_env.py,sha256=8kUISbZyMi0Xh9HK7Il1okKQyz0Iq-vAKWgzC8kqUfU,4513
|
|
@@ -436,7 +438,7 @@ plato/v1/extensions/envgen-recorder/sessions.js,sha256=IrW0elMYYh4cUEmNZiHC-XhFL
|
|
|
436
438
|
plato/v1/extensions/envgen-recorder/styles.css,sha256=NbpKw4NSbYw6RVDOn4zpNwwVnjFQtKIene2MZBz9kb0,5359
|
|
437
439
|
plato/v1/models/__init__.py,sha256=rnv5oO0RQ_mbnv_0FxvCWpCnSKmBePoYoIQ0h1LuKE8,813
|
|
438
440
|
plato/v1/models/build_models.py,sha256=zcRwg2pzU5GFDp_Qi7g0UCVNGkOtXTlHNvq_6gm5mJc,10201
|
|
439
|
-
plato/v1/models/env.py,sha256=
|
|
441
|
+
plato/v1/models/env.py,sha256=UZgdjZrIkODeuTLTHaIyUqUJM83S8YYY_RbYqDeYjDk,31043
|
|
440
442
|
plato/v1/models/flow.py,sha256=bkleb7-OR6V5tzPtggf0ZJhHZQwnktCYr1C-ONpRzwE,6920
|
|
441
443
|
plato/v1/models/sandbox.py,sha256=yRN036G91tFAXGxU1ni7zCU1o7U1N8nI0mjLlBRDoSk,3478
|
|
442
444
|
plato/v1/models/task.py,sha256=QXwdFpDM_NLjRpQSK6duibXJXFAPZ8-PpyuLWZC5o4I,4897
|
|
@@ -449,13 +451,13 @@ plato/v2/async_/artifact.py,sha256=JBWVQeVaZhkU2qn_knyzyA7wd5iQ8qxfLQ_l9GPhgYs,1
|
|
|
449
451
|
plato/v2/async_/client.py,sha256=GVgAgNN5gsDME8iV0zxqnwbsVS93J6cknOcq_VXwYN8,4209
|
|
450
452
|
plato/v2/async_/environment.py,sha256=Dv_4QuQx5vLVp1m1mJR2fXybvbhz-Q4gLtZecCdyFT8,4622
|
|
451
453
|
plato/v2/async_/flow_executor.py,sha256=Tl4nRu1ZPWJFNNxyTGy-PxvebZEUD18ZDaz8T2chtzU,14188
|
|
452
|
-
plato/v2/async_/session.py,sha256=
|
|
454
|
+
plato/v2/async_/session.py,sha256=3EL4SX1kiYDKd981dRWDZsEu1WtJOXkvbAdw3B5o_EI,35426
|
|
453
455
|
plato/v2/sync/__init__.py,sha256=_WigxuehCC8A2yRy4mSaMQmIZhS0Gch4hhZC1VHyYXs,310
|
|
454
456
|
plato/v2/sync/artifact.py,sha256=wTLC-tugG128wLvh-JqNPb0zsw5FXEJlZNahurSWink,1169
|
|
455
457
|
plato/v2/sync/client.py,sha256=Q9fS1BF4KxTMMnceMwCMlb5dNFZ6LA4gsXWNLgsL2eE,3870
|
|
456
458
|
plato/v2/sync/environment.py,sha256=EJS_MBXHQgdOYztmnvcDPyQV1Z0dV6BA-7UEJ_Z-bgE,3878
|
|
457
459
|
plato/v2/sync/flow_executor.py,sha256=N41-WCWIJVcCR2UmPUEiK7roNacYoeONkRXpR7lUgT8,13941
|
|
458
|
-
plato/v2/sync/session.py,sha256=
|
|
460
|
+
plato/v2/sync/session.py,sha256=jl0leH3wENQCcOXQruqBcxhb47yo_9QBsdMMktgpnnw,27101
|
|
459
461
|
plato/v2/utils/__init__.py,sha256=XLeFFsjXkm9g2raMmo7Wt4QN4hhCrNZDJKnpffJ4LtM,38
|
|
460
462
|
plato/v2/utils/db_cleanup.py,sha256=lnI5lsMHNHpG85Y99MaE4Rzc3618piuzhvH-uXO1zIc,8702
|
|
461
463
|
plato/v2/utils/models.py,sha256=PwehSSnIRG-tM3tWL1PzZEH77ZHhIAZ9R0UPs6YknbM,1441
|
|
@@ -464,9 +466,9 @@ plato/worlds/README.md,sha256=TgG4aidude0ouJSCfY81Ev45hsUxPkO85HUIiWNqkcc,5463
|
|
|
464
466
|
plato/worlds/__init__.py,sha256=crzpXFh4XD8eS4pYFTEUf3XgUf0wapFPT4npAu8sWwk,2078
|
|
465
467
|
plato/worlds/base.py,sha256=McV2QAuHYztSMfG8EXQML1kEPbdeADLt8tgiYpH35n4,10751
|
|
466
468
|
plato/worlds/build_hook.py,sha256=KSoW0kqa5b7NyZ7MYOw2qsZ_2FkWuz0M3Ru7AKOP7Qw,3486
|
|
467
|
-
plato/worlds/config.py,sha256=
|
|
469
|
+
plato/worlds/config.py,sha256=ggDcySspfeFry2KBUwhgnS6Po2KssYzwZNIDmVeGhPQ,9460
|
|
468
470
|
plato/worlds/runner.py,sha256=07fKyPYxem1vIKfPRo4le7eKWTkY3euDXugObVyAsf4,7858
|
|
469
|
-
plato_sdk_v2-2.
|
|
470
|
-
plato_sdk_v2-2.
|
|
471
|
-
plato_sdk_v2-2.
|
|
472
|
-
plato_sdk_v2-2.
|
|
471
|
+
plato_sdk_v2-2.2.2.dist-info/METADATA,sha256=1kiU4THegqudfEb-uvUEujXQzCP6EIRL97Y_LsWq1kg,8508
|
|
472
|
+
plato_sdk_v2-2.2.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
473
|
+
plato_sdk_v2-2.2.2.dist-info/entry_points.txt,sha256=upGMbJCx6YWUTKrPoYvYUYfFCqYr75nHDwhA-45m6p8,136
|
|
474
|
+
plato_sdk_v2-2.2.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|