everypixel-cli 0.1.0__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.
- everypixel_cli/__init__.py +1 -0
- everypixel_cli/__main__.py +5 -0
- everypixel_cli/application/__init__.py +10 -0
- everypixel_cli/application/models.py +59 -0
- everypixel_cli/application/serialization.py +20 -0
- everypixel_cli/application/services.py +1376 -0
- everypixel_cli/cli.py +1520 -0
- everypixel_cli/client.py +159 -0
- everypixel_cli/config.py +221 -0
- everypixel_cli/errors.py +262 -0
- everypixel_cli/files.py +298 -0
- everypixel_cli/mcp_server.py +828 -0
- everypixel_cli/openapi.py +338 -0
- everypixel_cli/output.py +159 -0
- everypixel_cli/resources/__init__.py +1 -0
- everypixel_cli/resources/openapi.json +5402 -0
- everypixel_cli/schemas.py +846 -0
- everypixel_cli-0.1.0.dist-info/METADATA +454 -0
- everypixel_cli-0.1.0.dist-info/RECORD +22 -0
- everypixel_cli-0.1.0.dist-info/WHEEL +4 -0
- everypixel_cli-0.1.0.dist-info/entry_points.txt +3 -0
- everypixel_cli-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"""Typed request and result models used independently from the CLI."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from dataclasses import dataclass, field
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from threading import Event
|
|
8
|
+
from typing import Any, Mapping
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class OperationCancelled(Exception):
|
|
12
|
+
"""Internal control flow raised when a caller abandons an operation."""
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclass(frozen=True)
|
|
16
|
+
class ExecutionOptions:
|
|
17
|
+
"""Execution concerns shared by synchronous and asynchronous operations."""
|
|
18
|
+
|
|
19
|
+
wait: bool = False
|
|
20
|
+
download_directory: Path | None = None
|
|
21
|
+
timeout: float = 300.0
|
|
22
|
+
poll_interval: float = 2.0
|
|
23
|
+
cancel_event: Event | None = field(
|
|
24
|
+
default=None,
|
|
25
|
+
repr=False,
|
|
26
|
+
compare=False,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
@property
|
|
30
|
+
def wait_for_result(self) -> bool:
|
|
31
|
+
"""Downloads always require a completed task."""
|
|
32
|
+
|
|
33
|
+
return self.wait or self.download_directory is not None
|
|
34
|
+
|
|
35
|
+
def check_cancelled(self) -> None:
|
|
36
|
+
"""Raise when the caller no longer wants this operation to continue."""
|
|
37
|
+
|
|
38
|
+
if self.cancel_event is not None and self.cancel_event.is_set():
|
|
39
|
+
raise OperationCancelled
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@dataclass(frozen=True)
|
|
43
|
+
class OperationRequest:
|
|
44
|
+
"""Transport-independent API operation request."""
|
|
45
|
+
|
|
46
|
+
endpoint: str
|
|
47
|
+
payload: Mapping[str, Any]
|
|
48
|
+
method: str = "POST"
|
|
49
|
+
execution: ExecutionOptions = ExecutionOptions()
|
|
50
|
+
fallback_extension: str = ".bin"
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@dataclass(frozen=True)
|
|
54
|
+
class OperationResult:
|
|
55
|
+
"""Application result that contains no presentation or HTTP objects."""
|
|
56
|
+
|
|
57
|
+
value: Any
|
|
58
|
+
task: Mapping[str, Any] | None = None
|
|
59
|
+
saved_files: tuple[Path, ...] = ()
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""Convert application results into the public CLI/MCP-safe data contract."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from collections.abc import Mapping
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from .models import OperationResult
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def serialize_operation_result(result: OperationResult) -> Any:
|
|
12
|
+
"""Preserve the existing CLI success payload shape."""
|
|
13
|
+
|
|
14
|
+
value = result.value
|
|
15
|
+
if isinstance(value, Mapping):
|
|
16
|
+
payload = dict(value)
|
|
17
|
+
if result.saved_files:
|
|
18
|
+
payload["downloaded"] = [str(path) for path in result.saved_files]
|
|
19
|
+
return payload
|
|
20
|
+
return value
|