mcp-virtual-computer 0.2.3__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.
Files changed (48) hide show
  1. kilntainers/__init__.py +3 -0
  2. kilntainers/__main__.py +6 -0
  3. kilntainers/auth.py +34 -0
  4. kilntainers/backends/__init__.py +17 -0
  5. kilntainers/backends/base.py +380 -0
  6. kilntainers/backends/docker.py +1498 -0
  7. kilntainers/backends/test___init__.py +37 -0
  8. kilntainers/backends/test_base.py +355 -0
  9. kilntainers/backends/test_docker.py +841 -0
  10. kilntainers/backends/test_docker_integration.py +310 -0
  11. kilntainers/backends/test_docker_management.py +122 -0
  12. kilntainers/backends/test_utils.py +152 -0
  13. kilntainers/backends/test_virtual_docker.py +387 -0
  14. kilntainers/cli.py +375 -0
  15. kilntainers/computers.py +284 -0
  16. kilntainers/config.py +71 -0
  17. kilntainers/dashboard.html +4263 -0
  18. kilntainers/dashboard.py +23 -0
  19. kilntainers/desktop.py +47 -0
  20. kilntainers/desktop_control.py +105 -0
  21. kilntainers/desktop_image/Dockerfile +67 -0
  22. kilntainers/desktop_image/desktop-control.py +661 -0
  23. kilntainers/desktop_image/start-desktop.sh +206 -0
  24. kilntainers/desktop_image/visual-action.py +185 -0
  25. kilntainers/desktop_image/wsproxy.py +218 -0
  26. kilntainers/errors.py +36 -0
  27. kilntainers/file_tools.py +320 -0
  28. kilntainers/server.py +1760 -0
  29. kilntainers/test_cli.py +704 -0
  30. kilntainers/test_cli_integration.py +213 -0
  31. kilntainers/test_computers.py +122 -0
  32. kilntainers/test_config.py +135 -0
  33. kilntainers/test_dashboard.py +113 -0
  34. kilntainers/test_desktop_control.py +109 -0
  35. kilntainers/test_e2e_mcp.py +310 -0
  36. kilntainers/test_errors.py +62 -0
  37. kilntainers/test_file_tools.py +175 -0
  38. kilntainers/test_http_lifecycle.py +353 -0
  39. kilntainers/test_lifecycle_integration.py +389 -0
  40. kilntainers/test_server.py +849 -0
  41. kilntainers/test_windows_docker.py +300 -0
  42. kilntainers/windows_docker.py +565 -0
  43. mcp_virtual_computer-0.2.3.dist-info/METADATA +179 -0
  44. mcp_virtual_computer-0.2.3.dist-info/RECORD +48 -0
  45. mcp_virtual_computer-0.2.3.dist-info/WHEEL +5 -0
  46. mcp_virtual_computer-0.2.3.dist-info/entry_points.txt +5 -0
  47. mcp_virtual_computer-0.2.3.dist-info/licenses/LICENSE +7 -0
  48. mcp_virtual_computer-0.2.3.dist-info/top_level.txt +1 -0
kilntainers/config.py ADDED
@@ -0,0 +1,71 @@
1
+ """Configuration dataclasses for the single-computer Docker server."""
2
+
3
+ import os
4
+ from dataclasses import dataclass
5
+ from typing import Literal
6
+
7
+ Transport = Literal["stdio", "http"]
8
+
9
+
10
+ def env_flag(name: str, *, default: bool = False) -> bool:
11
+ """Read a strict, human-friendly boolean environment variable."""
12
+ value = os.getenv(name)
13
+ if value is None:
14
+ return default
15
+ normalized = value.strip().casefold()
16
+ if normalized in {"1", "true", "yes", "on"}:
17
+ return True
18
+ if normalized in {"0", "false", "no", "off"}:
19
+ return False
20
+ raise ValueError(
21
+ f"{name} must be one of true/false, 1/0, yes/no, or on/off; got {value!r}"
22
+ )
23
+
24
+
25
+ @dataclass(frozen=True, slots=True, kw_only=True)
26
+ class BackendConfig:
27
+ """Base class for all backend configurations.
28
+
29
+ Contains fields shared across all backends. Backend-specific
30
+ config classes inherit from this.
31
+ """
32
+
33
+ # Passed through for tool description generation
34
+ default_timeout: int = 120
35
+
36
+
37
+ @dataclass(frozen=True, slots=True, kw_only=True)
38
+ class ServerConfig:
39
+ """Core server configuration from CLI arguments.
40
+
41
+ Consumed by the MCP server layer (Phase 4) and the startup
42
+ orchestration logic. Does not contain backend-specific config.
43
+ """
44
+
45
+ # Transport
46
+ transport: Transport = "stdio"
47
+ host: str = "127.0.0.1" # HTTP bind address
48
+ port: int = 8435 # HTTP listen port
49
+
50
+ # Exec defaults
51
+ default_timeout: int = 120 # seconds
52
+ output_limit: int = 2_097_152 # bytes (2 MiB)
53
+ file_text_limit: int = 1_048_576 # bytes (1 MiB)
54
+ workspace_directory: str = "/workspace"
55
+
56
+ # A server process owns exactly one persistent computer. The CLI replaces
57
+ # this programmatic default with the required COMPUTER_ID environment value.
58
+ computer_id: str = "virtual-computer"
59
+ desktop_environment: bool = False
60
+ network_access: bool = True
61
+
62
+ # Tool description
63
+ tool_instruction_override: str | None = None
64
+ extended_tool_instruction: str | None = None
65
+
66
+ # Session management (HTTP only)
67
+ session_timeout: int = 300 # seconds (5 minutes)
68
+
69
+ # Remote HTTP protection
70
+ auth_token: str | None = None
71
+ allow_unauthenticated_http: bool = False