openhands-agent-server 1.50.1__tar.gz → 1.51.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.
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/PKG-INFO +2 -2
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/agent_profiles_router.py +92 -73
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/api.py +4 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/config.py +19 -1
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/conversation_router.py +34 -31
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/conversation_service.py +134 -399
- openhands_agent_server-1.51.0/openhands/agent_server/docker_runtime/mediation.py +27 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/docker_runtime/registry.py +5 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/docker_runtime/routers.py +75 -20
- openhands_agent_server-1.51.0/openhands/agent_server/launch.py +266 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/llm_router.py +10 -1
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/openai/service.py +9 -5
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/persistence/models.py +10 -2
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/profiles_router.py +16 -6
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/provider_connections_router.py +4 -1
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/server_details_router.py +3 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/settings_router.py +25 -9
- openhands_agent_server-1.51.0/openhands/agent_server/tool_router.py +65 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands_agent_server.egg-info/PKG-INFO +2 -2
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands_agent_server.egg-info/SOURCES.txt +2 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands_agent_server.egg-info/requires.txt +1 -1
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/pyproject.toml +2 -2
- openhands_agent_server-1.50.1/openhands/agent_server/docker_runtime/mediation.py +0 -112
- openhands_agent_server-1.50.1/openhands/agent_server/tool_router.py +0 -26
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/__init__.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/__main__.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/_secret_redaction.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/_secrets_exposure.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/auth_router.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/bash_router.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/bash_service.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/canvas_extensions/__init__.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/canvas_extensions/backend.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/canvas_extensions/bridge.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/canvas_extensions/installed.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/canvas_extensions/manifest.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/canvas_extensions_bridge_router.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/canvas_extensions_router.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/conversation_lease.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/conversation_registry.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/credential_binding.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/dependencies.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/docker/Dockerfile +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/docker/build.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/docker_runtime/__init__.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/docker_runtime/provisioning.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/docker_runtime/proxy.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/env_parser.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/event_router.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/event_service.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/file_router.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/git_provider_service.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/git_router.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/hooks_router.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/hooks_service.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/init_router.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/local_secret_resolver.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/logging_config.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/managed_llm_key.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/mcp_oauth_store.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/mcp_router.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/meta_profiles_router.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/middleware.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/models.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/openai/__init__.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/openai/models.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/openai/router.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/openapi.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/persistence/__init__.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/persistence/store.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/plugins_router.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/plugins_service.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/pub_sub.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/py.typed +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/runtime_router.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/session_protocol.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/session_socket.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/skills_router.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/skills_service.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/sockets.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/sub_agents_router.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/telemetry/__init__.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/telemetry/factory.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/telemetry/http_exporter.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/telemetry/models.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/telemetry/policy.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/telemetry/posthog_exporter.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/telemetry/sanitizer.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/telemetry/service.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/telemetry/sink.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/telemetry/subscriber.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/telemetry_types.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/tool_preload_service.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/utils.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/vscode_extensions/openhands-settings/extension.js +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/vscode_extensions/openhands-settings/package.json +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/vscode_router.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/vscode_service.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/workspace_router.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/workspaces_router.py +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands_agent_server.egg-info/dependency_links.txt +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands_agent_server.egg-info/entry_points.txt +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands_agent_server.egg-info/top_level.txt +0 -0
- {openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openhands-agent-server
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.51.0
|
|
4
4
|
Summary: OpenHands Agent Server - REST/WebSocket interface for OpenHands AI Agent
|
|
5
5
|
Project-URL: Source, https://github.com/OpenHands/software-agent-sdk
|
|
6
6
|
Project-URL: Homepage, https://github.com/OpenHands/software-agent-sdk
|
|
@@ -14,7 +14,7 @@ Requires-Dist: fastapi>=0.104
|
|
|
14
14
|
Requires-Dist: openhands-sdk
|
|
15
15
|
Requires-Dist: openhands-tools
|
|
16
16
|
Requires-Dist: openai<3,>=2.33.0
|
|
17
|
-
Requires-Dist: pydantic>=2
|
|
17
|
+
Requires-Dist: pydantic>=2.13.5
|
|
18
18
|
Requires-Dist: sqlalchemy>=2
|
|
19
19
|
Requires-Dist: uvicorn>=0.52.4
|
|
20
20
|
Requires-Dist: websockets>=12
|
|
@@ -6,22 +6,28 @@ reference-bearing :class:`~openhands.sdk.profiles.AgentProfile` union and keeps
|
|
|
6
6
|
pointer-only — unlike the LLM ``/activate`` it must **not** write
|
|
7
7
|
``agent_settings`` (the creation-time-only contract).
|
|
8
8
|
|
|
9
|
-
``POST /{name}/materialize`` performs a dry-run resolve of a profile
|
|
10
|
-
|
|
11
|
-
(never raises on
|
|
9
|
+
``POST /{name}/materialize`` performs a dry-run resolve of a stored profile, or
|
|
10
|
+
of a draft body, and returns
|
|
11
|
+
:class:`~openhands.sdk.profiles.AgentProfileDiagnostics` (never raises on
|
|
12
|
+
dangling refs — those appear in the body).
|
|
12
13
|
"""
|
|
13
14
|
|
|
14
15
|
import asyncio
|
|
15
16
|
from typing import Annotated, Any
|
|
16
17
|
|
|
17
18
|
from fastapi import APIRouter, HTTPException, Path, Request, status
|
|
18
|
-
from pydantic import BaseModel, Field, ValidationError
|
|
19
|
+
from pydantic import BaseModel, ConfigDict, Field, PlainValidator, ValidationError
|
|
19
20
|
|
|
20
21
|
from openhands.agent_server._secrets_exposure import (
|
|
21
22
|
get_cipher,
|
|
22
23
|
get_config,
|
|
23
24
|
store_errors,
|
|
24
25
|
)
|
|
26
|
+
from openhands.agent_server.launch import (
|
|
27
|
+
can_probe_tools,
|
|
28
|
+
server_launch_stores,
|
|
29
|
+
target_launch_runtime,
|
|
30
|
+
)
|
|
25
31
|
from openhands.agent_server.persistence import (
|
|
26
32
|
PersistedSettings,
|
|
27
33
|
get_agent_profile_store,
|
|
@@ -29,7 +35,7 @@ from openhands.agent_server.persistence import (
|
|
|
29
35
|
get_settings_store,
|
|
30
36
|
)
|
|
31
37
|
from openhands.agent_server.profiles_router import MAX_PROFILES, _has_api_key
|
|
32
|
-
from openhands.
|
|
38
|
+
from openhands.sdk.launch import preview_launch
|
|
33
39
|
from openhands.sdk.llm import LLM
|
|
34
40
|
from openhands.sdk.llm.llm_profile_store import (
|
|
35
41
|
ProfileLimitExceeded as LLMProfileLimitExceeded,
|
|
@@ -37,11 +43,13 @@ from openhands.sdk.llm.llm_profile_store import (
|
|
|
37
43
|
from openhands.sdk.logger import get_logger
|
|
38
44
|
from openhands.sdk.profiles import (
|
|
39
45
|
SEED_PROFILE_NAME,
|
|
46
|
+
ACPAgentProfile,
|
|
47
|
+
AgentProfile,
|
|
40
48
|
AgentProfileDiagnostics,
|
|
41
49
|
AgentProfileStore,
|
|
50
|
+
OpenHandsAgentProfile,
|
|
42
51
|
ProfileLimitExceeded,
|
|
43
52
|
build_seed_profile,
|
|
44
|
-
resolve_agent_profile_dry_run,
|
|
45
53
|
safe_validation_error_detail,
|
|
46
54
|
save_profile_preserving_identity,
|
|
47
55
|
validate_agent_profile,
|
|
@@ -99,6 +107,30 @@ class ActivateAgentProfileResponse(BaseModel):
|
|
|
99
107
|
agent_settings_applied: bool = False
|
|
100
108
|
|
|
101
109
|
|
|
110
|
+
def _raw_profile_payload(value: Any) -> dict[str, Any] | None:
|
|
111
|
+
if value is not None and not isinstance(value, dict):
|
|
112
|
+
raise ValueError("profile must be an object")
|
|
113
|
+
return value
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class MaterializeAgentProfileRequest(BaseModel):
|
|
117
|
+
model_config = ConfigDict(extra="forbid")
|
|
118
|
+
|
|
119
|
+
# Kept raw so the draft goes through the same migrations as a save.
|
|
120
|
+
profile: Annotated[
|
|
121
|
+
dict[str, Any] | None,
|
|
122
|
+
PlainValidator(
|
|
123
|
+
_raw_profile_payload, json_schema_input_type=AgentProfile | None
|
|
124
|
+
),
|
|
125
|
+
] = Field(
|
|
126
|
+
default=None,
|
|
127
|
+
description=(
|
|
128
|
+
"Draft profile to evaluate instead of the stored one. The path name "
|
|
129
|
+
"overrides the draft's name."
|
|
130
|
+
),
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
|
|
102
134
|
class RenameAgentProfileRequest(BaseModel):
|
|
103
135
|
new_name: str = Field(
|
|
104
136
|
...,
|
|
@@ -304,23 +336,11 @@ async def get_agent_profile(name: ProfileName) -> AgentProfileDetailResponse:
|
|
|
304
336
|
return AgentProfileDetailResponse(name=name, profile=payload)
|
|
305
337
|
|
|
306
338
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
status_code=status.HTTP_201_CREATED,
|
|
311
|
-
)
|
|
312
|
-
async def save_agent_profile(
|
|
313
|
-
name: ProfileName, body: dict[str, Any]
|
|
314
|
-
) -> AgentProfileMutationResponse:
|
|
315
|
-
"""Save an ``AgentProfile`` under ``name`` (overwriting a namesake).
|
|
316
|
-
|
|
317
|
-
The path ``name`` is authoritative — it overrides any ``name`` in the body.
|
|
318
|
-
The profile is secret-free at rest (#4017), so no cipher/encryption is
|
|
319
|
-
involved. Returns 409 if creating a new profile would exceed
|
|
320
|
-
``MAX_AGENT_PROFILES``.
|
|
321
|
-
"""
|
|
339
|
+
def _validate_profile_payload(
|
|
340
|
+
payload: dict[str, Any],
|
|
341
|
+
) -> OpenHandsAgentProfile | ACPAgentProfile:
|
|
322
342
|
try:
|
|
323
|
-
|
|
343
|
+
return validate_agent_profile(payload)
|
|
324
344
|
except ValidationError as e:
|
|
325
345
|
# Match FastAPI's request-validation shape (``detail`` is a list of
|
|
326
346
|
# error objects): ``loc``/``type``/``msg`` (``input`` dropped — see
|
|
@@ -338,6 +358,24 @@ async def save_agent_profile(
|
|
|
338
358
|
detail="Invalid agent profile",
|
|
339
359
|
)
|
|
340
360
|
|
|
361
|
+
|
|
362
|
+
@agent_profiles_router.post(
|
|
363
|
+
"/{name}",
|
|
364
|
+
response_model=AgentProfileMutationResponse,
|
|
365
|
+
status_code=status.HTTP_201_CREATED,
|
|
366
|
+
)
|
|
367
|
+
async def save_agent_profile(
|
|
368
|
+
name: ProfileName, body: dict[str, Any]
|
|
369
|
+
) -> AgentProfileMutationResponse:
|
|
370
|
+
"""Save an ``AgentProfile`` under ``name`` (overwriting a namesake).
|
|
371
|
+
|
|
372
|
+
The path ``name`` is authoritative — it overrides any ``name`` in the body.
|
|
373
|
+
The profile is secret-free at rest (#4017), so no cipher/encryption is
|
|
374
|
+
involved. Returns 409 if creating a new profile would exceed
|
|
375
|
+
``MAX_AGENT_PROFILES``.
|
|
376
|
+
"""
|
|
377
|
+
profile = _validate_profile_payload({**body, "name": name})
|
|
378
|
+
|
|
341
379
|
store = get_agent_profile_store()
|
|
342
380
|
# The id is server-managed (the active pointer is keyed on it): overwrite
|
|
343
381
|
# keeps the namesake's id and bumps revision; create mints a fresh id,
|
|
@@ -508,60 +546,41 @@ async def activate_agent_profile(
|
|
|
508
546
|
response_model=AgentProfileDiagnostics,
|
|
509
547
|
)
|
|
510
548
|
async def materialize_agent_profile(
|
|
511
|
-
request: Request,
|
|
549
|
+
request: Request,
|
|
550
|
+
name: ProfileName,
|
|
551
|
+
body: MaterializeAgentProfileRequest | None = None,
|
|
512
552
|
) -> AgentProfileDiagnostics:
|
|
513
|
-
"""
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
553
|
+
"""Preview the launch of a profile; return a diagnostics report.
|
|
554
|
+
|
|
555
|
+
Previews the stored profile ``name``, or ``body.profile`` when given (so an
|
|
556
|
+
editor can preview before saving), with the same resolve and finalize as a
|
|
557
|
+
launch, against the runtime this server launches into. Dangling references
|
|
558
|
+
are reported in the body (valid=False) rather than raising — the only error
|
|
559
|
+
statuses are 404 (unknown stored profile) and 422 (invalid draft).
|
|
560
|
+
resolved_settings is redacted (no raw secrets).
|
|
518
561
|
"""
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
562
|
+
if body is not None and body.profile is not None:
|
|
563
|
+
profile = _validate_profile_payload({**body.profile, "name": name})
|
|
564
|
+
else:
|
|
565
|
+
store = get_agent_profile_store()
|
|
566
|
+
try:
|
|
567
|
+
with store_errors():
|
|
568
|
+
profile = store.load(name)
|
|
569
|
+
except FileNotFoundError:
|
|
570
|
+
raise HTTPException(
|
|
571
|
+
status_code=status.HTTP_404_NOT_FOUND,
|
|
572
|
+
detail=f"Agent profile '{name}' not found",
|
|
573
|
+
)
|
|
528
574
|
|
|
529
|
-
# Still needed here (unlike the profile load above): resolve_agent_profile_
|
|
530
|
-
# dry_run uses it to decrypt the *referenced LLM profile's* own secret.
|
|
531
|
-
cipher = get_cipher(request)
|
|
532
575
|
config = get_config(request)
|
|
533
576
|
settings = get_settings_store(config).load() or PersistedSettings()
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
discovery_error: str | None = None
|
|
544
|
-
available_skills = None
|
|
545
|
-
if profile.agent_kind == "openhands" or (
|
|
546
|
-
config.acp_skill_sourcing == "openhands_managed"
|
|
547
|
-
):
|
|
548
|
-
try:
|
|
549
|
-
available_skills = await asyncio.to_thread(discover_profile_skills)
|
|
550
|
-
except Exception as exc:
|
|
551
|
-
available_skills = None
|
|
552
|
-
discovery_error = str(exc)
|
|
553
|
-
logger.warning("Skill discovery failed during materialize: %s", exc)
|
|
554
|
-
|
|
555
|
-
llm_store = get_llm_profile_store()
|
|
556
|
-
diagnostics = resolve_agent_profile_dry_run(
|
|
557
|
-
profile,
|
|
558
|
-
llm_store=llm_store,
|
|
559
|
-
mcp_config=mcp_config,
|
|
560
|
-
available_skills=available_skills,
|
|
561
|
-
cipher=cipher,
|
|
577
|
+
context = settings.agent_settings.agent_context
|
|
578
|
+
return await asyncio.to_thread(
|
|
579
|
+
lambda: preview_launch(
|
|
580
|
+
profile,
|
|
581
|
+
server_launch_stores(settings, get_cipher(request)),
|
|
582
|
+
target_launch_runtime(config),
|
|
583
|
+
load_memory=context is not None and context.load_memory,
|
|
584
|
+
check_usable=can_probe_tools(config),
|
|
585
|
+
)
|
|
562
586
|
)
|
|
563
|
-
if discovery_error is not None:
|
|
564
|
-
diagnostics.errors.append(f"Skill discovery failed: {discovery_error}")
|
|
565
|
-
diagnostics.valid = False
|
|
566
|
-
diagnostics.resolved_settings = None
|
|
567
|
-
return diagnostics
|
{openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/api.py
RENAMED
|
@@ -105,6 +105,7 @@ from openhands.agent_server.vscode_router import vscode_router
|
|
|
105
105
|
from openhands.agent_server.vscode_service import get_vscode_service
|
|
106
106
|
from openhands.agent_server.workspaces_router import workspaces_router
|
|
107
107
|
from openhands.sdk.logger import DEBUG, get_logger
|
|
108
|
+
from openhands.sdk.tool.registry import seal_tool_catalog, unseal_tool_catalog
|
|
108
109
|
from openhands.sdk.utils.redact import sanitize_dict
|
|
109
110
|
from openhands.tools.terminal.constants import TMUX_SOCKET_NAME
|
|
110
111
|
|
|
@@ -187,6 +188,8 @@ async def api_lifespan(api: FastAPI) -> AsyncIterator[None]:
|
|
|
187
188
|
if not deferred:
|
|
188
189
|
emit_server_started()
|
|
189
190
|
|
|
191
|
+
seal_tool_catalog()
|
|
192
|
+
|
|
190
193
|
vscode_service = get_vscode_service()
|
|
191
194
|
tool_preload_service = get_tool_preload_service()
|
|
192
195
|
|
|
@@ -313,6 +316,7 @@ async def api_lifespan(api: FastAPI) -> AsyncIterator[None]:
|
|
|
313
316
|
# after `async with service` so terminal events are still accepted.
|
|
314
317
|
if secret_resolution is not None:
|
|
315
318
|
secret_resolution.__exit__(None, None, None)
|
|
319
|
+
unseal_tool_catalog()
|
|
316
320
|
backend_manager = getattr(api.state, "canvas_extension_backend_manager", None)
|
|
317
321
|
if backend_manager is not None:
|
|
318
322
|
await backend_manager.shutdown()
|
{openhands_agent_server-1.50.1 → openhands_agent_server-1.51.0}/openhands/agent_server/config.py
RENAMED
|
@@ -69,6 +69,9 @@ def _default_web_url() -> str | None:
|
|
|
69
69
|
return None
|
|
70
70
|
|
|
71
71
|
|
|
72
|
+
DEFAULT_CONVERSATION_IMAGE = "ghcr.io/openhands/agent-server:latest-python"
|
|
73
|
+
|
|
74
|
+
|
|
72
75
|
class WebhookSpec(BaseModel):
|
|
73
76
|
"""Spec to create a webhook. All webhook requests use POST method."""
|
|
74
77
|
|
|
@@ -365,7 +368,22 @@ class Config(BaseModel):
|
|
|
365
368
|
),
|
|
366
369
|
)
|
|
367
370
|
conversation_runtime: Literal["local", "docker"] = "local"
|
|
368
|
-
conversation_image: str =
|
|
371
|
+
conversation_image: str = DEFAULT_CONVERSATION_IMAGE
|
|
372
|
+
conversation_image_has_browser: bool | None = Field(
|
|
373
|
+
default=None,
|
|
374
|
+
description=(
|
|
375
|
+
"Whether conversation_image ships the browser (chromium) stack. "
|
|
376
|
+
"Unset means true for any tag or digest of the stock agent-server "
|
|
377
|
+
"image except its -minimal flavor, and false for other images."
|
|
378
|
+
),
|
|
379
|
+
)
|
|
380
|
+
enable_browser: bool = Field(
|
|
381
|
+
default=True,
|
|
382
|
+
description=(
|
|
383
|
+
"Whether conversations may get the browser tool set. When false, "
|
|
384
|
+
"launches leave it out even where chromium is available."
|
|
385
|
+
),
|
|
386
|
+
)
|
|
369
387
|
conversation_container_memory: str | None = "4g"
|
|
370
388
|
conversation_container_cpus: float | None = Field(default=2.0, gt=0)
|
|
371
389
|
conversation_container_pids_limit: int | None = Field(default=512, gt=0)
|
|
@@ -13,11 +13,11 @@ from fastapi import (
|
|
|
13
13
|
Response,
|
|
14
14
|
status,
|
|
15
15
|
)
|
|
16
|
-
from pydantic import SecretStr
|
|
17
16
|
|
|
18
17
|
from openhands.agent_server._secrets_exposure import (
|
|
19
18
|
decrypt_incoming_llm_secrets,
|
|
20
19
|
get_cipher,
|
|
20
|
+
store_errors,
|
|
21
21
|
)
|
|
22
22
|
from openhands.agent_server.conversation_registry import ConversationRegistry
|
|
23
23
|
from openhands.agent_server.conversation_service import (
|
|
@@ -25,6 +25,7 @@ from openhands.agent_server.conversation_service import (
|
|
|
25
25
|
InvalidParentConversation,
|
|
26
26
|
)
|
|
27
27
|
from openhands.agent_server.dependencies import get_conversation_service
|
|
28
|
+
from openhands.agent_server.launch import launch_http_exception
|
|
28
29
|
from openhands.agent_server.models import (
|
|
29
30
|
INCLUDE_SKILLS_PARAM_TITLE,
|
|
30
31
|
AgentResponseResult,
|
|
@@ -37,7 +38,6 @@ from openhands.agent_server.models import (
|
|
|
37
38
|
ConversationSortOrder,
|
|
38
39
|
ForkConversationRequest,
|
|
39
40
|
NavigateConversationRequest,
|
|
40
|
-
SendMessageRequest,
|
|
41
41
|
SetConfirmationPolicyRequest,
|
|
42
42
|
SetSecurityAnalyzerRequest,
|
|
43
43
|
StartConversationRequest,
|
|
@@ -47,21 +47,18 @@ from openhands.agent_server.models import (
|
|
|
47
47
|
UpdateSecretsRequest,
|
|
48
48
|
trim_conversation_response_skills,
|
|
49
49
|
)
|
|
50
|
-
from openhands.
|
|
50
|
+
from openhands.agent_server.persistence import get_llm_profile_store
|
|
51
|
+
from openhands.sdk import LLM
|
|
51
52
|
from openhands.sdk.conversation.state import ConversationExecutionStatus
|
|
53
|
+
from openhands.sdk.launch import AgentLaunchError, LaunchStoreError
|
|
52
54
|
from openhands.sdk.marketplace.registry import (
|
|
53
55
|
MarketplaceNotFoundError,
|
|
54
56
|
PluginNotFoundError,
|
|
55
57
|
PluginResolutionError,
|
|
56
58
|
)
|
|
57
59
|
from openhands.sdk.plugin import PluginFetchError
|
|
58
|
-
from openhands.sdk.profiles.resolver import
|
|
59
|
-
DanglingMcpServerRef,
|
|
60
|
-
ProfileNotFound,
|
|
61
|
-
)
|
|
60
|
+
from openhands.sdk.profiles.resolver import ProfileNotFound
|
|
62
61
|
from openhands.sdk.tool.client_tool import ClientToolRegistrationError
|
|
63
|
-
from openhands.sdk.workspace import LocalWorkspace
|
|
64
|
-
from openhands.tools.preset.default import get_default_tools
|
|
65
62
|
|
|
66
63
|
|
|
67
64
|
conversation_catalog_router = APIRouter(prefix="/conversations", tags=["Conversations"])
|
|
@@ -70,20 +67,20 @@ conversation_router = APIRouter(prefix="/conversations", tags=["Conversations"])
|
|
|
70
67
|
# Examples
|
|
71
68
|
|
|
72
69
|
START_CONVERSATION_EXAMPLES = [
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
llm
|
|
76
|
-
usage_id
|
|
77
|
-
model
|
|
78
|
-
api_key
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
70
|
+
{
|
|
71
|
+
"agent_settings": {
|
|
72
|
+
"llm": {
|
|
73
|
+
"usage_id": "your-llm-service",
|
|
74
|
+
"model": "your-model-provider/your-model-name",
|
|
75
|
+
"api_key": "your-api-key-here",
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
"workspace": {"working_dir": "workspace/project"},
|
|
79
|
+
"initial_message": {
|
|
80
|
+
"role": "user",
|
|
81
|
+
"content": [{"type": "text", "text": "Flip a coin!"}],
|
|
82
|
+
},
|
|
83
|
+
}
|
|
87
84
|
]
|
|
88
85
|
|
|
89
86
|
|
|
@@ -268,13 +265,8 @@ async def start_conversation(
|
|
|
268
265
|
"""Start a conversation in the local environment."""
|
|
269
266
|
try:
|
|
270
267
|
info, is_new = await conversation_service.start_conversation(request)
|
|
271
|
-
except ProfileNotFound as e:
|
|
272
|
-
raise
|
|
273
|
-
except DanglingMcpServerRef as e:
|
|
274
|
-
raise HTTPException(
|
|
275
|
-
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
|
|
276
|
-
detail={"message": str(e), "dangling_mcp_server_refs": e.missing},
|
|
277
|
-
) from e
|
|
268
|
+
except (ProfileNotFound, AgentLaunchError, LaunchStoreError) as e:
|
|
269
|
+
raise launch_http_exception(e) from e
|
|
278
270
|
except ClientToolRegistrationError as e:
|
|
279
271
|
raise HTTPException(
|
|
280
272
|
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, detail=str(e)
|
|
@@ -560,7 +552,10 @@ async def switch_conversation_llm(
|
|
|
560
552
|
"""Swap the conversation's LLM to a caller-supplied object.
|
|
561
553
|
|
|
562
554
|
Used by app-servers that own the LLM directly and don't push profiles
|
|
563
|
-
to the agent-server's filesystem (see #3017)
|
|
555
|
+
to the agent-server's filesystem (see #3017), and by the frontend's
|
|
556
|
+
per-conversation model switch, which forwards a profile config that may
|
|
557
|
+
reference a saved provider connection by id instead of carrying an inline
|
|
558
|
+
API key.
|
|
564
559
|
"""
|
|
565
560
|
event_service = await conversation_service.get_event_service(conversation_id)
|
|
566
561
|
if event_service is None:
|
|
@@ -569,6 +564,14 @@ async def switch_conversation_llm(
|
|
|
569
564
|
cipher = get_cipher(request)
|
|
570
565
|
if cipher is not None:
|
|
571
566
|
llm = decrypt_incoming_llm_secrets(llm, cipher)
|
|
567
|
+
# Resolve a referenced provider connection before installing the LLM, so a
|
|
568
|
+
# profile linked to a shared connection runs with its api_key / base_url
|
|
569
|
+
# instead of a keyless config (mirrors LLMProfileStore.load). A dangling
|
|
570
|
+
# reference or missing credential surfaces as 422 before the working LLM
|
|
571
|
+
# is replaced. Inline-key configs without a provider_connection_id are
|
|
572
|
+
# byte-identical to the old path.
|
|
573
|
+
with store_errors():
|
|
574
|
+
llm = get_llm_profile_store().resolve_provider_connection(llm, cipher=cipher)
|
|
572
575
|
conversation.switch_llm(llm)
|
|
573
576
|
return Success()
|
|
574
577
|
|