openhands-workspace 1.58.2__tar.gz → 1.60.0__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.
Files changed (23) hide show
  1. {openhands_workspace-1.58.2 → openhands_workspace-1.60.0}/PKG-INFO +1 -1
  2. {openhands_workspace-1.58.2 → openhands_workspace-1.60.0}/openhands/workspace/cloud/workspace.py +44 -5
  3. {openhands_workspace-1.58.2 → openhands_workspace-1.60.0}/openhands_workspace.egg-info/PKG-INFO +1 -1
  4. {openhands_workspace-1.58.2 → openhands_workspace-1.60.0}/pyproject.toml +1 -1
  5. {openhands_workspace-1.58.2 → openhands_workspace-1.60.0}/openhands/workspace/__init__.py +0 -0
  6. {openhands_workspace-1.58.2 → openhands_workspace-1.60.0}/openhands/workspace/agent_sandbox/__init__.py +0 -0
  7. {openhands_workspace-1.58.2 → openhands_workspace-1.60.0}/openhands/workspace/agent_sandbox/testing/agent_ollama_example.py +0 -0
  8. {openhands_workspace-1.58.2 → openhands_workspace-1.60.0}/openhands/workspace/agent_sandbox/testing/smoke_test.py +0 -0
  9. {openhands_workspace-1.58.2 → openhands_workspace-1.60.0}/openhands/workspace/agent_sandbox/workspace.py +0 -0
  10. {openhands_workspace-1.58.2 → openhands_workspace-1.60.0}/openhands/workspace/apptainer/__init__.py +0 -0
  11. {openhands_workspace-1.58.2 → openhands_workspace-1.60.0}/openhands/workspace/apptainer/workspace.py +0 -0
  12. {openhands_workspace-1.58.2 → openhands_workspace-1.60.0}/openhands/workspace/cloud/__init__.py +0 -0
  13. {openhands_workspace-1.58.2 → openhands_workspace-1.60.0}/openhands/workspace/docker/__init__.py +0 -0
  14. {openhands_workspace-1.58.2 → openhands_workspace-1.60.0}/openhands/workspace/docker/dev_workspace.py +0 -0
  15. {openhands_workspace-1.58.2 → openhands_workspace-1.60.0}/openhands/workspace/docker/workspace.py +0 -0
  16. {openhands_workspace-1.58.2 → openhands_workspace-1.60.0}/openhands/workspace/py.typed +0 -0
  17. {openhands_workspace-1.58.2 → openhands_workspace-1.60.0}/openhands/workspace/remote_api/__init__.py +0 -0
  18. {openhands_workspace-1.58.2 → openhands_workspace-1.60.0}/openhands/workspace/remote_api/workspace.py +0 -0
  19. {openhands_workspace-1.58.2 → openhands_workspace-1.60.0}/openhands_workspace.egg-info/SOURCES.txt +0 -0
  20. {openhands_workspace-1.58.2 → openhands_workspace-1.60.0}/openhands_workspace.egg-info/dependency_links.txt +0 -0
  21. {openhands_workspace-1.58.2 → openhands_workspace-1.60.0}/openhands_workspace.egg-info/requires.txt +0 -0
  22. {openhands_workspace-1.58.2 → openhands_workspace-1.60.0}/openhands_workspace.egg-info/top_level.txt +0 -0
  23. {openhands_workspace-1.58.2 → openhands_workspace-1.60.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openhands-workspace
3
- Version: 1.58.2
3
+ Version: 1.60.0
4
4
  Summary: OpenHands Workspace - Docker and container-based workspace implementations
5
5
  Project-URL: Source, https://github.com/OpenHands/software-agent-sdk
6
6
  Project-URL: Homepage, https://github.com/OpenHands/software-agent-sdk
@@ -10,10 +10,10 @@ from urllib.request import urlopen
10
10
 
11
11
  import httpx
12
12
  import tenacity
13
- from pydantic import Field, PrivateAttr, SecretStr
13
+ from pydantic import Field, PrivateAttr, SecretStr, ValidationError
14
14
 
15
15
  from openhands.sdk.logger import get_logger
16
- from openhands.sdk.mcp.config import MCPServer, MCPTransport
16
+ from openhands.sdk.mcp.config import MCPServer, MCPTransport, coerce_mcp_config
17
17
  from openhands.sdk.workspace.remote.base import RemoteWorkspace
18
18
  from openhands.sdk.workspace.repo import CloneResult, RepoMapping, RepoSource
19
19
 
@@ -43,6 +43,37 @@ def _mcp_api_key_headers(api_key: object) -> dict[str, SecretStr] | None:
43
43
  return {"Authorization": SecretStr(f"Bearer {api_key}")}
44
44
 
45
45
 
46
+ def _mcp_config_from_named_servers(
47
+ cloud_mcp_config: Mapping[str, Any],
48
+ ) -> dict[str, MCPServer]:
49
+ servers = cloud_mcp_config.get("mcpServers", cloud_mcp_config)
50
+ if not isinstance(servers, Mapping):
51
+ return {}
52
+ mcp_config: dict[str, MCPServer] = {}
53
+ for name, server in servers.items():
54
+ # Read servers one at a time so one this SDK version cannot read does
55
+ # not drop the others; the validation error would echo secret values.
56
+ try:
57
+ mcp_server = coerce_mcp_config({name: server})[name]
58
+ except ValidationError:
59
+ logger.warning(
60
+ "Skipping MCP server %r: this SDK version cannot read its settings",
61
+ name,
62
+ )
63
+ continue
64
+ # A token refreshed from here could not be saved back, and a rotated
65
+ # refresh token would break the user's other conversations.
66
+ if mcp_server.oauth_auth is not None:
67
+ logger.warning(
68
+ "Skipping MCP server %r: it signs in with OAuth, which only "
69
+ "conversations started by the app server support",
70
+ name,
71
+ )
72
+ continue
73
+ mcp_config[name] = mcp_server
74
+ return mcp_config
75
+
76
+
46
77
  def _is_retryable_error(error: BaseException) -> bool:
47
78
  """Return True for transient errors that are worth retrying."""
48
79
  if isinstance(error, httpx.HTTPStatusError):
@@ -693,12 +724,17 @@ class OpenHandsCloudWorkspace(RemoteWorkspace):
693
724
  def get_mcp_config(self) -> dict[str, MCPServer]:
694
725
  """Fetch MCP servers from the user's SaaS account.
695
726
 
696
- Calls ``GET /api/v1/users/me`` to retrieve the user's MCP configuration
697
- and transforms it into the native server map expected by the SDK Agent.
727
+ Calls ``GET /api/v1/users/me?expose_secrets=true`` to retrieve the
728
+ user's MCP configuration, either the ``{name: server}`` map or the
729
+ legacy ``sse_servers`` / ``shttp_servers`` / ``stdio_servers`` lists,
730
+ and returns the native server map expected by the SDK Agent.
731
+
732
+ Servers that sign in with OAuth, and servers this SDK version cannot
733
+ read, are left out with a warning naming them.
698
734
 
699
735
  Returns:
700
736
  A dictionary mapping server names to server configurations, or an
701
- empty dict if no MCP servers are configured.
737
+ empty dict if no usable MCP servers are configured.
702
738
 
703
739
  Raises:
704
740
  httpx.HTTPStatusError: If the API request fails.
@@ -716,6 +752,7 @@ class OpenHandsCloudWorkspace(RemoteWorkspace):
716
752
  resp = self._send_api_request(
717
753
  "GET",
718
754
  f"{self.cloud_api_url}/api/v1/users/me",
755
+ params={"expose_secrets": "true"},
719
756
  headers={"X-Session-API-Key": self._session_api_key or ""},
720
757
  )
721
758
  data = resp.json()
@@ -731,6 +768,8 @@ class OpenHandsCloudWorkspace(RemoteWorkspace):
731
768
  ("shttp_servers", "shttp", "streamable-http"),
732
769
  ("stdio_servers", None, None),
733
770
  )
771
+ if not any(source in cloud_mcp_config for source, _, _ in server_sources):
772
+ return _mcp_config_from_named_servers(cloud_mcp_config)
734
773
  for source, name_prefix, transport in server_sources:
735
774
  for index, server in enumerate(cloud_mcp_config.get(source) or []):
736
775
  if transport is None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openhands-workspace
3
- Version: 1.58.2
3
+ Version: 1.60.0
4
4
  Summary: OpenHands Workspace - Docker and container-based workspace implementations
5
5
  Project-URL: Source, https://github.com/OpenHands/software-agent-sdk
6
6
  Project-URL: Homepage, https://github.com/OpenHands/software-agent-sdk
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "openhands-workspace"
3
- version = "1.58.2"
3
+ version = "1.60.0"
4
4
  description = "OpenHands Workspace - Docker and container-based workspace implementations"
5
5
 
6
6
  requires-python = ">=3.12"